comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Euler formula with complex numbers
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Euler formula with complex numbers [message #29515] Fri, 22 February 2002 13:39
Robert Stockwell is currently offline  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 Go to previous message
J�lio Maranh�o is currently offline  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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: extra ticks on log axes
Next Topic: test

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:43:44 PDT 2025

Total time taken to generate the page: 0.00676 seconds