# numpy.poly¶

numpy.poly(seq_of_zeros)

Return polynomial coefficients given a sequence of roots.

Calculate the coefficients of a polynomial given the zeros of the polynomial.

If a square matrix is given, then the coefficients for characteristic equation of the matrix, defined by , are returned.

Parameters: seq_of_zeros : ndarray A sequence of polynomial roots or a square matrix. coefs : ndarray A sequence of polynomial coefficients representing the polynomial :math:mathrm{coefs}[0] x^{n-1} + mathrm{coefs}[1] x^{n-2} + ... + mathrm{coefs}[2] x + mathrm{coefs}[n]

numpy.poly1d
A one-dimensional polynomial class.
numpy.roots
Return the roots of the polynomial coefficients in p
numpy.polyfit
Least squares polynomial fit

Examples

Given a sequence of polynomial zeros,

>>> b = np.roots([1, 3, 1, 5, 6])
>>> np.poly(b)
array([ 1.,  3.,  1.,  5.,  6.])


Given a square matrix,

>>> P = np.array([[19, 3], [-2, 26]])
>>> np.poly(P)
array([   1.,  -45.,  500.])


numpy.polyval

numpy.roots