Finding a derivative of Indexed objects in sympy is resulting in value error

Viewed 102

I tried to take the derivative of the indexed objects but got the value error:

Can't calculate 1st derivative wrt x[j].

I see that some sites claim that this problem is fixed but when I copy the code over and ran in my environment (python version 3.4), it does not output the result.

I tried to resolve it for quite sometime now but not sure what the flaw is.

from sympy import *
x = IndexedBase('x')
j, k, n = symbols('j k n', cls=Idx)
f = 1/sqrt(Sum(x[k]**2, (k, 1, n)))
diff(f,x[j])
0 Answers
Related