sylee957 on master
Updated doctrsing sections. Merge pull request #20104 from … (compare)
Hi all -- I'm looking at how to differentiate expressions involving IndexedBase objects. When I run the following code:
import sympy n = sympy.symbols('n', integer=True) M = sympy.IndexedBase('M', shape=(n, n)) x = sympy.IndexedBase('x', shape=n) i = sympy.Idx('i', n) j = sympy.Idx('j', n) k = sympy.Idx('k', n) energy = 0.5 * M[i, j] * x[i] * x[j] print(sympy.simplify(energy.diff(x[k])))
I get an expression involving lots of Kronecker deltas. I feel it should be possible to simplify these out but I don't know how. Thoughts?
0.5 * (M[k, j] * x[j] + M[i, k] * x[i])at the very least
tests finished: 4675 passed, 1 failed, 183 skipped, 127 expected to fail, 1 expected to fail but passed, in 1238.67 seconds DO *NOT* COMMIT!