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

Home » Public Forums » archive » double precision complex #s
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: double precision complex #s [message #4045 is a reply to message #3960] Sun, 16 April 1995 00:00 Go to previous message
agraps is currently offline  agraps
Messages: 35
Registered: September 1994
Member
psharer@eos.arc.nasa.gov (Peter J. Sharer) writes:

> I am using the complex declaration for an array of complex numbers,
> but am running into a problem with floating point overflows in a
> polynomial calculation. Does anyone know of a way to create a complex
> variable with double precision?

> Thanks for your help,

> Peter Sharer


Peter,

Try handling the real and imaginary parts this way (it's
convoluted, but it works :) )

IDL> a = [1,2,3]
IDL> b = [4,5,6]
IDL> c = complex(a,b)
IDL> print, c
( 1.00000, 4.00000)( 2.00000, 5.00000)( 3.00000,
6.00000)

To get double precision reals, use some of the rules of complex algebra,

IDL> print, double(abs((c+conj(c))/2.0))
1.0000000 2.0000000 3.0000000

To get double precision imaginary, use idl's imaginary function,

IDL> print, double(imaginary(c))
4.0000000 5.0000000 6.0000000

(There are more zeros than what's being printed here, but you get the
idea.)

Amara


--

************************************************************ ***************
Amara Graps email: agraps@netcom.com
Computational Physicist vita: finger agraps@sunshine.arc.nasa.gov
Intergalactic Reality URL: http://www.best.com/~agraps/agraps.html
************************************************************ ****************
"The map is not the territory." --Alfred Korzybski
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Student version of IDL
Next Topic: problem converting FORTRAN to IDL

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

Current Time: Fri Oct 10 13:41:11 PDT 2025

Total time taken to generate the page: 0.64142 seconds