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

Home » Public Forums » archive » Re: complex arithmetic
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: complex arithmetic [message #1920 is a reply to message #1919] Wed, 06 April 1994 07:23 Go to previous messageGo to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
stl@sma.ch (Stephen Strebel) writes:

> In article <1994Apr5.123735.8305@news.uit.no> royd@zapffe.mat-stat.uit.no (Roy Einar Dragseth) writes:
>> Why isn't this supported:
>> IDL> x = complex(0.,1.)
>> IDL> print, x^(1./3.)
>> % Operation illegal with complex type.
>> % Execution halted at $MAIN$ .
>>
>> We are running IDL. Version 3.5.1 (hp-ux hp_pa) on a HP9000/755.
>>
> Hi,

> neat little problem! I just tested this on my Sparc 10 running Solaris
> 4.1 with IDL version 3.5.1 and the problem seems even worse then you
> stated. The following works:
> IDL> x = complex(0.,1.)
> IDL> print,x^(3)
> ( -0.00000, -1.00000

> but, as soon as you change the print to include a float things blow up:
> IDL> print,x^(3.)
> % Operation illegal with complex type.
> % Execution halted at $MAIN$ .

> does anyone understand this? SHould such an operation even be allowed?

I think the problem is that such problems are degenerate--there is more than
one correct answer. For example, if we define A and B to be

IDL> A = COMPLEX(1,1)
IDL> B = COMPLEX(-1,-1)

and C to be

and B to be

IDL> C = A^2
IDL> PRINT, C
( 0.00000, 2.00000)

then A can be thought of as the square root of C. However, so can B, because
A^2 and B^2 resolve to the same value. Thus, which is the correct answer for
C^(0.5)?

Evidently, IDL gets around this ambiguity by not allowing one to calculate a
complex number to a non-integer power, even if the floating point number could
be simplified to an integer such as in your example above.

Bill Thompson
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDL Map Projections ( PLATE CARREE )
Next Topic: JPEG routines for IDL

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

Current Time: Sat Oct 11 10:49:42 PDT 2025

Total time taken to generate the page: 0.96074 seconds