title: Discrete spline interpolation
text: # Discrete spline interpolation
  
  In the mathematical field of numerical analysis, discrete spline interpolation is a form of interpolation where the interpolant is a special type of piecewise polynomial called a discrete spline. A discrete spline is a piecewise polynomial such that its central differences are continuous at the knots whereas a spline is a piecewise polynomial such that its derivatives are continuous at the knots. Discrete cubic splines are discrete splines where the central differences of orders 0, 1, and 2 are required to be continuous.
  
  Discrete splines were introduced by Mangasarin and Schumaker in 1971 as solutions of certain minimization problems involving differences.
  
  ## Discrete cubic splines
  
  Let $x_1,$ $x_2,$ . . ., $x_{n-1}$ be an increasing sequence of real numbers. Let g(x) be a piecewise polynomial defined by
  
      $g(x)={\begin{cases}g_{1}(x)&x<x_{1}\\g_{i}(x)&x_{i-1}\leq x<x_{i}{\text{ for }}i=2,3,\ldots ,n-1\\g_{n}(x)&x\geq x_{n-1}\end{cases}}$
  
  where $g_1(x),$ . . ., $g_n(x)$ are polynomials of degree 3. Let h > 0. If
  
      $(g_{i+1}-g_{i})(x_{i}+jh)=0{\text{ for }}j=-1,0,1{\text{ and }}i=1,2,\ldots ,n-1$
  
  then g(x) is called a discrete cubic spline.
  
  ### Alternative formulation 1
  
  The conditions defining a discrete cubic spline are equivalent to the following:
  
      $g_{i+1}(x_{i}-h)=g_{i}(x_{i}-h)$
      $g_{i+1}(x_{i})=g_{i}(x_{i})$
      $g_{i+1}(x_{i}+h)=g_{i}(x_{i}+h)$
  
  ### Alternative formulation 2
  
  The central differences of orders 0, 1, and 2 of a function f(x) are defined as follows:
  
      $D^{(0)}f(x)=f(x)$
      $D^{(1)}f(x)={\frac {f(x+h)-f(x-h)}{2h}}$
      $D^{(2)}f(x)={\frac {f(x+h)-2f(x)+f(x-h)}{h^{2}}}$
  
  The conditions defining a discrete cubic spline are also equivalent to
  
      $D^{(j)}g_{i+1}(x_{i})=D^{(j)}g_{i}(x_{i}){\text{ for }}j=0,1,2{\text{ and }}i=1,2,\ldots ,n-1.$
  
  This states that the central differences $D^{(j)}g(x)$ are continuous at $x_i.$
  
  ### Example
  
  Let $x_1$ = 1 and $x_2$ = 2 so that n = 3. The following function defines a discrete cubic spline:
  
  $g(x)={\begin{cases}x^{3}&x<1\\x^{3}-2(x-1)((x-1)^{2}-h^{2})&1\leq x<2\\x^{3}-2(x-1)((x-1)^{2}-h^{2})+(x-2)((x-2)^{2}-h^{2})&x\geq 2\end{cases}}$
  
  ## Discrete cubic spline interpolant
  
  Let $x_0$ < $x_1$ and $x_n$ > $x_{n-1}$ and f(x) be a function defined in the closed interval $[x_0$ - h, $x_n$ + h]. Then there is a unique cubic discrete spline g(x) satisfying the following conditions:
  
      $g(x_{i})=f(x_{i}){\text{ for }}i=0,1,\ldots ,n.$
      $D^{(1)}g_{1}(x_{0})=D^{(1)}f(x_{0}).$
      $D^{(1)}g_{n}(x_{n})=D^{(1)}f(x_{n}).$
  
  This unique discrete cubic spline is the discrete spline interpolant to f(x) in the interval $[x_0$ - h, $x_n$ + h]. This interpolant agrees with the values of f(x) at $x_0,$ $x_1,$ . . ., $x_n.$
  
  ## Applications
  
  * Discrete cubic splines were originally introduced as solutions of certain minimization problems.
  * They have applications in computing nonlinear splines.
  * They are used to obtain approximate solution of a second order boundary value problem.
  * Discrete interpolatory splines have been used to construct biorthogonal wavelets.
  