Exercise 18.3

Exercise 18.3#

Question 1#

Consider the integral

\[ \int_0^{0.9} \frac{dx}{1 - x^2} \]

which has the exact solution:

\[ \frac{1}{2}\ln\left(\frac{x + 1}{1 - x}\right)~~\Bigg|_{x = 0.9} \]

Part 1#

Approximate the value of the integral using the composite Simpson’s rule for \(n = 1, 2, \dots, 10\) sub-intervals and compare the approximations to the exact value by plotting the value of the integral versus \(n\). Be sure to represent the exact solution in the plot as well.

Part 2#

For the same sub-intervals, determine the true error of the Simpson’s rule. Compare this to the theoretical upper bound of the error (which you can determine by finding using (22) with the maximum of \(f^{(4)}\) in the interval).

Question 2#

Use the composite Simpson’s rule to approximate the integral \(\int y~dx\) for the data sets

Note that the function of the integrand is defined in the header of the files, use these to determine the true error of the integrals and compare this to the theoretical upper bound of the error. Compare these results to the trapezoidal rule from Exercise 18.2.