User:Egm6341.s11.team3/sub6

= 6.1 =

Given: p4 and p5 values along the error expression and residual integral term
From by Prof. Vu-Quoc, functions $$ p_4(t), p_5(t) \ $$ expressions are given as:


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

$$ p_4(t) = c_1 \frac{t^4}{4!} + c_3 \frac{t^2}{2!} + c_5 \ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 *  $$ \displaystyle
 * }


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

$$ p_5(t) = c_1 \frac{t^5}{5!} + c_3 \frac{t^5}{5!} + c_5t \ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 *  $$ \displaystyle
 * }


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

$$ c_1 = -1, c_3 = \frac{1}{6}, c_5 = -\frac{7}{360} \ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 *  $$ \displaystyle
 * }

with expression for $$ E \ $$ at $$ p_5(t)^{th} \ $$ term is given as


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

$$ E = \left [ p_2g^{(1)} + p_4g^{(3)} \right ]_{-1}^{+1} - \ \int^{+1}_{-1}p_5g^{(5)}dt $$ $$
 * style="width:95%" |
 * style="width:95%" |
 *  $$ \displaystyle
 * }

Find: Expression for p6, p7, E at p6 and p7, the expression for global-to-local variable conversion and values for functions 'd'
(a) Expression for $$ p_6, p_7 \ $$ and $$ E \ $$

(b) Find $$ t_k(x) \ $$

(c) Find 
 * {| style="width:100%" border="0"

$$ d_1 = \bar {d}_{2.1} = \bar {d}_{2} = \frac{p_2(1)}{2^2} \ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 *  $$ \displaystyle
 * }


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

$$ d_2 = \bar {d}_{4} \ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 *  $$ \displaystyle
 * }


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

$$ d_3 = \bar {d}_{6} \ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 *  $$ \displaystyle
 * }

(a)
Having this expression for error $$ E = \left [ p_2(t)g^{(1)}(t) + p_4(t)g^{(3)}(t) \right ]_{-1}^{+1} - \ \int^{+1}_{-1}p_5(t)g^{(5)}(t)dt $$

, we integrate by parts the residual part once again

by noting that


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

$$ \frac{d}{dt} \left ( p_6(t)g^{(5)}(t) \right ) = p_5(t)g^{(5)}(t) + p_6(t)g^{(6)}(t) \ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 *  $$ \displaystyle
 * }

then by taking integral over the interval, for this more specific case, in interval $$ t \in [-1, +1] \ $$, we get

<span id="(1)">
 * {| style="width:100%" border="0"

$$ \int^{+1}_{-1} \frac{d}{dt} \left ( p_6(t)g^{(5)}(t) \right ) = \int^{+1}_{-1}p_5(t)g^{(5)}(t) + \int^{+1}_{-1} p_6(t)g^{(6)}(t) \ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ \left [ p_6(t)g^{(5)}(t)dt \right ]_{-1}^{+1} = \int^{+1}_{-1}p_5(t)g^{(5)}(t) + \int^{+1}_{-1} p_6(t)g^{(6)}(t) \ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle
 * }

Then re-writing the equations above

<span id="(1)">
 * {| style="width:100%" border="0"

$$ \int^{+1}_{-1}p_5(t)g^{(5)}(t) = \left [ p_6(t)g^{(5)}(t)dt \right ]_{-1}^{+1} - \int^{+1}_{-1} p_6(t)g^{(6)}(t) \ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle
 * }

2 things must be noted:


 * 1) the rewritten term is the same as the residual term in error as well as the residual next term is of the same format as $$ \int^{+1}_{-1}p_5(t)g^{(5)}(t) \ $$ term.
 * 2) note that by the definition of integration by parts, that was done in deriving expression for $$ \int^{+1}_{-1}p_5(t)g^{(5)}(t) \ $$, we expressed $$ \frac{d}{dt}p_6(t) = p_5(t) \ $$ or $$ p_6(t) = \int p_5(t) \ $$

Therefore,

