Spline Continuity and End Conditions - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

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{d}{2}+\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{d}{2}-\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}_{1}^{\left(1\right)}\left({x}_{0}\right),\mathrm{...},{p}_{1}^{\left[\frac{d}{2}-\frac{1}{2}\right]}\left({x}_{0}\right),{p}_{n}^{\left(1\right)}\left({x}_{n}\right),\mathrm{...},{p}_{n}^{\left[\frac{d}{2}-\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{d}{2}+\frac{1}{2}},\mathrm{for}k=1,2,\mathrm{...},\frac{d}{2}-\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{{x}_{i-1}}{2}+\frac{{x}_{i}}{2}$, 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{d}{2},\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{d}{2}$

 • 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{d}{2}\right)}\left({x}_{0}\right),{p}_{n+1}^{\left(1\right)}\left({x}_{n}\right),\mathrm{...},{p}_{n+1}^{\left(\frac{d}{2}\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{d}{2}},\mathrm{for}k=1,2,\mathrm{...},\frac{d}{2}$

 • 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{d}{2},\mathrm{...},d-1,\mathrm{and}$

${p}_{n+1}^{\left(k\right)}\left({x}_{n}\right)=0,\mathrm{for}k=\frac{d}{2},\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{d}{2},\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{d}{2}-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)$
 $\left\{\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}\right\$ (2)

A cubic spline using the 'periodic' end condition.

 > $\mathrm{Spline}\left(\mathrm{data},v,\mathrm{degree}=3,\mathrm{endpoints}='\mathrm{periodic}'\right)$
 $\left\{\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}\right\$ (3)

A quadratic spline using the 'notaknot' end condition.

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