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

## Synopsis

• Function: roots
• Usage:
roots p
• Inputs:
• p, , a univariate polynomial over ZZ, QQ, RR or CC.
• Optional inputs:
• Precision => ..., default value -1, the number of precision bits used to compute the roots.The default precision is 53 bits for polynomials over ZZ or QQ and the same as the coefficient ring for RR[x] or CC[x].
• Unique => , default value false, whether to return multiple roots one or multiple times.
• Outputs:
• a list, The roots of p each one represented as an elements of CC.

## 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 = {-.436092+.332356*ii, -.436092-.332356*ii, .425684-.538177*ii, ------------------------------------------------------------------------ .425684+.538177*ii, -.285748-1.02908*ii, .937486-.552608*ii, ------------------------------------------------------------------------ .937486+.552608*ii, -.285748+1.02908*ii, -1.02681, .98591+1.08117*ii, ------------------------------------------------------------------------ -1.11384+1.06693*ii, -1.11384-1.06693*ii, .98591-1.08117*ii} o3 : List i4 : o3#0 o4 = -.436092315961826808232340406742+.332355643931146767051821089403*ii 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 = {.425684+.538177*ii, -.436092+.332356*ii, -.436092-.332356*ii, ------------------------------------------------------------------------ .425684-.538177*ii, -1.02681, -.436092-.332356*ii, -.285748-1.02908*ii, ------------------------------------------------------------------------ .425684-.538177*ii, .937486-.552608*ii, .937486+.552608*ii, ------------------------------------------------------------------------ .425684+.538177*ii, -.285748+1.02908*ii, -.436092+.332356*ii, ------------------------------------------------------------------------ .98591-1.08117*ii, .937486-.552608*ii, .937486+.552608*ii, ------------------------------------------------------------------------ .98591+1.08117*ii, -.285748+1.02908*ii, -1.11384+1.06693*ii, -1.02681, ------------------------------------------------------------------------ -1.11384-1.06693*ii, -.285748-1.02908*ii, .98591+1.08117*ii, ------------------------------------------------------------------------ -1.11384+1.06693*ii, -1.11384-1.06693*ii, .98591-1.08117*ii} o7 : List i8 : o7#0 o8 = .425684046781973469631387293327682995356019688 +.538176972606594386584638016363221699619680744*ii o8 : CC (of precision 150)

The roots are computed using MPSolve.