<span id="(1)">
 * {| style="width:100%" border="0"

$$ E = \left [ p_2(t)g^{(1)}(t) + p_4(t)g^{(3)}(t) \right ]_{-1}^{+1} + \left [ p_6(t)g^{(5)}(t)dt \right ]_{-1}^{+1} - \int^{+1}_{-1} p_6(t)g^{(6)}(t) \ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle
 * }

, where $$ p_6(t) = c_1\frac{t^6}{6!} + c_3\frac{t^4}{4!}+ c_5\frac{t^2}{2!}+ c_7 \ $$

in same fashion we expand it once more

<span id="(1)">
 * {| style="width:100%" border="0"

$$ E = \left [ p_2(t)g^{(1)}(t) + p_4(t)g^{(3)}(t) \right ]_{-1}^{+1} + \left [ p_6(t)g^{(5)}(t)dt + p_7(t)g^{(6)}(t)dt \right ]_{-1}^{+1} - \int^{+1}_{-1} p_7(t)g^{(7)}(t) \ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle
 * }

, where we have now

<span id="(1)">
 * {| style="width:100%" border="0"

$$ p_6(t) = c_1\frac{t^6}{6!} + c_3\frac{t^4}{4!}+ c_5\frac{t^2}{2!}+ c_7 \ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ p_7(t) = c_1\frac{t^7}{7!} + c_3\frac{t^5}{5!}+ c_5\frac{t^3}{3!}+ c_7t + c_8\ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle
 * }

in order to reduce some error in residual function and noting that this is an error that generated from integration, we want to make 1 function odd such that negative and positive contribution to error would cancel out. Since we note that $$ p_1, p_3, p_5, .... \ $$ are odd functions, we will force with constants $$ c_1 - c_7 \ $$ for this function to cancel out at the interval $$ t \in [-1, +1] \ $$

That is:

They both end at the same point, namely '0'

<span id="(1)">
 * {| style="width:100%" border="0"

$$ p_7(-1) = p_7(+1) = 0 \ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle
 * }

as well as the function will pass though origin, in order to enforce the oddity of the function (remember that odd functions are symmetric with origin and, therefore, they pass though origin)

<span id="(1)">
 * {| style="width:100%" border="0"

$$ p_7(0) = 0 \Rightarrow c_8 = 0 \ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle
 * }

then by noting that constants $$ c_1, c_3, \ $$ and $$ c_5 \ $$ were already found for lower order 'p' functions and $$ c_8 = 0 \ $$

we plug in the final boundary value to find $$ c_7 \ $$

<span id="(1)">
 * {| style="width:100%" border="0"

$$ p_7(1) = (-1)\frac{1^7}{7!} + \frac{1}{6}\frac{1^5}{5!}+ \left (-\frac{7}{360} \right ) \frac{1^3}{3!}+ c_7(1) + 0 = 0 \ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ \Rightarrow c_7 = \frac{31}{15,120} \ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle
 * }

Therefore

$$ p_6(t) = c_1\frac{t^6}{6!} + c_3\frac{t^4}{4!}+ c_5\frac{t^2}{2!}+ c_7 \ $$

$$ p_7(t) = c_1\frac{t^7}{7!} + c_3\frac{t^5}{5!}+ c_5\frac{t^3}{3!}+ c_7t \ $$

$$ E = \left [ p_2(t)g^{(1)}(t) + p_4(t)g^{(3)}(t) + p_6(t)g^{(5)}(t)dt \right ]_{-1}^{+1} - \int^{+1}_{-1} p_7(t)g^{(7)}(t) \ $$

$$ c_1 = -1, c_3 = \frac{1}{6}, c_5 = -\frac{7}{360}, c_7 = \frac{31}{15,120} \ $$

(b)
From the equation (3) given in Prof. Vu-Quoc's

<span id="(1)">
 * {| style="width:100%" border="0"

$$ x(t_k) = \frac{x_k + x_{k+1}}{2} + t_k \frac{h}{2} \, t_k \in [-1, +1] $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle
 * }

