User:EGM6341.s10.Team1.toddmock/HW4

= Problem 21-1: Verify Change of Variables =

Given
Higher Order Error for Trap. rule equation:


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

$$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle \ E_n^1= \sum_{k=0}^{n-1}[ \int_{x_k}^{x_{k+1}}f(x)dx- \frac{h}{2}(f(x_k)+f(x_{k+1}))]
 * }
 * }

Find
Show that using change of variables this equation becomes


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

$$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle E_n^1=\dfrac{h}{2} \sum_{k=0}^{n-1}[ \int_{-1}^{1}g_k(t)dt-(g_k(-1)+g_k(+1))]
 * }.
 * }.

Where


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

$$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle g_k(t)=f(x(t))
 * }.
 * }.

And


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

$$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle x(t)=t\dfrac{h}{2}+\dfrac{x_k+x_{k+1}}{2}
 * }.
 * }.

Solution
Using the function
 * {| style="width:100%" border="0" align="left"

$$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle x(t)=t\dfrac{h}{2}+\dfrac{x_k+x_{k+1}}{2}
 * }.
 * }.

This can be changed into


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

$$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle x(t)=\dfrac{h}{2}(t+1)+x_k
 * }.
 * }.

This allows us to evaluate the function $$x(t)$$ at the endpoints to obtain


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

$$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle x(-1)=x_k
 * }
 * }

And


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

$$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle x(1)=x_{k+1}
 * }.
 * }.

Next using


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

$$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle g_k(t)=f(x(t))
 * }.
 * }.

we can transform


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

$$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle f(x(t))dx
 * }
 * }

into


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

$$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle g_k(t)dt
 * }
 * }

by using the derivative


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

$$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle \dfrac{d(x(t))}{dt}=\dfrac{h}{2}
 * }
 * }

Thus giving


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

$$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle d(x(t))=\dfrac{h}{2}dt
 * }.
 * }.

Placing all terms into the original equation with the new limits gives
 * {| style="width:100%" border="0" align="left"

$$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle E_n^1= \sum_{k=0}^{n-1} \int_{-1}^{1}g_k(t)\dfrac{h}{2}dt-\dfrac{h}{2}(g_k(-1)+g_k(+1))
 * }.
 * }.

Thus producing


 * {| style="width:20%" border="0"

$$\displaystyle E_n^1=\dfrac{h}{2} \sum_{k=0}^{n-1}[ \int_{-1}^{1}g_k(t)dt-(g_k(-1)+g_k(+1))] $$
 * style="width:20%; padding:10px; border:2px solid #8888aa" |
 * style="width:20%; padding:10px; border:2px solid #8888aa" |


 * style= |

--Egm6341.s10.team1.toddmock 19:01, 5 March 2010 (UTC)
 * }
 * }

= Problem 25-2(3): integration of ellipse arc length =

Given
For $$\displaystyle I = \int_{0}^{2\pi}\frac{1-sin^{2}(\frac{\pi}{12})}{1-sin(\frac{\pi}{12})cos\theta}d\theta$$,

the arc length integral is:


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

I= 4\int_0^{\pi/2}\sqrt {1-sin^{2}(\frac{\pi}{12}) \sin^2\theta}\ d\theta $$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle
 * }.
 * }.

compare MATLAB trapezoidal rule, Simpson's rule and Chebfun computational times.

Find
Total value of elliptical arc length (circumference) using built in MATLAB codes

Solution
For the Trapezoidal rule

For the Simpson's rule

And for the Chebfun function

As can be seen from the table above the quad function (simpson's rule) produces a result much faster than any of the other built in MATLAB functions --Egm6341.s10.team1.toddmock 19:02, 5 March 2010 (UTC)