1 | initial version |
The power operator has higher priority than the unary negation.
So in the first case you are really doing "minus (1 to the 1/3)", and not "(minus 1) to the 1/3".
For the real n-th root, use real_nth_root
.
sage: real_nth_root(-1, 3)
-1
Regarding cubing the cube root:
sage: a = (-1)^(1/3)
sage: a
(-1)^(1/3)
sage: a^3
-1
Using the numerical approximation of the cube root:
sage: aa = a.n()
sage: aa
0.500000000000000 + 0.866025403784439*I
sage: aa^3
-1.00000000000000 + 3.88578058618805e-16*I
So, very close to -1, with tiny imaginary part from rounding errors.