Professional Documents
Culture Documents
n
X
i=0
Let the data be (1, 0), (1, 3), (0, 1), write down one of the two polynomial interpolations.
Solution: (a) Lagrange polynomial interpolation:
pn (x) =
n
X
li (x)yi ,
li (x) =
i=0
n
Y
x xj
x
xj
j=0,j6=i i
n
X
f [x0 , x1 , , xi ] i (x),
i=0
f (n+1) ()
n+1 (x).
(n + 1)!
(d) Take f (x) 1, then f (n+1) () 0 when n > 0. That is, the interpolation is exact.
Therefore, we use the Lagrange polynomial interpolation to get
1 f (x) = pn (x) =
n
X
li (x).
i=0
f (i)
i! ,
we get
7!
=1
7!
f (8)
= 0.
f [0, 1, 2, , 7, 8] =
8!
f [0, 1, 2, , 7] =
i
X
f (xj )
(x )
j=0 i+1 j
= 0 since li (xj ) = 0 if i 6= j.
3. (a) Give the definition of a cubic spline S3 (x) given the nodal points x0 , x1 , , xn . What
are the three common boundary conditions?
(b) What is a B-spline interpolation? List some properties of a B-spline interpolation.
Solution: (a) A cubic spline S3 (x) is piecewise cubic function between [a, b], S3 (x)
has up to second order continuous derivatives. The three commonly used boundary
conditions are: (1) Natural spline: S3 (a) = S3 (b) = 0. (2) Clamped spline: S3 (a) =
(k)
(k)
f (a) and S3 (b) = f (b) are given. (3): Periodic spline: S3 (a) = S3 (b) for k = 0, 1, 2.
(b) A B-spline interpolation has the following form
S3 (x) =
n1
X
i Ni (x),
S3 (xi ) = f (xi )
i=3
where Ni (x) = g[xi , xi+1 , xi+2 , xi+3 , xi+4 ; t] with g(x, t) = (x t)3+ . 0 Ni (x) 1 and
has local support.
(x)|2 dx b |f (x)|2 dx
Also if S3,f is the cubic spline interpolation, then we have ab |S3,f
a
R b
R b
2
2
and a |f S3,f (x)| dx a |f (x) S3 (x)| dx for any spline function S3 (x).
4. Write down the Newton-Cotes quadrature closed, and open formulas and give an error
estimate.
Solution:
b
f (x)dx h
n
X
wi f (xi )
i=0
wi =
n+1
wi =
tk
dt
ik
k=0,k6=i
Y
n
Y
tk
dt
ik
k=0,k6=i
ba
n
ba
n+2
En (f ) =
f (x)dx In (f ) =
Mn
hn+3 f (n+2) () if n is even.
(n + 2)!
Kn
hn+2 f (n+1) () if n is odd.
(n + 1)!
5. (a) Write down (a) mid-point rule; (b) trapezoidal rule; (c) Simpson rule to evaluate the
integral
xi +h
xi
(b) Find out and show the algebraic precision of the trapezoidal rule.
Solution:
Z
xi +h
xi
Z xi +h
x3 dx h (xi + h/2)3
h 3
xi + (xi + h)3
2
xi
Z xi +h
h
x3 dx
x3i + 4(xi + h/2)3 + (xi + h)3
6
xi
x3 dx
3
The error estimates for he mid-point rule and the trapezoidal rule are both O(h
) and for
Rb k
ba
k
k
the Simpson rule, the error is 0. It is easy to check that a x dx = 2 a + b for k = 0,
and k = 1, but ab x2 6= ba
a2 + b2 , therefore the algebraic precision of the trapezoidal
2
rule is 1. The algebraic precision of the mid-point rule and the Simpson rule are 1 and 3,
respectively.
R
6. Set-up a system of equations for the coefficients 1 , 2 , x1 and x2 so that the following
quadrature
Z
has as high algebraic precision as possible. What is likely the algebraic precision? Note:
You do not need to solve the system of equation.
Solution: Since there are 4 parameters, we can set 4 equations
x0 :
x1 :
x2 :
x3 :
1
Z 1
1
Z 1
1
1
dx = 2 = 1 + 2
xdx = 0 = 1 x1 + 2 x2
x2 dx =
2
= 1 x21 + 2 x22
3
x3 dx = 0 = 1 x31 + 2 x32
Bh =
A( h) 3 A(h)
1 3
8A(h/2) A(h)
A(h/2) A(h)
=
,
1 3
7
1 (2)
1
.
2