You are viewing an older version (2.4.3). Go to latest (2.4.4)
{ } Raw JSON

bundles / numpy 2.4.3 / numpy / polynomial / polynomial / polyroots

function

numpy.polynomial.polynomial:polyroots

source: /numpy/polynomial/polynomial.py :1491

Signature

def   polyroots ( c )

Summary

Compute the roots of a polynomial.

Extended Summary

Return the roots (a.k.a. "zeros") of the polynomial

Parameters

c : 1-D array_like

1-D array of polynomial coefficients.

Returns

out : ndarray

Array of the roots of the polynomial. If all the roots are real, then out is also real, otherwise it is complex.

Notes

The root estimates are obtained as the eigenvalues of the companion matrix, Roots far from the origin of the complex plane may have large errors due to the numerical instability of the power series for such values. Roots with multiplicity greater than 1 will also show larger errors as the value of the series near such points is relatively insensitive to errors in the roots. Isolated roots near the origin can be improved by a few iterations of Newton's method.

Examples

import numpy.polynomial.polynomial as poly
poly.polyroots(poly.polyfromroots((-1,0,1)))
poly.polyroots(poly.polyfromroots((-1,0,1))).dtype
j = complex(0,1)
poly.polyroots(poly.polyfromroots((-j,0,j)))

See also

numpy.polynomial.chebyshev.chebroots
numpy.polynomial.hermite.hermroots
numpy.polynomial.hermite_e.hermeroots
numpy.polynomial.laguerre.lagroots
numpy.polynomial.legendre.legroots

Aliases

  • numpy.polynomial.Polynomial._roots
  • numpy.polynomial.polynomial.polyroots