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

Home » Public Forums » archive » Re: Math Question
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: Math Question [message #51115 is a reply to message #51110] Sun, 29 October 2006 16:15 Go to previous messageGo to previous message
Rob Dimeo is currently offline  Rob Dimeo
Messages: 17
Registered: November 1999
Junior Member
In general, powers of negative numbers are complex so you should start
with that assumption in the expression:

IDL> print,(dcomplex(-1.0,0.0))^2.01
( 0.99950656, 0.031410729)
IDL> print,(dcomplex(-1.0,0.0))^2.0
( 1.0000000, -2.4492127e-016)

It would be nice if IDL told you this rather than throwing a NaN at
you.

Rob

On Oct 29, 11:02 am, David Fanning <n...@dfanning.com> wrote:
> Folks,
>
> OK, I get the feeling that I am going to be referred to
> my own web page with this question:
>
> http://www.dfanning.com/math_tips/sky_is_falling.html
>
> And it is certainly true that I have been watching WAY
> too much TV lately (World Series, you know), but here is
> my question. How does one explain the following two
> IDL commands?
>
> IDL> Help, (-0.1)^2.0
> <Expression> FLOAT = 0.0100000
> IDL> Help, (-0.1)^2.01
> <Expression> FLOAT = -NaN
>
> In general, raising a negative number to any integer
> power seems to produce a real number, whereas raising
> a negative number to a non-integer power causes a NAN.
>
> I am sure this is explained in one of those textbooks
> covered with dust in my garage, but I thought one of
> you math guys could rescue me from a beautiful day
> spent covered with dust. :-)
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming:http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Determining a safe variable name from a string
Next Topic: overlaying arrow plots

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

Current Time: Sat Oct 11 06:08:46 PDT 2025

Total time taken to generate the page: 0.96239 seconds