User:Egm6341.s10.Team4.nimaa&m/HW4

= Problem 2: Applying periodic function for higher-order of Trap. rule =

Given
Envisage the higher-order error for Trap. rule which has been introduced as following [[media:Egm6341.s10.mtg19.djvu|19-3]], for a function $$\displaystyle f(x) $$ which is periodic on $$\displaystyle [a,b] $$


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

$$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle E_n=a_1h^{2\times 1}+a_2h^{2\times 2}+...+a_nh^{2\times n}=\sum_{i=1}^\infty a_ih^{2i}


 * }
 * }


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

$$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle for k=0,1,2,...        f^{(k)}(a)=f^{(k)}(b)


 * }
 * }


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

$$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle a_i=d_i[f^{(2i-1)}(b)-f^{(2i-1)}(a)]


 * }
 * }

Find
Demonstrate that for which $$\displaystyle n $$, the $$\displaystyle E_n=0 $$ would be achieved?

Solution
Since $$\displaystyle f(x) $$ is a periodic function on the domain, we can use the following property of periodic functions (refer to first equation on the [[media:Egm6341.s10.mtg20.djvu|20-2]]:

If $$\displaystyle f(x) $$ is periodic on $$\displaystyle [a,b] $$, the odd derivatives of it will be equal at the same interval:


 * $$\displaystyle

f^{(k)}(a)=f^{(k)}(b) $$



k=2i-1; i\in \mathbb{N} $$



\Rightarrow f^{(2i-1)}(a)=f^{(2i-1)}(b) $$



\Rightarrow a_i=d(di=-\dfrac {B_{2i}}{(2i!)}\cancelto{0}{[f^{(2i-1)}(b)-f^{(2i-1)}(a)]}=0 $$

Thus, recalling the higher-order error of Trapezoidal rule;



E_n=\sum_{i=1}^n a_ih^{2i}=0 $$

Author
Solved and typed by - Egm6341.s10.Team4.nimaa&amp;m 21:51, 27 February 2010 (UTC) .

= Problem 6: i-derivative of g function in higher-order of Trap. proof =

Given
Consider the following definitions for these two functions such that $$\displaystyle x\in [x_k,x_{k+1}] $$ interval:


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

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


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

$$ $$
 * $$\displaystyle
 * $$\displaystyle
 * $$\displaystyle g_k(t):=f(x(t))


 * }
 * }

Find
Show that $$\displaystyle g_k^{(i)}(t)=(\dfrac {h}{2})^i.f^{(i)}(x(t)) $$:

Solution
$$\displaystyle g_k(t)=f(x(t))=f(t\dfrac {h}{2}+\dfrac {x_k+x_{k+1}}{2}) $$

$$\displaystyle \Rightarrow g_k^{(1)}(t)=\dfrac {d[f(\dfrac {th}{2}+\dfrac {x_k+x_{k+1}}{2})]}{dt} $$

Using the Chain rule for derivation:

$$\displaystyle \Rightarrow g_k^{(1)}(t)=\dfrac {d[f(x(t))]}{dx}\times\dfrac {h}{2} $$

For second derivative of $$\displaystyle g_k^{(2)} $$, we have:

$$\displaystyle g_k^{(2)}(t)=\frac {d[g_k^{(1)}(t)]}{dt}=\frac {d[\frac {d[f(x(t))]}{dx}\times\frac {h}{2}]}{dt}=\frac {d[\frac {d[f(\frac{th}{2}+\frac {x_k+x_{k+1}}{2})]}{dx}\times\frac {h}{2}]}{dt} $$

Using the Chain rule for derivation:

$$\displaystyle \Rightarrow g_k^{(2)}(t)=\frac {d^2(f(x(t))}{dx^2}\times (\dfrac {h}{2})\times(\dfrac {h}{2})=\frac {d^2(f(x(t))}{dx^2}\times (\dfrac {h}{2})^2 $$

Similarly, for third derivative of $$\displaystyle g_k^{(3)} $$ we will find:

$$\displaystyle \Rightarrow g_k^{(3)}(t)=\frac {d^3(f(x(t))}{dx^3}\times (\dfrac {h}{2})\times (\dfrac {h}{2})\times (\dfrac {h}{2})=\frac {d^3(f(x(t))}{dx^3}\times (\dfrac {h}{2})^3 $$

Thus, for $$\displaystyle i^{th} $$, $$\displaystyle g_k^{(i)} $$ can be predicted as:

$$\displaystyle g_k^{(i)}(t)=(\dfrac {h}{2})^i.f^{(i)}(x(t)) $$

Author
Solved and typed by - Egm6341.s10.Team4.nimaa&amp;m 00:08, 2 March 2010 (UTC) .

= Problem 8: Chebfun coding for Clenshaw-Curtis quad.=

Given
Codes of the Chebfun project are available on the lecture plan link of the course web site as a zip. file to apply in programming softwares. These codes are written for estimating the Clenshaw-Curtis quadrature by (Trefethen et al.)with a command in which started with (sum).

Find
Install Chebfun codes to see how this set of codes can estimate Clenshaw-Curtis quadrature.

Solution
Installation instructions: Chebfun Version 3 is compatible with MATLAB 7.4 (2007a) and more recent versions. First, contents of the zip file to a directory. The name "chebfun" for this directory is suggested. Then, In MATLAB, the chebfun directory is added to the path. This can be done by selecting "File/Set Path..." from the main or Command window menus. It is recommended to select the "Save" button on this dialog so that chebfuns are on the path automatically in future MATLAB sessions. To check whether the system appears to be working or not, "chebtest" should be typed at the command window prompt. Now, $$\displaystyle >> f=chebfun ('f(x)') $$ can be used for estimating the Clenshaw-Curtis quadrature.

The curve between the data points is the polynomial interpolant, which is evaluated by the barycentric formula introduced by Salzer [Berrut & Trefethen 2004, Salzer 1972]. This method of evaluating polynomial interpolants is stable and efficient even if the degree is in the millions [Higham 2004].

As an example if we want to know what is the integral of f from a to b? we should use this command:



>> sum ('f(x)') $$

This command can be applied for integration of $$\displaystyle f(x) $$ by Clenshaw-Curtis quadrature, as an alternative method for composite trapezoidal rule, composite simpson's rule, some Matlab commands and Richardson extrapolation (Romberg table).

Author
Solved and typed by - Egm6341.s10.Team4.nimaa&amp;m 21:59, 27 February 2010 (UTC) .