It has always seemed very inconvenient to me that "computer algebra programs such as Mathematica" choose to define derivative as complex-derivative. I believe a reasonable alternative is what is known as a Wirtinger derivative. Wirtinger derivatives exist for all continuous complex-valued functions including non-holonomic functions and permit the construction of a differential calculus for functions of complex variables that is analogous to the ordinary differential calculus for functions of real variables
http://en.wikipedia.org/wiki/Wirtinger_derivatives Wirtinger derivatives come in conjugate pairs but we have f(x).diff(conjugate(x)) = conjugate(conjugate(f(x).diff(x)) so we really only need one derivative given an appropriate conjugate function. The Cauchy-Riemann equations reduce to f(x).diff(conjugate(x)) = 0 I also like that abs is related to the sgn function abs(x).diff(x) = x/abs(x) This is consistent with abs(x)=sqrt(x*conjugate(x)) The Wirtinger derivative of abs(x) is 1/2 x/abs(x). Its total Wirtinger derivative is x/abs(x). I have implemented conjugate and Wirtinger derivatives in FriCAS http://axiom-wiki.newsynthesis.org/SandBoxWirtinger Unfortunately I have not yet been able to convince the FriCAS developers of the appropriateness of this approach. I would be happy to find someone with whom to discuss this further, pro and con. The discussion on the FriCAS email list consisted mostly of the related proper treatment of conjugate without making explicit assumptions about variables. Regards, Bill Page. On 13 November 2014 10:29, Ondřej Čertík <ondrej.cer...@gmail.com> wrote: > Yes. Note also here: > > http://mathworld.wolfram.com/AbsoluteValue.html > > which says that complex derivative of d|z|/dz does not exist, as > Cauchy-Riemann equations do not hold for Abs(z). And: > > "As a result of the fact that computer algebra programs such as > Mathematica generically deal with complex variables (i.e., the > definition of derivative always means complex derivative), d|z|/dz > correctly returns unevaluated by such software." > > So perhaps SymPy and Sage should return Derivative(Abs(x), x). Only > when user specifies that "x" is real, only then we can differentiate. > > Ondrej > > On Thu, Nov 13, 2014 at 12:17 AM, Clemens Heuberger > <clemens.heuber...@aau.at> wrote: >> >> possibly related to http://trac.sagemath.org/ticket/12588 ? >> >> Regards, CH >> >> Am 2014-11-13 um 06:19 schrieb Ondřej Čertík: >>> Hi, >>> >>> With Sage 6.3, I am getting: >>> >>> sage: abs(x).diff(x) >>> x/abs(x) >>> sage: abs(I*x).diff(x) >>> -x/abs(I*x) >>> >>> But abs(I*x) == abs(x). So also abs(x).diff(x) and abs(I*x).diff(x) >>> must be the same. But in the first case we get x/abs(x), and in the >>> second we got -x/abs(x). >>> >>> In SymPy, the answer is: >>> >>> In [1]: abs(x).diff(x) >>> Out[1]: >>> d d >>> re(x)⋅──(re(x)) + im(x)⋅──(im(x)) >>> dx dx >>> ───────────────────────────────── >>> │x│ >>> >>> >>> In [2]: x = Symbol("x", real=True) >>> >>> In [3]: abs(x).diff(x) >>> Out[3]: sign(x) >>> >>> In [4]: abs(I*x).diff(x) >>> Out[4]: sign(x) >>> >>> In [26]: var("x") >>> Out[26]: x >>> >>> Which seems all correct --- in the complex case [1] we get a little >>> messy expression, but a correct one. For a real case, we get the >>> correct answer. >>> >>> In Wolfram Alpha, the answer of abs(I*x).diff(x) is x/abs(x): >>> >>> http://www.wolframalpha.com/input/?i=Diff%5BAbs%5Bi*x%5D%2C+x%5D >>> >>> Which is only correct for real "x", but at least it is correct for >>> this special case. >>> >>> The Sage result seems wrong for any "x". >>> >>> Ondrej >>> >> >> >> -- >> Univ.-Prof. Dr. Clemens Heuberger Alpen-Adria-Universität Klagenfurt >> Institut für Mathematik, Universitätsstraße 65-67, 9020 Klagenfurt, Austria >> Tel: +43 463 2700 3121 Fax: +43 463 2700 99 3121 >> clemens.heuber...@aau.at http://wwwu.aau.at/cheuberg >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sage-devel" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to sage-devel+unsubscr...@googlegroups.com. >> To post to this group, send email to sage-devel@googlegroups.com. >> Visit this group at http://groups.google.com/group/sage-devel. >> For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at http://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.