next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Macaulay2Doc :: roots(RingElement)

roots(RingElement) -- compute the roots of a polynomial

Synopsis

Description

i1 : RR_100[x]

o1 = RR   [x]
       100

o1 : PolynomialRing
i2 : p = x^13 + 5*x^9 + 7*x^4 + x +1

      13     9     4
o2 = x   + 5x  + 7x  + x + 1

o2 : RR   [x]
       100
i3 : roots p

o3 = {-1.02681, -.436092-.332356*ii, -.436092+.332356*ii, .425684-.538177*ii,
     ------------------------------------------------------------------------
     .425684+.538177*ii, .937486-.552608*ii, .937486+.552608*ii,
     ------------------------------------------------------------------------
     -.285748-1.02908*ii, -.285748+1.02908*ii, -1.11384-1.06693*ii,
     ------------------------------------------------------------------------
     -1.11384+1.06693*ii, .98591-1.08117*ii, .98591+1.08117*ii}

o3 : List
i4 : o3#0

o4 = -1.02680661191363435076348853555

o4 : CC (of precision 100)
i5 : ZZ[x]

o5 = ZZ[x]

o5 : PolynomialRing
i6 : p = x^13 + 5*x^9 + 7*x^4 + x +1

      13     9     4
o6 = x   + 5x  + 7x  + x + 1

o6 : ZZ[x]
i7 : roots(p^2, Precision=>150, Unique=>true)

o7 = {-1.02681, -.436092-.332356*ii, -.436092+.332356*ii, .425684-.538177*ii,
     ------------------------------------------------------------------------
     .425684+.538177*ii, .937486-.552608*ii, .937486+.552608*ii,
     ------------------------------------------------------------------------
     -.285748-1.02908*ii, -.285748+1.02908*ii, -1.11384-1.06693*ii,
     ------------------------------------------------------------------------
     -1.11384+1.06693*ii, .98591-1.08117*ii, .98591+1.08117*ii}

o7 : List
i8 : o7#0

o8 = -1.0268066119136343507634885355450113136693342

o8 : CC (of precision 150)

The roots are computed using pari.