Skip to main content

Module lagrange

Module lagrange 

Source
Expand description

Polynomial interpolation through n points: the Lagrange form (direct evaluation) and the Newton divided-difference form (build coefficients once, evaluate cheaply).

Functionsยง

lagrange_eval
Evaluate the Lagrange interpolating polynomial through (xs, ys) at x.
newton_coefficients
Newton divided-difference coefficients for (xs, ys) (the leading diagonal of the divided-difference table). Use with newton_eval.
newton_eval
Evaluate the Newton form (Horner over the nested products) at x.