, where $$ h \ $$ is the size of an interval, namely, $$ h = x_k + x_{k+1} \ $$

By re-arranging members

$$ t_k(x) = \frac{2x - (x_k + x_{k+1})}{h} \ $$

(c)
From Prof. Vu-Quoc's on expression for function "d"

<span id="(1)">
 * {| style="width:100%" border="0"

$$ \bar {d}_{2r} = \frac{p_{2r}(1)}{2^{2r}} = d_r = - \frac{B_{2r}}{(2r)!} \ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ p_2(t) = c_1\frac{t^2}{2!}+ c_3 \ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ p_4(t) = c_1\frac{t^4}{4!}+ c_3\frac{t^2}{2!}+ c_5 \ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ p_6(t) = c_1\frac{t^6}{6!} + c_3\frac{t^4}{4!}+ c_5\frac{t^2}{2!}+ c_7 \ $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle
 * }

$$ d_1 = \frac{p_2(1)}{2^2} = \frac{-1 \frac{1^2}{2!}+\frac{1}{6}}{2^2} = - \frac{1}{12} \ $$

$$ d_2 = \frac{p_4(1)}{2^4} = \frac{-1 \frac{1^4}{4!}+ \frac{1}{6}\frac{1^2}{2!}- \frac{7}{360}}{2^4} = \frac{1}{720} $$

$$ d_3 = \frac{p_6(1)}{2^6} = \frac{ -1\frac{1^6}{6!} +\frac{1}{6} \frac{1^4}{4!}- \frac{7}{360}\frac{1^2}{2!}+ \frac{31}{15,120}}{2^6} = - \frac{1}{30,240} $$

Miscellaneous/Matlab Code for caluclations
--Egm6341.s11.team3.JA 03:07, 4 April 2011 (UTC)

=6.2 =

