Comment #7 on issue 1816 by elliso...@gmail.com: Adding partial derivatives
and taking derivatives with respect to functions
http://code.google.com/p/sympy/issues/detail?id=1816
In my funcderiv branch the following now work:
In [2]: diff(f(x), x).diff(f(x))
Out[2]: 0
In [3]: (sin(f(x)) - cos(diff(f(x), x))).diff(f(x))
Out[3]: cos(f(x))
The following one should be zero and is. There are a couple of ways seeing
this but all yield zero consistently.
In [4]: diff(f(x), x, x).diff(diff(f(x), x))
Out[4]: 0
I claim that the following is *now* correct even though this is different
from what wsa given after 1620 was fixed.
In [5]: f(g(x)).diff(x)
Out[5]: Derivative(f(g(x)), g(x))*Derivative(g(x), x)
Post 1620 this was given as a Subs, which made sense because derivatives
wrt functions were not allowed at that point. But now because derivatives
wrt functions are allowed, no Subs is needed. The criteria I use to
determine whether or not a Subs is returned is by looking at the _diff_wrt
property. If it is True, no Subs is returned, if False, I continue to
return a Subs:
In [7]: f(x**2).diff(x)
Out[7]: 2*x*Subs(Derivative(f(_xi_1), _xi_1), Tuple(_xi_1), Tuple(x**2))
I think this overall behavior is much better as the chain rule looks just
like people expect.
I am still adding more tests because all of this is super subtle.
--
You received this message because you are subscribed to the Google Groups
"sympy-patches" group.
To post to this group, send email to sympy-patches@googlegroups.com.
To unsubscribe from this group, send email to
sympy-patches+unsubscr...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/sympy-patches?hl=en.