

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


J. M. Powers prepared by Weiming Li Due: Friday, 17 September 2004
(i) s (x 0 ) = f (x 0 ) , s
(xi+xi+ 2
= f
(xi+xi+ 2
, for each i = 0, 1 ,... , N − 1 , s (xN ) = f (xN ); (ii) s ∈ C^1 [a, b]; (iii) for each i = 0, 1 ,... , N − 1 , hi = xi+1 − xi, s (x) = ai + bi(x − xi) + ci(x − xi)^2 , xi ≤ x ≤ xi+1.
(a) Show that conditions (i),(ii),(iii) lead to the equations: a 0 = f (x 0 ) , ai + 12 bihi + 14 cih^2 i = f
xi + h 2 i
, for each i = 0, 1 ,... , N − 1 , aN − 1 + bN − 1 hN − 1 + cN − 1 h^2 N − 1 = f (xN ) , ai = ai− 1 + bi− 1 hi− 1 + ci− 1 h^2 i− 1 , for each i = 1,... , N − 1 , bi = bi− 1 + 2ci− 1 hi− 1 , for each i = 1,... , N − 1. (b) Show that the results of part (a) lead to the equations: 3 8 b^0 h^0 +^
1 8 b^1 h^0 =^ f^
x 0 + h 20
− f (x 0 ) , 1 8 bi−^1 hi−^1 +^
3 8 bi^ (hi^ +^ hi−^1 ) +^
1 8 bi+1hi^ =^ f^
xi + h 2 i
− f
xi− 1 + hi 2 −^1
for each i = 1,... , N − 2 , 1 8 bN^ −^2 hN^ −^2 +^ bN^ −^1
8 hN^ −^2 +^
1 3 hN^ −^1
= 43 f
xN − 1 + hN 2 −^1
f
xN − 2 + hN 2 −^2
− 13 f (xN ). (c) Devise an algorithm to find b 0 ,... , bN − 1. (d) Given b 0 ,... , bN − 1 , derive formulas for a 0 ,... , aN − 1 , c 0 ,... , cN − 1. (e) Let f (x) = ex, x 0 = 0, x 1 = 0. 2 , x 2 = 0. 6 , x 3 = 0.9. Find the quadratic interpo- lating spline s (x) for f (x), and compute s (0.5). Is s (0.5) a good approximation to f (0.5)?
f (x) =
(x − 1)^2 + 0. 002
(x − 0 .2)^2 + 0. 005
− 5; 0 ≤ x ≤ 1.
Get the exact integration. Plot the error associated with each as a function of the discretization size, N, on a log-log scale. Also, investigate the machine round-off error by increasing N to a very large value.
a
f (x)dx = (b − a)
j=
Hj f
a + j
b − a N + 1
Show that their weight coefficients Hj are defined by
Hj = (−1)N^ −j^
j − 1
0
t − 1 N
dt t − j
Evaluate these coefficients for N = 2,... , 6 points and prove that they satisfy the symmetry requirement Hj = HN −j+1. [Useful formulas:
(t− 1 N
= (^) N !((tt−− 1 1)!−N )! ,
j− 1
= (^) (j−(1)!(N^ −N1)! −j)! ]
∫ (^) ∞
0
e−^10 x^ sin xdx and
0
e−x 1 + e−^2 x^
dx
using N = 2, 3 , 4 , 5 points and compare the results with the true value. (b) Use Hermite-Gauss quadrature to approximate the integral ∫ (^) +∞
−∞
|x|e−^3 x
2 dx and
−∞
|x|e−x
2 cos xdx
using N = 2, 3 , 4 , 5 points and compare the results with the true value.