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

Home » Public Forums » archive » Cubic root finding on a grid
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: cubic root [message #83959 is a reply to message #68737] Tue, 16 April 2013 09:44 Go to previous messageGo to previous message
Lajos Foldy is currently offline  Lajos Foldy
Messages: 176
Registered: December 2011
Senior Member
On Tuesday, April 16, 2013 5:19:00 PM UTC+2, fawltyl...@gmail.com wrote:

> (-1)^1.0/3 gives -0.333333 for me.
>
> You have to specify that you want complex roots:
>
> IDL> help, complex(-1.0)^(1.0/3)
> <Expression> COMPLEX = ( 0.500000, 0.866025)
>

Also, here is a function for the real cubic root:

function cubic_root, x
return, x ge 0 ? x^(1/3.0) : -(-x)^(1/3.0)
end

(Change 3.0 to 3.0d for double precision x.)

regards,
Lajos
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Finding distance with longitude and latitude
Next Topic: All logical unit currently in use

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

Current Time: Fri Oct 10 14:23:29 PDT 2025

Total time taken to generate the page: 1.36120 seconds