I want to differentiate expressions such as yᵢ = ∑j aᵢⱼ xⱼ with respect to an indexed variable. For example ∂yᵢ/∂aᵢₖ = xₖ.
A more involved example:
fₖ = xₖ ∑i ∑j g(aᵢⱼ, xⱼ)
∂fₖ/∂xₙ = δₙₖ ∑i ∑j g(aᵢⱼ, xⱼ) + xₖ ∑i ∑j D₂ g(aᵢⱼ, xⱼ) δₙⱼ
= δₙₖ ∑i ∑j g(aᵢⱼ, xⱼ) + xₖ ∑i D₂ g(aᵢₙ, xₙ)
where D₂ g is the derivative of g with respect to its second parameter, and δ is the Kronecker delta.
How can I get Mathematica to give me these results? When I put in
f = D[(Sum[a[i, j] * x[j], {j, 1, n}]), x[k]]
FullSimplify[f, Assumptions -> {Integer[i], Integer[j], Integer[k]}]
It just gives me ∑j aᵢⱼ δjk, in other words it fails to simplify the sum. (I want it to give just aᵢₖ).