Re: Euler formula with complex numbers [message #29515] |
Fri, 22 February 2002 13:39 |
Robert Stockwell
Messages: 74 Registered: October 2001
|
Member |
|
|
Try this:
z=complex(3,2)
mag=abs(z)
phi=atan(imaginary(z),double(z))
z_prime=mag*exp(complex(0,1)*phi)
print,'mag ',mag
print,'phi ',phi
print,'z ',z
print,'z_prime ',z_prime
RESULTS:
IDL> .GO
mag 3.60555
phi 0.58800260
z ( 3.00000, 2.00000)
z_prime ( 3.0000000, 2.0000000)
Cheers,
bob
J�lio Maranh�o wrote:
> Look into the "IDL Online Help" in "What's New in IDL 5.5". Search for ATAN
> and look for the changes.
>
> ATAN(z) doesn't return the phase anymore. It returns a complex.
> Use ATAN(IMAGINARY(z), REAL_PART(z)) instead. I know it's awful, but...
>
> Cheers.
>
> J�lio Maranh�o
>
>
> "frederic" <raison@srl.caltech.edu> escreveu na mensagem
> news:9f6b22a3.0202220953.2ceb4f73@posting.google.com...
> I start from:
>
> z=complex(3,2)
> mag=abs(z)
> phi=atan(z)
>
> and I want to come back to z with mag and phi in this way:
>
> z_prime=mag*exp(complex(0,1)*phi)
>
>
> and I get z_prime=( 0.715179, 3.02955) which is different from z.
>
>
> What is wrong in the way I use IDL?
>
> Thank you
>
>
>
|
|
|
Re: Euler formula with complex numbers [message #29518 is a reply to message #29515] |
Fri, 22 February 2002 10:06  |
J�lio Maranh�o
Messages: 8 Registered: May 2000
|
Junior Member |
|
|
Look into the "IDL Online Help" in "What's New in IDL 5.5". Search for ATAN
and look for the changes.
ATAN(z) doesn't return the phase anymore. It returns a complex.
Use ATAN(IMAGINARY(z), REAL_PART(z)) instead. I know it's awful, but...
Cheers.
J�lio Maranh�o
"frederic" <raison@srl.caltech.edu> escreveu na mensagem
news:9f6b22a3.0202220953.2ceb4f73@posting.google.com...
I start from:
z=complex(3,2)
mag=abs(z)
phi=atan(z)
and I want to come back to z with mag and phi in this way:
z_prime=mag*exp(complex(0,1)*phi)
and I get z_prime=( 0.715179, 3.02955) which is different from z.
What is wrong in the way I use IDL?
Thank you
|
|
|