Comment #16 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
I think the best way to explain it is to just assert that diff(f(g(x)), g(x)) is f'(g(x)). In other words, the derivative with respect to the function is the same as the derivative evaluated at the function. This matches closely with the implementation, which puts in a temporary symbol for g(x) and substitutes it back (this step is skipped if it can be represented as Derivative(f(g(x)), g(x))). Because it's consistant in the cases where we cannot write it this way, I think we could just say that it's a notational convenience. Also, it seems to be consistant with the notation df/dg notation used in calculus.
Regarding diff(f(x), x).diff(f(x)), I'm not so sure about it. I admit that Brian's argument in comment 12 doesn't hold much sway with me either, though that doesn't mean that the result is incorrect.
I just noticed that this still allows sin(x).diff(cos(x)). As I said above (or maybe it was on the pull request), I don't think this should work. There has to be a certain amount of functional independence for this to be correct, which we can assert for unnamed functions like f, but not for named functions like sin and cos. So I think this should be disallowed, and that a note about the assumptions of independence (i.e., f(x).diff(g(x)) == 0 for arbitrary unnamed Functions f and g) should be added to the docstring. There's also some assumptions involved with things like f(2*x).diff(f(x)) == 0 that should be addressed in the docstring as well (basically, we are assuming that f(x) is an *arbitrary* differentiable function).
-- 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.