User:Egm6341.s11.team4.yang/hw6

=HW 6.7 problem: compute circumference bifolium and ellilpse =

Refer to lecture slide [[media:nm1.s11.mtg33.djvu|mtg-33]] for the problem statement.

Objective
Compute circumference of : 1).bifolium; 2). ellipse using the following methods: a). composite trap b). Romberg c). clenshaw-curtis quad d). Fast CC winckel

1.bifolium
$$r(t)=2\sin (t)\cos {{(t)}^{2}},t\in [0,\pi ]$$ The circumference of bifolium can be computed by: $$C=\int\limits_{t=0}^{\pi }{\sqrt{{{r}^{2}}+{{(\frac{dr}{dt})}^{2}}}}dt$$

Four methods to compute the integral: a).Composite trap Use error estimate for Composite Trapezoidal Rule to find n, such that the error is to the order of $$\displaystyle O(10^{-8}) $$.

Use successive numerical Integration results as a stopping criterion, i.e,


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

$$ $$
 * $$\displaystyle
 * I_{n+2} - I_{n}| < 10^{-8}
 * I_{n+2} - I_{n}| < 10^{-8}
 * $$\displaystyle
 * }.
 * }.

 Matlab Code:  b).Romberg The first column of Romberg table is calculated by composite trap, and then use the following equation to continue. $$\displaystyle T_{k}(2n) = \frac{2^{2k}T_{k-1}(2n) - T_{k-1}(n)}{2^{2k}-1}. $$  Matlab Code:  c).Clenshaw-Curtis Using Clenshaw-Curtis matlab code to compute the result.  Matlab Code:  d).Fast CC Using fast Clenshaw-Curtis matlab code to compute the result.  Matlab Code:  The results from the different methods are compared here:

2.ellipse-A

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

$$\displaystyle r(\theta) = \frac{a(1-e^2)}{1-e \, cos(\theta)} $$ $$
 * $$\displaystyle
 * }.
 * }.

Here, $$\displaystyle a=10,b=3 $$ and $$\displaystyle e=\sqrt{1-{{\left( \frac{b}{a} \right)}^{2}}} $$

Arc Length for an elliptical curve with $$\displaystyle \theta$$ varying from 0 to $$\displaystyle 2\pi $$ is given by,


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

$$\displaystyle

I=\int_{0}^{2\pi }{\sqrt{{{r}^{2}}+{{\left( \frac{dr}{d\theta } \right)}^{2}}}}d\theta

$$ $$ Four methods to compute the integral: a).Composite trap Use error estimate for Composite Trapezoidal Rule to find n, such that the error is to the order of $$\displaystyle O(10^{-10}) $$.
 * $$\displaystyle
 * }.
 * }.

Use successive numerical Integration results as a stopping criterion, i.e,


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

$$ $$
 * $$\displaystyle
 * I_{n+2} - I_{n}| < 10^{-10}
 * I_{n+2} - I_{n}| < 10^{-10}
 * $$\displaystyle
 * }.
 * }.

b).Romberg The first column of Romberg table is calculated by composite trap, and then use the following equation to continue. $$\displaystyle T_{k}(2n) = \frac{2^{2k}T_{k-1}(2n) - T_{k-1}(n)}{2^{2k}-1}. $$

c).Clenshaw-Curtis Using Clenshaw-Curtis matlab code to compute the result. d).Fast CC Using fast Clenshaw-Curtis matlab code to compute the result.

The results from the different methods are compared here:

3.ellipse-B
The elliptic integral of the second kind is given as:


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

$$\displaystyle I=4aE(e)=4a\int_{0}^{\pi /2}{\sqrt{1-{{e}^{2}}{{\sin }^{2}}\theta }}\ d\theta $$ $$ Four methods to compute the integral: a).Composite trap Use error estimate for Composite Trapezoidal Rule to find n, such that the error is to the order of $$\displaystyle O(10^{-10}) $$.
 * $$\displaystyle
 * }.
 * }.

Use successive numerical Integration results as a stopping criterion, i.e,


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

$$ $$
 * $$\displaystyle
 * I_{n+2} - I_{n}| < 10^{-10}
 * I_{n+2} - I_{n}| < 10^{-10}
 * $$\displaystyle
 * }.
 * }.

b).Romberg The first column of Romberg table is calculated by composite trap, and then use the following equation to continue. $$\displaystyle T_{k}(2n) = \frac{2^{2k}T_{k-1}(2n) - T_{k-1}(n)}{2^{2k}-1}. $$

c).Clenshaw-Curtis Using Clenshaw-Curtis matlab code to compute the result. d).Fast CC Using fast Clenshaw-Curtis matlab code to compute the result.

The results from the different methods are compared here:

Observations
1.For all the problem, Romberg method always need less time than Composite trap method. 2.The second kind of ellips (ellip-B) need less time than ellip-A. 3.The fast CC method always performs better than CC method. 4.For the problem of ellip-B, the computation time is similar for the four methods. This problem was solved by shengfeng yang