seemps.analysis.expansion.LegendreExpansion#
- class seemps.analysis.expansion.LegendreExpansion#
Bases:
PolynomialExpansionExpansion in the Legendre basis.
The Legendre polynomials \(P_k(x)\) are orthogonal on the interval \([−1, 1]\) with respect to the uniform weight \(w(x)=1\). They are widely used in approximation theory since truncated Legendre series minimize the error in the \(L^2([-1,1])\) norm.
See https://en.wikipedia.org/wiki/Legendre_polynomials for more information.
- classmethod project(func: Callable[[ndarray[tuple[Any, ...], dtype[_ScalarT]]], float], order: int, approximation_domain: tuple[float, float] = (-1.0, 1.0)) LegendreExpansion[source]#
Project a scalar function onto the Legendre basis on the given approximation domain.
The approximation domain must contain the full range of arguments on which the expansion will be evaluated; otherwise, rescaling maps the argument outside the orthogonality domain where the basis is not defined, leading to large errors.
- recurrence_coefficients(k: int) tuple[float, float, float][source]#
Returns the three-term coefficients of the Legendre recursion:
\[(k+1) P_{k+1}(x) = (2k+1) x P_k(x) - k P_{k-1}(x)\]