How can I get MATLAB to calculate $(1)^{1/3}$ as $1$? Why is it giving me $0.5000 + 0.8660i$ as solution? I have same problem with $({1\over0.1690})^{1/3}$ which should be negative.

Hint: Think of a property the real root has that the (two) complex conjugate roots do not, to rewrite your expression. – user_of_math Dec 03 '14 at 04:47

3Maybe because $\;\frac12+\frac{\sqrt3}2i=e^{\pi i/3}\;$ is one of the three roots of unit in the complex field...? – Timbuc Dec 03 '14 at 04:47

2See also [this post](http://undocumentedmatlab.com/blog/matlabnumericalgotchas/#cuberoot) on the Undocumented Matlab blog. – horchler Dec 03 '14 at 05:29

1FWIW, this is not (solely) a Matlab issue. Mathematica does the same: `N @ (1)^(1/3) → 0.5 + 0.866025i` but `CubeRoot[1] → 1`. – Raphael Dec 03 '14 at 16:00

3"Wrong", you say? – imallett Dec 04 '14 at 04:21

1I think "wrong" is the wrong word to use. Without context there is no objective way to select the "best" result for a many valued function. – Tim Seguine Dec 04 '14 at 07:14
3 Answers
In the following I'll assume that $n$ is odd, $n>2$, and $x<0$.
When asked for $\sqrt[n]{x}$, MATLAB will prefer to give you the principal root in the complex plane, which in this context will be a complex number in the first quadrant. MATLAB does this basically because the principal root is the most convenient one for finding all of the other complex roots.
You can dodge this issue entirely by taking $\sqrt[n]{x}$.
If you want to salvage what you have, then you'll find that the root you want on the negative real axis is $z \left ( \frac{z}{z} \right )^n$. Basically, this trick is finding a complex number with the same modulus as the root $z$ (since all the roots have the same modulus), but $n$ times the argument. This "undoes" the change in argument from taking the principal root.
 93,998
 3
 73
 140


2Why they down voted a perfectly healthy answer I don't understand... – Fmonkey2001 Dec 03 '14 at 04:53

3And now someone's downvoted the question, which is a perfectly legitimate one. – user_of_math Dec 03 '14 at 04:55

Taking $\sqrt[n]{x}$ only works if you assume $x$ is negative. $\:$ "If you want to salvage what ... on the negative real axis is" _not_ what's given in this answer, as can be seen from trying $\:z=8\;$. $\;\;\;$ You can _actually_ "dodge this issue entirely by taking" $\:($ [signum](https://en.wikipedia.org/wiki/Sign_function) $(x))^n\cdot \sqrt[n]{x}\;$. $\;\;\;\;\;\;\;$ – Dec 03 '14 at 22:45

1@RickyDemer Yes, and the OP was asking about a negative input. I didn't answer a question they didn't ask. I also mentioned this in the first paragraph. – Ian Dec 03 '14 at 22:45

@RickyDemer Wich will give you $\sqrt 2$ as a result for $\sqrt{2}$... Ouch. – AlexR Dec 04 '14 at 20:50


@Ian Your answer was okay since the OP specifically asked for the $3^{\text{rd}}$ root. The problem arises for evenorder roots, where the ${\rm sgn}^n(x)$ doesn't salvage a correct root. – AlexR Dec 05 '14 at 07:27
Try nthroot(1,3)
.
If you type (1)^(1/3)
, it'll give you the solution to $x^3=1$ on the complex plane with lower argument.
 1,610
 1
 14
 23
If you want the real cube root of $a<0$, try $a^{\Large\frac{1}{3}}$.
 10,438
 3
 47
 99
 4,032
 10
 31


@turkeyhundt Since it's an odd root you can pull the negative out and just take the absolute value of $a$ to the $1/3$ power and then multiple by the negative at the very end. – Fmonkey2001 Dec 03 '14 at 05:01
