User:Egm6341.s11.team4.kurth/hw4

Homework 4

=Problem 4.7: Composite Simpson Rule Error Boundary=

Refer to lecture slide [[media:Nm1.s11.mtg22.djvu|22-2]] for problem assignment.

Objective
Prove that the error when using the composite Simpson rule to approximate the integral of a function, $$\displaystyle f$$, from a to b is bound by

where

Solution
From equation [[media:Nm1.s11.mtg7.djvu|(4)p.7-4]]

Breaking (7.2) into discrete intervals yields

Now applying the simple Simpon's error theorem presented on lecture slide [[media:Nm1.s11.mtg18.djvu|18-2]] to each interval:

Next, define $$\displaystyle \overline{M_4}$$

(7.7) becomes

Since

Substituting (7.11) into (7.9)


 * {| style="width:95%" border="0" align="center"

$$\displaystyle $$ $$
 * style="width:35%" |
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * E_n^S| \leq \frac{(b-a)h^4}{180}M_4 = \frac{(b-a)^5}{180n^4}M_4
 * $$\displaystyle
 * style= |
 * }
 * }

Note: This solution differs from the problem statement but is confirmed by Atkinson pp.257&258

Solved by William Kurth.

=Problem 4.10: Error Convergence for the Trapezoidal and Simpon's Rules=

Given
Consider the exact integrals

and

Objectives

 * 1.) Create a table showing the approximations of (10.1) by using the Trapezoidal rule with successively doubling values of n, as well as the corresponding error involved in the approximation. Also, the table should include the ratio of successive errors to show the effect of doubling the value of n on the error.


 * 2.) Create a table showing the approximations of (10.1) by using Simpson's rule with successively doubling values of n, as well as the corresponding error involved in the approximation. Also, the table should include the ratio of successive errors to show the effect of doubling the value of n on the error.


 * 3.) Create a table showing the errors of approximating (10.2) by using both the Trapezoidal and Simpon's rules, as well as the ratio of successive errors to show the effect of doubling the value of n on the error.

Calculation of the True Values of the Integrals
Wolfram Alpha was used to compute the exact values of (10.1) and (10.2):

Approximation of the Integral of $$f(x) = e^x sin(x)$$ by Trapezoidal Rule
The following MATLAB code was used to calculate the approximation of (10.1) for increasing values of n using the Trapezoidal rule, as well as the associated approximation errors and the ratios of successive approximation errors.

As can be seen in this table the error is quartered when the interval size is halved, indicating that the error indeed scales with $$ O(h^2)$$.

Approximation of the Integral of $$f(x) = e^x sin(x)$$ by Simpon's Rule
The following MATLAB code was used to calculate the approximation of (10.1) for increasing values of n using Simpson's rule, as well as the associated approximation errors and the ratios of successive approximation errors.

As can be seen in this table that as the interval size is halved the error is reduced by a factor of sixteen, indicating that the error indeed scales with $$ O(h^4)$$.

Error of Approximating the Integral of $$ f(x) = x^{3.7}$$ Using Both Trapezoidal and Simpon's Rules
The following MATLAB code was used to calculate the approximation of (10.2) for increasing values of n using both the Trapezoidal and Simpson's rules, as well as the associated approximation errors and the ratios of successive approximation errors for each method.

As can be seen in this table that as the interval size is halved the error associated with the Trapezoidal rule is quartered and the error associated with Simpson's rule is reduced by a factor of sixteen, indicating that the errors indeed scale with $$ O(h^2)$$ and $$ O(h^4)$$, respectively.

Solved by William Kurth.