6.5 Data fitting — Lagrange interpolation
Source: Ideas from Computational Physics (Landau, Páez, Bordeianu), §6.5–6.5.1. Rewritten in original wording. Continues 6.4b Magnetization labs (searching → fitting). Labs: 6.5b Lagrange interpolation labs.
Interpolation vs. fitting
A table of measurements is not a function — it is isolated points, each carrying its own experimental error. Two different questions can be asked of it:
- Interpolate: find some smooth curve that passes through the tabulated values, so you can read off a value between them.
- Fit: assume a theoretical functional form and adjust its free parameters so the curve matches the data as well as possible in a statistical sense (least squares — covered separately).
Interpolation is simpler and doesn't require knowing the "correct" theory, but it also doesn't account for noise: it forces the curve through every point, warts and all. A worked example is neutron-nucleus resonant scattering. The tabulated cross section:
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | |
|---|---|---|---|---|---|---|---|---|---|
| (MeV) | 0 | 25 | 50 | 75 | 100 | 125 | 150 | 175 | 200 |
| (mb) | 10.6 | 16.0 | 45.0 | 83.5 | 52.8 | 19.9 | 10.8 | 8.25 | 4.7 |
| Error (mb) | 9.34 | 17.9 | 41.5 | 85.5 | 51.5 | 21.5 | 10.8 | 6.29 | 4.14 |
The theoretical Breit–Wigner shape this data is expected to follow is
with unknown resonance energy , width , and scale — but interpolation alone never needs to know this formula.
Local polynomials, one interval at a time
Assume can be approximated on interval by a degree- polynomial
The fit is local: a different set of coefficients is used in each interval, rather than forcing one polynomial to cover the entire table. Multiple low-degree polynomials, stitched together, behave far better than a single high-degree one.
The Lagrange formula
Lagrange found a closed form that fits an -degree polynomial through points directly, without solving for the by hand. Walk the construction — at each step pick the matching equation (lookalikes included).
Worked check. Given and , expanding the four-point formula simplifies to . Checks: ✓, and off-node. Nodes need not be evenly spaced.
Why global fits misbehave
The interpolant hits every node, but the remainder between nodes can explode when high derivatives are large (noisy tables). Pick the remainder formula and the practical remedy among lookalikes.
Rule of thumb: keep interpolation local (small , e.g. ) and treat global high-degree fits with suspicion. Extrapolation outside the table is riskier still.
Lagrange interpolation
1 / 4An n-point Lagrange interpolation produces a polynomial of degree…
Pick an answer to see if you are right.