# numpy.polynomial.legendre.Legendre¶

class numpy.polynomial.legendre.Legendre(coef, domain=[-1, 1], window=[-1, 1])[source]

A Legendre series class.

Legendre instances provide the standard Python numerical methods ‘+’, ‘-‘, ‘*’, ‘//’, ‘%’, ‘divmod’, ‘**’, and ‘()’ as well as the listed methods.

Parameters : coef : array_like Legendre coefficients, in increasing order. For example, (1, 2, 3) implies P_0 + 2P_1 + 3P_2 where the P_i are a graded polynomial basis. domain : (2,) array_like, optional Domain to use. The interval [domain[0], domain[1]] is mapped to the interval [window[0], window[1]] by shifting and scaling. The default value is [-1,1]. window : (2,) array_like, optional Window, see domain for its use. The default value is [-1,1]. .. versionadded:: 1.6.0

Notes

It is important to specify the domain in many cases, for instance in fitting data, because many of the important properties of the polynomial basis only hold in a specified interval and consequently the data must be mapped into that interval in order to benefit.

Attributes

 domain window
 coef (N,) ndarray Legendre coefficients, from low to high.

Methods

 __call__(arg) basis(deg[, domain, window]) Legendre polynomial of degree deg. cast(series[, domain, window]) Convert instance to equivalent Legendre series. convert([domain, kind, window]) Convert to different class and/or domain. copy() Return a copy. cutdeg(deg) Truncate series to the given degree. degree() The degree of the series. deriv([m]) Differentiate. fit(x, y, deg[, domain, rcond, full, w, window]) Least squares fit to data. fromroots(roots[, domain, window]) Return Legendre instance with specified roots. has_samecoef(other) Check if coefficients match. has_samedomain(other) Check if domains match. has_sametype(other) Check if types match. has_samewindow(other) Check if windows match. identity([domain, window]) Identity function. integ([m, k, lbnd]) Integrate. linspace([n, domain]) Return x,y values at equally spaced points in domain. mapparms() Return the mapping parameters. roots() Return list of roots. trim([tol]) Remove small leading coefficients truncate(size) Truncate series to length size.

#### Previous topic

numpy.polynomial.legendre.poly2leg

#### Next topic

numpy.polynomial.legendre.Legendre.domain