Spline Continuity and End Conditions - Maple Help

Home : Support : Online Help : Mathematics : Numerical Computations : Interpolation and Curve Fitting : CurveFitting Package : CurveFitting/General/SplineConditions

Spline Continuity and End Conditions

 This help page describes the interpolating, continuity, and end conditions used in CurveFitting[Spline].
 The form of the resulting piecewise function returned depends on whether the degree d is odd or even, and whether or not the knots='data' option is specified in the even case.

Odd Degree

 The resulting function created by CurveFitting[Spline] is of the form $\mathrm{piecewise}\left(v<{x}_{1},{p}_{1},...,{p}_{n}\right)$, where the n spline sections $\left\{{p}_{1},{p}_{2},...,{p}_{n}\right\}$ are polynomials of degree at most d. These polynomials are given by the following $\left(d+1\right)n$ conditions:

2n Interpolating Conditions

 • Force continuity at the knots.

$p[i]\left({x}_{i-1}\right)={y}_{i-1},\mathrm{and}p[i]\left({x}_{i}\right)={y}_{i},\mathrm{for}i=1,2,\mathrm{...},n$

(d-1)(n-1) Continuity Conditions

 • Force continuity of the derivatives of order $1,2,...,d-1$ at the knots.

${p}_{i}^{\left(k\right)}\left({x}_{i}\right)={p}_{i+1}^{\left(k\right)}\left({x}_{i}\right),\mathrm{for}i=1,2,\mathrm{...},n-1,\mathrm{and}k=1,2,\mathrm{...},d-1$

d-1 End Conditions

 • Natural splines specified by endpoints='natural'.
 Equate the derivates of order $\frac{\left(d+1\right)}{2},...,d-1$ at the end nodes to zero.

${p}_{i}^{\left(k\right)}\left({x}_{0}\right)=0,\mathrm{and}{p}_{n}^{\left(k\right)}\left({x}_{n}\right)=0,\mathrm{for}k=\frac{1}{2}d+\frac{1}{2},\mathrm{...},d-1$

 • Not-a-knot splines specified by endpoints='notaknot'.
 Force the continuity of the dth derivative at the knots ${x}_{i}$, for $i=1,2,...,\frac{\left(d-1\right)}{2}$ and $i=n-\frac{\left(d-1\right)}{2},...,n-1$.

${p}_{i}^{\left(k\right)}\left({x}_{i}\right)={p}_{i+1}^{\left(d\right)}\left({x}_{i}\right),\mathrm{and}{p}_{n-i}^{\left(d\right)}\left({x}_{n-i}\right)={p}_{n-i+1}^{\left(d\right)}\left({x}_{n-i}\right),\mathrm{for}i=1,2,\mathrm{...},\frac{1}{2}d-\frac{1}{2}$

 • Periodic splines specified by endpoints='periodic'.
 Match the derivatives of order $1,2,...,d-1$ at the end nodes.

${p}_{1}^{\left(k\right)}\left({x}_{0}\right)={p}_{n}^{\left(k\right)}\left({x}_{n}\right),\mathrm{for}k=1,2,\mathrm{...},d-1$

 • Clamped splines specified by endpoints=V.
 Equate the derivates of order $1,2,...,\frac{\left(d-1\right)}{2}$ at the end nodes to the specified values given in V, where V is either a list, Vector, or an Array, of dimension $d-1$ containing the specified clamped conditions. Specifically,

$V=\left[{p}_{i}^{\left(1\right)}\left({x}_{0}\right),\mathrm{...},{p}_{1}^{\left[\frac{1}{2}d-\frac{1}{2}\right]}\left({x}_{0}\right),{p}_{n}^{\left(1\right)}\left({x}_{0}\right),\mathrm{...},{p}_{n}^{\left[\frac{1}{2}d-\frac{1}{2}\right]}\left({x}_{n}\right)\right],\mathrm{with}$

