Exercise 18.2

Exercise 18.2#

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 trapezoid 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 midpoint rule. Compare this to the theoretical upper bound of the error (which you can determine by finding using (20) with the maximum of \(f''\) in the interval).

Question 2#

Use the composite trapezoidal 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.