Function quad_polynomial

Source
pub fn quad_polynomial(
    x: f64,
    x0: f64,
    x1: f64,
    x2: f64,
    y0: f64,
    y1: f64,
    y2: f64,
) -> f64
Expand description

Evaluates the quadratic Lagrange polynomial defined by three points.

Given points (x0, y0), (x1, y1), (x2, y2) this returns P(x) where P is the unique polynomial of degree ≤ 2 passing through the three points.

§Panics

Panics if any two abscissas are identical because the interpolation coefficients would involve division by zero.