The Lagrange form is elegant but slow and unstable; barycentric interpolation is its rehabilitation. Precompute one weight per node, wj = 1/∏k≠j(xj−xk), and then the interpolant at any point is a single quotient: p(x) = [Σ wj yj/(x−xj)] / [Σ wj/(x−xj)]. Adding a new node costs an O(n) weight update, not a refit; evaluation is O(n) and numerically stable even for hundreds of points (Berrut & Trefethen). It is the form real software uses to reconstruct a function from samples — the same value as Newton and Neville, computed as a ratio of weighted contributions.
The same three samples. The demo precomputes the barycentric weights and reconstructs the value as one weighted quotient: live demo
“Lagrange interpolation is O(n²) and unstable.” — the barycentric form makes it O(n) and stable: the weights carry the geometry once, and every evaluation is a clean quotient. The classic formula, rehabilitated. cited
The weights are the Vandermonde geometry, precomputed; every reconstruction after is one quotient. Fast, stable, and exact where the nodes are distinct. Berrut-Trefethen 2004
On the canonical compiler, weights 0.5, −1, 0.5 reconstruct the value to 19 at x=3 (to f64 precision) — the same value as Newton and Neville: