Problem 1: Determination of leading coefficients of polynomials
[edit | edit source]
P. 26-3
To show that the value of the constants and in the polynomials and
From page 26-2, we know that:
We select such that it is a odd function and
Therefore, using , we get:
|
(1)
|
Similarly, using , we get:
|
(2)
|
Egm6341.s10.team2.lee 08:58, 24 March 2010 (UTC)
proofread --Egm6341.s10.team2.niki 14:53, 24 March 2010 (UTC)
P. 27-1
Continue the proof of Trapezoidal Rule Error to steps 4a and 4b and determine and
From steps 3a and 3b( P.26-3) we get the expression
|
(P.26-3)
|
|
(P.26-3)
|
|
|
where,
|
|
where,
Selecting such that
,we get
|
|
--Egm6341.s10.team2.niki 22:04, 23 March 2010 (UTC)
--Proofread by Egm6341.s10.team2.lee 10:14, 26 March 2010 (UTC)
Problem 3: Expression of as function of
[edit | edit source]
find on P. 27-1
From Page 27-1, we know:
Now rearranging the terms on both sides to write in terms of , we get:
where the size of the interval,
It can also be easily verified by substituting which yields
Also when yields
Srikanth Madala (SM)
Problem 4: Evaluation of which can be used to calculate the coefficients of the even power euler-maclaurin error series for trapezoidal rule
[edit | edit source]
P. 27-2
Find the values of and
Clue: Use the formula:
We know from the formula:
From Mtg 26,slide 26-1, we know the formula:
|
(1)
|
From Mtg 26,slide 26-3, we know the formula:
|
(2)
|
From problem 2 on this HW , where we deduced that:
|
(3)
|
--Srikanth Madala 01:44, 24 March 2010 (UTC) Srikanth Madala (SM)
Problem 5: Derivation of the Error of the Trapezoidal Rule
[edit | edit source]
P. 28-2 derive
Derive the Following Equation for the error of the trapezoidal rule:
The Following Equation is to be derived:
Since is an even function then:
With this property then A can be rewritten as follows:
A transformation of variable is needed from 't' to 'x' and is as follows:
With this transformation A can be rewritten as follows:
The Following is then defined:
as discussed in [28-2] of the lectures.
A is then rewritten as follows:
The Next Step is to simplify the term 'B'
Using the previously mentioned transformation of variable the following can be stated:
With the previously performed simplifications the following is written:
This is recognized as the Error for the trapezoidal rule.
--Egm6341.s10.Team2.GV 22:09, 25 March 2010 (UTC)
--Proofread by Egm6341.s10.team2.lee 10:13, 26 March 2010 (UTC)
Problem 6: Derivation of terms using Taylor expansion of the hyperbolic function
[edit | edit source]
P. 28-2 bernoulli nos
Egm6341.s10.team2.lee 10:12, 26 March 2010 (UTC)
Problem 7: Understanding the derivation of the proof of Trapezoidal Error
[edit | edit source]
P. 28-2
Redo steps in the proof of the Trapezoidal Rule error by trying to cancel terms with odd order derivatives of "g"
We begin with equation (5) on P. 21-1 which is the result of transformation of variables on equation (1) P. 21-1
(Prob 4 HW4) (P. 21-1)
|
(5) on P.21-1
|
From Prob 5 HW4, we can express the above equation as:
|
(1)
|
Integrating the term withing the square brackets by "Integration by parts" Prob 7 HW4 we can rewrite (1) as follows
|
(2)
|
In order to eliminate terms with even powers of we need to remove terms with odd derivatives of .Therefore, the boundary term in eqn (2) above must be set to zero by selection of .
We have from eqns (1 and 2)P. 21-3
|
(1)p21-3
|
|
(2)p21-3
|
Setting gives and hence we get
|
(3)
|
So following this method, the next term to be eliminated will have P4(t)
|
(4)
|
Setting and solving we get .Continuing on these lines we get the eqn (2) in the form
|
(5)
|
Dropping all the terms with odd order derivatives of we get
|
(6)
|
In general on integrating "m" times we get:
|
(7)
|
manipulating the terms yields,
|
(8)
|
Transforming g(t) back to f(x) we get [see [prob 6 HW4]
|
(9)
|
Since the polynomial is odd, it can be extracted out to give the eqn in the form
|
(9)
|
The problem with this formula is evident at first sight, from this expression.The HO derivatives add up in the first term of the expression and since they will not cancel out (9) cannot be reduced to a simpler form. To see the difference in the two approaches more clearly we compare the equations from the two methods. From (1) P. 27-1 we have
|
(10)
|
|
(9)
|
Comparing the eqns 9 and 10 we see that the first term on 9 has a summation of HO derivatives at different points in the square brackets as opposed to 10 which has the difference of the higher order derivative at only the end points.
In this lies the difference of the two methods. 10 is general and easier to apply as we need to evaluate the differential of F(x) at only the end points while 9 is computationally cumbersome since it needs the derivative evaluated at all points.
--Egm6341.s10.team2.niki 14:52, 24 March 2010 (UTC)
Problem 8: Calculating the coefficients and the pairs of polynomials using the Recurrence formula
[edit | edit source]
P. 29-3
Use the recurrence formula on P.29-2 to obtain the coefficients and expressions of the pairs of polynomials
We know the recurrence formulae:
Since all the polynomials are odd functions and are set to zero at +1 and -1, we have:
similarly,
Now evaluating the polynomials using the coefficients:
Similarly,
Srikanth Madala (SM)
To write a explanatory commentary on kessler's Matlab code for the evaluation of polynomials and their coefficients in the Trapezoidal error P. 30-2
Matlab 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; %defining variables 'f,g,cn and cd'
cn=-1; cd=1;
for k=1:n %beginning of 'for' loop with 'n' as the input value of 'traperror' function
f=f.*g.*(g+1); %reassigning the value of f by using element-wise multiplication of matrix f,g
[newcn,newcd]=fracsum(-1*cn,cd.*f); %calling the function 'fracsum' and passing the arguments n=-1*cn and d=cd.*f to the function fracsum(n,d).
%The function fracsum returns the values [nsum,dsum] which are stored in [newcn,newcd]
cn=[cn;newcn]; cd=[cd;newcd]; % the 'cn' (numerator of the coefficient) and 'cd' (denominator of the coefficient) values are reassigned in
%the execution of the For loop. In each iteration of the for loop, the new values of 'cn' and 'cd' matrices are incremented by one additional
%column element 'newcn' and 'newcd' respectively
f=[f;1]; %the 'f' matrix is incremented by an additional column element=1, in each iteration of the for loop
g=[2+g(1);g]; % the 'g' matrix is incremented by an additional column element=even number, in each iteration of the for loop
[newpn,newpd]=fracsum((g-1).*cn,f.*cd);%calling the function 'fracsum' and passing the arguments n=(g-1).*cn and d=f.*cd to the function fracsum(n,d).
%The function fracsum returns the values [nsum,dsum] which are stored in [newpn,newpd]
pn(k,1)=newpn; % each numerator element of the polynomial function is stored in a column matrix with 'k' rows
pd(k,1)=newpd; % each denominator element of the polynomial function is stored in a column matrix with 'k' rows
end % end of for loop to check and see if k=n?
c=int64([cn cd]); % converts the numerator and denominator of the coefficient to signed 64-bit integers
p=int64([pn pd]); % converts the numerator and denominator of the polynomial function to signed 64-bit integers
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [nsum,dsum]= fracsum(n,d) %the arguments 'n' and 'd' are passed to this function and the output of this function are 'nsum' and 'dsum'
div=gcd(round(n),round(d)); %'round' is a matlab function to rounding off the fraction to the nearest integer and 'gcd' is a matlab function that
%returns the greatest common divisor of round(n) and round(d). This value of gcd is stored in a variable 'div'
n=round(n./div); % 'n' matrix is reassigned by carrying out element wise division with 'div' and then rounding off
d=round(d./div); % 'd' matrix is reassigned by carrying out element wise division with 'div' and then rounding off
dsum=1; % a new variable 'dsum' is initially assigned a value of 1
for k=1:length(d) % a new 'for' loop is started
dsum=lcm(dsum,d(k)); %'lcm' is a matlab function that returns the lowest common multiple of the values in the parentheses and in this case dsum and d(k)
end % end of for loop to check and see if k=length(d)?
nsum=dsum*sum(n./d); %'nsum' variable is defined by carrying out the arithemetic operation between 'dsum' and sum(n./d)
div=gcd(round(nsum),round(dsum)); %'div' is reassigned a different value which is the GCD of rounded values of 'nsum' and 'dsum'
nsum=nsum/div; %'nsum' is redefined
Srikanth Madala (SM)
Problem 10: Calculating the Circumference of an ellipse
[edit | edit source]
P. 30-4
An Ellipse as given:
where:
Calculate the Circumference of the elipse as follows:
Method 1:
Method 2:
The Circumference will be calculated by using the following:
And then integrated numerically using 3 methods:
- Composite Trapezoidal
- Clencurt
- Romberg Table
The approximation for the exact integral was calculated using the "quad" Matlab command. It was approximated to be 6.176517851674653
Composite Trapezoidal Rule
|
n
|
Value
|
Error
|
2
|
6.283099768855828
|
0.106581917181175
|
4
|
6.169238034994176
|
0.007279816680477
|
8
|
6.176493841410109
|
2.401026454457167e-005
|
16
|
6.176517900218237
|
4.854358426342742e-008
|
Matlab code for composite Trapezoidal calculation
%Calculates the Integral using the Composite Trapezoidal Rule
function [I,E]=circompos(a,b,n)
h=(b-a)/n;
pi2=2*pi();
i=0;
Itot=0;
It=0;
It2=0;
%Function elarc calculates the value of the function of the integral as seen in the code below
while i<=n
if i==0
Itot1=(1/2)*elarc(a);
else if i<n
u=h*i;
It(i)= elarc(u);
else
It2=(1/2)*elarc(b);
end
end
Itot=Itot1+sum(It)+It2;
i=i+1;
end
I=Itot*(h);
%Error Calculation compared to built in 'quad' matlab command
Ir=quad(@elarc,0,pi2);
E=Ir-I;
Matlab code for calculation of the integrand
function arc = elarc(t)
%Finding the Circumference of an ellipse
%C=integral(dl) from 0 to 2PI
e=sin(pi()/12);
e2=e^2;
r=(1-.0670)./(1-e.*cos(t));
dr2=(118270190867084615574681258512889*sin(t).^2)./(2028240960365167042394725128601600*((291404338770025.*cos(t))./1125899906842624 - 1).^4);
%Integrand:
arc=(r.^2 + (dr2) ).^(.5);
Clencurt Function
|
Value
|
Error
|
6.176517900218237
|
4.854358426342742e-008
|
Matlab code
[xx,ww] = clencurt(n); %Calls the clencurt function
xx=pi+xx.*pi;
ww=ww.*pi;
F=elarc(xx); %Evaluation of the function
I_cl=ww*F
I=6.176517851674653;
E=abs(I_cl-I)
function arc = elarc(t)
%Finding the Circumference of an ellipse
%C=integral(dl) from 0 to 2PI
e=sin(pi()/12);
e2=e^2;
r=(1-.0670)./(1-e.*cos(t));
dr2=(118270190867084615574681258512889*sin(t).^2)./(2028240960365167042394725128601600*((291404338770025.*cos(t))./1125899906842624 - 1).^4);
%Integrand:
arc=(r.^2 + (dr2) ).^(.5);
Romberg Table for n=16
6.176517900218236 6.176517900385847 6.176517900341150 6.176517900343991 6.176517900343945 6.176517900343941
6.176517900343945 6.176517900343943 6.176517900343947 6.176517900343945 6.176517900343941 0
6.176517900343944 6.176517900343946 6.176517900343945 6.176517900343941 0 0
6.176517900343946 6.176517900343946 6.176517900343941 0 0 0
6.176517900343946 6.176517900343942 0 0 0 0
6.176517900343943 0 0 0 0 0
Error of Romberg Table
-0.485435833752490 -0.487111941893659 -0.486664966103945
-0.486692917078813 -0.486692899315244 -0.486692934842381
-0.486692908197028 -0.486692925960597 -0.486692917078813
-0.486692925960597 -0.486692925960597 -0.486692881551676
-0.486692925960597 -0.486692890433460 0
-0.486692899315244 0 0
Columns 4 through 6
-0.486693378931591 -0.486692917078813 -0.486692881551676
-0.486692917078813 -0.486692881551676 0
-0.486692881551676 0 0
0 0 0
0 0 0
0 0 0
Romberg Table Results
|
Value
|
Error
|
6.176517900343941
|
4.86692881551676e-008
|
Matlab code
%The Function outputs the romberg table and a table with the error, the
%inputs are a=low boundary b=high boundary n=initial number of integration
%points for the romberg table
function [table,etable] = elarcromb(a,b,n)
tic
table=zeros(6,6);
%Generate 1st column of Romberg Table using built in composite trapezoidal
%function. Notice it calls the function 'Valus' which obtains the values
%for the function. The function is also corrected at initial point 0
for j=1:6
r=n;
x=linspace(a,b,r+1);
FX=elarc(x);
%FX(1)=1; %because of 0 start point
table(j,1)=trapz(x,FX);
n=2*r;
end
%Generate 2nd column of Romberg Table
for j=1:5
table(j,2)= ([(2^2)*table(j+1,1)] - [table(j,1)])/(2^2 - 1);
end
%Generate 3rd column of Romberg Table
for j=1:4
table(j,3) = ([(2^(2*2))*table(j+1,2)] - table(j,2))/(2^(2*2)-1);
end
%Generate 4th column of Romberg Table
for j=1:3
table(j,4) = ([(2^(2*3))*table(j+1,3)] - table(j,3))/(2^(2*3)-1);
end
%Generate 5th Column of Romberg Table
for j=1:2
table(j,5) = ([(2^(2*4))*table(j+1,4)] - table(j,4))/(2^(2*4)-1);
end
%Generate 6th column of Romberg Table
table(1,6) = ([(2^(2*5))*table(2,5)] - table(1,5))/(2^(2*5)-1);
%Table of errors for the Romberg Table
etable=zeros(6,6);
pi2=2*pi();
I=quad(@elarc,0,pi2); %Value found using Quad function of Matlab
%1st column
for i=1:6
etable(i,1)= I - (table(i,1));
end
%2nd column
for i=1:5
etable(i,2)= I - (table(i,2));
end
%3rd column
for i=1:4
etable(i,3)= I - (table(i,3));
end
%4th Column
for i=1:3
etable(i,4)= I - (table(i,4));
end
%5th column
for i=1:2
etable(i,5)= I - (table(i,5));
end
%6th Column
etable(1,6) = I - (table(1,6));
toc
The integral is calculated using 3 methods:
- Composite Trapezoidal
- "Clencurt" Matlab Command
- Romberg Table
It will then by used to find the circumference as previously stated.
Composite Trapezoidal Rule
|
n
|
Value
|
Error
|
2
|
1.538588738571503
|
0.001739607794329
|
4
|
1.537280664642864
|
4.315338656908363e-004
|
8
|
1.536956805756325
|
1.076749791522058e-004
|
16
|
1.536855855380622
|
6.724603448970967e-006
|
1.536876035753892 1.536849128589532 1.536849129666574 1.536849129666558 1.536849129666558 1.536849129666558
1.536855855380622 1.536849129599258 1.536849129666558 1.536849129666558 1.536849129666558 0
1.536850811044599 1.536849129662352 1.536849129666558 1.536849129666558 0 0
1.536849550007914 1.536849129666295 1.536849129666558 0 0 0
1.536849234751700 1.536849129666542 0 0 0 0
1.536849155937831 0 0 0 0 0
Both Methods yield similar but not equal results. Also it is noted that the error associated with method 1 is less than that of method 2
--Egm6341.s10.Team2.GV 22:07, 25 March 2010 (UTC)
Problem 11: Derivation of infinitesimal arc length using the Law of cosine
[edit | edit source]
Derive the infinitesimal arc length using the Law of cosine
Egm6341.s10.team2.lee 08:57, 24 March 2010 (UTC)
Solved problems 4 and 9. Proofread 5,10--Srikanth Madala (SM)
Solved problem 2 and 7. Proofread 1,3,8,10--Egm6341.s10.team2.niki| Niki Nachappa (NN) 17:17, 24 March 2010 (UTC)
Proofread problems 3, 8, 11--Egm6341.s10.team2.patodon 20:57, 24 March 2010 (UTC)
Solved problems 5 and 10. Proofread 1, 4, 11 --Egm6341.s10.Team2.GV 22:14, 25 March 2010 (UTC)
Solved problems 1,6, 11. Proofread 2, 7, 9 --Egm6341.s10.team2.lee 16:28, 26 March 2010 (UTC)
Problem Assignments
|
Problem #
|
Solution
|
Reviewed
|
Problem 1
|
JP
|
NN,GV
|
Problem 2
|
NN
|
PO,JP
|
Problem 3
|
PO
|
SM,NN
|
Problem 4
|
SM
|
GV,PO
|
Problem 5
|
GV
|
JP,SM
|
Problem 6
|
JP
|
PO,GV
|
Problem 7
|
NN
|
SM,JP
|
Problem 8
|
PO
|
GV,NN
|
Problem 9
|
SM
|
JP,PO
|
Problem 10
|
GV
|
NN,SM
|
Problem 11
|
JP
|
PO,GV
|