Legendre Module (numpy.polynomial.legendre)

New in version 1.6.0.

This module provides a number of objects (mostly functions) useful for dealing with Legendre series, including a Legendre 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).

Legendre Class

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

Basics

legval(x, cs) Evaluate a Legendre series.
legval2d
legval3d
leggrid2d
leggrid3d
legroots(cs) Compute the roots of a Legendre series.
legfromroots(roots) Generate a Legendre series with the given roots.

Fitting

legfit(x, y, deg[, rcond, full, w]) Least squares fit of Legendre series to data.
legvander(x, deg) Vandermonde matrix of given degree.
legvander2d
legvander3d

Calculus

legder(cs[, m, scl]) Differentiate a Legendre series.
legint(cs[, m, k, lbnd, scl]) Integrate a Legendre series.

Algebra

legadd(c1, c2) Add one Legendre series to another.
legsub(c1, c2) Subtract one Legendre series from another.
legmul(c1, c2) Multiply one Legendre series by another.
legmulx(cs) Multiply a Legendre series by x.
legdiv(c1, c2) Divide one Legendre series by another.
legpow(cs, pow[, maxpower]) Raise a Legendre series to a power.

Quadrature

leggauss
legweight

Miscellaneous

legcompanion(cs) Return the scaled companion matrix of cs.
legdomain
legzero
legone
legx
legtrim(c[, tol]) Remove “small” “trailing” coefficients from a polynomial.
legline(off, scl) Legendre series whose graph is a straight line.
leg2poly(cs) Convert a Legendre series to a polynomial.
poly2leg(pol) Convert a polynomial to a Legendre series.