${p}_{1}^{\left(k\right)}\left({x}_{0}\right)={V}_{k},\mathrm{and}{p}_{n}^{\left(k\right)}\left({x}_{n}\right)={V}_{k+\frac{1}{2}d+\frac{1}{2}},\mathrm{for}k=1,2,\mathrm{...},\frac{1}{2}d-\frac{1}{2}$

 • Generalized splines given by endpoints=G.
 Generalized end conditions can be specified involving any arbitrary linear combination of the values of the derivatives (of any order $1,2,...,d$ at the nodes ${x}_{0}$, ${x}_{1}$, ${x}_{n-1}$, and ${x}_{n}$, where $1). Such end conditions can be represented by a linear system of the form $\mathrm{Ax}=b$, where $x$ is a vector of dimension $4d$, with

$x=\left[{p}_{1}^{\left(1\right)}\left({x}_{0}\right),{p}_{2}^{\left(1\right)}\left({x}_{1}\right),\mathrm{...},{p}_{1}^{\left(d-1\right)}\left({x}_{0}\right),{p}_{2}^{\left(d-1\right)}\left({x}_{1}\right),{p}_{1}^{\left(d\right)},{p}_{2}^{\left(d\right)},{p}_{n-1}^{\left(1\right)}\left({x}_{n-1}\right),{p}_{n}^{\left(1\right)}\left({x}_{n}\right),\mathrm{...},{p}_{n-1}^{\left(d-1\right)}\left({x}_{n-1}\right),{p}_{n}^{\left(d-1\right)}\left({x}_{n}\right),{p}_{n-1}^{\left(d\right)},{p}_{n}^{\left(d\right)}\right]$

 $A$ is the corresponding coefficient matrix of dimension $d-1$ by $4d$ and $b$, a vector of dimension $d-1$, represents the right-hand side of the linear system.
 Generalized end conditions are specified with the optional parameter endpoints=G, where $G$ is a Matrix or an Array. Here, $G$ represents the augmented linear system $[A|b]$, having dimensions $d-1$ by $4d+1$.

Even Degree

 Without the knots='data' option, the resulting function created by CurveFitting[Spline] is of the form $\mathrm{piecewise}\left(v<{z}_{1},{p}_{1},...,v<{z}_{n},{p}_{n},{p}_{n+1}\right)$, where ${z}_{i}=\frac{1}{2}{x}_{i-1}+\frac{1}{2}{x}_{i}$, for $i=1,2,\mathrm{...},n$ (that is, the spline knots are defined at the midpoints of the nodes) and the $n+1$ spline sections $\left\{{p}_{1},{p}_{2},...,{p}_{n+1}\right\}$ are polynomials of degree at most d. These polynomials are specified by the following $\left(d+1\right)\left(n+1\right)$ conditions.

n+1 Interpolating Conditions at the Nodes

 • Force continuity at the nodes.

$p[i]\left({x}_{i-1}\right)={y}_{i-1},\mathrm{for}i=1,2,\mathrm{...},n+1$

n Interpolating Conditions at the Knots

 • Force continuity at the knots.

$p[i]\left({z}_{i}\right)=p[i+1]\left({z}_{i}\right),\mathrm{for}i=1,2,\mathrm{...},n$

(d-1)n Continuity Conditions

 • Force continuity of the derivatives of order $1,2,...,d-1$ at the knots.

${p}_{i}^{\left(k\right)}\left({z}_{i}\right)={p}_{i+1}^{\left(k\right)}\left({z}_{i}\right),\mathrm{for}i=1,2,\mathrm{...},n\mathrm{and}k=1,2,\mathrm{...},d-1$

d End Conditions

 • Natural splines specified by endpoints='natural'.
 Equate the derivates of order $\frac{d}{2},...,d-1$ at the end nodes to zero.

${p}_{1}^{\left(k\right)}\left({x}_{0}\right)=0,\mathrm{and}{p}_{n+1}^{\left(k\right)}\left({x}_{n}\right)=0,\mathrm{for}k=\frac{1}{2}d,\mathrm{...},d-1$

 • Not-a-knot splines specified by endpoints='notaknot'.
 Force the continuity of the dth derivative at the knots ${z}_{i}$, for $i=1,2,...,\frac{d}{2}$ and $i=n+1-\frac{d}{2},...,n-1$.

