Interpolation Calculator
Interpolate from a table of values with Newton's forward or backward differences, Lagrange's formula or divided differences: the difference table, the interpolating polynomial and the value at any x, all in exact fractions.
About the Interpolation Calculator
Given y at equally spaced x₀, x₀ + h, …, the forward differences Δy₀ = y₁ − y₀, Δ²y₀ = Δy₁ − Δy₀, … give Newton's forward formula y = y₀ + pΔy₀ + p(p − 1)/2! Δ²y₀ + …, with p = (x − x₀)/h. It suits x near the start of the table; the backward formula, built on the last value yₙ and ∇yₙ = yₙ − yₙ₋₁, suits x near the end.
For unequal spacing, Lagrange's formula writes y = Σ yᵢ Lᵢ(x), and Newton's divided differences build the same polynomial one point at a time. Through n points there is exactly one polynomial of degree at most n − 1, so all four methods agree.
The formula
y = y₀ + pΔy₀ + p(p − 1)/2! Δ²y₀ + …, p = (x − x₀)/h
Worked example
x: 1, 2, 3, 4, 5; y = x³
- Δy₀ = 7, Δ²y₀ = 12, Δ³y₀ = 6, Δ⁴y₀ = 0
- At x = 2.5: p = 1.5
- y = 1 + 1.5(7) + (1.5)(0.5)/2 (12) + (1.5)(0.5)(−0.5)/6 (6) = 15.625
Questions people ask
Forward or backward?
Use the forward formula for an x near the top of the table and the backward formula near the bottom: fewer terms are needed for the same accuracy. With every term included, both give the same exact value.
Why are the answers fractions?
The data are read exactly, so the polynomial and the value are exact. A decimal is shown alongside when the fraction doesn't end quickly.