I want D[Subscript[a, k],Subscript[a,j]] to return something like the Kronecker delta. Is this possible?


1 Answer 1


Of course, if you don't instist on logical correctness.

      Subscript /: D[Subscript[a_, b_], Subscript[a_, c_]] := 
                   KroneckerDelta[b, c]
     Subscript /: D[ Subscript[a_, _], Subscript[b_, _]] := 0 /; a != b

      D[ Subscript[a,k], Subscript[a,j]]
       Subscript[\[Delta], j,k]

      D[ Subscript[a,k], Subscript[1,k]]
  • 1
    $\begingroup$ I am not sure why Subscript[\[Delta], j,k] appears in the code $\endgroup$ May 19 at 20:37
  • $\begingroup$ Probably you are able to Trace the answer easily. Evaluation algorithm produces terms Derivatives[1,0][Subscript] and Derivative[0,1][Subscript] . The rest is printers professional secret. $\endgroup$
    – Roland F
    May 20 at 4:56
  • $\begingroup$ I think I might have understood what you did to get the Subscript[\[Delta], j,k]. Maybe you used copy as then selected plain text rather than directly copy which would show KroneckerDelta[j, k]. $\endgroup$ May 20 at 7:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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