Physics · Article
Interpolation, extrapolation, and approximation
Construct values between supplied points, distinguish extensions beyond them, and check approximation error through original position models with explicit units and assumptions.
Previous article: Linear systems and numerical eigenvalue problems
Back to PhysicsAfter reading, you can
- Distinguish interpolation, extrapolation and approximation of a function.
- Build a piecewise linear interpolant with dimensionless weights and compatible units.
- Explain why finite samples do not determine an unrestricted underlying function.
- Construct a quadratic interpolant while retaining its degree restriction.
- Use a conditional curvature bound and separately propagate supplied endpoint error bounds.
- Record the model, domain and checks needed to interpret an estimated value.
State the samples and the question
The supplied positions are 2 m at 1 s and 5 m at 2 s. What position should we estimate at 1.5 s? Averaging the two gives 3.5 m, but we need a reason for that rule and a way to check it. Let t be elapsed time in seconds and x a signed position in metres along a fixed axis, with the same tracked point and origin throughout. These supplied values are not new readings from an instrument.
For checking this lesson's calculations, separately stipulate f(t) = 1 m + (1 m/s²)t² on [0 s, 3 s]. Its values generate the table. Treating the samples alone as our information is a different problem from knowing that full formula. No measured trajectory or physical law is asserted.
An interpolation rule builds a function from the supplied pairs. Start with the table, adjacent lines and comparison graph: basic arithmetic and reading a position–time graph are enough for that first pass. The published lesson Algebra and functions reviews graphs and function domains. If derivatives are new, return to the slope and curvature-bound discussion after Derivatives, Taylor series, and local approximation; those bounds need more than the table.
| Sample time t | Supplied position x |
|---|---|
| 0 s | 1 m |
| 1 s | 2 m |
| 2 s | 5 m |
Separate interpolation, extrapolation and fitting
An interpolant matches each supplied sample: p(tᵢ) = xᵢ. Using it at a time between the first and last sample is interpolation. Extending a chosen rule beyond that sampled interval is extrapolation. Thus 1.5 s is inside our sample range, whereas 3 s is outside it, even though both belong to the stipulated formula's domain.
Approximation is broader: we choose a simpler or more convenient function and assess its difference from a target under stated conditions. A regression or smoothing fit can deliberately leave nonzero discrepancies at samples. An interpolant instead has zero discrepancies at those supplied points, which does not prove zero error elsewhere.
The input times must be distinct for the formulas below. Conflicting positions at one identical time cannot be matched by a single-valued function. Repeated equal pairs add no new distinct node. Inputs with the same numerical label but different units must first be expressed consistently.
Connect adjacent points with a line
For a < b, put h = b − a and α = (t − a)/h. The line through positions xₐ and xᵦ is L(t) = (1 − α)xₐ + αxᵦ. The time ratio α has no unit; the output remains a position. If a ≤ t ≤ b, both weights are nonnegative and add to one, so the value lies between the two endpoint positions.
Use the adjacent pair that brackets the requested time. Our piecewise linear rule is p(t) = 1 m + (1 m/s)t on [0 s, 1 s], and p(t) = 2 m + (3 m/s)(t − 1 s) on [1 s, 2 s]. Both pieces give 2 m at 1 s, so the rule is continuous there.
The two pieces have slopes 1 m/s and 3 m/s. The interpolant has no derivative at their joining time, because the one-sided slopes differ. These slopes describe the chosen interpolant; they are not automatically the instantaneous velocity of an unknown motion. An unweighted average is appropriate only at the midpoint of the selected time interval.
Identify what the samples leave open
The full quadratic f is one function matching all three samples. Another is g(t) = f(t) + (1 m/s³)t(t − 1 s)(t − 2 s), also stipulated on [0 s, 3 s]. The extra term is zero at every sampled time, but it need not vanish between or beyond them.
At 1.5 s, f gives 3.25 m and g gives 2.875 m. At 3 s they give 10 m and 16 m. Both are smooth functions with exactly the same table. Therefore smoothness alone, without a suitable quantitative restriction or chosen model class, does not make those samples determine the missing position.
Extending the last line segment to 3 s gives 8 m. This is an explicitly chosen extrapolation rule, with error −2 m against f at that time. The extension is not part of the original piecewise rule's [0 s, 2 s] domain. Extrapolation can succeed when additional knowledge supports it; sample agreement alone supplies no such guarantee.
- Quadratic f: solid curve
- Alternative g: long-dashed curve
- Adjacent lines p: dotted line
- Chosen extension: dash-dot line
- Supplied sample: diamond
| Time t | Quadratic f(t) | Alternative g(t) | Adjacent lines p(t) | Chosen last-line extension |
|---|---|---|---|---|
| 0 s | 1 m | 1 m | 1 m | Not used |
| 1 s | 2 m | 2 m | 2 m | Not used |
| 1.5 s | 3.25 m | 2.875 m | 3.5 m | Not used |
| 2 s | 5 m | 5 m | 5 m | 5 m |
| 3 s | 10 m | 16 m | Outside its domain | 8 m |
Choose a polynomial class explicitly
Three distinct input times determine one interpolating polynomial of degree at most two. The qualification matters: it identifies the chosen class, rather than proving that the actual trajectory is quadratic. To keep units clear, write τ = t/(1 s), a dimensionless coordinate, and seek a position-valued polynomial q(τ).
For our nodes τ = 0, 1, 2, use L₀(τ) = (τ − 1)(τ − 2)/2, L₁(τ) = −τ(τ − 2), and L₂(τ) = τ(τ − 1)/2. Each weight is one at its own node and zero at the other two. Then q(τ) = (1 m)L₀(τ) + (2 m)L₁(τ) + (5 m)L₂(τ). Expanding gives q(τ) = (1 + τ²) m.
Here q(t/(1 s)) reproduces f(t) throughout [0 s, 3 s] because the separately stipulated f is already in that polynomial class. It does not reproduce g. Two quadratics matching three distinct nodes must be identical: their difference has degree at most two and three distinct zeros, which forces the zero polynomial. This establishes class-specific uniqueness.
Use an error bound with its assumptions
Suppose a target position function has a continuous second derivative throughout [a, b], its endpoint values are exact, and |f″(t)| ≤ M there. M measures how rapidly its slope can change and has units m/s². Its endpoint line then satisfies |f(t) − L(t)| ≤ M(t − a)(b − t)/2 ≤ Mh²/8 for a ≤ t ≤ b, where h = b − a.
The factor (t − a)(b − t) equals h²/4 − (t − (a + b)/2)², so it is largest at the midpoint. For our f, f″ = 2 m/s². A 1 s interval has an error bound of 0.25 m; an exact 0.5 s sampling interval has a bound of 0.0625 m. For this quadratic, the maximum errors attain those values.
Halving h quarters this curvature-bound term when the same M remains valid and the new endpoint samples are exact. It does not guarantee that every point's actual error quarters. A curvature bound cannot generally be inferred from a finite table alone. The stated interval bound also does not certify an extrapolated value outside that interval.
Keep data error separate from interpolation error
Now hold the endpoint times fixed, but let each supplied endpoint position differ from the target's value by δₐ or δᵦ, with |δₐ|, |δᵦ| ≤ η. These are deterministic absolute bounds, not standard uncertainties or independent random errors. The change in the endpoint line is ΔL(t) = (1 − α)δₐ + αδᵦ.
Inside the interval, |ΔL| ≤ η because the weights are nonnegative and sum to one. Combining this with the curvature bound gives |f − L_supplied| ≤ Mh²/8 + η. With M = 2 m/s², h = 1 s and η = 0.02 m, this is 0.27 m. It covers these two specified contributions; input-time errors and arithmetic errors require separate treatment.
Outside the interval the weights can have opposite signs. Their absolute values give |ΔL| ≤ (|1 − α| + |α|)η. Extending the last [1 s, 2 s] segment to 3 s gives α = 2 and a data-error bound of 0.06 m when η = 0.02 m. This amplification bound concerns endpoint perturbations of that chosen line, not its additional mismatch with the unknown target.
Check and record the approximation
State the target quantity, sampled times, units, rule and allowed evaluation domain. Check that every supplied point is reproduced, that interval selection and boundary values agree, and that claimed error bounds retain their hypotheses. Record whether a comparison used an exact known formula, additional samples or an assumed physical model.
For our test model, additional exact samples can reveal errors between the original nodes. For an experiment, extra measurements also carry their own uncertainty and conditions. A few checks establish only those comparisons; a whole-interval bound needs an argument that covers the whole interval. Different approximation rules may agree at samples and differ elsewhere.
Choose a rule for the question being asked, including the required accuracy and available knowledge. A smooth-looking interpolant does not establish a physical mechanism, and zero sample discrepancy does not establish its derivative or integral. The next lesson, Numerical differentiation and integration, examines those numerical questions with their own assumptions.
Worked examples
Interpolate and check an interior position
Use the supplied positions 2 m at 1 s and 5 m at 2 s to estimate the position at 1.5 s. Compare it with the stipulated f and the conditional curvature bound.
- The selected interval has width h = 1 s. Its time fraction is α = (1.5 s − 1 s)/(1 s) = 1/2.
- L(1.5 s) = (1/2)(2 m) + (1/2)(5 m) = 3.5 m. Substituting either endpoint reproduces its supplied position.
- The stipulated formula gives f(1.5 s) = 1 m + (1 m/s²)(1.5 s)² = 3.25 m. The signed interpolation error L − f is +0.25 m.
- The whole selected interval has continuous f″ = 2 m/s², so Mh²/8 = 0.25 m. The midpoint attains this bound here; exact arithmetic of the estimate does not make it the exact target value.
The linear estimate is 3.5 m, with error +0.25 m against f. Its absolute error equals the justified bound for this original case.
Compare two interpolating functions
Evaluate the quadratic interpolant at 1.5 s using its three weights. Does agreement with all three samples prove that an unknown target has this value?
- τ = 1.5. The weights are L₀ = −1/8, L₁ = 3/4 and L₂ = 3/8. They sum to one, but one is negative.
- q = (−1/8)(1 m) + (3/4)(2 m) + (3/8)(5 m) = 26/8 m = 3.25 m. This also equals (1 + τ²) m.
- The additional cubic term in g is (1 m/s³)(1.5 s)(0.5 s)(−0.5 s) = −0.375 m. Thus g(1.5 s) = 2.875 m while matching every sampled pair.
- The samples uniquely determine q within the degree-at-most-two class. They do not exclude g when that degree restriction is not known to describe the target. The two functions already differ inside the sampled interval.
The quadratic estimate is 3.25 m. Class-specific uniqueness does not prove the missing value of an unrestricted target.
Separate endpoint perturbation from model mismatch
For the last segment, change the supplied endpoint positions from 2 m and 5 m to 1.98 m and 5.02 m. Compare the line changes at 1.5 s and at the extrapolated 3 s.
- The changes are δₐ = −0.02 m and δᵦ = +0.02 m, each within η = 0.02 m. Endpoint times remain exactly 1 s and 2 s.
- At 1.5 s, the weights are 1/2 and 1/2. The perturbed value is (1.98 m + 5.02 m)/2 = 3.5 m, so ΔL = 0 m. Opposite changes cancel in this particular case; no random averaging claim is used.
- At 3 s, α = 2 and the weights are −1 and 2. The perturbed extension is −1.98 m + 2(5.02 m) = 8.06 m, compared with the original extension 8 m. Its change +0.06 m attains (1 + 2)η.
- Against the stipulated f(3 s) = 10 m, the perturbed extension still has error −1.94 m. The 0.06 m bound controls the line's data perturbation only. It does not bound the extrapolation's full target error.
The interior estimate is unchanged; the extrapolated line increases by 0.06 m. That small data-change bound does not certify its accuracy against the target.
Try it yourself
A separate endpoint line uses f(1 s) = 2 m and f(3 s) = 10 m. Find its estimate at 1.5 s and compare it with f(1.5 s). Is an unweighted endpoint average appropriate?
Show the answer and reasoning
α = 1/4, the line gives 4 m, and its error against f is +0.75 m. An unweighted average is inappropriate at this time.
The time interval is 2 s and the query is 0.5 s from its left endpoint. Therefore L = (3/4)(2 m) + (1/4)(10 m) = 4 m. The stipulated f gives 3.25 m. The endpoint average 6 m corresponds to the interval's midpoint, 2 s.
Can a single-valued interpolant reproduce both (1 s, 2 m) and (1 s, 3 m)? Can those pairs be used as a two-point line with width zero?
Show the answer and reasoning
Neither construction is valid: the same input would need two different outputs, and the line formula would divide by zero.
A function assigns one value at a given time. The two incompatible positions cannot both be its value. Repeated equal positions at that time could be consolidated, but they would still supply only one distinct node.
The three original samples give q(1.5) = 3.25 m. Why does the distinct cubic g not contradict uniqueness of the quadratic interpolant?
Show the answer and reasoning
Uniqueness applies to polynomials of degree at most two; g has a nonzero cubic term and is outside that class.
The coefficient 1 m/s³ multiplying t(t − 1 s)(t − 2 s) is nonzero. In the dimensionless time coordinate this contributes a cubic position term. Its vanishing at the three nodes preserves the table without producing a second quadratic.
At 3 s, compare the last-segment extension, f and g. Which value is forced by the three samples alone?
Show the answer and reasoning
The line extension gives 8 m, f gives 10 m and g gives 16 m. The samples alone force none of these unsampled values.
The query is beyond the final sampled time of 2 s. Each number follows from its declared rule or additional formula. Since f and g agree at every supplied node but disagree at 3 s, the table cannot select their continuation without more assumptions.
Hold the last segment's endpoint times fixed and allow arbitrary endpoint position changes with absolute values at most 0.02 m. Bound the line change at 1.5 s and at its 3 s extension. Must the interior change be zero?
Show the answer and reasoning
The bounds are 0.02 m inside and 0.06 m at 3 s. The interior change need not be zero.
At 1.5 s the sum of absolute weights is 1; at 3 s it is 3. Multiply each by η. Two endpoint changes both equal to +0.02 m give an interior change +0.02 m. Cancellation in the worked example was a property of those opposite signed changes, not a general consequence of interpolation.
Suppose M = 2 m/s² holds on every selected interval and fixed-time endpoint position errors are bounded by η = 0.02 m. Does Mh²/8 + η certify a 0.04 m target for h = 0.5 s? What about h = 0.25 s?
Show the answer and reasoning
The 0.5 s bound is 0.0825 m and does not certify the target. The 0.25 s bound is 0.035625 m and does, under the supplied assumptions.
For 0.5 s the curvature term is 0.0625 m; for 0.25 s it is 0.015625 m. Add the unchanged 0.02 m endpoint bound. A bound above the target does not prove that the actual error exceeds it. The conclusion covers the specified function and data contributions, with arithmetic and input-time errors still excluded.
What to carry forward
- An interpolant matches supplied points; interpolation and extrapolation name where the new input lies relative to the sampled range.
- Adjacent-point linear interpolation uses time-ratio weights and retains the output quantity's units.
- Finite samples do not determine an unrestricted smooth function between or beyond them.
- Polynomial uniqueness requires distinct nodes and an explicit degree restriction.
- A curvature bound requires smoothness, an interval-wide bound and exact endpoint values; endpoint errors can be bounded separately.
- Record domains, error contributions and independent comparisons before interpreting an approximation as a physical result.
References
Sources for the concepts and teaching approaches in this article.
- Fundamentals of Numerical ComputationTobin A. Driscoll and Richard J. Braun — Fundamentals of Numerical ComputationTeaching resourceThe interpolation problemPiecewise linear interpolation
- Statistical Computing — Interpolation李东风 (Li Dongfeng) — Peking University, School of Mathematical SciencesTeaching resource