Given: The Error Expression of the Trapezoidal Rule
<span id="(1)">
 * {| style="width:100%" border="0"

$$E_n^T = I - T_0(n) = \sum_{r=1}^{l} h^{2r}\bar{d}_{2r}\left[ f^{(2r-1)}(b) - f^{(2r-1)}(a) \right] - \left(\frac{h}{2} \right)^{2l} \sum_{k=0}^{n-1} \int_{x_k}^{x_{k+1}} P_{2l}(t_k(x))f^{(2l)}(x)dx$$ $$ \displaystyle(Eq.6.2.1)$$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

where: <span id="(1)">
 * {| style="width:100%" border="0"

$$ \bar{d}_{2r} = \frac{P_{2l}(1)}{2^{2r}}$$ $$ \displaystyle(Eq.6.2.2)$$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Find: Derive the Given Expression
Derive equations 6.2.1 and 6.2.2.

Solution
From class lecture, we have the following error expression: <span id="(1)">
 * {| style="width:100%" border="0"

$$ E = \sum_{r=1}^{l} P_{2r}(+1) \left[g^{(2r-1)}(+1) - g^{(2r-1)}(-1) \right] - \int_{-1}^{+1} P_{2l}(t) g^{(2l)}(t)dt $$ $$ \displaystyle(Eq.6.2.3a)$$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Where: <span id="(1)">
 * {| style="width:100%" border="0"

$$ g_k^{(i)}(t) = \left(\frac{h}{2} \right)^if^{(i)}(x(t)), \quad x \in [x_k,x_{k+1}] $$ $$ \displaystyle(Eq.6.2.4)$$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

By recognizing that x(+1)=b and x(-1)=a, equation 6.2.4 may be used to solve for three of the parameters in equation 6.2.3 as follows: <span id="(1)">
 * {| style="width:100%" border="0"

$$ g^{(2r-1)}(+1) = \left(\frac{h}{2} \right)^{(2r-1)}f^{(2r-1)}(x(+1))= \left(\frac{h}{2} \right)^{(2r-1)}f^{(2r-1)}(b)$$ $$ \displaystyle(Eq.6.2.5)$$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$ g^{(2r-1)}(-1) = \left(\frac{h}{2} \right)^{(2r-1)}f^{(2r-1)}(x(-1))=\left(\frac{h}{2} \right)^{(2r-1)}f^{(2r-1)}(a)$$ $$ \displaystyle(Eq.6.2.6)$$ <span id="(1)">
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * {| style="width:100%" border="0"

$$ g^{(2l)}(t) = \left(\frac{h}{2} \right)^{2l}f^{(2l)}(x(t))$$ $$ \displaystyle(Eq.6.2.7)$$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Substituting these three expressions (Equations 6.2.5, 6.2.6, and 6.2.7) into the error expression in Equation 6.2.3 yields:

<span id="(1)">
 * {| style="width:100%" border="0"

$$ E = \sum_{r=1}^{l} P_{2r}(+1) \left[\left(\frac{h}{2} \right)^{(2r-1)}f^{(2r-1)}(b) - \left(\frac{h}{2} \right)^{(2r-1)}f^{(2r-1)}(a) \right] - \int_{-1}^{+1} P_{2l}(t) \left(\frac{h}{2} \right)^{2l}f^{(2l)}(x(t))dt $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ \quad = \sum_{r=1}^{l} \left(\frac{h}{2} \right)^{(2r-1)}P_{2r}(+1) \left[f^{(2r-1)}(b) - f^{(2r-1)}(a) \right] - \left(\frac{h}{2} \right)^{2l}\int_{-1}^{+1} P_{2l}(t) f^{(2l)}(x(t))dt $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ \quad = \sum_{r=1}^{l} \left(\frac{h^{(2r)}}{2^{(2r)}} \right)\left(\frac{h^{(-1)}}{2^{(-1)}} \right)P_{2r}(+1) \left[f^{(2r-1)}(b) - f^{(2r-1)}(a) \right] - \left(\frac{h}{2} \right)^{2l}\int_{-1}^{+1} P_{2l}(t) f^{(2l)}(x(t))dt $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ \quad = \sum_{r=1}^{l} 2h^{(2r-1)} \left(\frac{P_{2r}(+1)}{2^{2r}} \right) \left[f^{(2r-1)}(b) - f^{(2r-1)}(a) \right] - \left(\frac{h}{2} \right)^{2l}\sum_{k=0}^{n-1}\int_{x_k}^{x_{k-1}} P_{2l}(t_k(x)) f^{(2l)}(x)dx $$ $$ \displaystyle(Eq.6.2.8a)$$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

By substituting the expression given by Equation 6.2.2 into Equation 6.2.8, the final answer is achieved:

<span id="(1)">
 * {| style="width:100%" border="0"

$$ \therefore E = \sum_{r=1}^{l} 2h^{(2r-1)} \bar{d}_{2r} \left[f^{(2r-1)}(b) - f^{(2r-1)}(a) \right] - \left(\frac{h}{2} \right)^{2l}\sum_{k=0}^{n-1}\int_{x_k}^{x_{k-1}} P_{2l}(t_k(x)) f^{(2l)}(x)dx $$ $$ \displaystyle(Eq.6.2.9a)$$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

However, this answer is different than the one given in the problem statement. Unless the solution given in the problem statement is incorrect, I believe this is likely due to a misprint in the lecture notes. Had the expression in Equation 6.2.3 been given instead as:

<span id="(1)">
 * {| style="width:100%" border="0"

$$ E = \left(\frac{h}{2} \right)\sum_{r=1}^{l} P_{2r}(+1) \left[g^{(2r-1)}(+1) - g^{(2r-1)}(-1) \right] - \int_{-1}^{+1} P_{2l}(t) g^{(2l)}(t)dt $$ $$ \displaystyle(Eq.6.2.3b)$$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Then, by following the same exact steps shown above, the derivation would instead have led to:

<span id="(1)">
 * {| style="width:100%" border="0"

$$ E = \left(\frac{h}{2} \right)\sum_{r=1}^{l} P_{2r}(+1) \left[\left(\frac{h}{2} \right)^{(2r-1)}f^{(2r-1)}(b) - \left(\frac{h}{2} \right)^{(2r-1)}f^{(2r-1)}(a) \right] - \int_{-1}^{+1} P_{2l}(t) \left(\frac{h}{2} \right)^{2l}f^{(2l)}(x(t))dt $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ \quad = \left(\frac{h}{2} \right)\sum_{r=1}^{l} \left(\frac{h}{2} \right)^{(2r-1)}P_{2r}(+1) \left[f^{(2r-1)}(b) - f^{(2r-1)}(a) \right] - \left(\frac{h}{2} \right)^{2l}\int_{-1}^{+1} P_{2l}(t) f^{(2l)}(x(t))dt $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ \quad = \left(\frac{h}{2} \right)\sum_{r=1}^{l} \left(\frac{h^{(2r)}}{2^{(2r)}} \right)\left(\frac{h^{(-1)}}{2^{(-1)}} \right)P_{2r}(+1) \left[f^{(2r-1)}(b) - f^{(2r-1)}(a) \right] - \left(\frac{h}{2} \right)^{2l}\int_{-1}^{+1} P_{2l}(t) f^{(2l)}(x(t))dt $$
 * style="width:95%" |
 * style="width:95%" |
 * }
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$ \quad = \sum_{r=1}^{l} h^{(2r)} \left(\frac{P_{2r}(+1)}{2^{2r}} \right) \left[f^{(2r-1)}(b) - f^{(2r-1)}(a) \right] - \left(\frac{h}{2} \right)^{2l}\sum_{k=0}^{n-1}\int_{x_k}^{x_{k-1}} P_{2l}(t_k(x)) f^{(2l)}(x)dx $$ $$ \displaystyle(Eq.6.2.8b)$$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Which, after making the substitution given by Equation 6.2.2, agrees with the desired final solution. So, by assuming the aforementioned misprint in Lecture 31 Page 3 Equation 2, the error may be expressed as:

<span id="(1)">
 * {| style="width:100%" border="0"

$$ \therefore E = \sum_{r=1}^{l} h^{(2r)} \bar{d}_{2r} \left[f^{(2r-1)}(b) - f^{(2r-1)}(a) \right] - \left(\frac{h}{2} \right)^{2l}\sum_{k=0}^{n-1}\int_{x_k}^{x_{k-1}} P_{2l}(t_k(x)) f^{(2l)}(x)dx $$ $$ \displaystyle(Eq.6.2.9b)$$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Egm6341.s11.team3.russo 19:35, 28 March 2011 (UTC)

Given: Kessler's code
Kessler's code is given below

Find: understand Kessler's code line by line
Using $$(p_{2i},\ p_{2i+1}),\ i=1,2,3$$ to understand Kessler's code line by line, starting with the best of Spring 2010

Solution
The Kessler's code is to compute the coefficients $$p_{2n}$$ and the constants $$c_{n}$$ where $$n=1,2,3,...,n$$, according to the following algorithm :

1) $$i=0$$: <span id="(1)">
 * {| style="width:100%" border="0"

$$p_1(t)=c_1t,\ c_1=-1 $$ $$ (Eq.6.6.1) \ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

2) $$i=1,2,3,...$$: <span id="(1)">
 * {| style="width:100%" border="0"

$$c_{2i+1}=-\sum^{i-1}_{j=0}\frac{c_{2j+1}}{[2(i-j)+1]!}$$ $$ (Eq.6.6.2) \ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

$$p_{2i}(t)=\sum^{i}_{j=0}c_{2j+1}\frac{t^{2(i-j)}}{[2(i-j)]!}$$ $$ (Eq.6.6.3) \ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }
 * function traperror

The input of this function $$n$$ is a integer that ranges from 1 to $$\infty$$. The function returns two arrays $$c$$ and $$p$$, corresponding to the constants $$c_{n}$$ and the coefficients $$p_{2n}$$.

Set initial values for f, g, cn and cd, where the initial value of cn and cd are the numerator and denominator of $$c_1=-1$$, respectively.

Start iteration from $$k=1$$ to $$k=n$$

Update vector f according to $$f^k_i=f^{k-1}_ig^{k-1}_i(g^{k-1}_i + 1)$$, where $$f^k_i$$ is the denominator of the factors of $$c_i$$ in (Eqn 6.6.2) as $$i=k$$

Calculate $$c_{2k-1}$$ according to (Eqn 6.6.2)

Update vector f and g, where $$g_i$$ and $$f_i$$ are respectively the numerator and denominator of the factors of $$c_{2i+1}$$ in (Eqn 6.6.2) as $$i=k$$

Calculate $$p_{2k}$$ according to (Eqn 6.6.3)

Add $$c_{2k+1}$$ and $$p_{2k}$$ to the output arrays c and p


 * function fracsum

This function is to calculate the summation of $$n_i/d_i$$ from vectors $$n$$ and $$d$$. The outputs nsum and dsum returns the numerator and denominator,respectively. $$\frac{nsum}{dsum}=\sum_{i}\frac{n_i}{d_i}$$

The function round is used to round off a number to its nearest integer. The function gcd returns an array containing the greatest common divisors of the corresponding elements of the two input arrays.

This is to remove the common divisors from $$n_i$$ and $$d_i$$, while the ratio $$n_i/d_i$$ is preserved.

The function lcm returns the least common multiple of corresponding elements of two input arrays

Egm6341.s11.team3.ren 06:31, 30 March 2011 (UTC)

Results:
The integration results for a), c) and d) are shown and compared in the following table:

The Romberg table for b) is:

(2) Circumference for Ellipse: Method1
From definition of eccentricity of ellipse :

<span id="(1)">
 * {| style="width:100%" border="0"

$$ e = \sqrt {1-\frac{b^2}{a^2}} = \frac{\sqrt{91}}{10} \quad $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle (Eq. 6.7.11)
 * }

From (Eq. 6.7.2), (Eq. 6.7.3), we derive the Integration as:

<span id="(1)">
 * {| style="width:100%" border="0"

$$ C = I = \int_{0}^{2 \pi} a(1-e^2)(1-ecos \theta)^{-2}\sqrt{(1 +e^2 - 2e cos \theta)} d \theta \quad $$ $$ = \int_{0}^{2 \pi} \frac{9}{10} (1- \frac{\sqrt{91}}{10} cos \theta)^{-2}(\frac{191}{100} - \frac{\sqrt{91}}{5} cos \theta)^{\frac{1}{2}} d \theta \quad $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle (Eq. 6.7.12)
 * }

Using WolframAlpha, the exact solution is calculated to be :

<span id="(1)">
 * {| style="width:100%" border="0"

$$ C_{exact} = I_{exact} = 43.8591 \quad $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle (Eq. 6.7.13)
 * }

Following the same approaches as in (Eq. 6.7.7), (Eq. 6.7.8) and (Eq. 6.7.9), the integration is computed using the following code:

Results:
The integration results for a), c) and d) are shown and compared in the following table:

The Romberg table for b) is:

(3) Circumference for Ellipse: Method2
The 2nd method of circumference for ellipse follows (Eq. 6.7.4). Similar to previous calculations, the function integrated here is defined as:

<span id="(1)">
 * {| style="width:100%" border="0"

$$ f(\theta) = 4a[1-e^2 sin^2 \theta]^{\frac{1}{2}} = 40\sqrt{1- 0.91 sin^2 \theta} \quad $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle (Eq. 6.7.14)
 * }

Using WolframAlpha, the exact solution is calculated to be :

<span id="(1)">
 * {| style="width:100%" border="0"

$$ C_{exact} = I_{exact} = 43.8591 \quad $$ $$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right"> $$ \displaystyle (Eq. 6.7.13)
 * }

Which is identical to (Eq. 6.7.13), following the same approaches as in (Eq. 6.7.7), (Eq. 6.7.8) and (Eq. 6.7.9), the integration is computed using the following code:

Results:
The integration results for a), c) and d) are shown and compared in the following table:

