Skip to main content

Module least_squares

Module least_squares 

Source
Expand description

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).

Functions§

poly_eval
Evaluate a polynomial given ascending coefficients at x (Horner).
poly_fit
Fit a degree-degree polynomial to (xs, ys) in the least-squares sense. Returns coefficients in ascending order [c₀, c₁, …, c_degree] (so the polynomial is Σ cₖ xᵏ). Fails closed if there are too few points or the system is singular.