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]
```