# Sagemath and TI-83 giving different answers

My expression

 (-3)^(1/3) 

SageMath returns a complex number:

bash sage: n((-3)^(1/3)) 0.721124785153704 + 1.24902476648341*I 

while TI-83 returns -1.4422 (expected answer)

edit retag close merge delete

Sort by » oldest newest most voted

EDIT: Based on Sebastien's comment below, I dusted off a book on complex number theory to find that, for nth root of a complex number the unique nth root is defined to be when k=0 in the formula for the nth roots and is called the principal nth root. So for z^3=3, r=cuberoot(3) and theta = 0 (the angle used in polar form representation of 1) so the formula for the roots is cuberoot(3)cis((0+2kpi)3) = cuberoot(3) cis(0), cuberoot(3) cis(2pi/3), cuberoot(3)cis(4pi/3). For z^3=-3, r=cuberoot(3), but now theta = pi so the formula for the roots is cuberoot(3)cis((pi+2kpi)/3)= cuberoot(3)cis(pi/3), cuberoot(3)cis(pi), cuberoot(3)cis(5pi/3). So perhaps SAGE is giving the princpal root which is then used to get the rest via the formula?

more

Note that, for positive number, the positive real root is returned

sage: 3^(1/3).n()
1.44224957030741


so Sage does not always return a primitive root.

1

Hmmm. I searched this site and found this. It sounds like nth_root() might be something to remember as long as you keep the base from looking like an integer. That is:

(-3.0).nth_root(3)
-1.44224957030741


but not

(-3).nth_root(3)


which gives an error.

1

Another way you could easily ensure you're getting the negative real root is to just take the negative sqrt of the norm, e.g. n(-sqrt(((-3)^(1/3)).norm())) ensures the result they were looking for. The equation $x^3=-3$ has three roots in the complex plane.

sage: x=polygen(QQbar,'x')
sage: factor(x**3+3)
(x - 0.7211247851537042? - 1.249024766483407?*I) * (x - 0.7211247851537042? + 1.249024766483407?*I) * (x + 1.442249570307409?)

more

1

Probably OP wants to know why taking the cube root in SageMath yields this particular root and not the real root.

1