10.4 Roots of polynomials

Sage can compute roots of a univariant polynomial.

sage: x = PolynomialRing(RationalField(), 'x').gen()
sage: f = x^3 - 1
sage: f.roots()
[(1, 1)]
sage: f = (x^3 - 1)^2
sage: f.roots()
[(1, 2)]
sage: x = PolynomialRing(CyclotomicField(3), 'x').gen()
sage: f = x^3 - 1
sage: f.roots()
[(1, 1), (zeta3, 1), (-zeta3 - 1, 1)]
The first of the pair is the root, the second of the pair is its multiplicity.

There are some situations where GAP does find the roots of a univariate polynomial but GAP does not do this generally. (The roots must generate either a finite field or a subfield of a cyclotomic field.) However, there is a GAP package called RadiRoot, which must be installed into Sage's installation of GAP, which does help to do this for polynomials with rational coefficients (radiroot itself requires other packages to be installed; please see its webpage for more details). The Factors command actually has an option which allows you to increase the groundfield so that a factorization actually returns the roots. Please see the examples given in section 64.10 ``Polynomial Factorization'' of the GAP Reference Manual for more details.

See About this document... for information on suggesting changes.