Hi!

On Jan 28, 10:36 am, Mike Hansen <[email protected]> wrote:
>
> You could convert to the SymbolicRing SR where the equations live:

Or you could avoid the SymbolicRing (I don't know what is better). For
example:

sage: R = PolynomialRing(ZZ,x)
sage: f = R.random_element(degree = 3)
sage: f
-6*x^3 - 3*x + 1
sage: f.roots()
[]

If you read the documentation (e.g., by typing "f.roots?<RETURN>"),
you see that by default, "roots" returns the root in the underlying
base ring, which are the integers. So, not much surprise that the
cubic polynomial has no integral root.

However, you can try to find roots in RR (reals), even with
multiplicities:
sage: f.roots(ring=RR)
[(0.286366112162914, 1)]

So, it has one real root. There is a special command for the complex
roots:
sage: f.complex_roots()
[0.286366112162914, -0.143183056081457 - 0.749335814335920*I,
-0.143183056081457 + 0.749335814335920*I]

This is without multiplicities, apparently. Or would double roots
occur twice in that list?

Anyway, if you want multiplicities, you may do
sage: f.roots(ring=CC)
[(0.286366112162914, 1), (-0.143183056081457 - 0.749335814335920*I,
1), (-0.143183056081457 + 0.749335814335920*I, 1)]

Again, I don't know what is better for solving polynomial equations
(SR or "proper" polynomials).

Cheers,
Simon

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to