I need to obtain set of derivatives for the function f and so I use the command:
f = z (Sum[x[i], i])^2 + y Sum[x[i], i]+c;
D[f,{{x[i],y}}];
However, the answer I get is {0,0}. The derivatives individually give
D[f, #] & /@ {x[i], y}
= {i y + 2 i z Sum[x[i],i], Sum[x[i],i] }
which makes sense to me.
However, for a more complicated application I need to use a command of the form:
D[function, {vars1_list}, {vars2_list}]
where vars1 and vars2 are list of variables with respect to which I wish to find the derivative. In addition to the above when I try to use Table for the same f with
l1 = {x[i], y}
l2 = {z,c}
Table[D[f, l1[[1]], l2[[j]]], {i, 1, 2}, {j, 1, 2}]
gives me all zeroes again.
Any suggestions ?
i
inSum[x[i],i]
is not the same as thei
inx[i]
. I don't think that Mathematica can support this sort of differentiation out of the box. $\endgroup$