Ask Your Question

Revision history [back]

Since there are no integer roots, p.roots() does not gies anything sine it is a polynomial over the integers:

sage: p.parent()
Univariate Polynomial Ring in x over Integer Ring

You can however ask for its roots as algebraic numbers:

sage: p.roots(QQbar)
[(-2.236067977499790?, 1), (2.236067977499790?, 1)]

or as symbolic expressions:

sage: p.roots(SR)
[(-sqrt(5), 1), (sqrt(5), 1)]

or even as floating-point real numbers:

sage: p.roots(RDF)
[(-2.23606797749979, 1), (2.23606797749979, 1)]

Since there are no integer roots, p.roots() does not gies anything sine since it is a polynomial over the integers:

sage: p.parent()
Univariate Polynomial Ring in x over Integer Ring

You can however ask for its roots as algebraic numbers:

sage: p.roots(QQbar)
[(-2.236067977499790?, 1), (2.236067977499790?, 1)]

or as symbolic expressions:

sage: p.roots(SR)
[(-sqrt(5), 1), (sqrt(5), 1)]

or even as floating-point real numbers:

sage: p.roots(RDF)
[(-2.23606797749979, 1), (2.23606797749979, 1)]