Hermite interpolation, natural interpolation and periodic interpolation are three kinds of interpolation obtained by specifying three kinds of constraints. The unicity of the solution of the interpolation problem can be proved for each kind of constraints.

If *l* is odd (*l* = 2*m* - 1), there are 2*m* - 2 degrees of
liberty. The constraints are defined by :

- Hermite interpolation
1
*j**m*- 1,*s*^{(j)}(*a*) =*f*^{(j)}(*a*),*s*^{(j)}(*b*) =*f*^{(j)}(*b*) - Natural interpolation
*m**j*2*m*- 2,*s*^{(j)}(*a*) =*s*^{(j)}(*b*) = 0 - periodic interpolation
1
*j*2*m*- 2,*s*^{(j)}(*a*) =*s*^{(j)}(*b*)

If *l* is even (*l* = 2*m*), there are 2*m* - 1 degrees of
liberty. The constraints are defined by :

- Hermite interpolation
1and
*j**m*- 1,*s*^{(j)}(*a*) =*f*^{(j)}(*a*),*s*^{(j)}(*b*) =*f*^{(j)}(*b*)*s*^{(m)}(*a*) =*f*^{(m)}(*a*) - Natural interpolation
*m**j*2*m*- 2,*s*^{(j)}(*a*) =*s*^{(j)}(*b*) = 0*s*^{(2m-1)}(*a*) = 0 - Periodic interpolation
1
*j*2*m*- 1,*s*^{(j)}(*a*) =*s*^{(j)}(*b*)

`spline` takes as arguments a list of abscissa (by increasing order),
a list of ordinates, a variable name, and a degree.
`spline` returns the natural spline function (with the specified degree
and crossing points) as a list of polynomials, each
polynomial being valid on an interval.

Examples:

- a natural spline of degree 3, crossing through the points
*x*_{0}= 0,*y*_{0}= 1,*x*_{1}= 1,*y*_{1}= 3 and*x*_{2}= 2,*y*_{2}= 0, input :`spline([0,1,2],[1,3,0],x,3)`*x*:[- 5*defined respectivly on the intervals [0, 1] and [1, 2].*x*3/4 + 13**x*/4 + 1, 5*(*x*- 1)3/4 - 15*(*x*- 1)2/4 + (*x*- 1)/ - 2 + 3] - a natural spline of degree 4, crossing through the points
*x*_{0}= 0,*y*_{0}= 1,*x*_{1}= 1,*y*_{1}= 3,*x*_{2}= 2,*y*_{2}= 0 and*x*_{3}= 3,*y*_{3}= - 1, input :`spline([0,1,2,3],[1,3,0,-1],x,4)`*x*:[(- 62**x*4 + 304**x*)/121 + 1,(201*(*x*- 1)4 - 248*(*x*- 1)3 - 372*(*x*- 1)2 + 56*(*x*- 1))/121 + 3,(- 139*(defined respectivly on the intervals [0, 1], [1, 2] and [2, 3].*x*- 2)4 + 556*(*x*- 2)3 + 90*(*x*- 2)2 + - 628*(*x*- 2))/121] - The natural spline interpolation of cos on
[0,/2, 3/2], input :
`spline([0,pi/2,3*pi/2],cos([0,pi/2,3*pi/2]),x,3)`[((3*3 + (- 7*2)**x*+ 4**x*3)*1/3)/(3),((15*3 + (- 46*2)**x*+ 36***x*2 - 8**x*3)*1/12)/(3)]