Expand description
Interpolation & function approximation (Gap analysis §3.7).
lagrange— Lagrange and Newton divided-difference polynomial interpolation.spline— natural cubic spline (tridiagonal Thomas solve) and linear interpolation.least_squares— polynomial least-squares fit via the normal equations.
Fail-closed (InterpolationError): empty/mismatched data, duplicate nodes, an
over-high fit degree, or a singular system return an error rather than a fabricated
curve.
Re-exports§
pub use lagrange::lagrange_eval;pub use lagrange::newton_coefficients;pub use lagrange::newton_eval;pub use least_squares::poly_eval;pub use least_squares::poly_fit;pub use spline::linear_interp;pub use spline::CubicSpline;
Modules§
- lagrange
- Polynomial interpolation through
npoints: the Lagrange form (direct evaluation) and the Newton divided-difference form (build coefficients once, evaluate cheaply). - least_
squares - Polynomial least-squares fitting via the normal equations
(VᵀV) c = Vᵀy, solved by Gaussian elimination with partial pivoting (the small(d+1)×(d+1)system). - spline
- Natural cubic spline interpolation (the tridiagonal system for the second derivatives is solved with the Thomas algorithm) and piecewise-linear interpolation.