Polynomial Module (numpy.polynomial.polynomial)

New in version 1.4.0.

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

Polynomial Class

Polynomial(coef[, domain, window]) A power series class.

Basics

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.
polyroots(c) Compute the roots of a polynomial.
polyfromroots(roots) Generate a monic polynomial with given roots.
polyvalfromroots(x, r[, tensor]) Evaluate a polynomial specified by its roots at points x.

Fitting

polyfit(x, y, deg[, rcond, full, w]) Least-squares fit of a polynomial to data.
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.

Calculus

polyder(c[, m, scl, axis]) Differentiate a polynomial.
polyint(c[, m, k, lbnd, scl, axis]) Integrate a polynomial.

Algebra

polyadd(c1, c2) Add one polynomial to another.
polysub(c1, c2) Subtract one polynomial from another.
polymul(c1, c2) Multiply one polynomial by another.
polymulx(c) Multiply a polynomial by x.
polydiv(c1, c2) Divide one polynomial by another.
polypow(c, pow[, maxpower]) Raise a polynomial to a power.

Miscellaneous

polycompanion(c) Return the companion matrix of c.
polydomain
polyzero
polyone
polyx
polytrim(c[, tol]) Remove “small” “trailing” coefficients from a polynomial.
polyline(off, scl) Returns an array representing a linear polynomial.