User:Egm6341.s10.Team4/HW5
[edit] Problem 1: Trapezoidal Rule Error Proof: Step 3b
[edit] Given
Refer Lecture slide 26-3 for problem statement.
-
.

[edit] Find
Selecting
and
, find
and
.
[edit] Solution
When
Equation (1),
-
.
-
.
When
Equation (1),
-
.
-
.
[edit] Author
Solved and typed by - Egm6341.s10.Team4.andy 08:18, 24 March 2010 (UTC).
Proofed by - Egm6341.s10.Team4.riherd 14:14, 24 March 2010 (UTC) and --Egm6341.s10.Team4.roni 18:35, 24 March 2010 (UTC)
[edit] Problem 2: Steps 4a and 4b in the proof of higher order derivation of Trap. error
[edit] Given
Envisage the acquired expression for E at the end of step 3 on 26-3 as following:
[edit] Find
What are the expressions for
, and
?
[edit] Solution
At the end of step 3 of this procedure, we have obtained:
Step 4a:
If we call the second term (integration term) as:
By integrating by parts we have:
Step 4b:
Then by defining F as:
We repeat integration by parts method;
We want to make
to be equal to zero. So, for an odd function like
, we have:
-
.
-
.
[edit] Author
Solved and typed by - Egm6341.s10.Team4.nimaa&m 23:25, 18 March 2010 (UTC)
Proofed by - Egm6341.s10.Team4.riherd 14:19, 24 March 2010 (UTC) .
[edit] Problem 3: Deducing a relation between x and t in proof of trapezoidal error
[edit] Given
-
.
[edit] Find
-
.Find tk in terms of x.
[edit] Solution
-
.
-
.
-
.
Substituting x=xk.
-
.
-
.
-
.
We know that xk+1-xk=h.
-
.
-
.
Substituting x=xk+1.
-
.
-
.
-
.
We know that xk+1-xk=h.
-
.
-
.
[edit] Author
Solved and typed by - Egm6341.s10.team4.anandankala 12:50, 24 March 2010 (UTC).
Reviewed by - Egm6341.s10.Team4.andy 19:25, 24 March 2010 (UTC)
[edit] Problem 4: Comparing Richarson Extrap. Coeff. to Coeff. from Trap. Error Estimate
[edit] Given
Richardson Extrapolation Coefficients on slide 19-3, which is:

[edit] Find
That these coefficients are equal to the following: equation (3) on slide 27-1




