Construct the Lagrange interpolating polynomial through given data points and evaluate at x.
Lagrange interpolation constructs the unique polynomial of degree ≤ n-1 passing through n data points. It uses the formula P(x) = Σ yᵢ·Lᵢ(x) where each basis polynomial Lᵢ(x) = Π_{j≠i} (x-xⱼ)/(xᵢ-xⱼ) equals 1 at xᵢ and 0 at all other data points. Enter x and y values as comma-separated lists.
Lagrange formula
P(x) = Σᵢ yᵢ · Πⱼ≠ᵢ (x - xⱼ)/(xᵢ - xⱼ)
With many equally-spaced points, high-degree polynomials can oscillate wildly between points. Use Chebyshev nodes or splines for many data points.
n points determine a unique polynomial of degree n-1. More points give higher-degree polynomials but risk oscillation.