boundlab.ops.legendre#

Legendre polynomial bases and basis-to-monomial conversion.

Legendre polynomials \(P_i\) are orthogonal on \([-1, 1]\) (\(\int P_i P_j = \frac{2}{2i+1}\delta_{ij}\)) and satisfy Bonnet’s recurrence \((i + 1) P_{i+1}(x) = (2i + 1) x\, P_i(x) - i P_{i-1}(x)\), which generate_legendre_polynomials() unrolls. A truncated Legendre series is the \(L^2\)-optimal polynomial approximation on the interval, which is why the boundlab.polysp.legendre relaxations expand in this basis before converting to monomial coefficients.

Functions

generate_legendre_polynomials

Build the first count standard Legendre polynomials.

legendre_polynomial

Convert sum_i li[i] * hw**i * P_i(x/hw) to monomial coefficients.