The Romberg table for b) is:

Egm6341.s11.team3.Xia 18:00, 31 March 2011 (UTC)

Solution
$$ \sum_{i=0}^{3} C_is^i = \sum_{i=1}^{4} N_i(s)d_i\,$$ $$ C_0+C_1s+C_2s^2+C_3s^3=N_1(s)d_1+N_2(s)d_2+N_3(s)d_3+N_4(s)d_4\,$$ $$ C_0=z_i \,$$ $$ C_1=z_i' \,$$ $$ C_2=-3z_i-2z_i'+3z_{i+1}-z_{i+1}' \,$$ $$ C_3=2z_i+z_i'-2z_{i+1}+z_{i+1}' \,$$ $$ d_1=z_i\,$$ $$ d_2=\dot{z_i}=z_i'\frac{1}{h}\,$$ $$ d_3=z_{i+1}\,$$ $$ d_4=\dot{z_{i+1}}=z_{i+1}'\frac{1}{h} \,$$ $$ z_i+z_i's+(-3z_i-2z_i'+3z_{i+1}-z_{i+1}')s^2+(2z_i+z_i'-2z_{i+1}+z_{i+1}')s^3=N_1(s)z_i+N_2(s)z_i'\frac{1}{h}+N_3(s)z_{i+1}+N_4(s)z_{i+1}'\frac{1}{h} \,$$ $$ z_i(1-3s^2+2s^3)+z_i'(s-2s^2+s^3)+z_{i+1}(3s^2-2s^3)+z_{i+1}'(-s^2+s^3)=z_i(N_1(s))+z_i'(N_2(s)\frac{1}{h})+z_{i+1}(N_3(s))+z_{i+1}'(N_4(s)\frac{1}{h}) \,$$