${p}_{i}^{\left(d\right)}\left({z}_{i}\right)={p}_{i+1}^{\left(d\right)}\left({z}_{i}\right),\mathrm{and}{p}_{n-i+1}^{\left(d\right)}\left({z}_{n-i+1}\right)={p}_{n+2-i}^{\left(d\right)}\left({z}_{n-i+1}\right),\mathrm{for}i=1,2,\mathrm{...},\frac{1}{2}d$

 • Periodic splines specified by endpoints='periodic'.
 Match the derivatives of order $1,2,...,d$ at the end nodes.

${p}_{1}^{\left(k\right)}\left({x}_{0}\right)={p}_{n+1}^{\left(k\right)}\left({x}_{n}\right),\mathrm{for}k=1,2,\mathrm{...},d$

 • Clamped splines specified by endpoints=V.
 Equate the derivates of order $1,2,...,\frac{d}{2}$ at the end nodes to the specified values given in V, where V is either a list, Vector, or an Array, of dimension $d$ containing the specified clamped conditions. Specifically,

$V=\left[{p}_{1}^{\left(1\right)}\left({x}_{0}\right),\mathrm{...},{p}_{1}^{\left(\frac{1}{2}d\right)}\left({x}_{0}\right),{p}_{n+1}^{\left(1\right)}\left({x}_{n}\right),\mathrm{...},{p}_{n+1}^{\left(\frac{1}{2}d\right)}\left({x}_{n}\right)\right],\mathrm{with}$

${p}_{1}^{\left(k\right)}\left({x}_{0}\right)={V}_{k},\mathrm{and}{p}_{n+1}^{\left(k\right)}\left({x}_{n}\right)={V}_{k+\frac{1}{2}d},\mathrm{for}k=1,2,\mathrm{...},\frac{1}{2}d$

 • Generalized splines specified by endpoints=G.
 Generalized end conditions can be specified involving any arbitrary linear combination of the values of the derivatives (of any order $1,2,...,d$ at the nodes ${x}_{0}$ and ${x}_{n}$). Such end conditions can be represented by a linear system of the form $\mathrm{Ax}=b$, where $x$ is a vector of dimension $2d$, with

$x=\left[{p}_{1}^{\left(1\right)}\left({x}_{0}\right),\mathrm{...},{p}_{1}^{\left(d-1\right)}\left({x}_{0}\right),{p}_{1}^{\left(d\right)},{p}_{n+1}^{\left(1\right)}\left({x}_{n}\right),\mathrm{...},{p}_{n+1}^{\left(d-1\right)}\left({x}_{n}\right),{p}_{n+1}^{\left(d\right)}\right]$

 $A$ is the corresponding coefficient matrix of dimension $d$ by $2d$ and $b$, a vector of dimension $d$, represents the right-hand side of the linear system.
 Generalized end conditions are specified with the optional parameter endpoints=G, where $G$ is a Matrix or an Array. Here, $G$ represents the augmented linear system $[A|b]$, having dimensions $d$ by $2d+1$.

Even degree with knots='data'

 With the knots='data' option included, CurveFitting[Spline] will avoid creating knots at the midpoints of the nodes, and instead use the nodes for the knots in the even case.  The resulting function is of the form $\mathrm{piecewise}\left(v<{x}_{1},{p}_{1},...,{p}_{n}\right)$, where the n spline sections $\left\{{p}_{1},{p}_{2},...,{p}_{n}\right\}$ are polynomials of degree at most d. These polynomials are given by the following $\left(d+1\right)n$ conditions:

2n Interpolating Conditions

 • Force continuity at the knots.

$p[i]\left({x}_{i-1}\right)={y}_{i-1},\mathrm{and}p[i]\left({x}_{i}\right)={y}_{i},\mathrm{for}i=1,2,\mathrm{...},n$

(d-1)(n-1) Continuity Conditions

 • Force continuity of the derivatives of order $1,2,...,d-1$ at the knots.

