Ask Your Question

Revision history [back]

Or you can alternatively use embeddings of a number field as follows. I first show the example for the three cube root of 2. The three cube roots are the solution of the polynomial equation $x^3 - 2 = 0$. You then do

sage: R1.<a> = NumberField(x^3 - 2, 'a')
sage: e1,e2,e3 = R.embeddings(QQbar)
sage: a1 = e1(a)
sage: a2 = e2(a)
sage: a3 = e3(a)
sage: a1
-0.6299605249474365? - 1.091123635971722?*I
sage: a1^3
sage: a2
-0.6299605249474365? + 1.091123635971722?*I
sage: a2^3
sage: a3
sage: a3^3

For the roots of -1 it is different because its polynomial equation $x^3 + 1 = (x + 1)(x^2 - x + 1)$ is not irreducible over QQ. But using the irreducible factor of degree 2 you can get the cube root as well:

sage: R2.<b> = NumberField(x^2 - x + 1, 'b')
sage: e1,e2 = R2.embeddings(QQbar)
sage: b1 = e1(b)
sage: b2 = e2(b)
sage: b1
0.50000000000000000? - 0.866025403784439?*I
sage: b1^3
sage: b2
0.50000000000000000? + 0.866025403784439?*I
sage: b2^3

The b1 and b2 above are exactly the numbers j and j^2 mentionned in tmonteil post. The advantage of this method is that it works for roots of polynomial equations and not only cubic roots.