Special Polynomial Families

Classical orthogonal polynomial families including Legendre, Chebyshev (1st and 2nd kind), Hermite, and Laguerre polynomials with both symbolic expansion and numerical evaluation capabilities.

πŸ“

Mathematical Definition

Orthogonal Polynomials: A sequence {Pn(x)}\{P_n(x)\} satisfying orthogonality relation:

∫abPn(x)Pm(x)w(x) dx=0forΒ nβ‰ m\int_a^b P_n(x) P_m(x) w(x) \, dx = 0 \quad \text{for } n \neq m

where w(x)w(x) is the weight function on interval [a,b][a, b].

Three-Term Recurrence: All orthogonal polynomials satisfy:

Pn+1(x)=(anx+bn)Pn(x)βˆ’cnPnβˆ’1(x)P_{n+1}(x) = (a_n x + b_n) P_n(x) - c_n P_{n-1}(x)

Family Definitions:

1. Legendre: Interval [βˆ’1,1][-1, 1], w(x)=1w(x) = 1 - Differential equation: (1βˆ’x2)Pnβ€²β€²βˆ’2xPnβ€²+n(n+1)Pn=0(1-x^2)P_n'' - 2xP_n' + n(n+1)P_n = 0 - Recurrence: Pn+1=(2n+1)xPnβˆ’nPnβˆ’1n+1P_{n+1} = \frac{(2n+1)xP_n - nP_{n-1}}{n+1}

2. Chebyshev (1st): Interval [βˆ’1,1][-1, 1], w(x)=11βˆ’x2w(x) = \frac{1}{\sqrt{1-x^2}} - Definition: Tn(cos⁑θ)=cos⁑(nΞΈ)T_n(\cos\theta) = \cos(n\theta) - Recurrence: Tn+1=2xTnβˆ’Tnβˆ’1T_{n+1} = 2xT_n - T_{n-1}

3. Chebyshev (2nd): Interval [βˆ’1,1][-1, 1], w(x)=1βˆ’x2w(x) = \sqrt{1-x^2} - Definition: Un(cos⁑θ)=sin⁑((n+1)ΞΈ)sin⁑θU_n(\cos\theta) = \frac{\sin((n+1)\theta)}{\sin\theta} - Recurrence: Un+1=2xUnβˆ’Unβˆ’1U_{n+1} = 2xU_n - U_{n-1}

4. Hermite: Interval (βˆ’βˆž,∞)(-\infty, \infty), w(x)=eβˆ’x2w(x) = e^{-x^2} - Differential equation: Hnβ€²β€²βˆ’2xHnβ€²+2nHn=0H_n'' - 2xH_n' + 2nH_n = 0 - Rodriguez formula: Hn(x)=(βˆ’1)nex2dndxn(eβˆ’x2)H_n(x) = (-1)^n e^{x^2} \frac{d^n}{dx^n}(e^{-x^2}) - Recurrence: Hn+1=2xHnβˆ’2nHnβˆ’1H_{n+1} = 2xH_n - 2nH_{n-1}

5. Laguerre: Interval [0,∞)[0, \infty), w(x)=eβˆ’xw(x) = e^{-x} - Differential equation: xLnβ€²β€²+(1βˆ’x)Lnβ€²+nLn=0xL_n'' + (1-x)L_n' + nL_n = 0 - Recurrence: Ln+1=(2n+1βˆ’x)Lnβˆ’nLnβˆ’1n+1L_{n+1} = \frac{(2n+1-x)L_n - nL_{n-1}}{n+1}

Code Examples

Legendre Polynomials

Solutions to Legendre's differential equation

use mathhook_core::core::polynomial::special_families::Legendre;
use mathhook_core::core::polynomial::special_families::OrthogonalPolynomial;
use mathhook_core::symbol;

let x = symbol!(x);

// Symbolic expansion
let p0 = Legendre::polynomial(0, &x);  // 1
let p1 = Legendre::polynomial(1, &x);  // x
let p2 = Legendre::polynomial(2, &x);  // (3x^2 - 1)/2

// Numerical evaluation
let val = Legendre::evaluate(2, 0.5);  // P_2(0.5) = -0.125

// Recurrence: P_{n+1} = ((2n+1)x*P_n - n*P_{n-1}) / (n+1)
let (a, b, c) = Legendre::recurrence_coefficients(2);

Chebyshev Polynomials (First Kind)

Defined by T_n(cos(theta)) = cos(n*theta)

use mathhook_core::core::polynomial::special_families::ChebyshevT;
use mathhook_core::core::polynomial::special_families::OrthogonalPolynomial;
use mathhook_core::symbol;

let x = symbol!(x);

// Symbolic
let t0 = ChebyshevT::polynomial(0, &x);  // 1
let t1 = ChebyshevT::polynomial(1, &x);  // x
let t2 = ChebyshevT::polynomial(2, &x);  // 2x^2 - 1

// Numerical
let val = ChebyshevT::evaluate(2, 0.5);  // T_2(0.5) = -0.5

// Recurrence: T_{n+1} = 2x*T_n - T_{n-1}

Hermite Polynomials

Solutions to Hermite's equation (physicist's convention)

use mathhook_core::core::polynomial::special_families::Hermite;
use mathhook_core::core::polynomial::special_families::OrthogonalPolynomial;
use mathhook_core::symbol;

let x = symbol!(x);

// Symbolic
let h0 = Hermite::polynomial(0, &x);  // 1
let h1 = Hermite::polynomial(1, &x);  // 2x
let h2 = Hermite::polynomial(2, &x);  // 4x^2 - 2

// Numerical
let val = Hermite::evaluate(1, 0.5);  // H_1(0.5) = 1

// Recurrence: H_{n+1} = 2x*H_n - 2n*H_{n-1}

Laguerre Polynomials

Solutions to Laguerre's equation

use mathhook_core::core::polynomial::special_families::Laguerre;
use mathhook_core::core::polynomial::special_families::OrthogonalPolynomial;
use mathhook_core::symbol;

let x = symbol!(x);

// Symbolic
let l0 = Laguerre::polynomial(0, &x);  // 1
let l1 = Laguerre::polynomial(1, &x);  // 1 - x
let l2 = Laguerre::polynomial(2, &x);  // (x^2 - 4x + 2)/2

// Numerical
let val = Laguerre::evaluate(1, 0.5);  // L_1(0.5) = 0.5

// Recurrence: L_{n+1} = ((2n+1-x)*L_n - n*L_{n-1}) / (n+1)

Variable Substitution

Use any variable symbol in polynomial generation

use mathhook_core::core::polynomial::special_families::Legendre;
use mathhook_core::core::polynomial::special_families::OrthogonalPolynomial;
use mathhook_core::symbol;

// Use variable t instead of x
let t = symbol!(t);
let p2_t = Legendre::polynomial(2, &t);
// Result uses t: (3t^2 - 1)/2

πŸ”— Related Topics