PHYCS 6730 Lab Exercise: Simpson's Rule

Exercise 1 Degree of precision for Trapezoid rule

Verify explicitly that the trapezoid rule gives exact results for the integral of a linear function. Take the case
   P(x) = x - 1
over the interval [-2,1]. First do the integral exactly. Then do it using the trapezoid rule with h = 3. That is, you will be evaluating the integrand at only two x values, -2 and 1.

Your answer should show the formula you used for the trapezoid rule. It should also state the degree of precision.


Exercise 2 Degree of precision for Simpson's rule

Verify explicitly that Simpson's rule gives exact results for the integral of a cubic polynomial. Take the case
   P(x) = 4x3 - 2x2 + x - 1
over the interval [1,5]. First do the integral exactly. (OK, you may use Maple to save you the arithmetic.) Then do it using Simpson's rule with h = 2. That is, you will be evaluating the integrand at only three x values, 1, 3, and 5.

Your answer should show the formula you used and state the degree of precision.


Exercise 3 Degree of precision for three-point Gauss-Legendre quadrature

We will discuss Gauss-Legendre quadrature in the next lecture. Here we will look at its magic by verifying that three-point Gauss-Legendre quadrature gives exact results for the integral of a quintic (fifth degree) polynomial! Take the case
P(x) = x5 - 3x4 + 5x3 - 2x2 + x - 1
on the interval [-1,1]. Get the exact result from Maple.

Here are the G-L weights for n=3

        x_i         w_i
      -sqrt(3/5)   5/9
          0        8/9
       sqrt(3/5)   5/9

Do the same integral by calculating

   w_1 P(x_1) + w_2 P(x_2) + w_3 P(x_3).

If this magic is true for all quintics, what is the degree of precision for this method of numerical integration?


Exercise 4 Change of variables

Note that with a change of variable, we can map any interval to [-1,1]. Find the linear change of variables that maps [1,5] to this interval. That is, find c_0 and c_1 so that if t = c_0 + c_1 * x, we get t = -1 when x = 1 and t = +1 when x = 5.

Your answer should give c_0 and c_1.