Comment #2 on issue 2476 by asmeurer: nth order Derivative
http://code.google.com/p/sympy/issues/detail?id=2476

The syntax would have to be different from the non-symbolic case, because D(x**3, x, a) already means the derivative of x**3 with respect to x and then with respect to a. I was thinking you could do Derivative(f(x), (x, n)) to mean the nth derivative of f(x) with respect to x. It should be backwards compatibile, since we presently don't allow tuples at all. To be consistant, we should also allow diff(f(x), (x, 3)), but if the arguments are not nested and symbolic, like diff(f(x), x, n), it must assume it means the derivative with respect to both x and n as symbols.

By the way, Derivative should internally represent Derivative(f(x), x, 10) using (x, 10), not (x, x, x, x, x, x, x, x, x, x).

You bring up an interesting point about subs, though. I suppose the only way to make sense of that is to only let subs change the expresion, not the variables. In other words, Derivative(x**3, x, a).subs(a, 3) should just return Derivative(x**3, x, a) because x**3 does not contain a. This also makes sense since the symbols part of Derivative can only contain symbols or nonnegative integers, not arbitrary expressions.

And of course, the actual order should allow arbitrary expressions, like diff(f(x), (x, 2*n)), though if at any point the expression is a number that is not a nonnegative integer it should raise ValueError (unless we want to support fractional derivatives).

Finally, I want to note that it might be fun to implement some heuristics that let us do stuff like

exp(x).diff((x, n))
exp(x)
(x**n).diff((x, n))
factorial(n)
cos(x).diff((x, n))
Piecewise((cos(x), Eq(n%4, 0)), (-sin(x), Eq(n%4, 1)), (-cos(x), Eq(n%4, 2)), (sin(x), Eq(n%4, 3)))

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To post to this group, send email to sympy-issues@googlegroups.com.
To unsubscribe from this group, send email to 
sympy-issues+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy-issues?hl=en.

Reply via email to