# Math cube root

**URL:** <https://www.ruby-forum.com/t/math-cube-root/171915>\
**Category:** Ruby\
**Created:** [July 11, 2009, 12:48pm UTC](https://www.ruby-forum.com/t/math-cube-root/171915 "2009-07-11T12:48:40Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![z4n9ief](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/7993a0/32.png) [@z4n9ief](https://www.ruby-forum.com/u/z4n9ief)\
**Post date:** [May 14, 2011, 8:01am UTC](https://www.ruby-forum.com/t/math-cube-root/171915/21 "2011-05-14T08:01:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![z4n9ief](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/7993a0/32.png) [@z4n9ief](https://www.ruby-forum.com/u/z4n9ief)\
**Post date:** [May 14, 2011, 8:12pm UTC](https://www.ruby-forum.com/t/math-cube-root/171915/22 "2011-05-14T20:12:43Z")

</div>

On Fri, May 13, 2011 at 12:00 AM, Josh C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> On Thu, May 12, 2011 at 10:26 AM, Colin B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)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 😕

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

[Previous page](https://www.ruby-forum.com/t/math-cube-root/171915.md?page=1)
