spline
compute a natural spline
Calling Sequence
Parameters
Description
Examples
spline(X, Y, z, d)
X, Y
-
two vectors or two lists
z
name
d
(optional) positive integer or name
Important: The spline function has been deprecated. Use the superseding function CurveFitting[Spline] instead. A call to spline automatically generates a call to CurveFitting[Spline].
The spline function computes a piecewise polynomial approximation to the X Y data values of degree d (default 3) in the variable z. The X values must be distinct and in ascending order. There are no conditions on the Y values. The result is returned in the form
P1z<X2P2z<X3PN...
which is equivalent to
if z<X2 then P1 elif z<X3 then P2 ... else PN end if
where the N=nops⁡X−1 segment polynomials Pi are of degree ≤d.
The segment polynomials P1,P2,...,PN are uniquely given by the following d+1⁢N conditions
2⁢N interpolating conditionsPi|z=Xi=Yi andPi|z=Xi+1=Yi+1, i=1..N
d−1⁢N−1 continuity conditionsⅆkⅆxkPi|z=Xi+1=ⅆkⅆxkPi|z=Xi+1, i=1..N−1,k=1..d−1
d−1 additional conditionsⅆkⅆxkP1|z=X1=0, k=d−iquo⁡d,2,...,d−1, andⅆkⅆxkPN|z=XN+1=0, k=d−iquo⁡d−1,2,...,d−1.
The last two conditions give rise to what are called the ``natural splines''. For example, for cubic splines, with k=2, we obtain the two conditions
ⅆ2ⅆx2P1|z=X1=0⁢anⅆ⁢ⅆ2ⅆx2PN|z=XN+1=0
The fourth optional argument must be a positive integer (default 3) or one of the keywords linear, quadratic, cubic, or quartic. It specifies the degree of the segment polynomials.
spline⁡0,1,2,3,0,1,4,3,x,linear
xx<1−2+3⁢xx<26−xotherwise
spline⁡0,1,2,3,0,1,4,3,x,cubic
45⁢x3+15⁢xx<1−2⁢x3+425⁢x2−415⁢x+145x<265⁢x3−545⁢x2+1515⁢x−1145otherwise
See Also
CurveFitting
CurveFitting[Spline]
piecewise
Download Help Document