User:Egm6341.s10.team3.ynahn81/HW3-5

= (5) Comparison of Romberg table with Taylor, Trap and Simpson's Rules = Ref: Lecture notes [[media:Egm6341.s10.mtg19.djvu|p.19-2]]

Problem Statement
This problem is continued from the HW on [[media:Egm6341.s10.mtg6.pdf|p.6-5]]

i) Modify matlab code to make the computation of $$\displaystyle T_{0}(2^{j}) $$ efficient, i.e. $$\displaystyle T_{0}(2^{j}) = T_{0}(2^{(j-1)}) + \cdot\cdot\cdot $$. 

ii) Construct Romberg table and compare to previous results, i.e. compare Romberg table to Taylor, Trap. and Simpson's rules. 

Solution
 i)  Recall the formula of comp. Trap. rule.


 * {| style="width:100%" border="0" align="left"

T_{0}(n) = h\left[\frac{1}{2}f(x_{0}) + f(x_{1}) + f(x_{2}) + \cdot\cdot\cdot + f(x_{n-1}) + \frac{1}{2}f(x_{n}) \right] $$ $$ where $$\displaystyle h = \frac{b-a}{n} $$ and $$\displaystyle x_{0} = a,\quad x_{n} = b $$.
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 1)
 * }
 * }

Also, realize the fact that if we want to double the number of sub-intervals, we don't have to calculate the functions at even point, i.e. $$\displaystyle f(x_{0}), f(x_{2}), \cdot\cdot\cdot, f(x_{n-2}), f(x_{n}) $$ because we already calculated the functions at these even point at the previous step. Therefore, all we have to do is evaluating the functions only at the odd points and combine them with the calculated values at the previous step. As a result, we can use the following inductive formula.
 * {| style="width:100%" border="0" align="left"

T_{0}(2n) = T_{0}(n) + h\sum_{i=1}^{n}f(x_{2i-1}). $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 2)
 * }
 * }

In the following table, we summarize $$\displaystyle T_{0}(n) $$ for $$\displaystyle n = 1, 2, 4, 8, 16, 32, 64, 128 $$. The Matlab code for this calculation is provided in the end of this document.

 

ii)

In order to construct Romberg table, recall that the following inductive formula from the lecture note [[media:Egm6341.s10.mtg19.djvu|p.19-2]],


 * {| style="width:100%" border="0" align="left"

T_{k}(2n) = \frac{2^{2k}T_{k-1}(2n) - T_{k-1}(n)}{2^{2k}-1}. $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle (Eq. 3)
 * }
 * }

Since we already obtain $$\displaystyle T_{0}(n) $$ in part i), the following Romberg table can be constructed using Eq.(3).  Matlab code to make this table is provided in the end part of this document. 

'''Note the fact that the first and second columns of the above table correspond to Trap. and Simpson's rules respectively.'''

In order to compare the Romberg integration table to Taylor, Trap. and Simpson's rules, let's evaluate errors of the Romberg integration table.

In the previous HW (i.e. HW on [[media:Egm6341.s10.mtg6.pdf|p.6-5]] of the lecture note), we already found that we can achieve $$\displaystyle E_{n} = O(10^{-7})$$ when $$\displaystyle n = 8$$ in Taylor series expansion. As we shows the first and second column of above table, to achieve $$\displaystyle E_{n} = O(10^{-7})$$, $$\displaystyle n > 128$$ for trap. rule and $$\displaystyle n = 8$$ for Simpson's rule. On the other hand, we can achieve the same order of error when $$\displaystyle n = 4$$ using Romberg table (see. the third column of above table).

Therefore, Romberg integration table is the most efficient and accurate integration method.

Matlab code for part i) and ii)

 

Yong Nam Ahn 15:18, 17 February 2010 (UTC)