Math cube root

Thanks a lot for your explanations. They really help me a lot. You are
great :slight_smile:

On Fri, May 13, 2011 at 12:00 AM, Josh C. [email protected]
wrote:

On Thu, May 12, 2011 at 10:26 AM, Colin B. [email protected]wrote:

which also changes this:
(-1) ** (1.0 / 3) #=> NaN
to:
(-1) ** (1.0 / 3) #=> (0.5+0.866025403784439i)
so we can also get complex roots if we want them!

Which we don’t here, given that the cube root of -1 isn’t imaginary :confused:

Think of -1 in polar form (r exp(i theta)) as 1.exp(i pi), then note
that the cube roots are (1 exp (i pi/3)), (1 exp (i 2pi/3)) and (1
exp(i pi)). The principal cube root is the one with the smallest value
of theta.

martin