| 1 | initial version |
For polynomial equations with rational or algebraic coefficients,
the best is to use the roots method applied to a proper polynomial
in a polynomial ring, instead of using symbolic expressions and solve.
Here is an example.
Define a polynomial ring and a polynomial:
sage: R.<x> = QQ[]
sage: p = x^3 + 8
Compute the roots in AA (the field of real algebraic numbers):
sage: rr = p.roots(AA, multiplicities=False)
sage: rr
[-2.000000000000000?]
So there is exactly one root, which seems to be minus two.
Use the exactify method to make Sage decide if it is actually that (it is!).
sage: _ = [r.exactify() for r in rr]
sage: rr
[-2]
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.