-
Find the natural spline of degree 3, crossing through the points
x0=0,y0=1, x1=1,y1=3 and x2=2, y2=0.
Input:
spline([0,1,2],[1,3,0],x,3)
Output:
⎡
⎢
⎢
⎣ | − | | x3+ | | x+1, | | | ⎛
⎝ | x−1 | ⎞
⎠ | 3− | | | ⎛
⎝ | x−1 | ⎞
⎠ | 2− | | +3 | ⎤
⎥
⎥
⎦ |
Where the first polynomial, −5/4 x3+13/4 x+1, is
defined on the interval [0,1] (the first interval defined by the
list [0,1,2]) and the second polynomial 5/4
(x−1)3−15/4
(x−1)2−x−1/2+3 is defined on the interval
[1,2], the second interval defined by the list [0,1,2].
- Find the natural spline of degree 4, crossing through the points
x0=0,y0=1, x1=1,y1=3, x2=2, y2=0 and x3=3, y3=−1.
Input:
spline([0,1,2,3],[1,3,0,-1],x,4)
Output:
| | | | | | | | | | | |
| | ⎛
⎝ | x−1 | ⎞
⎠ | 4− | | ⎛
⎝ | x−1 | ⎞
⎠ | 3− | |
| ⎛
⎝ | x−1 | ⎞
⎠ | 2+ | |
| ⎛
⎝ | x−1 | ⎞
⎠ | +3, |
| | | | | | | | | |
− | | | ⎛
⎝ | x−2 | ⎞
⎠ | 4+ | | | ⎛
⎝ | x−2 | ⎞
⎠ | 3+ | | | ⎛
⎝ | x−2 | ⎞
⎠ | 2− | | | ⎛
⎝ | x−2 | ⎞
⎠ | ⎤
⎥
⎥
⎥
⎦ |
| | | | | | | | | |
|
Output is a list of three polynomial functions of x,
defined respectively on the intervals [0,1], [1,2] and [2,3].
- Find 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)
Output: