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 
Switch to threaded view of this topic Create a new topic Submit Reply
double precision complex #s [message #3960] Thu, 13 April 1995 00:00 Go to next message
psharer is currently offline  psharer
Messages: 1
Registered: April 1995
Junior Member
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
Re: double precision complex #s [message #4041 is a reply to message #3960] Mon, 17 April 1995 00:00 Go to previous message
agraps is currently offline  agraps
Messages: 35
Registered: September 1994
Member
thompson@orpheus.nascom.nasa.gov (William Thompson) writes:

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

> Uhhh, sorry to disappoint you, but simply taking a single precision number and
> converting it to double precision does not mean that it has double precision
> accuracy.

> Fear not, IDL v4.0 will have a DCOMPLEX data type.

> Bill Thompson

Yes, of course, but that's not what I was saying. Since I didn't know
where Peter's use of complex numbers were coming in for his calculation,
I was just offering a way for him to manipulate the real and imaginary
components in double precision separately (It'd be better to avoid the
complex stuff altogether.).

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
************************************************************ ****************
"I don't make jokes- I just watch the government and report the facts."
-- Will Rogers
Re: double precision complex #s [message #4042 is a reply to message #3960] Mon, 17 April 1995 00:00 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
agraps@netcom.com (Amara Graps) writes:

> 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.)

Uhhh, sorry to disappoint you, but simply taking a single precision number and
converting it to double precision does not mean that it has double precision
accuracy.

Fear not, IDL v4.0 will have a DCOMPLEX data type.

Bill Thompson
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
  Switch to threaded view of this topic Create a new topic Submit Reply
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: Wed Oct 08 15:52:49 PDT 2025

Total time taken to generate the page: 0.00494 seconds