New in version 1.4.0.

Power Series (numpy.polynomial.polynomial)

This module provides a number of objects (mostly functions) useful for dealing with polynomials, including a Polynomial class that encapsulates the usual arithmetic operations. (General information on how this module represents and works with polynomial objects is in the docstring for its “parent” sub-package, numpy.polynomial).


Polynomial(coef[, domain, window])

A power series class.


polyadd(c1, c2)

Add one polynomial to another.

polysub(c1, c2)

Subtract one polynomial from another.


Multiply a polynomial by x.

polymul(c1, c2)

Multiply one polynomial by another.

polydiv(c1, c2)

Divide one polynomial by another.

polypow(c, pow[, maxpower])

Raise a polynomial to a power.

polyval(x, c[, tensor])

Evaluate a polynomial at points x.

polyval2d(x, y, c)

Evaluate a 2-D polynomial at points (x, y).

polyval3d(x, y, z, c)

Evaluate a 3-D polynomial at points (x, y, z).

polygrid2d(x, y, c)

Evaluate a 2-D polynomial on the Cartesian product of x and y.

polygrid3d(x, y, z, c)

Evaluate a 3-D polynomial on the Cartesian product of x, y and z.


polyder(c[, m, scl, axis])

Differentiate a polynomial.

polyint(c[, m, k, lbnd, scl, axis])

Integrate a polynomial.

Misc Functions


Generate a monic polynomial with given roots.


Compute the roots of a polynomial.

polyvalfromroots(x, r[, tensor])

Evaluate a polynomial specified by its roots at points x.

polyvander(x, deg)

Vandermonde matrix of given degree.

polyvander2d(x, y, deg)

Pseudo-Vandermonde matrix of given degrees.

polyvander3d(x, y, z, deg)

Pseudo-Vandermonde matrix of given degrees.


Return the companion matrix of c.

polyfit(x, y, deg[, rcond, full, w])

Least-squares fit of a polynomial to data.

polytrim(c[, tol])

Remove “small” “trailing” coefficients from a polynomial.

polyline(off, scl)

Returns an array representing a linear polynomial.