Re: atan in IDL 5.5 [message #31054 is a reply to message #31052] |
Tue, 04 June 2002 07:17  |
Richard Younger
Messages: 43 Registered: November 2000
|
Member |
|
|
Zoe Dent wrote:
>
> I'm having problems with the 'atan' function in IDL 5.5. I have a
> program which reads in an array of complex numbers, so an array of
> single numbers should be produced, but in fact another complex array
> os produced. At the command-line the atan of a set of complex numbers
> produces a single number. I have disabled the multi-threading option
> with no effect. I'd appreciate any advice on this matter.
Zoe,
I think your problem is that RSI changed the behavior of ATAN in IDL
5.5. It used to be that IDL through 5.4 interpreted the arctangent of a
complex number as the the phase angle of that complex number, namely,
ArcTan(imag/real). when I switched to 5.5, I found a new "feature" in
the What's New that said something like 'Trigonometric functions now
handle complex values!' This means that you now have to explicitly
separate the complex and real parts to get the phase angle, which was a
bit of a nuisance to find and replace. E.G.:
a = complex(1.0, -0.5)
phase = ATAN(Imaginary(a),Real_Part(a))
I don't know about the command line producing different numbers. It
seems to work fine for me. At the command line, I get
IDL> print, !version
{ x86 Win32 Windows Microsoft Windows 5.5 Aug 28 2001 32 64}
IDL> a = complex(1.0, -0.5)
IDL> help, atan(a)
<Expression> COMPLEX = ( 0.847576, -0.238878)
IDL> help, ATAN(Imaginary(a),Real_Part(a))
<Expression> FLOAT = -0.463648
Best,
Rich
--
Richard Younger
|
|
|