Skip to main content
`Ctrl`+`K`

# Legendre Series (`numpy.polynomial.legendre`)

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`).

## Classes

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

## Constants

`legdomain` | ndarray(shape, dtype=None, buffer=None, offset=0, strides=None, order=None)
`legzero` | ndarray(shape, dtype=None, buffer=None, offset=0, strides=None, order=None)
`legone` | ndarray(shape, dtype=None, buffer=None, offset=0, strides=None, order=None)
`legx` | ndarray(shape, dtype=None, buffer=None, offset=0, strides=None, order=None)

## Arithmetic

`legadd`(c1, c2) | Add one Legendre series to another.
`legsub`(c1, c2) | Subtract one Legendre series from another.
`legmulx`(c) | Multiply a Legendre series by x.
`legmul`(c1, c2) | Multiply one Legendre series by another.
`legdiv`(c1, c2) | Divide one Legendre series by another.
`legpow`(c, pow[, maxpower]) | Raise a Legendre series to a power.
`legval`(x, c[, tensor]) | Evaluate a Legendre series at points x.
`legval2d`(x, y, c) | Evaluate a 2-D Legendre series at points (x, y).
`legval3d`(x, y, z, c) | Evaluate a 3-D Legendre series at points (x, y, z).
`legvalnd`(pts, c) | Evaluate an N-D Legendre series at points.
`leggrid2d`(x, y, c) | Evaluate a 2-D Legendre series on the Cartesian product of x and y.
`leggrid3d`(x, y, z, c) | Evaluate a 3-D Legendre series on the Cartesian product of x, y, and z.

## Calculus

`legder`(c[, m, scl, axis]) | Differentiate a Legendre series.
`legint`(c[, m, k, lbnd, scl, axis]) | Integrate a Legendre series.

## Misc Functions

`legfromroots`(roots) | Generate a Legendre series with given roots.
`legroots`(c) | Compute the roots of a Legendre series.
`legvander`(x, deg) | Pseudo-Vandermonde matrix of given degree.
`legvander2d`(x, y, deg) | Pseudo-Vandermonde matrix of given degrees.
`legvander3d`(x, y, z, deg) | Pseudo-Vandermonde matrix of given degrees.
`leggauss`(deg) | Gauss-Legendre quadrature.
`legweight`(x) | Weight function of the Legendre polynomials.
`legcompanion`(c) | Return the scaled companion matrix of c.
`legfit`(x, y, deg[, rcond, full, w]) | Least squares fit of Legendre series to data.
`legtrim`(c[, tol]) | Remove "small" "trailing" coefficients from a polynomial.
`legline`(off, scl) | Legendre series whose graph is a straight line.
`leg2poly`(c) | Convert a Legendre series to a polynomial.
`poly2leg`(pol) | Convert a polynomial to a Legendre series.

## See also

numpy.polynomial