1
$\begingroup$

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]

http://www.wolframalpha.com/input/?i=x%5E%281%2F3%29%2Cx%5E3

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
$\endgroup$
3
  • 3
    $\begingroup$ In case you didn't know, there is also a Mathematica stack exchange site. See for example Finding real roots of negative numbers $\endgroup$ Commented Jan 8, 2013 at 23:04
  • 2
    $\begingroup$ Look at a table of values. See the real and complex plot? Maybe that is your issue? Regards $\endgroup$
    – Amzoti
    Commented Jan 8, 2013 at 23:08
  • $\begingroup$ 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. $\endgroup$
    – Robert
    Commented Jan 8, 2013 at 23:27

3 Answers 3

2
$\begingroup$

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.

$\endgroup$
3
  • $\begingroup$ I think you are missing an $i$ in your last equality, $(1+\sqrt{3}i)/2$. $\endgroup$
    – Daryl
    Commented Jan 9, 2013 at 3:36
  • $\begingroup$ @Daryl: Thanks. I edited it. :-) $\endgroup$
    – Mikasa
    Commented Jan 9, 2013 at 6:10
  • $\begingroup$ very good detective work! +1 $\endgroup$
    – amWhy
    Commented Feb 21, 2013 at 0:09
1
$\begingroup$

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.

$\endgroup$
1
  • 1
    $\begingroup$ 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. $\endgroup$
    – apnorton
    Commented Jan 8, 2013 at 23:41
1
$\begingroup$

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.

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .