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
?