1Splines

Instead of adopting basis functions defined over the entire sampling interval [x0,xn] as exemplified by the monomial or Lagrange bases, approximations of f: can be constructed with different branches over each subinterval, by introducing Si:[xi-1,xi], and the approximation

p(t)={ S1(t) x0t<x1 S2(t) x1t<x2 Sn(t) xn-1t<xn Sn+1(t) t=xn ..

The interpolation conditions p(xi)=yi lead to constraints

Si(xi-1)=yi-1.

The form of S(t) can be freely chosen, and though most often S(t) is a low-degree polynomial, the spline functions may have any convenient form, e.g., trigonometric or arcs of circle. The accuracy of the p(t) approximant is determined by the choice of form of S(t), and by the sample points. It is useful to introduce a quantitative measure of the sampling through the following definitions.

Definition. {x0,x1,,xn} is a partition of the interval [a,b] if xi, i=0,1,,n, satisfy

a=x0<x1<<xn-1<xn=b.

Definition. The norm of partition X={x0,x1,,xn} of the interval [a,b] is

||X||=max1in|xi-xi-1|.

Constant splines (degree 0).
A simple example is given by the constant functions Si(t)=yi-1. Arbitrary accuracy of the approximation can be achieved in the limit of n, ||X||0. Over each subinterval the polynomial error formula gives

f(t)-Si(t)=f'(ξt)(t-xi-1),

so overall

|f(t)-p(t)|||f'||||X||,

which becomes

|f(t)-p(t)|||f'||h,

for equidistant partitions xi=x0+ih, h=(xn-x0)/n. The interpolant p(t) converges to f(t) linearly (order of convergence is 1)

Linear splines (degree 1).
A piecewise linear interpolant is obtained by

Si(t)=t-xi-1xi-xi-1(yi-yi-1)+yi-1.

The interpolation error is bounded by

|f(t)-p(t)|12||f'||h2,

for an equidistant partition, exhibiting quadratic convergence.

Quadratic splines (degree 2).
A piecewise quadratic interpolant is formulated as

Si(t)=bi(t-xi-1)2+ci(t-xi-1)+yi-1.

The interpolation conditions are met since Si(xi-1)=yi-1. The additional parameters of this higher order spline interpolant can be determined by enforcing additional conditions, typically continuity of function and derivative at the boundary between two subintervals

Si(xi)=bihi2+cihi=yi, i=1,2,,n Si'(xi)=2bihi+ci=2bi+1hi+1+ci+1=Si+1'(xi) i=1,2,,n-1 .

An additional condition is required to close the system, for example Sn'(xi)=yn' (known end slope), or Sn'(xi)=0 (zero end slope), or Sn'(xi)=Sn'(xi-1) (constant end-slope). The coefficients bi,ci are conveniently determined by observing that Si'(t) is linear over interval [xi-1,xi] of length hi=xi-xi-1, and is given by

Si'(t)=t-xi-1hi(si-si-1)+si-1=si-1hi(xi-t)+sihi(t-xi-1),

with si=yi', the slope of the interpolant at xi. The continuity of first derivative conditions Si'(xi)=Si+1'(xi) are satisfied, and integration gives

Si(t)=si2hi(t-xi-1)2-si-12hi(xi-t)2+Ai.

The interpolation condition Si(xi-1)=yi-1, determines the constant of integration Ai

Ai-si-1hi2=yi-1Ai=yi-1+si-1hi2,

Imposing the continuity of function condition Si(xi)=Si+1(xi) gives

sihi2+yi-1+si-1hi2=-sihi+12+yi+sihi+12,

or

si-1+si=2hi(yi-yi-1),i=1,2,,n,

a bidiagonal system for the slopes that is solved by backward substituion in 𝒪(2n) operations. For i=1, the s0 value arising in the system has to be given by an end condition, and the overall system 𝑩𝒔=𝒅 is defined by

𝑩=[ 1 1 1 1 1 1 1 ],𝒅=[ 2h1(y1-y0)-s0 2h2(y2-y1) 2hn(yn-yn-1) ],𝒔n,𝑩n×n.

The interpolation error is bounded by

|f(t)-p(t)|12||f'||h2,

for an equidistant partition, exhibiting quadratic convergence.

Cubic splines (degree 3).
The approach outlined above can be extended to cubic splines, of special interest since continuity of curvature is achieved at the nodes, a desirable feature in many applications. The second derivative is linear

Si''(t)=zi-1hi(xi-t)+zihi(t-xi-1),

with zi-1=Si''(xi-1), zi=Si''(xi) the curvature at the endpoints of the [xi-1,xi] subinterval. Double integration gives

Si(t)=zi-16hi(xi-t)3+zi6hi(t-xi-1)3+Ai(t-xi-1)+Bi(xi-t).

The interpolation conditions Si(xi-1)=yi-1, Si-1(xi)=yi, gives the integration constants

Ai=yihi-zihi6,Bi=yi-1hi-zi-1hi6

and continuity of first derivative, Si'(xi)=Si+1'(xi), subsequently leads to a tridiagonal system for the curvatures

hizi-1+2(hi+hi-1)zi+hi+1zi+1=6(yi+1-yi)hi+1-6(yi-yi-1)hi,i=1,2,,n-1.

End conditions are required to close the system. Common choices include:

  1. Zero end-curvature, also known as the natural end conditions: z0=zn=0.

  2. Curvature extrapolation: z0=z1, zn=zn-1

  3. Analytical end conditions given by the function curvature: z0=f''(x0), zn=f''(xn).