You are on page 1of 1

Assignment 5 – Due November 1

All written assignments are due in the class on the specified date. One summary report is required for
each programming project. You may hand in a printed copy of your report in class on the due day and
email all of your source codes (with instruction on how to compile and run) before 11:30PM of the same
day. Or, you may email all of your source codes and the report in an electronic format before 11:30PM on
the due date.
Grading: Total is 100 points, with 32 for the programming assignment and 17 for each of the regular
problems.

1. Using the Hermite interpolation H2 (x) to approximate f (x), prove the resulting quadrature is given
as Z b Z b
(b − a)2  0
 
. b−a
f (b) − f 0 (a)

f (x)dx = H2 (x) dx = [f (a) + f (b)] −
a a 2 12
Also find an error formula by using the error formula for Hermite interpolation. Generalize it to the
composite rule, i.e., using n sub-divisions of [a, b] with the above quadrature for each sub-interval.

2. Let p2 (x) be the quadratic polynomial interpolation of f (x) at x = 0, h, 2h, and then derive a quadra-
Z 3h
ture Ih for I = f (x) dx. Use a Taylor series expansion of f (x) to prove that
0

3
I − Ih = h4 f (3) (0) + O(h5 )
8

3. Prove that the Gauss-Legendre nodes and weights on [−1, 1] are symmetrically distributed about the
origin x = 0.

4. Derive the one- and two-point Gauss quadrature formulas for


Z 1 n
. X
I= xf (x) dx = ωj f (xj )
0 j=1

ie, the weight function ω(x) = x.

5. Programming Assignment: Write program(s) to evaluate


Z 1
ecos(8πx) dx
−1

using the trapezoidal rule, Simpson’s rule, and the Gauss-Legendre quadrature with n=2, 4, 8, 16, 32,
64, 128, 256. Here n is the number of nodes for Gauss quadrature, and the number of subdivisions for
the trapezoidal and Simpson’s rule. Analyze empirically the rate of convergence with the formula
I2n − In
pn =
I4n − I2n
A Matlab code computing Legendre-Gauss quadrature is given below:

function [x,w] = gauss(N)


beta = .5./sqrt(1-(2*(1:N-1)).ˆ(-2));
T = diag(beta,1) + diag(beta,-1);
[V,D] = eig(T);
x = diag(D); [x,i] = sort(x);
w = 2*V(1,i).ˆ2;

You might also like