In the mathematical field of numerical analysis, spline interpolation is a form of interpolation where the interpolant is a special type of piecewise polynomial called a spline. That is, instead of fitting a single, high-degree polynomial to all of the values at once, spline interpolation fits low-degree polynomials to small subsets of the values, for example, fitting nine cubic polynomials between each of the pairs of ten points, instead of fitting a single degree-nine polynomial to all of them. Spline interpolation is often preferred over polynomial interpolation because the interpolation error can be made small even when using low-degree polynomials for the spline. Spline interpolation also avoids the problem of Runge's phenomenon, in which oscillation can occur between points when interpolating using high-degree polynomials.
Introduction
Originally, spline was a term for elastic rulers that were bent to pass through a number of predefined points, or knots. These were used to make technical drawings for shipbuilding and construction by hand, as illustrated in the figure. We wish to model similar kinds of curves using a set of mathematical equations. Assume we have a sequence of n + 1 {\displaystyle n+1} knots, ( x 0 , y 0 ) {\displaystyle (x_{0},y_{0})} through ( x n , y n ) {\displaystyle (x_{n},y_{n})} . There will be a cubic polynomial q i ( x ) = y {\displaystyle q_{i}(x)=y} between each successive pair of knots ( x i − 1 , y i − 1 ) {\displaystyle (x_{i-1},y_{i-1})} and ( x i , y i ) {\displaystyle (x_{i},y_{i})} connecting to both of them, where i = 1 , 2 , … , n {\displaystyle i=1,2,\dots ,n} . So there will be n {\displaystyle n} polynomials, with the first polynomial starting at ( x 0 , y 0 ) {\displaystyle (x_{0},y_{0})} , and the last polynomial ending at ( x n , y n ) {\displaystyle (x_{n},y_{n})} . The curvature of any curve y = y ( x ) {\displaystyle y=y(x)} is defined as
κ = y ″ ( 1 + y ′ 2 ) 3 / 2 , {\displaystyle \kappa ={\frac {y''}{(1+y'^{2})^{3/2}}},}
where y ′ {\displaystyle y'} and y ″ {\displaystyle y''} are the first and second derivatives of y ( x ) {\displaystyle y(x)} with respect to x {\displaystyle x} . To make the spline take a shape that minimizes the bending (under the constraint of passing through all knots), we will define both y ′ {\displaystyle y'} and y ″ {\displaystyle y''} to be continuous everywhere, including at the knots. Each successive polynomial must have equal values (which are equal to the y-value of the corresponding datapoint), derivatives, and second derivatives at their joining knots, which is to say that
… excerpt ends here. Continue reading the full article.


