Why in matlab the result of a cubic root can be correct, but not unambiguous?
For example,
& gt; & gt; (-5-3) ^ (1/3)
ANS =.
1.0000 + 1.7321i
And if immediately:
& gt; & gt; -8 ^ (1/3)
ANS =.
-2.
It is clear that in both cases a cubic root is extracted from -8, but the answer is different, although the right one in both cases.
How can you control which result you need to get – integrated or valid?
Answer 1, Authority 100%
You can nthroot Use to calculate the real value of the root N-th degree.
Judging by Documentation Operator A. ^ b For negative A and fractional B module less 1 will always return the integrated value of the root.
If it happened, as you describe, then in the unary – priority is lower than y ^, do so (-8) ^ (1/3) – and get the expected comprehensive result.