Professional Documents
Culture Documents
Splines
Splines
S(x) =
0, 1 x 0
x2 , 0 x 1
x0 = 1, x1 = 0, x2 = 1
S(x) is a spline of degree m = 2 (quadratic spline).
EXAMPLE
S(x) =
0, 1 x 0
1 (x 1)2 , 0 x 1
h = 1/n,
x0 = 0,
xn = 1
x
x
x
i
i+1
+ ai+1
, i = 0, . . . , n 1
Si00 (x) = ai
h
h
(using Lagrange 1st order interpolating polynomial).
Then
)
Si00 (xi ) = ai
00
Si1
(xi ) = ai = Si00 (xi )
00
Si (xi+1 ) = ai+1
Thus, S 00 (x) is continuous at the interior nodes.
STEP 2 (function values)
Integrate twice
ai (xi+1 x)3 ai+1 (x xi )3
Si (x) =
+
+ bi (xi+1 x) + ci (x xi )
6h
6h
the last two terms are written in this special form just for convenience
)
2
2
Si (xi ) = ai h6 + bi h = fi
bi h = fi ai h6
2
ci h = fi+1 ai+1 h6
Substitute
ai (xi+1 x)3 ai+1 (x xi )3
+
6h
6h
h2
xi+1 x
h2
x xi
+ fi ai
+ fi+1 ai+1
6
h
6
h
Si (x) =
Si (x) =
2h
2h
2
fi
h
ai
h
6
h
fi+1
ai+1
h
6
fi
h
fi+1
h
ai
+
ai+1
h
6
h
6
f
f
h
h
h
i
i+1
Si0 (xi+1 ) = ai+1
ai
+
ai+1
2
h
6
h
6
h
Si0 (xi ) = ai
2
0
We require, Si1
(xi ) = Si0 (xi ), so (shifting i i 1 in Si0 (xi+1 ))
fi1
fi
h
h
h
ai
ai1
+
ai
2
h
6
h
6
h
fi
h
fi+1
h
= ai
ai
+
ai+1
2
h
6
h
6
h
h h h h
h
+
+ ai+1 = (fi1 2fi + fi+1 ) /h
ai1 + ai
6
2 6 2 6
6
Multiply both sides by
6
h
6
(fi1 2fi + fi+1 )
h2
4
1
1
4
...
0
1
...
...
0
0
...
...
...
00
Sn1
(xn ) = 0 an = 0
... 0
f0 2f1 + f2
a1
... 0
.
..
..
=
.
.
...
..
.. h2
... 1
1 4
fn2 2fn1 + fn
an1
()
positive definite
strictly diagonally dominant
Notes:
1. For clamped splines, there are two additional equations that involve a0
and an .
2. Condition (*) explains why the spline has additional inflection points.
See the handout about natural cubic spline interpolation.
Recall
A = (aij ) is strictly diagonally dominant if
|aii | >
n
X
j=1
j6=i
n
X
aij xj = aii xi +
j=1
n
X
aij xj
j=1
j6=i
n
n
X
X
|aii xi | =
aij xj
|aij ||xj |
j=1
j=1
j6=i
j6=i
|aii |
n
X
j=1
j6=i
|xj | X
|aij |
|aij |
|xi |
j=1
j6=i
Theorem Let f be defined on [a, b], a = x0 < x1 < . . . < xn1 < xn = b and
let S be the natural cubic spline interpolant of f (or clamped cubic spline).
1.
5
max |f (4) (x)| h4
384 axb
|f (x) S(x)|
Note
1. Cubic spline interpolation is 4th order accurate.
2. Condition (2) is optimality property: spline S(x) oscillates least of all
smooth functions satisfying interpolation condition + BC (natural BC
or clamped spline S 0 (x0 ) = y00 , S 0 (xn ) = yn0 ).
Curvature
(x) =
val.
Rb
a [f
00
|f 00 (x)|
(1 +
[f 0 (x)]2 )3/2
|f 00 (x)|
[S (x)] dx
a
[f 00 (x)]2 dx :
Z
2
u(x)v(x)|ba
u(x)v (x)dx =
a
00
00
00
b
a
n1 Z
X
i=0
n1
X
S (x)(S (x) f
x
(x))|xi+1
n1
X
i=0
Z
000
xi+1
S (xi )
xi+1
xi
Z
00
i=0
u0 (x)v(x)dx
xi+1
000
(S 0 (x) f 0 (x))dx
xi
n1
X
i=0