Spline under tension

Directly to the input form

 
  • Another type of a two times differentiable piecewise interpolation of a finite data set (xi,yi), i=1,...,n with strictly increasing xi is obtained from the spline under tension, whose physical model is a thin elastic rod with fixed position at a set of points under a tension force applied to its two ends (this corresponds to the parameter σ appearing in the following). This spline, called s here, is defined by the following set of conditions:
    s(x)=si(x) for xi<=x<=xi+1 (piecewise definition)
    si"(x)-σ2si(x)= ((xi+1-x)*(Mi2yi)+(x-xi)* (Mi+12yi+1))/(xi+1-xi)
    a second order ode for si on the interval
    xi<=x<=xi+1
    Mi = s"(xi) (the so called bending moments)
    si(xi)=yi, si(xi+1)=yi+1
    (the required two boundary conditions which produce the interpolation)
    s'''(x0)=0, s'''(xn)=0, the two additional conditions making this unique
    s'i(xi+1)=s'i+1(xi+1), i=0,...,n-1 continuity of s', fixing the Mi
    (The continuity of s follows from the interpolation conditions and continuity of s'' from the construction of the differential equation)
  • Hence s is two times continuously differentiable. Its ''pieces'' are obtained from linear two point boundary value problems. The solution manifold of the homogeneous form of the differential equation has a solution manifold made up from exp(-σ*x), exp(σ*x) (or cosh(σ*x), sinh(σ*x)). Hence si is composed from the homogeneous solution and a linear function
    (since the right hand side of the differential equation is a linear function, we can find a special inhomogeneous solution of this type.) For the representation of si one can equally well use sinh(σ*(x-xi)) and sinh(σ*(xi+1-x)) , as is done here.
  • The unknowns Mi are obtained from a linear system of equations with a tridiagonal structure. But for larger σ this becomes, contrary to the polynomial spline, quite illconditioned.
  • With the tension force σ increasing to infinity this spline approaches the piecewise linear arc connecting the given data points.
  • Hence using an appropriate σ one can compromise between goodness of interpolation error and curvature of the interpolating function.
  • For σ = 0 one gets the classical natural cubic spline if one replaces the end conditions used here (for better approximation) by s"(x0)=0, s"(xn)=0.
  • The computational code used here is fitpack from netlib.
 

Input

 
  • You can choose between input of a (x,y)-dataset of your own or the artificial generation of such a set using a predefined or a self defined function. In the first case you can also require a printed output of the spline formula.
  • If you want to experiment with artificial data then you have the choice between 5 predefined functions or you may specify a function yourself.
  • If you want to define a function yourself you must follow FORTRAN conventions.
  • You specify the number of data points: 4 <= n <= 200 !. In the case of data generation the abscissae are chosen equidistant in the interval you specify.
  • The interval bounds a, b.
  • The tension parameter σ. Important: for numerical reasons: 0 <= σ <= 50!
 

Output

 
  • If you provided a data set of your own, then you get a plot showing this data set and the interpolating tension spline. If you required this, you also get the formula representation of the spline.
  • Otherwise, you get two plots, one showing the function and the spline and the other showing the interpolation error.
 

Questions?!

 
  • How influences the tension parameter the shape of the spline?
  • How behaves the interpolation error if you increase the tension parameter?
 

to the input form

 
 
Back to the top!

30.08.2016