${p}_{i}^{\left(k\right)}\left({x}_{i}\right)={p}_{i+1}^{\left(k\right)}\left({x}_{i}\right),\mathrm{for}i=1,2,\mathrm{...},n-1,\mathrm{and}k=1,2,\mathrm{...},d-1$

d-1 End Conditions

 • Natural splines specified by endpoints='natural'.
 Equate the derivates of order $\frac{d}{2},...,d-1$ at the left end node and the derivatives of order $\frac{d}{2},...,d-2$ at the right end node to zero.

${p}_{1}^{\left(k\right)}\left({x}_{0}\right)=0,\mathrm{for}k=\frac{1}{2}d,\mathrm{...},d-1,\mathrm{and}$

${p}_{n+1}^{\left(k\right)}\left({x}_{n}\right)=0,\mathrm{for}k=\frac{1}{2}d,\mathrm{...},d-2$

 • Not-a-knot splines specified by endpoints='notaknot'.
 Force the continuity of the dth derivative at the knots ${z}_{i}$, for $i=1,2,...,\frac{d}{2}$ and $i=n+1-\frac{d}{2},...,n-1$.

${p}_{i}^{\left(d\right)}\left({z}_{i}\right)={p}_{i+1}^{\left(d\right)}\left({z}_{i}\right),\mathrm{for}i=1,2,\mathrm{...},\frac{1}{2}d,\mathrm{and}$

${p}_{n-i}^{\left(d\right)}\left({z}_{n-i}\right)={p}_{n-i+1}^{\left(d\right)}\left({z}_{n-i}\right),\mathrm{for}i=1,2,\mathrm{...},\frac{1}{2}d-1$

Examples

 > $\mathrm{with}\left(\mathrm{CurveFitting}\right):$
 > $\mathrm{data}≔\left[\left[0,0\right],\left[1,5\right],\left[2,-1\right],\left[3,0\right]\right]$
 ${\mathrm{data}}{:=}\left[\left[{0}{,}{0}\right]{,}\left[{1}{,}{5}\right]{,}\left[{2}{,}{-}{1}\right]{,}\left[{3}{,}{0}\right]\right]$ (1)

