Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

Just doing a quick plot of the cuberoot of x, but both Mathematica 9 and R 2.15.32 are not plotting it in the negative space. However they both plot x cubed just fine:

Plot[{x^(1/3), x^3}, 
    {x, -2, 2}, PlotRange -> {-2, 2}, AspectRatio -> Automatic]


plot(function(x){x^(1/3)} , xlim=c(-2,2), ylim=c(-2,2))

Is this a bug in both software packages, or is there something about the cubed root that I don't understand?

In[19]:= {1^3, 1^(1/3), -1^3, -1^(1/3), 42^3, -42^3, 42^(1/3) // N, -42^(1/3) // N}
Out[19]= {1, 1, -1, -1, 74088, -74088, 3.47603, -3.47603}

Interestingly when passing -42 into the R function I get NaN, but when I multiply it directly I get -3.476027.

> f = function(x){x^(1/3)}
> f(c(42, -42))
[1] 3.476027      NaN
> -42^(1/3)
[1] -3.476027
share|improve this question
In case you didn't know, there is also a Mathematica stack exchange site. See for example Finding real roots of negative numbers –  Jonas Meyer Jan 8 '13 at 23:04
Look at a table of values. See the real and complex plot? Maybe that is your issue? Regards –  Amzoti Jan 8 '13 at 23:08
Thanks Amzoti and Jonas I need to study more about the imaginary unit. I think you should make those answers instead of just a comment. –  Robert Jan 8 '13 at 23:27

3 Answers 3

up vote 2 down vote accepted

I think: if $z < 0$, Mathematica is using the principal branch of the log along with the identity $$z^{1/3} = \exp((1/3)*\log(z)).$$
If you use $z = -1$, you get $$z^{1/3} = \text{e}^{(1/3)*\log(z)} = \text{e}^{\pi/3} = \exp(i\pi/3) = {1 + \sqrt{3}i\over 2}$$ In a word, the software is being "scrupulous to a fault." It's a small price to pay for the program being so complex-number savvy.

share|improve this answer
I think you are missing an $i$ in your last equality, $(1+\sqrt{3}i)/2$. –  Daryl Jan 9 '13 at 3:36
@Daryl: Thanks. I edited it. :-) –  B. S. Jan 9 '13 at 6:10
very good detective work! +1 –  amWhy Feb 21 '13 at 0:09

Really funny you'd mention that... my Calc professor talked about that last semester. ;)

Many software packages plot the principal root, rather than the real root. http://mathworld.wolfram.com/PrincipalRootofUnity.html

For example, $\sqrt[3]{3}$ has three values: W|A

Mathematica uses the roots in the upper-left quadrant when plotting the cube root. Thus, it thinks it's complex, and therefore doesn't graph it.

share|improve this answer
I reread my answer, and thought it needed a little clarification: Mathematica doesn't use the roots in the upper-left quadrant all the time--rather, it uses the principal root (informally, the root with the lowest positive imaginary part). This happens to occur in the upper-left quadrant for the cube root. –  anorton Jan 8 '13 at 23:41

If you merely want to plot the function, then you can be smarter. The function $x/|x|$ returns $1$ when $x\geq0$ and $-1$ otherwise. Thus, the function $\frac{x}{|x|}|x|^{1/3}$ has the same image as $x^{1/3}$ but it is defined over the whole domain $\mathbb{R}$.

See also TeX.SE.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.