Message Boards Message Boards

0
|
486 Views
|
3 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Differentiating summation notation with respect to an indexed variable

Posted 1 month ago

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ᵢₖ).

POSTED BY: B P
3 Replies

I suppose that it is because x[k] does not contain x[n], and then it is treated as a constant. This seems to work:

Assuming[
 1 <= k <= N && 1 <= n <= N && (k | n | N) \[Element] Integers, 
 ff = D[If[k == n, x[n], x[k]]*
     Sum[Sum[g[a[i, j], x[j]], {j, 1, N}],
      {i, 1, N}], x[n]] // Simplify]
POSTED BY: Gianluca Gorni

Try this:

Assuming[
 1 <= k <= n && k \[Element] Integers,
 ff = D[(Sum[a[i, j]*x[j], {j, 1, n}]), x[k]] // Simplify
 ]

(*  a[i, k]  *)
POSTED BY: Michael Rogers
Posted 1 month ago

Thank you! I'm very new to Mathematica. When I try the same method for my more involved example, it gives the wrong answer:

Assuming[
 1 <= k <= N && k \[Element] Integers
&& 1 <= n <= N && n \[Element] Integers,
 ff = D[x[k] * Sum[Sum[g[a[i, j],x[j]], {j, 1, N}], {i, 1, N}], x[n]] // Simplify
 ]

The result it gives is xₖ ∑i D₂ g(aᵢₙ, xₙ) which is only half the answer, omitting the δₙₖ ∑i ∑j g(aᵢⱼ, xⱼ) term. What am I doing wrong?

Is it making an incorrect assumption that n != k? How do I tell it not to assume that?

POSTED BY: B P
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract