Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168703
Image: ubuntu2004

Sage takes an interesting approach to solving for the roots of polynomials using the roots() function. It returns a 2-tuple for each root. The first number is the root and the second is its multiplicity. So if roots() returns

[(2, 2), (-I, 1)]

that means that the polynomial has three roots, 2, 2, and -√1.

f=6+5*x+x^2 f.roots()
[(-3, 1), (-2, 1)]
g=x^2+1 g.roots()
[(-I, 1), (I, 1)]
h=x^2+2/3*x+1 h.roots()
[(-2/3*I*sqrt(2) - 1/3, 1), (2/3*I*sqrt(2) - 1/3, 1)]