Comment #46 on issue 1816 by asmeurer: Adding partial derivatives and taking derivatives with respect to functions
http://code.google.com/p/sympy/issues/detail?id=1816
This was also explained before, but let me explain again. diff can only take derivatives with respect to objects that have a the _diff_wrt property set to True. This lets people extend their own types to work with this functionality (though of course if they implement it in something that doesn't actually make consistant sense, then it is their own fault).
In the core, the types Function (including both defined and undefined functions) and Derivative have this property set to True. I think Brian has also set it to True in some similar objects in the quantum code.
You did remind me of some other points that should be made in the docstring. First, differentiation with respect to Symbols is always the way that it is defined. Second, we define diff(f(x), x).diff(f(x)) to be 0, which is consistant with diff(f(x), x) itself being a separate "differentiable symbol". This is consistant first with Derivative having _diff_wrt set to True and second to its common usage in variational calculus. I'll put that in the docstring path that I think I will just go ahead and submit to Brian (and probably write it better than above; it's a little early in the morning still).
-- 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.