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 #51099 is a reply to message #51098] Mon, 30 October 2006 12:32 Go to previous messageGo to previous message
Jean H. is currently offline  Jean H.
Messages: 472
Registered: July 2006
Senior Member
Jo Klein wrote:
>> Just out of curiosity, has anyone tried this on Matlab? I'd expect the
>> same (or similar) results, but it'd be interesting if they weren't.
>
> Matlab returns the real part of the argument if it's a real number you
> put in:
>>> -0.1^2.0
>
> ans =
> -0.0100
>
>>> -0.1^2.01
> ans =
> -0.0098
>
>>> complex(-0.1,0)^2.01
> ans =
> 0.0098 + 0.0003i
> Hmm - I don't know if this is more desirable than IDL's behaviour, I
> think it's fair enough to warn people who try to do something like that
> with their data. In Matlab, try and invert the second operation ... this
> can't be good. Suppose there are arguments for both approaches.
> Jo

It depends indeed...

>> -0.1^2.1
ans =
-0.0079

>> (-0.1)^2.1
ans =
0.0076 + 0.0025i

You don't have to specify the complex() statement!

Jean
[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: Thu Oct 09 21:56:37 PDT 2025

Total time taken to generate the page: 1.43853 seconds