Documente Academic
Documente Profesional
Documente Cultură
Let a = x0 < x1 < . . . < xn1 < xn = b. A spline of degree m is a function S(x) which satises the following conditions: 1. For x [xi , xi+1 ], S(x) = Si (x): polynomial of degree m 2. S (m1) exists and continuous at the interior points x1 , . . . , xn1 , i.e. (m1) (m1) limxx Si1 (x) = limxx+ Si (x) i i EXAMPLE S(x) = 0, 1 x 0 x2 , 0 x 1
STEP 1 (2nd derivative conditions) Since Si (x) is a cubic polynomial, Si (x) is linear for x Si (x) = ai xi+1 x h + ai+1 x xi h , i = 0, . . . , n 1
(using Lagrange 1st order interpolating polynomial). Then Si (xi ) = ai Si (xi+1 ) = ai+1 Si1 (xi ) = ai = Si (xi )
Thus, S (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 Si (xi ) = ai h + bi h = fi 6 Si (xi+1 ) = ai+1 h + ci h = fi+1 6 Substitute Si (x) = ai (xi+1 x)3 ai+1 (x xi )3 + 6h 6h h2 6 xi+1 x h + fi+1 ai+1 h2 6 x xi h
2 2
bi h = fi ai h 6
2 2
ci h = fi+1 ai+1 h 6
+ fi ai
fi h ai h 6
h fi+1 ai+1 h 6
fi h ai h 6 fi h ai h 6
+ +
We require, Si1 (xi ) = Si (xi ), so (shifting i i 1 in Si (xi+1 )) h ai 2 fi1 h ai1 h 6 + fi h ai h 6 + fi+1 h ai+1 h 6 h = (fi1 2fi + fi+1 ) /h 6
fi h ai h 6
h h h h + 2 6 2 6
6 h
+ ai+1
This holds for i = 1, . . . , n 1. STEP 4 (boundary conditions) S0 (x0 ) = 0 a0 = 0 4 1 0 The coecient matrix is tridiagonal symmetric
3
1 4 ...
0 1 ... ...
Sn1 (xn ) = 0 an = 0 ... 0 f0 2f1 + f2 a1 ... 0 . . . . 6 . . . = 2 . ... . . h . . ... 1 1 4 fn2 2fn1 + fn an1
()
positive denite 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 inection points. See the handout about natural cubic spline interpolation. Recall A = (aij ) is strictly diagonally dominant if
n
|aii | >
j=1 j=i
Theorem If A is strictly diagonally dominant, then A is invertible. Proof. Suppose A is not invertible. Then there exists a vector x = 0 such that Ax = 0. Choose index i such that |xi | = ||x|| = maxj |xj |. Then
n n
0 = (Ax)i =
j=1
aij xj = aii xi +
j=1 j=i
aij xj
|aii xi | =
j=1 j=i
aij xj
j=1 j=i
|aij ||xj |
|aii |
j=1 j=i
|aij |
j=1 j=i
This contradicts the assumption that A is strictly diagonally dominant. Note In practice, the values ai = S (xi ) are found by Gaussian elimination for a tridiagonal system.
4
Theorem Let f be dened 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. |f (x) S(x)| 5 max |f (4) (x)| h4 384 axb
[S (x)] dx
a
[f (x)]2 dx
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 (x0 ) = y0 , S (xn ) = yn ). Curvature (x) = val.
b a [f
|f (x)|
b a
[S (x)] dx
[f (x)]2 dx :
any smooth interpolating function must have a total curvature at least as large as that of the cubic spline (natural or clamped) Proof of (2) for natural splines algebraic identity: F 2 S 2 = (F S)2 2S(S F ) Let F = f (x), S = S (x), integrate over [a, b].
b a
[f (x)] dx
a
[S (x)] dx =
a b
[f (x) S (x)]2 dx
2
a
The rst term is 0. We will show that the second term is 0. Integration by parts:
b
u(x)v (x)dx =
a b
u(x)v(x)|b a
a n1
u (x)v(x)dx
xi+1
=
i=0 n1
S (x)(S (x) f
xi+1
=
i=0
S (xi )
xi
(S (x) f (x))dx
i=0