rtoy / maxima

A Clone of Maxima's repo
Other
0 stars 0 forks source link

carg(exp(x+%i*y)) -> y not correct #4154

Closed rtoy closed 3 months ago

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-09 17:50:53 Created by crategus on 2010-08-07 17:04:58 Original: https://sourceforge.net/p/maxima/bugs/2053


I think the following result is not correct in general:

(%i1) carg(exp(x+%i*y)); (%o1) y

It is only valid for -%pi < y <= %pi.

This is a simple example:

(%i2) carg(exp(n*%pi*%i)); (%o2) %pi*n

The above result is correct for n=1, but not for n=2. For n=2 we have exp(2*%pi*%i) -> 1. carg(1) is zero and not 2*%pi.

A more correct simplification would be

carg(exp(x+%i*y)) --> atan2(sin(y),cos(y))

Dieter Kaiser

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-09 17:50:54 Created by crategus on 2010-08-22 18:35:31 Original: https://sourceforge.net/p/maxima/bugs/2053/#028e


Fixed in rpart revision 1.36.

Now we get

(%i7) carg(exp(x+%i*y)); (%o7) atan2(sin(y),cos(y))

The most general case is:

(%i8) declare([z1,z2],complex);

(%i9) carg(z1^z2); (%o9) atan2(sin('carg(z1)*'realpart(z2)+log(abs(z1))*'imagpart(z2)), cos('carg(z1)*'realpart(z2)+log(abs(z1))*'imagpart(z2)))

Dieter Kaiser

rtoy commented 3 months ago

Imported from SourceForge on 2024-07-09 17:50:57 Created by crategus on 2010-08-22 18:35:31 Original: https://sourceforge.net/p/maxima/bugs/2053/#491b