Skip to main content

Polynomial Interpolation

Computational Math
Interpolation
Parametric Curves
Compare piecewise linear and cubic spline interpolation through a set of points.
Author

Apurva Nakade

Published

July 13, 2026

Connects \(n+1\) samples \((x_k,y_k)\), \(y_k=f(x_k)\), of \(f\) on \([a,b]\) with straight segments (linear),

\[ L(x) = y_k + \frac{y_{k+1}-y_k}{x_{k+1}-x_k}\,(x-x_k),\qquad x\in[x_k,x_{k+1}], \]

or with the natural cubic spline \(S\): the unique piecewise cubic through every node with \(S\), \(S'\), and \(S''\) continuous at each interior node and \(S''(x_0)=S''(x_n)=0\) at the ends. The page then compares how fast each interpolant’s arc length converges to \(f\)’s true arc length as \(n\) grows.

Both interpolants depend linearly on the data, so each is a sum of fixed cardinal functions weighted by the data,

\[ p(x) = \sum_{k=0}^{n} y_k\,\varphi_k(x),\qquad \varphi_k(x_j) = \begin{cases}1 & j = k\\ 0 & j \ne k,\end{cases} \]

where \(\varphi_k\) is the interpolant of the data \((0,\dots,0,1,0,\dots,0)\) and depends only on the nodes, not on \(f\). The basis chart draws the terms \(y_k\varphi_k\) of that sum: add them up and you get back the interpolant in the main chart. For the linear interpolant, \(\varphi_k\) is a hat function: it rises from \(0\) at \(x_{k-1}\) to \(1\) at \(x_k\) and falls back to \(0\) at \(x_{k+1}\), so each \(y_k\) affects only the two neighboring intervals. The spline’s \(\varphi_k\) also equals \(1\) at \(x_k\) and \(0\) at the other nodes, but it ripples, with decaying amplitude, across the whole of \([a,b]\): changing one \(y_k\) moves the spline everywhere, just less and less farther away.

NoteConvergence plots