User:Egm6341.s11.team4.kurth/hw5

=Problem 5.5: Modifying MATLAB Code to Calculate the Composite Trapezoidal Rule More Efficiently=

Objective

 * 1) Modify the MATLAB code used in HW 2.4 to make calculating the composite trapezoidal rule more efficient, i.e., $$ \displaystyle T_0(2^j)=T_0(2^{(j-1)})+\cdots$$
 * 2) Create a Romberg table and compare results to those initially calculated in HW 2.4

Modified MATLAB Code and Development Process
Recall the formula for the composite trapezoidal rule


 * $$T_0(n)=\frac{(b-a)}{n}\left(\frac{1}{2}f(x_0)+f(x_1)+f(x_2)+\cdots+f(x_{n-1})+\frac{1}{2}f(x_n)\right)$$

where $$ h = \frac{(b-a)}{n},,\;\;x_0=a,$$ and $$\displaystyle x_n=b$$. In practice it is common to successively double n (typically a power of two to begin with), the number of panels used, until a satisfactory convergence is obtained, effectively halving each subinterval. The new set of nodes would include all of the previously used $${x_i, i=0,1,2,...,n}$$ as well as new nodes which bisect the previous panels. To increase computation efficiency, the values of the function evaluated at all the nodes during the previous computation will be reused to calculate successive estimates. This yields the following relationship

Note that the $$\frac{1}{2}$$ factor in the result of (5.1) is due to the halving of the step-size; $$ h_{new} = \frac{1}{2}h_{old}$$.

This concept was employed to modify a previous MATLAB code to use this technique to cut down on computational cost. The modified code is found below.

Romberg Table
The Romberg Table involves using previously calculated numerical estimates of an integral to produce higher order estimates to surprisingly high accuracy. Equation [[media:nm1.s11.mtg29.djvu| (3)p.29-5]] gives the relation

A MATLAB code was developed to take the output of the modified composite trapezoidal rule and create a Romberg table and is found below:

These codes were used to find estimates of the integral

The following MATLAB script performed the computations for this case:

Matlab Code:

Comments
The 2nd column, corresponding to the composite trapezoidal rule approximations match those previously calculated in 2.4 exactly. It it observed that for higher levels of the trapezoidal rule (higher k) that a much smaller number of panels is needed for far greater accuracy. This shows that the Romberg table is a powerful tool for acquiring accurate numerical estimations of integrals using minimal computational effort.

Solved by William Kurth.

=Problem 5.7: Pros and Cons of Various Numerical Integration Techniques=

Objective
Discuss the pros and cons of the following numerical integration methods:
 * 1) Taylor Series
 * 2) Composite Trapezoidal Rule
 * 3) Composite Simpson's Rule
 * 4) Romberg Table(Richardson Extrapolation)
 * 5) Corrected Trapezoidal Rule