<span id="(1)">
 * {| style="width:100%" border="0"

$$ \displaystyle N_1(s) = 1-3s^2+2s^3 \,$$ $$ \displaystyle N_2(s) = h(s-2s^2+s^3) \,$$ $$ \displaystyle N_3(s) = 3s^2-2s^3 \,$$ $$ \displaystyle N_4(s) = h(-s^2+s^3) \,$$ $$ \displaystyle$$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

<span id="(1)">
 * {| style="width:100%" border="0"


 * style="width:95%" |
 * style="width:95%" |

$$ \bar{N_1}(s) = 1-3s^2+2s^3 \,$$ $$ \bar{N_2}(s) = s-2s^2+s^3 \,$$ $$ \bar{N_3}(s) = 3s^2-2s^3 \,$$ $$ \bar{N_4}(s) = -s^2+s^3 \,$$ $$ \displaystyle$$
 * <p style="text-align:right">
 * }

<span id="(1)">
 * {| style="width:100%" border="0"

Note for Verifying that : $$ \bar{N_1}(0)=1, \dot{\bar{N_1}}(0)=0, \bar{N_1}(1)=0, \dot{\bar{N_1}}(1)=0 \,$$ $$ \bar{N_2}(0)=0, \dot{\bar{N_2}}(0)=1, \bar{N_2}(1)=0, \dot{\bar{N_2}}(1)=0 \,$$ $$ \bar{N_3}(0)=0, \dot{\bar{N_3}}(0)=0, \bar{N_3}(1)=1, \dot{\bar{N_3}}(1)=0 \,$$ $$ \bar{N_4}(0)=0, \dot{\bar{N_4}}(0)=0, \bar{N_4}(1)=0, \dot{\bar{N_4}}(1)=1 \,$$ $$ \displaystyle$$
 * style="width:95%" |
 * style="width:95%" |
 * <p style="text-align:right">
 * }

Plot of N1, N2, N3, N4 as a function s Egm6341.s11.team3.rakesh 19:21, 4 April 2011 (UTC)

=Contributing Members =