0

Please refer to the following MWE:

import sympy as s
x = s.IndexedBase('x')
y = s.IndexedBase('y')
i,j,k = map(s.Idx,['i','j','k'])
a = s.exp(x[i]*y[j]*s.KroneckerDelta(i,j))
b = a.diff(x[j])

The value of b is LaTeX rendering of b. Since I am not allowed to embed images yet, here is the text form

((Derivative(KroneckerDelta(i, j), i)*Derivative(i, x[j]) + Derivative(KroneckerDelta(i, j), j)*Derivative(j, x[j]))*x[i]*y[j] + KroneckerDelta(i, j)*y[j])*exp(KroneckerDelta(i, j)*x[i]*y[j])

The key point is that there are unevaluated derivatives of KroneckerDelta with respect to indices i and j and derivatives of indices i and j with respect to x[i]. Why are these not 0?

1 Answers1

0

I think, the kind of behaviour I was expecting with symbolic differentiation of indexed variables has not been fully implemented in Sympy yet. I moved on to using other tools like Maxima or Mathematica (or even pen and paper) for these calculations.