[edit] Solution
Recalling:
equation (2) on slide 21-2
equation (1) on slide 21-3
equation (4) on slide 21-3
on slide 26-3
In General, from the Paper by Patch Kessler we have:
Giving (also from HW 5.2 and it's solution) 27-1
We only need P1, P4 and P6
Giving,
[edit] Author
Solved and typed by - --Egm6341.s10.Team4.roni 18:23, 24 March 2010 (UTC)
[edit] Problem 5: Derivation of Compsit Trap. Rule Error
[edit] Given
Refer Lecture slide 28-3 for problem statement
The Error of Composit Trap. Rule
-
.![\displaystyle
E^1_n= \sum_{k=0}^{n-1} \left[ \int_{x_{k}}^{x_{k+1}}f(x)dx-\frac{h}{2} \left\{ f(x_k)+f(x_{k+1}) \right\} \right]](//upload.wikimedia.org/wikiversity/en/math/5/a/2/5a297fe0f74200f3f6989c058bdcd0d2.png)
[edit] Find
Derive the Compsit Trap.Rule Error equation.
-
.![\displaystyle
E=\sum_{r=1}^{\ell} 2 \, \overline{d}_{2r} \, h^{2r-1}\Bigg[f^{(2r-1)}(b)-f^{(2r-1)}(a)\Bigg]-\frac{h^{2\ell}}{2^{2\ell}} \sum_{k=0}^{n-1} \int_{x_k}^{x_{k+1}} \, p_{2\ell}(t_{k}(x)) \, f^{(2\ell)}(x)dx](//upload.wikimedia.org/wikiversity/en/math/5/3/2/532e7dd673612f1a2897452d6f30d372.png)
where,
[edit] Solution
The Error of Composit Trap. Rule
-
.![\displaystyle
E^1_n= \sum_{k=0}^{n-1} \left[ \int_{x_{k}}^{x_{k+1}}f(x)dx-\frac{h}{2} \left\{ f(x_k)+f(x_{k+1}) \right\} \right]](//upload.wikimedia.org/wikiversity/en/math/5/a/2/5a297fe0f74200f3f6989c058bdcd0d2.png)
Transfer int.
to ![\displaystyle [1,+1]](http://upload.wikimedia.org/wikiversity/en/math/c/b/a/cba1788db431329148d4c66c15bb0c74.png)
where,
-
.![\displaystyle
x(t):=t\frac{h}{2}+\frac{x_k+x_{k+1}}{2}, \, \, \, \, \, \, \, t \in [-1,1]\, \, \,\, \, \, , h:=(b-a)/n](//upload.wikimedia.org/wikiversity/en/math/1/6/f/16f229fbe16740397de321e2cce79732.png)
-
.![\displaystyle
g_k(t) = f(x(t)) \,\,\,\,\,\,such \,\,\,that\,\,\,\,\,x \in [x_k, x_{k+1}]](//upload.wikimedia.org/wikiversity/en/math/9/f/4/9f447ba95196424ff778f0d1a60bbc40.png)
-
.![\displaystyle
E^1_n= \frac{h}{2}\sum_{k=0}^{n-1} \left[ \int_{-1}^{+1}g_k(t)dt- \left\{ g_k(-1)+g_k(+1) \right\} \right]](//upload.wikimedia.org/wikiversity/en/math/c/d/e/cde43310da55b289aeeaedfdd1379be4.png)
through the successive integration by parts, the below equation can be obtained21-2,326-3
-
.![\displaystyle
\begin{align}
E^1_n & = \frac{h}{2} \left[ \sum_{k=0}^{n-1}\Big[p_2(t)g_k^{(1)}(t)+p_4(t)g_k^{(3)}(t_k)+p_6(t)g_k^{(5)}(t)+......+p_{2\ell}(t)g_k^{(2\ell-1)}(t)\Big]_{-1}^{+1}- \sum_{k=0}^{n-1} \left[ \int_{-1}^{1}p_{2\ell}(t)g_k^{(2\ell)}(t) dt \right]\right]\\
&= \frac{h}{2} \left[ \sum_{r=1}^{\ell}\sum_{k=0}^{n-1}\Big[p_{2r}(t)g_k^{(2r-1)}(t)\Big]_{-1}^{+1} - \sum_{k=0}^{n-1} \left[ \int_{-1}^{1}p_{2\ell}(t)g_k^{(2\ell)}(t) dt \right]\right]
\end{align}](//upload.wikimedia.org/wikiversity/en/math/b/d/5/bd53d201a2a49df4f5640686dbbbbcba.png)
Extend the first summation term.
-
.![\displaystyle
\begin{align}
E^1_n &= \frac{h}{2} \left[ \sum_{r=1}^{\ell}\sum_{k=0}^{n-1}\Big[p_{2r}(+1)g_k^{(2r-1)}(+1)-p_{2r}(-1)g_k^{(2r-1)}(-1)\Big]- \sum_{k=0}^{n-1} \left[ \int_{-1}^{1}p_{2l}(t)g_k^{(2\ell)}(t) dt \right]\right]\\
& because \,\,\,\,\,\,p_{2r}(+1)=p_{2r}(-1),\\
&= \frac{h}{2} \left[ \sum_{r=1}^{\ell}\sum_{k=0}^{n-1} p_{2r}(+1) \Big[g_k^{(2r-1)}(+1)-g_k^{(2r-1)}(-1)\Big]- \sum_{k=0}^{n-1} \left[ \int_{-1}^{1}p_{2l}(t)g_k^{(2\ell)}(t) dt\right]\right]
\end{align}](//upload.wikimedia.org/wikiversity/en/math/3/8/0/380fcc91f956c592dc0dac9ed640a4dc.png)
Using below relationship,
-
.![\displaystyle
g_k^{(i)}(t)=\left(\frac{h}{2}\right)^if^{(i)}(x(t)),,\,\,\,\,\ x \in [x_k,x_{k+1}]](//upload.wikimedia.org/wikiversity/en/math/9/7/d/97d151865dc54a151f896f9493f60740.png)
can be changed to
and below was obtained.
-
.
Plug in thess relationships to the equation 
-
.![\displaystyle
\begin{align}
E^1_n & = \left(\frac{h}{2}\right) \left[ \sum_{r=1}^{\ell} p_{2r}(+1) \left(\frac{h}{2}\right)^{2r-1} \sum_{k=0}^{n-1} \Big[f^{(2r-1)}(x_{k+1})-f^{(2r-1)}(x_k)\Big]- \sum_{k=0}^{n-1} \left[ \int_{x_k}^{x_{k+1}}p_{2\ell}(t_k(x))\left(\frac{h}{2}\right)^{2\ell}f^{(2\ell)}(x) dx \right] \right]\\
&= \sum_{r=1}^{\ell} h^{2r} \frac{p_{2r}(+1)}{2^{2r}} \Big[f^{(2r-1)}(x_{n})-f^{(2r-1)}(x_0)\Big]- \left(\frac{h}{2}\right)^{2\ell+1} \sum_{k=0}^{n-1} \left[ \int_{x_k}^{x_{k+1}}p_{2\ell}(t_k(x))f^{(2\ell)}(x) dx \right]
\end{align}](//upload.wikimedia.org/wikiversity/en/math/3/9/4/394982df5f335f7bcc977af268392e97.png)
by the definition of 
This solution is little bit different from the given solution of the lecture.
the coefficient of second summation term that marked 
we got
instead of
.
[edit] Author
Solved and typed by - Egm6341.s10.Team4.yunseok 16:59, 24 March 2010 (UTC)
Reviewed by - Egm6341.s10.Team4.andy 18:41, 24 March 2010 (UTC)
[edit] Problem 6 - Evaluation of d2i
[edit] Given
The hyperbolic cotangent is defined as
.
The function
, where Bi are the Bernoulli numbers.
[edit] Find
We are asked to verify the values of di for i=2,4, and 6, where di is the constant
. This is done previously given the values d2=-1/12, d4=1/720 and d6=-1/30240.
We are also asked to determine the values of d8 and d10.
Additionally, we are asked to compare these values of di to another relationship for di used in our error of the trapezoidal rule, where
.
[edit] Solution
Expanding cosh(x) and sinh(x) in terms of the exponential function and then expanding those exponential functions as series around the point x=0, we see that



Substituting all of this into the function
, we see that

Performing the appropriate polynomial division (which will not be shown here due to length and no clear way to show long division in Latex), we see that

This series expansion of xcoth(x) in hand, we are able to determine the values of
to be -
| 2i | d2i (calculated from f(x)=xcosh(x)) | d2i (calculated using known Bernoulli numbers) | d2i (given) |
|---|---|---|---|
| 0 | 1 | 1 | 1 |
| 2 | -1/12 | -1/12 | -1/12 |
| 4 | 1/720 | 1/720 | 1/720 |
| 6 | -1/30240 | -1/30240 | -1/30240 |
| 8 | 1/209600 | 1/209600 | n/a |
| 10 | -1/95800320 | -1/95800320 | n/a |
Additionally, we are asked to calculate d2i using a definition given by the polynomial functions defined in our trapezoidal error analysis, where
.
From analysis done in class and coefficients as given by Kessler, P. (Trapezoidal Rule Error, http://www.mechanicaldust.com/UCB/math128a/extrap.pdf, 2008), we know that





With these coefficients in hand, we are able to calculate the values for d2i using the formula as given above relating p2i(1) and d2i.
| 2i | d2i (calculated from f(x)=xcosh(x)) | d2i (calculated using polynomial coefficients) |
|---|---|---|
| 0 | 1 | 1 |
| 2 | -1/12 | -1/12 |
| 4 | 1/720 | 1/720 |
| 6 | -1/30240 | -1/30240 |
| 8 | 1/209600 | 1/209600 |
| 10 | -1/95800320 | -1/95800320 |
Comparing these values, we see that the formulas given to find d2i are consistent with each other.
[edit] Author
Solved and Written by Egm6341.s10.Team4.riherd 07:13, 24 March 2010 (UTC)
[edit] Problem 7: Trapezoidal Rule Error by Canceling Odd Derivative Orders of 
[edit] Given
Refer Lecture slide 28-2 for problem statement.
Higher Order Error for Trap. rule is given by [ Refer 21-1 ]:
-
.![\displaystyle
E_n^1=\frac{h}{2} \sum_{k=0}^{n-1} \left[ \underbrace{\int_{-1}^{1}g_k(t)dt-(g_k(-1)+g_k(+1))}_{E}\right]](//upload.wikimedia.org/wikiversity/en/math/3/8/6/3861c92d4184cee8cc226d5b8839d7d1.png)

where
can be written as,
-
.

-
.![\displaystyle
\begin{align}
\Rightarrow E &=\int_{-1}^{1}\underbrace{(-t)}_{p_{1}(t)}g_k^{(1)}(t)dt \\
&= \left[p_2(t)g_k^{(1)}(t) \right]_{-1}^{+1} - \int_{-1}^{+1}p_2(t)g_k^{(2)}(t)dt
\end{align}](//upload.wikimedia.org/wikiversity/en/math/0/f/5/0f5686352cd98ea6c3b01da73275f495.png)
where
.
After successive integration by parts,
-
.![\displaystyle
E = \left[p_2(t)g_k^{(1)}(t)-p_3(t)g_k^{(2)}(t)+p_4(t)g_k^{(3)}(t)-p_5(t)g_k^{(4)}(t)+p_6(t)g_k^{(5)}(t)+ \cdots +p_{\ell}(t)g_k^{(\ell-1)}(t)\right]_{-1}^{+1} - \int_{-1}^{1}p_{\ell}(t)g_k^{(\ell)}(t) dt](//upload.wikimedia.org/wikiversity/en/math/b/4/6/b461e9f5a22368932ab38a61cb59e1e6.png)

[edit] Find
Try to derive the Higher Order Trapezoidal Rule Error equation by canceling odd order derivative terms of
, i.e., make terms
to zero at
.
[edit] Solution
We know,
-
.
At
,
-
.
-
.
We also know,
-
.
And,
-
.
At
,
-
.
-
.
Functions
are odd functions.
Since functions
are made zero at
, Equation (3) becomes,
-
.![\displaystyle
\begin{align}
E & = \left[-p_3(t)g_k^{(2)}(t)-p_5(t)g_k^{(4)}(t)-p_7(t)g_k^{(6)}(t)\cdots\cdots-p_{(2\ell-1)}(t)g_k^{(2\ell-2)}(t)\right]_{-1}^{+1} + \int_{-1}^{1}p_{(2\ell-1)}(t)g_k^{(2\ell-1)}(t) dt \\
& = \sum_{r=2}^{\ell} \left[ -p_{(2r-1)}g_k^{(2r-2)}\right]_{-1}^{+1} + \int_{-1}^{1}p_{(2\ell-1)}(t)g_k^{(2\ell-1)}(t) dt \\
& = \sum_{r=2}^{\ell} \left[ -p_{(2r-1)}(1)g_k^{(2r-2)}(1) + p_{(2r-1)}(-1)g_k^{(2r-2)}(-1)\right] + \int_{-1}^{1}p_{(2\ell-1)}(t)g_k^{(2\ell-1)}(t) dt \\
\end{align}](//upload.wikimedia.org/wikiversity/en/math/d/7/1/d714d383eb51d7e93c525b3bfe51606e.png)
Since
are odd functions, we know
.
And so
becomes,
-
.![\displaystyle
E = \sum_{r=2}^{\ell} p_{(2r-1)}(-1) \left[ g_k^{(2r-2)}(1) + g_k^{(2r-2)}(-1)\right] + \int_{-1}^{1}p_{(2\ell-1)}(t)g_k^{(2\ell-1)}(t) dt](//upload.wikimedia.org/wikiversity/en/math/b/8/e/b8e010e055be2ee3519e1ed538383770.png)

Using the below relationship
-
.![\displaystyle
g_k^{(i)}(t)=\left(\frac{h}{2}\right)^if^{(i)}(x(t)); \ \ \ \ \ x \in [x_k,x_{k+1}]](//upload.wikimedia.org/wikiversity/en/math/1/0/f/10f47ed2d50e4d7948290002c7b671f1.png)
In Equation (4)
can be transferred to
as shown below:
-
.
And so, Equation (4) becomes,
-
.![\displaystyle
E = \sum_{r=2}^{\ell}\left[ \left(\frac{h}{2}\right)^{(2r-2)} p_{(2r-1)}(-1) \Big[ f^{(2r-2)}(x_{k+1}) + f^{(2r-2)}(x_{k})\Big] \right] + \left(\frac{h}{2}\right)^{(2\ell-1)} \int_{x_k}^{x_{k+1}}p_{(2\ell-1)}(t_k(x))f^{(2\ell-1)}(x) dx](//upload.wikimedia.org/wikiversity/en/math/9/a/7/9a72c2bcf36ab015a3897c1bccb4a884.png)

Substituting Equation (5) in Equation (1),
-
.![\displaystyle
\begin{align}
E_n^1 &= \sum_{r=2}^{\ell}\left[ \left(\frac{h}{2}\right)^{(2r-1)} p_{(2r-1)}(-1) \sum_{k=0}^{n}\Big[ f^{(2r-2)}(x_{k+1}) + f^{(2r-2)}(x_{k})\Big] \right] + \left(\frac{h}{2}\right)^{(2\ell)} \sum_{k=0}^{n} \left [\int_{-1}^{1}p_{(2\ell-1)}(t_k(x))f^{(2\ell-1)}(x) dx \right ] \\
& = \sum_{r=2}^{\ell}\left[ \left(\frac{h}{2}\right)^{(2r-1)} p_{(2r-1)}(-1) \Big[ \underbrace{f^{(2r-2)}(x_n) + f^{(2r-2)}(x_{n-1}) + \cdots \cdots + f^{(2r-2)}(x_{0})}_{\beta}\Big] \right] + \left(\frac{h}{2}\right)^{(2\ell)} \sum_{k=0}^{n} \left [\int_{-1}^{1}p_{(2\ell-1)}(t_k(x))f^{(2\ell-1)}(x) dx \right ]
\end{align}](//upload.wikimedia.org/wikiversity/en/math/e/2/6/e26e349d47c5826af0b7b150290983b2.png)
In the above error equation
, but it contains terms that involve all the points from
.
But instead of canceling out terms that involve odd order derivatives of
, if we had canceled only terms that involve even order derivatives of
then the term
would involve only first and last points, i.e.,
and
, as we have got in Problem 5 above.
[edit] Author
Solved and typed by - Egm6341.s10.Team4.andy 08:21, 24 March 2010 (UTC)
Reviewed by- Egm6341.s10.team4.anandankala 12:55, 24 March 2010 (UTC).
[edit] Problem 8: Using Recurrence formula to find 
[edit] Given
Consider the Recurrence formula on slide 29-2 as follows:
Where;
[edit] Find
Obtain
,
and
:
[edit] Solution
For
we can get
. Thus,
-
.
-
.
Likewise, for
, we can write:
By setting
in Recurrence equation:
-
.
-
.
Ultimately, for
, we have:
By setting
in Recurrence equation:
-
.
-
.
[edit] Author
Solved and typed by - Egm6341.s10.Team4.nimaa&m 00:44, 19 March 2010 (UTC)
Reviewed by- Egm6341.s10.team4.anandankala 13:05, 24 March 2010 (UTC). .
[edit] Problem 9: Kessler's Code
[edit] Given
-
.Given below is the Kessler's code function [c,p]=traperror(n) %compute the coefficients p_2, p_4, ... , p_{2n} associated with the %trapezoidal rule error expansion. Also compute c_1, c_3, ... f=1; g=2; cn=-1; cd=1; for k=1:n f=f.*g.*(g+1); [newcn,newcd]=fracsum(-1*cn,cd.*f); cn=[cn;newcn]; cd=[cd;newcd]; f=[f;1]; g=[2+g(1);g]; [newpn,newpd]=fracsum((g-1).*cn,f.*cd); pn(k,1)=newpn; pd(k,1)=newpd; end c=int64([cn cd]); p=int64([pn pd]); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [nsum,dsum]=fracsum(n,d) div=gcd(round(n),round(d)); n=round(n./div); d=round(d./div); dsum=1; for k=1:length(d) dsum=lcm(dsum,d(k)); end nsum=dsum*sum(n./d); div=gcd(round(nsum),round(dsum)); nsum=nsum/div;
[edit] Find
-
.Use (p2,p3),(p4,p5)(p6,p7) to understand the Kessler's code 
[edit] Solution
-
.The above code has been used to compute the coefficients p(2k) and the constants c(k) where k varies from 1 to n. In the above code a function fracsum has been defined and called accordingly in order to compute c(k) and p(2k).
The various commands used in the code are gcd, lcm and round. Gcd is used to find the greatest common divisor between two numbers, lcm is used to find the least common multiple of the two numbers and round is used to round off a number to its nearest intezer.
We know that


-
.

-
.

-
.

-
.

-
.In the code, the value of c1 is taken to be -1. The value of k ranges from 1 to n, the value of n being user defined. Considering the case where k=1, we get the value of c3 and p2(1). We have
and cn=-1, cd=1.The initial values of f and g are 1,2. The final value of f is equal to 6.
The variables for the function fracsum are
and
, which give the new values of c after every iteration.The array size of the input variables for the function increases by a unit size after every iteration.
The funtion inputs in the first iteration are (1,6) which are equivalent to (n,d). The function returns the output values of these as (1,6).
The cn array has now been updated to [-1 1] and the cd array to [1,6], where cn and cd are the numerator and denominator of constant c(k+2).
To compute the value of p2(1), the following steps are done in the program. f array has been changed to [f;1] and g array to [2+g(1);g]. For k=1, we get it as f=[6 1] and g= [4 2]. Now these input variables are returned to the function as
and
where cn= [-1 1] and cd= [1 6].In this case we get arrays with two elements each and the commands gcd and lcm are implemented independently on each of those elements. we get the values of newpn and newpd as -1 and 3, where pn and pd are the numerator and denominator of p2k(1). We get p=[pn pd]=[-1 3]

-
.In the next iteration the value of k is increased to 2.
. We get f= [120 6], cn= [-1 1] and cd= [1 6].From the function, we get the values of newcn and newcd as -7 and 360. For computing p4(1), f is again changed to [120 6 1] and g to [6 4 2]. The function is called again with input variables as
and
.We get the values of newpn and newpd as 1 and 45. pn=[-1 1] and pd=[3 45].
similar cycle is continued for all the higher iterations and we get the higher p and c.

[edit] Author
Solved and typed by -Egm6341.s10.team4.anandankala 13:15, 24 March 2010 (UTC).
.
[edit] Problem 10: Application of Engineering Orbital Mech.
[edit] Given
Refer Lecture slide 30-4 for problem statement
Polar form relative to focus
Eq (3) from Page 30-3

In our problem , a=1
where, eccentricity 
First Method to compute the Arc Length for an elliptical curve is using Eq (4) from Page 30-3 Since for the Ellipse
range is from 0 to 2 
Circumference 
Where Eq (1)
.
The second method uses the elliptic integral of the second kind which is defined as:
Eq(6) in page 30-4
The circumference of an ellipse is
Eq(5) in page 30-4,
Giving the integral:
[edit] Find
Find Arc length of ellipse using the two Integrals and the integration methods below.
compute
to the error
,
compute time using tic/toc matlab command and error estimate
1) Composit Trapozoidal rule
2) Romberg Table
3) Clencurt
[edit] Solution
The Integration result are summarized in the following table:
Note that checking both integral calculations against Ramanujan approximation 's:
where, a = longest radius, b= shortest radius in ellipse
the results of our integration method and Ramanujan approximation were same. 
Discussion: One can clearly see that for these integrals the Trapezoidal method gives superior performance This is due to the fact that the Integrand is a periodic function. Clencurt has slightly better performance than Romberg. First method Integral gives lower quality on all methods and need more CPU time for similar performance.
(1) Composite Trapezoidal rule
Matlab Code:
% Trapezoidal Integration HW 5-10 % Modified from HW 4-11 clc clear format long %limit lowlimit=0.; highlimit=2*pi; %exact I (calculated by quad comment with Tol = 10^-11) e=sin(pi/12); F = @(x) sqrt(1-e^2*sin(x).*sin(x)); I = 4*quad(F,0,pi/2,10^-11); tic n=1; E_n=1; while E_n >= 10^(-10) %make x(i) x(1)=lowlimit; h=(highlimit-lowlimit)/n; for i=1:n; x(i+1)=x(i)+h; end %make I_n sum=0.; for i=2:n; sum=sum+ff5_10(x(i)); end I_n=h*(sum+0.5*(ff5_10(x(1))+ff5_10(x(n+1)))); E_n=abs(I-I_n); n=n+1; end n toc
subfunction ff5_10(x)
function y = ff5_10(x) e=sin(pi/12); r=(1-e^2)/(1-e*cos(x)); dr=-r*e*sin(x)/(1-e*cos(x)); %dr=-((1-e^2)*e)*sin(x)/((1-e*cos(x))^2); y=sqrt(r^2+dr^2); end
(2) Romberg Table
Matlab Code:
% Romberg Table - Modified from HW 4-11 for HW 5-10 clear all close all format long clc % integration Range lowlimit=0.; highlimit=2*pi; %exact I (calculated by quad comment with Tol = 10^-11) e=sin(pi/12); F = @(x) sqrt(1-e^2*sin(x).*sin(x)); I = 4*quad(F,0,pi/2,10^-11); tic E_n(1)=1; k=1; I_n(1)= ((highlimit-lowlimit)/2*(ff5_10(lowlimit)+ff5_10(highlimit))); while E_n(k) >= 10^(-10) k=k+1; n=2^(k-1); x(1)=lowlimit; h=(highlimit-lowlimit)/n; for i=1:n/2; x(2*i)=x(1)+(2*i-1)*h; end %make I_n sum=0.; for j=1:n/2; sum=sum+ff5_10(x(2*j)); end I_n(k)=0.5*I_n(k-1) + h*sum; % E_n(k)=abs(I-I_n(k)); %% Richardson Interpolation %% T1=zeros(length(n),1); T2=zeros(length(n),1); for i=1:k-1 % T1(n) Terms T1(i+1)=(4*I_n(i+1)-I_n(i))/(4-1); end for i=1:k-2 % T2(n) Terms T2(i+2)=(4^2*T1(i+2)-T1(i+1))/(4^2-1); end E_n(k)=4*abs(I-T2(k-1)); end toc k n I=I; I_n=I_n E_n(k) T1=4*T1; T2=4*T2; %xlswrite('4_11.xls', I_n, T1, T2); Rombergtable=[I_n' T1' T2']
(3) ClenCurt Integration)
Matlab Code:
% ClenCurt spectral integration (modified from Trefethen p30.m) % Modified from HW 4-11 By Roni Plachta for HW 5-10 % Computation: various values of N needed to get Error % of integration < 1E-10 for (1-e^2*sin(x)^2)^.5 x=0 to x=pi/2 clear all close all format long Nmax = 23; %limits a=0; b=2*pi; %exact I (calculated by quad comment with Tol = 10^-11) e=sin(pi/12); F = @(x) sqrt(1-e^2*sin(x).*sin(x)); I = 4*quad(F,0,pi/2,1E-10); tic for N = 1:Nmax; [x,w] = clencurt(N); clear f; f(N+1,1)=0; % ReScale x = 0.5 * ( ( x + 1.0 ) * a - ( x - 1.0 ) * b ); w = 0.5 * ( b - a ) * w; for i = 1:N+1 f(i,1)= ff5_10(x(i)); end E(N)=0; S(N)=0; for i = 1:N+1 S(N)= S(N)+ (w(i)*f(i)); end E(N) = abs(I-S(N)); end toc xlswrite('5_10_7b.xls', E); S(N)
[edit] Author
Solved and typed by - --Egm6341.s10.Team4.roni 18:25, 24 March 2010 (UTC)
[edit] Problem 11: Derivation of the equation of arclength using the cosine law
[edit] Given
Refer Lecture slide [1] for problem statement
[Figure 1]
where, eccentricity 
[edit] Find
Derive the equation of arclength using triangle OAB and cosine law.
[edit] Solution
Apply the cosine law to triangle OAB in the Figure1 (See Figure 1)
Part
is approximately
For part
Using the other cosine summation law
because, 
In small
approximately,
using this fact,
So, Plug in part(a) and Part(b)
when
is very small, approximately, 
[edit] Author
Solved and typed by - Egm6341.s10.Team4.yunseok 17:01, 24 March 2010 (UTC)
Proof read by - Egm6341.s10.Team4.nimaa&m 16:06, 24 March 2010 (UTC) and --Egm6341.s10.Team4.roni 18:26, 24 March 2010 (UTC)
[edit] Contributing Members
Egm6341.s10.Team4.andy 08:28, 24 March 2010 (UTC) - Author of Problems: 1, 7 ; Proof Read: 5, 3
Egm6341.s10.Team4.riherd 14:19, 24 March 2010 (UTC) - Author of Problem: 6 ; Proof Read: 1, 2
Egm6341.s10.Team4.nimaa&m 16:06, 24 March 2010 (UTC) - Author of Problems: 2, 8 ; Proof Read: 11
Egm6341.s10.Team4.yunseok 17:02, 24 March 2010 (UTC) - Author of Problems: 5, 11
Egm6341.s10.team4.anandankala 12:50, 24 March 2010 (UTC)- Author of problems: 3,9; Proofread:7, 8.
Egm6341.s10.Team4.roni 18:28, 24 March 2010 (UTC) - Author of problems: 4,10; Proofread: 1,11.






![\displaystyle E=[p_2(t).g^{(1)}(t)+p_4(t).g^{(3)}(t)]_{-1}^{+1}-\int\limits_{-1}^{+1} p_5(t).g^{(5)}(t)dt](http://upload.wikimedia.org/wikiversity/en/math/0/5/8/0589d9aea7151d36e3d120d18a4f749e.png)


![E=[p_2(t).g^{(1)}(t)+p_4(t).g^{(3)}(t)]_{-1}^{+1}-\int\limits_{-1}^{+1} p_5(t).g^{(5)}(t)dt](http://upload.wikimedia.org/wikiversity/en/math/7/4/2/74225f7b1dea27509cb769fc39c19ff4.png)



![\Rightarrow D=[uv]_{-1}^{+1}-\int\limits_{-1}^{+1} vdu=[p_6(t).g^{(5)}(t)]_{-1}^{+1}-\int\limits_{-1}^{+1} p_6(t).g^{(6)}(t)dt](http://upload.wikimedia.org/wikiversity/en/math/c/1/4/c14fa84bcd978c985fedf7482afdb1c7.png)




![\Rightarrow F=[p_7(t).g^{(6)}]_{-1}^{+1}-\int\limits_{-1}^{+1} p_7(t).g^{(7)}(t)dt](http://upload.wikimedia.org/wikiversity/en/math/8/b/b/8bb13b404ebe59e5d8024f0cda9915a0.png)































![\displaystyle
E^1_n= \sum_{k=0}^{n-1} \left[ \int_{x_{k}}^{x_{k+1}}f(x)dx-\frac{h}{2} \left\{ f(x_k)+f(x_{k+1}) \right\} \right]](http://upload.wikimedia.org/wikiversity/en/math/5/a/2/5a297fe0f74200f3f6989c058bdcd0d2.png)
![\displaystyle
E=\sum_{r=1}^{\ell} 2 \, \overline{d}_{2r} \, h^{2r-1}\Bigg[f^{(2r-1)}(b)-f^{(2r-1)}(a)\Bigg]-\frac{h^{2\ell}}{2^{2\ell}} \sum_{k=0}^{n-1} \int_{x_k}^{x_{k+1}} \, p_{2\ell}(t_{k}(x)) \, f^{(2\ell)}(x)dx](http://upload.wikimedia.org/wikiversity/en/math/5/3/2/532e7dd673612f1a2897452d6f30d372.png)

![\displaystyle x \in [a,b]](http://upload.wikimedia.org/wikiversity/en/math/d/6/e/d6e84a2a682bda5c2d12b29daf2779f6.png)
![\displaystyle
x(t):=t\frac{h}{2}+\frac{x_k+x_{k+1}}{2}, \, \, \, \, \, \, \, t \in [-1,1]\, \, \,\, \, \, , h:=(b-a)/n](http://upload.wikimedia.org/wikiversity/en/math/1/6/f/16f229fbe16740397de321e2cce79732.png)
![\displaystyle
g_k(t) = f(x(t)) \,\,\,\,\,\,such \,\,\,that\,\,\,\,\,x \in [x_k, x_{k+1}]](http://upload.wikimedia.org/wikiversity/en/math/9/f/4/9f447ba95196424ff778f0d1a60bbc40.png)
![\displaystyle
E^1_n= \frac{h}{2}\sum_{k=0}^{n-1} \left[ \int_{-1}^{+1}g_k(t)dt- \left\{ g_k(-1)+g_k(+1) \right\} \right]](http://upload.wikimedia.org/wikiversity/en/math/c/d/e/cde43310da55b289aeeaedfdd1379be4.png)
![\displaystyle
\begin{align}
E^1_n & = \frac{h}{2} \left[ \sum_{k=0}^{n-1}\Big[p_2(t)g_k^{(1)}(t)+p_4(t)g_k^{(3)}(t_k)+p_6(t)g_k^{(5)}(t)+......+p_{2\ell}(t)g_k^{(2\ell-1)}(t)\Big]_{-1}^{+1}- \sum_{k=0}^{n-1} \left[ \int_{-1}^{1}p_{2\ell}(t)g_k^{(2\ell)}(t) dt \right]\right]\\
&= \frac{h}{2} \left[ \sum_{r=1}^{\ell}\sum_{k=0}^{n-1}\Big[p_{2r}(t)g_k^{(2r-1)}(t)\Big]_{-1}^{+1} - \sum_{k=0}^{n-1} \left[ \int_{-1}^{1}p_{2\ell}(t)g_k^{(2\ell)}(t) dt \right]\right]
\end{align}](http://upload.wikimedia.org/wikiversity/en/math/b/d/5/bd53d201a2a49df4f5640686dbbbbcba.png)
![\displaystyle
\begin{align}
E^1_n &= \frac{h}{2} \left[ \sum_{r=1}^{\ell}\sum_{k=0}^{n-1}\Big[p_{2r}(+1)g_k^{(2r-1)}(+1)-p_{2r}(-1)g_k^{(2r-1)}(-1)\Big]- \sum_{k=0}^{n-1} \left[ \int_{-1}^{1}p_{2l}(t)g_k^{(2\ell)}(t) dt \right]\right]\\
& because \,\,\,\,\,\,p_{2r}(+1)=p_{2r}(-1),\\
&= \frac{h}{2} \left[ \sum_{r=1}^{\ell}\sum_{k=0}^{n-1} p_{2r}(+1) \Big[g_k^{(2r-1)}(+1)-g_k^{(2r-1)}(-1)\Big]- \sum_{k=0}^{n-1} \left[ \int_{-1}^{1}p_{2l}(t)g_k^{(2\ell)}(t) dt\right]\right]
\end{align}](http://upload.wikimedia.org/wikiversity/en/math/3/8/0/380fcc91f956c592dc0dac9ed640a4dc.png)
![\displaystyle
g_k^{(i)}(t)=\left(\frac{h}{2}\right)^if^{(i)}(x(t)),,\,\,\,\,\ x \in [x_k,x_{k+1}]](http://upload.wikimedia.org/wikiversity/en/math/9/7/d/97d151865dc54a151f896f9493f60740.png)

![\displaystyle
\begin{align}
E^1_n & = \left(\frac{h}{2}\right) \left[ \sum_{r=1}^{\ell} p_{2r}(+1) \left(\frac{h}{2}\right)^{2r-1} \sum_{k=0}^{n-1} \Big[f^{(2r-1)}(x_{k+1})-f^{(2r-1)}(x_k)\Big]- \sum_{k=0}^{n-1} \left[ \int_{x_k}^{x_{k+1}}p_{2\ell}(t_k(x))\left(\frac{h}{2}\right)^{2\ell}f^{(2\ell)}(x) dx \right] \right]\\
&= \sum_{r=1}^{\ell} h^{2r} \frac{p_{2r}(+1)}{2^{2r}} \Big[f^{(2r-1)}(x_{n})-f^{(2r-1)}(x_0)\Big]- \left(\frac{h}{2}\right)^{2\ell+1} \sum_{k=0}^{n-1} \left[ \int_{x_k}^{x_{k+1}}p_{2\ell}(t_k(x))f^{(2\ell)}(x) dx \right]
\end{align}](http://upload.wikimedia.org/wikiversity/en/math/3/9/4/394982df5f335f7bcc977af268392e97.png)

![\displaystyle
E^1_n = \sum_{r=1}^{\ell} h^{2r} \overline{d}_{2r} \Big[f^{(2r-1)}(b)-f^{(2r-1)}(a)\Big]- \underbrace{\left(\frac{h}{2}\right)^{2\ell+1}}_{(?)} \sum_{k=0}^{n-1} \left[ \int_{x_k}^{x_{k+1}}p_{2\ell}(t_k(x))f^{(2\ell)}(x) dx \right]](http://upload.wikimedia.org/wikiversity/en/math/b/a/1/ba1a933f9d1ee73e5103b38e659c2da8.png)

![\displaystyle
E_n^1=\frac{h}{2} \sum_{k=0}^{n-1} \left[ \underbrace{\int_{-1}^{1}g_k(t)dt-(g_k(-1)+g_k(+1))}_{E}\right]](http://upload.wikimedia.org/wikiversity/en/math/3/8/6/3861c92d4184cee8cc226d5b8839d7d1.png)


![\displaystyle
\begin{align}
\Rightarrow E &=\int_{-1}^{1}\underbrace{(-t)}_{p_{1}(t)}g_k^{(1)}(t)dt \\
&= \left[p_2(t)g_k^{(1)}(t) \right]_{-1}^{+1} - \int_{-1}^{+1}p_2(t)g_k^{(2)}(t)dt
\end{align}](http://upload.wikimedia.org/wikiversity/en/math/0/f/5/0f5686352cd98ea6c3b01da73275f495.png)
![\displaystyle
E = \left[p_2(t)g_k^{(1)}(t)-p_3(t)g_k^{(2)}(t)+p_4(t)g_k^{(3)}(t)-p_5(t)g_k^{(4)}(t)+p_6(t)g_k^{(5)}(t)+ \cdots +p_{\ell}(t)g_k^{(\ell-1)}(t)\right]_{-1}^{+1} - \int_{-1}^{1}p_{\ell}(t)g_k^{(\ell)}(t) dt](http://upload.wikimedia.org/wikiversity/en/math/b/4/6/b461e9f5a22368932ab38a61cb59e1e6.png)








![\displaystyle
\begin{align}
E & = \left[-p_3(t)g_k^{(2)}(t)-p_5(t)g_k^{(4)}(t)-p_7(t)g_k^{(6)}(t)\cdots\cdots-p_{(2\ell-1)}(t)g_k^{(2\ell-2)}(t)\right]_{-1}^{+1} + \int_{-1}^{1}p_{(2\ell-1)}(t)g_k^{(2\ell-1)}(t) dt \\
& = \sum_{r=2}^{\ell} \left[ -p_{(2r-1)}g_k^{(2r-2)}\right]_{-1}^{+1} + \int_{-1}^{1}p_{(2\ell-1)}(t)g_k^{(2\ell-1)}(t) dt \\
& = \sum_{r=2}^{\ell} \left[ -p_{(2r-1)}(1)g_k^{(2r-2)}(1) + p_{(2r-1)}(-1)g_k^{(2r-2)}(-1)\right] + \int_{-1}^{1}p_{(2\ell-1)}(t)g_k^{(2\ell-1)}(t) dt \\
\end{align}](http://upload.wikimedia.org/wikiversity/en/math/d/7/1/d714d383eb51d7e93c525b3bfe51606e.png)
![\displaystyle
E = \sum_{r=2}^{\ell} p_{(2r-1)}(-1) \left[ g_k^{(2r-2)}(1) + g_k^{(2r-2)}(-1)\right] + \int_{-1}^{1}p_{(2\ell-1)}(t)g_k^{(2\ell-1)}(t) dt](http://upload.wikimedia.org/wikiversity/en/math/b/8/e/b8e010e055be2ee3519e1ed538383770.png)

![\displaystyle
g_k^{(i)}(t)=\left(\frac{h}{2}\right)^if^{(i)}(x(t)); \ \ \ \ \ x \in [x_k,x_{k+1}]](http://upload.wikimedia.org/wikiversity/en/math/1/0/f/10f47ed2d50e4d7948290002c7b671f1.png)

![\displaystyle
E = \sum_{r=2}^{\ell}\left[ \left(\frac{h}{2}\right)^{(2r-2)} p_{(2r-1)}(-1) \Big[ f^{(2r-2)}(x_{k+1}) + f^{(2r-2)}(x_{k})\Big] \right] + \left(\frac{h}{2}\right)^{(2\ell-1)} \int_{x_k}^{x_{k+1}}p_{(2\ell-1)}(t_k(x))f^{(2\ell-1)}(x) dx](http://upload.wikimedia.org/wikiversity/en/math/9/a/7/9a72c2bcf36ab015a3897c1bccb4a884.png)

![\displaystyle
\begin{align}
E_n^1 &= \sum_{r=2}^{\ell}\left[ \left(\frac{h}{2}\right)^{(2r-1)} p_{(2r-1)}(-1) \sum_{k=0}^{n}\Big[ f^{(2r-2)}(x_{k+1}) + f^{(2r-2)}(x_{k})\Big] \right] + \left(\frac{h}{2}\right)^{(2\ell)} \sum_{k=0}^{n} \left [\int_{-1}^{1}p_{(2\ell-1)}(t_k(x))f^{(2\ell-1)}(x) dx \right ] \\
& = \sum_{r=2}^{\ell}\left[ \left(\frac{h}{2}\right)^{(2r-1)} p_{(2r-1)}(-1) \Big[ \underbrace{f^{(2r-2)}(x_n) + f^{(2r-2)}(x_{n-1}) + \cdots \cdots + f^{(2r-2)}(x_{0})}_{\beta}\Big] \right] + \left(\frac{h}{2}\right)^{(2\ell)} \sum_{k=0}^{n} \left [\int_{-1}^{1}p_{(2\ell-1)}(t_k(x))f^{(2\ell-1)}(x) dx \right ]
\end{align}](http://upload.wikimedia.org/wikiversity/en/math/e/2/6/e26e349d47c5826af0b7b150290983b2.png)





















and cn=-1, cd=1.
and
, which give the new values of c after every iteration.
and
where cn= [-1 1] and cd= [1 6].

![C \approx \pi \left[3(a+b) - \sqrt{(3a+b)(a+3b)}\right]= \pi(3(a+b)-\sqrt{10ab+3(a^2+b^2)})](http://upload.wikimedia.org/wikiversity/en/math/a/c/a/aca11e2cbf83386931c1751c515b4f54.png)


![d\ell=d\theta \left[ r^2+ \left( \frac{dr}{d\theta}\right)^2\right]^{\frac{1}{2}}](http://upload.wikimedia.org/wikiversity/en/math/0/3/f/03faaf24f13dc4011d8b4d7e5850e5dd.png)




![\displaystyle dl = \sqrt{\underbrace{\Big[r(\theta) - r(\theta+d\theta)\Big]^2}_{(a)} + 2r(\theta)r(\theta+d\theta)\underbrace{(1-\cos(d\theta))}_{(b)}}\,](http://upload.wikimedia.org/wikiversity/en/math/a/3/b/a3b17b9f9ef5587f039a6f8584b23d00.png)









