Question: Help to understand the use of expand, subs and diff in this old piece of code.

Hello

I am struggling to translate an old Maple V3 package to work with the latest version of Maple. Although I have received help from members of this list and managed to resolve some problems on my own, I am at a loss as to how to fix the following Maple code. 

# differentiation
ddf := proc(f)
    local j;
    print(f):
    sum('expand(eval(subs(diff = 0,diff(f,indets(f)[j])))*(indets(f)[j]))','j' = 1 .. nops(indets(f)))
end proc:

Suppose that 

f:=x;

ddf(f);
                               x

Error, (in SumTools:-DefiniteSum:-ClosedForm) summand is singular in the interval of summation

Any help in figuring out what the author was going for would be really appreciated.

Obs.: An example taken from the old Maple v3 help file.  If f:=z^2+y, the output is 2*z*z'+y'.

Please Wait...