User:Egm6341.s2010.Team1.lei/HW3

For HW 3, I am responsible for 1 problem: 19-2.

=Problem 9-1 =

Find
a) Modify matlab code to make the comp. of $$ T_{0}\left ( 2^j \right )\,$$ efficient, i.e,$$ T_{0}\left ( 2^j \right )=T_{0}\left (2^{(j-1)}\right )+...\,$$

b) Romberg table, compare to previous results

Given
Cont'd  [[media:Egm6341.s10.mtg6.pdf|Lec. 6-5]]
 * {| style="width:100%" border="0" align="left"


 * $$\displaystyle f(x)= \frac{e^x-1}{x} $$
 * $$\displaystyle I= \int\limits_{0}^{1}\frac{e^x-1}{x}\, dx $$
 * }
 * }
 * }

Solution
a) From [[media:Egm6341.s10.mtg18.pdf|Lec. 18-3]]


 * $$ T(2n)\,$$ comp. based on $$ T(n)\,$$, and $$ f(x_i), i=1,3,5,...\,$$


 * $$ T(n)=h [1/2f_0+f_1+f_2+...+f_{n-1}+1/2f_n], h=(b-a)/n \,$$


 * $$ T(2n)=\underbrace{\left (h [1/2f_0+f_2+f_4...+f_{2(n-1)}+1/2f_n]\right)}_{T(n)}+h [f_1+f_3+f_5+...+f_{2n-1}], h=(b-a)/2n \,$$


 * $$\Rightarrow T_{0}\left ( 2^j \right )= T_{0}\left (2^{(j-1)}\right )+ (b-a)/2n [f_1+f_3+f_5+...+f_{2(j-1)}] \,$$

Based on this method,modify matlab code to make the comp.of $$ T_{0}\left ( 2^j \right )\,$$ efficient.

Modified Matlab Code:

b) Romberg table display the results as follows:

Previous results:

From the comparation, for a given value of n,the most accurate value is for the largest value of k.

Matlab Code:

Egm6341.s10.team1.lei Egm6341.s10.team1.lei 16:06, 17 February 2010 (UTC)