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.

Reply via email to