I'm not sure about the mathematics if diff(conjugate(x), x)
should be zero. The fact that diff(x,x.conjugate())
gives zero has nothing to do with mathematics (and might even be considered a SymPy bug). It gives zero simply because x
does not contain conjugate(x)
(symbolically), so it sees it as a constant with respect to it. This is probably wrong, since x
is not a constant with respect to conjugate(x)
. The fact that SymPy lets you take derivatives with respect to defined functions is probably a bug, actually. It is supposed to allow things like diff(f(x)**2, f(x))
, where f = Function('f')
is an undefined function, but for defined functions, it is probably mathematically incorrect (or at least not what you expect).
See http://docs.sympy.org/latest/modules/core.html?highlight=derivative#sympy.core.function.Derivative, particularly the section on derivatives wrt non-Symbols. To paraphrase, taking derivatives with respect to a function is just a notational convenience and does not represent a mathematical chain rule. Rather, something like diff(x, conjugate(x))
should be thought of as something like diff(x.subs(conjugate(x), dummy), dummy).subs(dummy, conjugate(x))
.
Regarding conjugate(x).diff(x)
, this gives an unevaluated derivative because no derivative is defined for conjugate. I'm not sure if any closed-form answer is possible here anyway. Probably this is the most useful thing that SymPy could return. I can't find any good answers anywhere as to what a reasonable answer for this should be (you should ask on math SE to get a better answer about it).