TOPIC 2 / 2
Interpolation & Numerical Integration
For a long equation, swipe sideways inside its formula box to see every term.
Meaning & notation
Numerical integration replaces a difficult curve by simpler pieces whose areas can be calculated. Linear interpolation joins neighboring data points with a straight line; integrating these lines produces trapezoids. Simpson’s rule integrates quadratic interpolants on pairs of equal-width panels. The approximation quality depends on the function between sample points, not merely the precision of the given samples.
- Interpolation
- An interpolant matches the sampled function values exactly at specified nodes. For two distinct nodes, there is one line passing through both data points.
- Composite trapezoidal rule
- For equal spacing h, add the areas under linear interpolants. Interior node values receive full weight h because two neighboring half-weights meet there.
- Composite Simpson rule
- For an even number n of equal-width panels, use weights 1,4,2,4,...,2,4,1 multiplied by . The rule is exact for every polynomial of degree at most three.
Conditions before calculation
- Interpolation nodes must be distinct. Standard composite Simpson weights require equally spaced nodes and an even number of panels; they do not apply unchanged to arbitrary data spacing.
- The usual trapezoidal error bound assumes a continuous second derivative; Simpson’s usual error bound assumes a continuous fourth derivative on the full interval.
- A formula based only on samples cannot certify accuracy for an unrestricted function between nodes. Discontinuities, singularities, and rapid oscillations require additional analysis or adapted methods.
Why the method works
1. Build the local model
Between a and b, the interpolating line weights the two endpoint values by distance. Its area is width times average endpoint height.
2. Assemble consistent weights
Let xj=a+jh and . For the trapezoidal sum, count each shared interior endpoint only through the two half-contributions.
3. Bound what remains
If M2 bounds the absolute second derivative and M4 bounds the absolute fourth derivative, these inequalities quantify truncation error, excluding measurement and rounding errors.
Worked examples
EXAMPLE 1
Use two equal panels to integrate x squared from 0 to 2 by trapezoidal and Simpson rules.
The nodes are 0,1,2, step size is 1, and sampled values are 0,1,4.
Compute both weighted sums.
Compare with the antiderivative and apply the trapezoidal error bound using .
Conclusion: Simpson is exact for this quadratic; the trapezoidal estimate is an overestimate with error .
EXAMPLE 2
Measurements are and . Linearly interpolate at and integrate the line from 1 to 3.
The slope is the change in value divided by the nonzero node separation.
The line through the first node gives the interpolated value.
Its integral is the trapezoid area.
Conclusion: The interpolant has value 7 at the midpoint and area 14. These are exact for the fitted line, not necessarily for the unknown underlying function.
Pitfalls & counterexamples
Tempting claim: A rule exact at the sample points must have the exact integral.
Correction: Matching finitely many points leaves the behavior between them undetermined.
Test the claim: On [0,2], zero and x squared times squared times squared agree at 0,1,2, but the latter has positive integral.
Check your understanding
Can standard composite Simpson weights be used with five equal panels?
Write a reason before opening the explanation. This reflection is not graded or saved.
Compare your reasoning
No.
The standard construction groups panels in pairs, so the panel count must be even.
Connect this idea
Interpolation also supports data reconstruction and differential-equation solvers. Comparing refined grids can suggest an error trend, but a proven bound still requires assumptions about the function.
Reference reading
Use these texts to study the underlying definitions and theorems in greater depth. The explanations and examples above are written for Numerive.