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 satisfying orthogonality relation:
where is the weight function on interval .
Three-Term Recurrence: All orthogonal polynomials satisfy:
Family Definitions:
1. Legendre: Interval , - Differential equation: - Recurrence:
2. Chebyshev (1st): Interval , - Definition: - Recurrence:
3. Chebyshev (2nd): Interval , - Definition: - Recurrence:
4. Hermite: Interval , - Differential equation: - Rodriguez formula: - Recurrence:
5. Laguerre: Interval , - Differential equation: - Recurrence:
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