A quintic spline using the 'natural' end condition.

 > $\mathrm{Spline}\left(\mathrm{data},v,\mathrm{degree}=5,\mathrm{endpoints}='\mathrm{natural}'\right)$
 ${{}\begin{array}{cc}\frac{{3}}{{11}}{}{{v}}^{{5}}{-}\frac{{101}}{{11}}{}{{v}}^{{2}}{+}\frac{{153}}{{11}}{}{v}& {v}{<}{1}\\ {-}\frac{{6}}{{11}}{}{{v}}^{{5}}{+}\frac{{45}}{{11}}{}{{v}}^{{4}}{-}\frac{{90}}{{11}}{}{{v}}^{{3}}{-}{{v}}^{{2}}{+}\frac{{108}}{{11}}{}{v}{+}\frac{{9}}{{11}}& {v}{<}{2}\\ \frac{{3}}{{11}}{}{{v}}^{{5}}{-}\frac{{45}}{{11}}{}{{v}}^{{4}}{+}\frac{{270}}{{11}}{}{{v}}^{{3}}{-}\frac{{731}}{{11}}{}{{v}}^{{2}}{+}\frac{{828}}{{11}}{}{v}{-}\frac{{279}}{{11}}& {\mathrm{otherwise}}\end{array}$ (2)

A cubic spline using the 'periodic' end condition.

 > $\mathrm{Spline}\left(\mathrm{data},v,\mathrm{degree}=3,\mathrm{endpoints}='\mathrm{periodic}'\right)$
 ${{}\begin{array}{cc}{-}{5}{}{{v}}^{{3}}{+}{4}{}{{v}}^{{2}}{+}{6}{}{v}& {v}{<}{1}\\ {6}{}{{v}}^{{3}}{-}{29}{}{{v}}^{{2}}{+}{39}{}{v}{-}{11}& {v}{<}{2}\\ {-}{{v}}^{{3}}{+}{13}{}{{v}}^{{2}}{-}{45}{}{v}{+}{45}& {\mathrm{otherwise}}\end{array}$ (3)

A quadratic spline using the 'notaknot' end condition.

 > $\mathrm{Spline}\left(\mathrm{data},v,\mathrm{degree}=2,\mathrm{endpoints}='\mathrm{notaknot}'\right)$
 ${{}\begin{array}{cc}{-}{7}{}{{v}}^{{2}}{+}{12}{}{v}& {v}{<}\frac{{3}}{{2}}\\ {5}{}{{v}}^{{2}}{-}{24}{}{v}{+}{27}& {\mathrm{otherwise}}\end{array}$ (4)

A clamped cubic spline with slope A and B at the two end nodes.

 > $\mathrm{Spline}\left(\mathrm{data},v,\mathrm{endpoints}=\left[A,B\right]\right)$
 ${{}\begin{array}{cc}\left(\frac{{11}}{{15}}{}{A}{-}\frac{{49}}{{5}}{+}\frac{{1}}{{15}}{}{B}\right){}{{v}}^{{3}}{+}\left(\frac{{74}}{{5}}{-}\frac{{26}}{{15}}{}{A}{-}\frac{{1}}{{15}}{}{B}\right){}{{v}}^{{2}}{+}{A}{}{v}& {v}{<}{1}\\ \left({-}\frac{{1}}{{5}}{}{A}{+}\frac{{42}}{{5}}{-}\frac{{1}}{{5}}{}{B}\right){}{{v}}^{{3}}{+}\left({-}\frac{{199}}{{5}}{+}\frac{{16}}{{15}}{}{A}{+}\frac{{11}}{{15}}{}{B}\right){}{{v}}^{{2}}{+}\left({-}\frac{{9}}{{5}}{}{A}{+}\frac{{273}}{{5}}{-}\frac{{4}}{{5}}{}{B}\right){}{v}{+}\frac{{14}}{{15}}{}{A}{-}\frac{{91}}{{5}}{+}\frac{{4}}{{15}}{}{B}& {v}{<}{2}\\ \left({-}\frac{{29}}{{5}}{+}\frac{{1}}{{15}}{}{A}{+}\frac{{11}}{{15}}{}{B}\right){}{{v}}^{{3}}{+}\left(\frac{{227}}{{5}}{-}\frac{{8}}{{15}}{}{A}{-}\frac{{73}}{{15}}{}{B}\right){}{{v}}^{{2}}{+}\left({-}\frac{{579}}{{5}}{+}\frac{{7}}{{5}}{}{A}{+}\frac{{52}}{{5}}{}{B}\right){}{v}{+}\frac{{477}}{{5}}{-}\frac{{6}}{{5}}{}{A}{-}\frac{{36}}{{5}}{}{B}& {\mathrm{otherwise}}\end{array}$ (5)

A cubic spline using the generalized end conditions with second derivative equal to 5 at the end nodes.

 > $G≔\mathrm{Matrix}\left(2,13,\left\{\left(1,3\right)=1,\left(1,13\right)=5,\left(2,10\right)=1,\left(2,13\right)=5\right\}\right):$
 > $\mathrm{Spline}\left(\mathrm{data},v,\mathrm{endpoints}=G\right)$
 ${{}\begin{array}{cc}{-}\frac{{22}}{{5}}{}{{v}}^{{3}}{+}\frac{{5}}{{2}}{}{{v}}^{{2}}{+}\frac{{69}}{{10}}{}{v}& {v}{<}{1}\\ {6}{}{{v}}^{{3}}{-}\frac{{287}}{{10}}{}{{v}}^{{2}}{+}\frac{{381}}{{10}}{}{v}{-}\frac{{52}}{{5}}& {v}{<}{2}\\ {-}\frac{{8}}{{5}}{}{{v}}^{{3}}{+}\frac{{169}}{{10}}{}{{v}}^{{2}}{-}\frac{{531}}{{10}}{}{v}{+}\frac{{252}}{{5}}& {\mathrm{otherwise}}\end{array}$ (6)