I have tried to have mathematica replace the kronecker delta in the summation, but I have not obtained result, the index remain the same.

First i define the derivative the z-function in function of index.

         z /: D[z[i_, j_], z[m_, n_], NonConstants -> {z}] := KroneckerDelta[i, m]*KroneckerDelta[j, n];    
         zz /: D[zz[i_, j_], zz[m_, n_], NonConstants -> {zz}] := KroneckerDelta[i, m]*KroneckerDelta[j, n] ;  

For example if take

            A=Sum[z[m, n]*zz[m, n], m, n], m, n];

And then take the derivative with repect to z, I obtain

           D[A,z[1,1],NonConstants -> {z}]= Sum[KroneckerDelta[1, m] KroneckerDelta[1, n] zz[m, n],m,n]

How can I make mathematica evaluate the kronecker delta and eliminate sumations?.

Thank you very much

  • 1
    $\begingroup$ Your second code block has a misplaced right bracket (or a missing left bracket), and it's not obvious exactly how to fix it. $\endgroup$ Aug 31 '17 at 19:51

Straight from the Mathematica documentation for KroneckerDelta, we have

Use in sums to pick out elements:

Sum[KroneckerDelta[a, 3] f[a], {a, Infinity}]
(* f[3] *)

So when we issue the command

Sum[KroneckerDelta[1, m] KroneckerDelta[1, n] zz[m, n], {m, Infinity}, {n, Infinity}]

Mathematica returns z[1,1], which I suspect is what you want. Unfortunately, since your code for A is currently broken, I can't address how to modify that definition so that this happens.

  • $\begingroup$ thanks very much, your response was very helpful $\endgroup$
    – Arturo_222
    Sep 1 '17 at 0:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.