Ask Your Question
2

Get variants of complex cube-root

asked 2013-04-25 15:31:30 +0100

avi9526 gravatar image

updated 2015-08-31 15:44:36 +0100

tmonteil gravatar image

I found-out that complex cube-root can have 3 variants (see http://en.wikipedia.org/wiki/Cube_root)

But if I try in SageMath to do

(-1)^(1/3)

SageMath return (-1)^(1/3). When I try

(-1)^(1/3).n()

SageMath gives me numerical approximation of the one root (not real)...

How I can get all variants of complex cube-root without numerical approximation?

Thanks! P.S. Sorry for poor English...

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
2

answered 2013-04-25 16:03:34 +0100

tmonteil gravatar image

updated 2013-04-25 16:30:42 +0100

Fist, when you write

sage: a = (-1)^(1/3)

you define an element of the Symbolic Ring, which is not a safe place:

sage: a.parent()
Symbolic Ring
sage: a^2
1

So it is better to work on QQbar, the set of algebraic complex numbers.

sage: a = QQbar(-1)^(1/3)
sage: a.parent()
Algebraic Field
sage: a^2
-0.500000000000000? + 0.866025403784439?*I

Now, if a is a cubic root of some complex number (in your case -1), the other cube roots are a*j and a*j^2, where j=exp(2*I*pi/3)=(-1+I*sqrt(3))/2. Hence you can define

sage: j = QQbar(-1)^(2/3)
sage: j == QQbar(e^(2*I*pi/3))
True
sage: j == QQbar(-1+I*sqrt(3))/2 
True
sage: 1+j+j^2 == 0
True
sage: complex_cube_roots = [a, a*j, a*j^2]

and check

sage: for i in complex_cube_roots:
....:     print i, 'whose cube is', i^3
0.500000000000000? + 0.866025403784439?*I whose cube is -1
-1 whose cube is -1
0.500000000000000? - 0.866025403784439?*I whose cube is -1
edit flag offensive delete link more
2

answered 2013-04-25 19:15:21 +0100

vdelecroix gravatar image

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
2
sage: a2
-0.6299605249474365? + 1.091123635971722?*I
sage: a2^3
2
sage: a3
1.259921049894873?
sage: a3^3
2

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
-1
sage: b2
0.50000000000000000? + 0.866025403784439?*I
sage: b2^3
-1

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.

edit flag offensive delete link more
2

answered 2015-04-08 10:45:57 +0100

MvG gravatar image

If you want to find all numbers $x$ which satisfy $x^3=-1$ resp. $x^3+1=0$ you can do

sage: QQ[x](x^3+1).roots(QQbar)
[(-1, 1),
 (0.500000000000000? - 0.866025403784439?*I, 1),
 (0.500000000000000? + 0.866025403784439?*I, 1)]

The x^3+1 is a symbolic polynomial using the symbolic variable x which is already defined by default, but which you could also define using var('x'). The QQ[x] defines a polynomial ring with rational coefficients and using x as the name for its indeterminate. Using that like a function is a type cast, which will turn the symbolic expression into an element of the polynomial ring. And for elements of polynomial rings, you can compute roots. In particular, you can compute all roots exactly by using the filed of algebraic numbers $\bar{\mathbb Q}$. The resulting list contains tuple: the root followed by its multiplicity.

If you want to see some more details along the way, look at this:

sage: x
x
sage: x.parent()
Symbolic Ring
sage: QQx = QQ[x]; QQx
Univariate Polynomial Ring in x over Rational Field
sage: p1 = x^3 + 1; p1
x^3 + 1
sage: p1.parent()
Symbolic Ring
sage: p2 = QQx(p1); p2
x^3 + 1
sage: p2.parent()
Univariate Polynomial Ring in x over Rational Field
sage: p2.roots(AA) # real only
[(-1.000000000000000?, 1)]
sage: p2.roots(QQbar, multiplicities=False)
[-1,
 0.500000000000000? - 0.866025403784439?*I,
 0.500000000000000? + 0.866025403784439?*I]
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2013-04-25 15:31:30 +0100

Seen: 5,496 times

Last updated: Apr 08 '15