Given a function defined by
f[x_,y_] := Sum[ x[[i]] (g[y[[i]]] - g[Total[y]] - Log[x[[i]]]), {i, 1, Length[x]}]
I can easily calculate the derivative for a fixed n
by
D[f[{x1, x2, x3}, {y1, y2, y3}], {{x1, x2, x3}}]
which yields
{-g(y1 + y2 + y3) + g(y1) - log(x1) - 1,
-g(y1 + y2 + y3) + g(y2) - log(x2) - 1,
-g(y1 + y2 + y3) + g(y3) - log(x3) - 1}
I want to differentiate w.r.t. x
in the general case, by something like this:
D[f[x, y], x]
yielding something like this:
{-g(Total[y]) + g(y[[i]]) - Log[x[[i]]], {i, 1, Length[x]}}
Is this possible?
Ideally it chains with Solve
as well so that I can write something like:
Solve[D[f[x, y], x] == Table[0, {Length[x]}], x]
and get something like
{{x[[i]] -> E^(-g(Total[y]) + g(y[[i]]) - 1), {i, 1, Length[x]}}