1. Home

Between the samples

Interpolation and Calculus: Differences, Quadrature and Differential Equations

Plaster board with five pegs and a green thread drawn through them in a smooth curve (AI-generated image)
AI-generated image

Data arrive as samples, yet calculus lives on continuous functions. The methods in this section bridge the two: fill in values between samples, estimate slopes, add up areas, and follow a differential equation forward in time. Each page ends with an error estimate, since in numerical calculus the error is half of the result.

Interpolation

Given values at a handful of points, interpolation builds a function through them. The one-dimensional interpolation page compares the main choices: straight segments, polynomials and smoother piecewise curves. A warning worth stating early is that a single high-degree polynomial through equally spaced points can oscillate wildly near the ends, so piecewise methods are the safer default. The two-dimensional version applies the same idea on a grid, as when a table of values over two variables needs a value in a gap.

Differences

Slopes and curvature come from finite differences of arbitrary order, combinations of samples with binomial weights. They are simple, and they carry a trade-off between truncation and rounding error that dictates the step size. Differentiation amplifies noise while integration smooths it, which is why measured data are often smoothed or interpolated before differences are taken.

Integration

Quadrature replaces an integral by a weighted sum of function values. Gaussian rules choose both the points and the weights cleverly, so that n points integrate every polynomial up to degree 2n − 1 exactly. The page on two-dimensional Gaussian quadrature extends the rule to areas. Another page covers evaluating special functions through continued fractions with Lentz’s method, a tool that complements series expansions where those converge slowly.

Differential equations

A system of linear differential equations with constant coefficients has the solution y(t) = eAty(0), which turns the problem into computing a matrix exponential. The matrix ODE page shows how a Padé approximation, a ratio of two polynomials, delivers that exponential accurately.

Where to begin

Read interpolation first, since differences and quadrature can both be seen as operations on the interpolating curve. Then differences, then quadrature. Check every method on a function you can handle exactly, such as a low-degree polynomial or the exponential, and compare the observed error with the formula on the page.

Matrix machinery for the last topic lives in linear algebra, and the glossary collects the vocabulary.

Questions about interpolation

What is the difference between interpolation and curve fitting?

An interpolating curve passes exactly through every data point. A fitted curve, such as a least squares line, follows the general trend and may miss every point. Interpolation suits accurate data that must be honored. Fitting suits noisy measurements, where passing through each point would reproduce the noise.

Why does high-degree polynomial interpolation sometimes go wrong?

A single polynomial through many equally spaced points can oscillate wildly near the ends of the interval, which is known as Runge’s phenomenon. The fit is exact at the data but poor between points. Splines, which join low-degree pieces smoothly, avoid this and are the usual choice for many points.

Can I extrapolate with an interpolation formula?

You can evaluate the formula outside the data range, but the result is unreliable. Interpolation errors are bounded between the data points, while beyond them polynomials and splines tend to diverge quickly. If extrapolation is necessary, keep it short, use a low-degree model and treat the output as an estimate.

How accurate is a finite difference derivative?

The error has two parts. A step that is too large causes truncation error from the formula itself. A step that is too small makes rounding error dominate, since two nearly equal numbers are subtracted. For a central difference in double precision, a step near the cube root of machine epsilon, about 10⁻⁵ for unit-sized arguments, balances them.

Back to top