University of Florida/Egm6341/s10.Team2/HW2

From Wikiversity
Jump to navigation Jump to search

Problem-1: Expressions for co-efficients of second degree Newton-Cotes integration polynomial[edit | edit source]

P. 9-1 of Lecture 9 Notes

Problem Statement[edit | edit source]

Using the following equations find the expressions for in terms of and where i=0,1,2′′

(1 p8-3)

(3 p8-3)

Solution[edit | edit source]

We have the general formula for the Lagrange basis function as

(2 p7-3)

for the case of Simple Simpson's Rule, n =2 i.e i=0,1,2. For the given interval

Expanding equation 3 p8-3 we get:




Thus we have the polynomial as

Grouping coefficients of ,

Comparing this equation with eqn 1p8-3 we see that




Inference: This solution essentially shows the equivalence of the two methods for the Simpson's rule i.e. cubic polynomial and using Lagrange basis functions.

Solution for problem 1:Egm6341.s10.team2.niki 00:18, 8 February 2010 (UTC)

Proofread problem 1: Srikanth Madala 07:04, 11 February 2010 (UTC)

Problem-2: Application of Newton-Cotes method to derive the simple Simpson's rule[edit | edit source]

P. 9-1 of Lecture 9 Notes

Problem Statement[edit | edit source]

Derive the simple Simpson's rule using Eq.(4) on slide 8-3 Lecture-8 notes i.e. the second degree polynomial of Newton-Cotes method:

Solution[edit | edit source]

But we know that

So we get the values of and as follows:

But we know that or

Similarily by substituting the value of in the equations of and , we get:

Now plugging back the values of and in the Equation for , we get:

Now isolating the terms, terms and constant terms, we get three consolidated terms as follows:

Term-1: -term

Integrating this term between limits and , we get:

Term-2: -term

Integrating this term between limits and , we get:

Term-3: Constant term

Integrating this term between limits and , we get:

Note that

Now consolidating the coefficients of in all the three terms, we get:

Consolidated Coefficient of as:

Consolidated Coefficient of as:

Consolidated Coefficient of as:

Now the value of is the sum of all the consolidated coefficient multiplied by their respective term. i.e.


Thus, the simple Simpson's rule is derived using the Lagrange polynomial of second degree.

Solution for problem 2: Srikanth Madala 07:04, 11 February 2010 (UTC)

Proofread problem 2:

Problem-3: Study of Newton-Cotes method of numerical integration with the help of an example[edit | edit source]

Problem Statement[edit | edit source]

P.9-2 of Lecture 9 Notes

For the function:

on the interval between 0 and 1 and letting

Consider: n=1,2,4,8,16.

1) Construct

Plot Fn for n=1,2,4,8,16

2) Compute the integral for n=1,2,4,8 and compare to I=1.3179022

3) for n=4 plot:

1: Calculation of Function[edit | edit source]

For n=1

For n=2

For n=4

For n=8

For n=16

2:Integral Comparison[edit | edit source]

Integrals using Newton Cotes
Actual Value 1.3179022
n Estimated Value Percent Difference
n=1 1.35915 3.12981%
n=2 1.318008 .00802791%
n=4 1.318009 .00810379%
n=8 1.31790215 3.7939E-6

3: Lagrange Polynomial Plots[edit | edit source]


The plots for l3 and l4 (3rd and 4th Lagrange Polynomial) are not necessary to be plotted as their graph are symmetrical to one another (a mirror image of the l0 and l1 polynomials).

Solution for problem 3: Guillermo Varela

Problem-4: Simple to composite Simpson's rule[edit | edit source]


Solution for problem 4: Egm6341.s10.team2.lee 18:48, 7 February 2010 (UTC)

Proofread problem 4:

Problem-5: Error Bound[edit | edit source]

Refer to P. 11-1 on Lecture-11 Notes

Problem Statement[edit | edit source]

Find if:

For and

Solution[edit | edit source]

Constructing the Lagrangian Interpolating Function:


The Lagrangian Error

By Computing

Must plot the functions to compute

The Taylor Series Error





Solution for problem 5:Egm6341.s10.team2.patodon 21:43, 10 February 2010 (UTC)

Proofread problem 5:

Problem 6: derivative of Lagrange Interpolation Error[edit | edit source]

P. 12-2 reference: Lecture-12 Notes

Problem Statement[edit | edit source]

For the Lagrange Interpolation Error verify the following:


Solution[edit | edit source]

We can write the Lagrange Interpolation error as

differentiating the above expression once we get

differentiating the expression (n+1) times we get

But since is a polynomial of degree n the (n+1)th derivative is zero


Solution for problem 6: Egm6341.s10.team2.niki 00:20, 8 February 2010 (UTC)
Proofread problem 6:

Problem-7: Intermediate step in the proof of Error in Newton Cotes method[edit | edit source]

P. 12-3 (top); reference: Lecture-12 Notes

Problem Statement[edit | edit source]

To Prove that the derivative of is

Solution[edit | edit source]

We know that by definition is:

Expanding the above terms in the product, we get:

We see that the above expression is a degree polynomial in

Let it be expressed as:

Note that here the coefficient of is 1. As we successively differentiate the term times, all the lower degree terms that are less than vanish. Therefore, we are concerned only about the degree term i.e. as we successively differentiate the equation.

Thus, we proved that the derivative of is

Solution for problem 7: Egm6341.s10.team2.madala 11:58, 8 February 2010 (UTC)

Proofread problem 7:

Problem-8: Geometric Interpretation of G(x) Error for Log(x)[edit | edit source]


Problem Statement[edit | edit source]



1) A graph of and

2) A plot of the Lagrange Polynomial when i=3

3) A plot of when n=6

Part 1[edit | edit source]

The Lagrange Interpolation Function is as follows:

The plot is as follows:


Part 2[edit | edit source]

The Lagrange Polynomial is as follows:

The plot as follows: Egm6341.s10.Team2.Hw2problem82.jpg

Part 3[edit | edit source]

The Plot as Follows:


Solution for problem 8:

Proofread problem 8: Srikanth Madala 07:04, 11 February 2010 (UTC)

Problem-9: Error in simple Trapezoidal rule[edit | edit source]


Solution for problem 9: Egm6341.s10.team2.lee 20:48, 9 February 2010 (UTC)

Proofread problem 9:

Problem 10: Simple Simpson's Rule Error[edit | edit source]

P. 13-2

Problem Statement[edit | edit source]

Show that the Error for the simple simpson's rule is:

Solution[edit | edit source]

The error can be written:


The Integral can be evaluated as follows:

After algebraic manipulation and simplification the following is obtained:

which reduces to:

This result is used in the error function to yield:

Solution for problem 10: Guillermo Varela

Problem 11:To show that Simpson's rule can be used to integrate a cubic polynomial exactly[edit | edit source]

P. 13-3, reference: Lecture-13 Notes

Problem Statement[edit | edit source]

Given the polynomial where determine the exact integral and the integral using Simpson's Rule

Solution[edit | edit source]

Case A: Determination of Exact Integral[edit | edit source]


Case B: Using Simple Simpson's rule[edit | edit source]

We have the Simple Simpson's rule as

(2 p7-2)


we know substituting we get


Conclusion[edit | edit source]

From the above we see that which proves that the Simpsons rule can integrate a cubic polynomial exactly

Solution for problem 11: Egm6341.s10.team2.niki 00:23, 8 February 2010 (UTC)

Proofread problem 11:

Problem-12: Differentiation of a definite integral[edit | edit source]


Solution for problem 12:Egm6341.s10.team2.lee 20:54, 9 February 2010 (UTC)

Proofread problem 12:

Problem-13: Intermediate step in proving the tight error bound of the Simpson's rule[edit | edit source]


Solution for problem 13: Egm6341.s10.team2.lee 20:47, 9 February 2010 (UTC)

Proofread problem 13: Srikanth Madala 07:04, 11 February 2010 (UTC)

Problem-14: An intermediate step in the proof of tight error bound of the simple Simpson's rule[edit | edit source]

P. 15-2 (bottom), Refer: Lecture-15 Notes

Title[edit | edit source]

To Prove that: which is an intermediate step in the proof of tight error bound of simple Simpson's rule

Solution[edit | edit source]

We know by the definition

Differentiating with respect to 't', we get:

Again Differentiating with respect to 't', we get:

Again Differentiating with respect to 't', we get:

Thus Proved.

Solution for problem 14: Srikanth Madala 07:04, 11 February 2010 (UTC)

Proofread problem 14:

Problem-15: Relationship between [edit | edit source]

P. 15-3 on Lecture-15 Notes

Problem Statement[edit | edit source]


Solution[edit | edit source]


The next step is to substitute h, and manipulate the equations as follows:

It is then seen that the relation between must be:

Solution for problem 15:

Proofread problem 15:

Problem 16: Illustration of Runge Phenomenon[edit | edit source]

P. 16-1 on Lecture-16 Notes

Problem Statement[edit | edit source]

Given data:
To find:

  1. Using Newton-Cotes for find the numerical integral , and find Exact Integral also for comparison
  2. Plot for selected values of
  3. Plot vs and prove that the value of does not converge with increasing value of
  4. Prove that the weights for are not all positive and plot the for with

Solution[edit | edit source]

1. From the below Matlab code, we generate the values of and various values of as tabulated below:

Integrals using Newton Cotes
Exact Integral value (I i.e 'IE' in Matlab code) 2 Arctan(5)=2.7468
n Numerical Integral Value (I_{n} i.e 'I' in Matlab code) Percent Difference
n=1 0.3846 614.1684
n=2 6.7949 -59.5754
n=3 2.0814 31.9659
n=4 2.3740 15.7033
n=5 2.3077 19.0281
n=6 3.8704 -29.0314
n=7 2.8990 -5.2499
n=8 1.5005 83.0604
n=9 2.3986 14.5160
n=10 4.6733 -41.2235
n=11 3.2448 -15.3469
n=12 -0.3129 -977.7504
n=13 1.9198 43.0777
n=14 7.8995 -65.2284
n=15 4.1556 -33.9006

2. We already know that:

And from Matlab code below we know that:

Failed to parse (Conversion error. Server ("") reported: "Cannot get mml. upstream request timeout"): {\displaystyle \;f_{12}(x)=-1/130*(-6/5*y-5)*(-3/5*y-2)*(-2/5*y-1)*(-3/10*y-1/2)*(-6/25*y-1/5)*y*(-6/35*y+1/7)*(-3/20*y+1/4)*(-2/15*y+1/3)*(-3/25*y+2/5)*(-6/55*y+5/11)*(-1/10*y+1/2)-216/16525*(6/5*y+6)*(-6/5*y-4)*(-3/5*y-3/2)*(-2/5*y-2/3)*(-3/10*y-1/4)*y*(-1/5*y+1/6)*(-6/35*y+2/7)*(-3/20*y+3/8)*(-2/15*y+4/9)*(-3/25*y+1/2)*(-6/55*y+6/11)-27/1090*(3/5*y+3)*(6/5*y+5)*(-6/5*y-3)*(-3/5*y-1)*(-2/5*y-1/3)*y*(-6/25*y+1/5)*(-1/5*y+1/3)*(-6/35*y+3/7)*(-3/20*y+1/2)*(-2/15*y+5/9)*(-3/25*y+3/5)-8/145*(2/5*y+2)*(3/5*y+5/2)*(6/5*y+4)*(-6/5*y-2)*(-3/5*y-1/2)*y*(-3/10*y+1/4)*(-6/25*y+2/5)*(-1/5*y+1/2)*(-6/35*y+4/7)*(-3/20*y+5/8)*(-2/15*y+2/3)-27/170*(3/10*y+3/2)*(2/5*y+5/3)*(3/5*y+2)*(6/5*y+3)*(-6/5*y-1)*y*(-2/5*y+1/3)*(-3/10*y+1/2)*(-6/25*y+3/5)*(-1/5*y+2/3)*(-6/35*y+5/7)*(-3/20*y+3/4)-216/305*(6/25*y+6/5)*(3/10*y+5/4)*(2/5*y+4/3)*(3/5*y+3/2)*(6/5*y+2)*y*(-3/5*y+1/2)*(-2/5*y+2/3)*(-3/10*y+3/4)*(-6/25*y+4/5)*(-1/5*y+5/6)*(-6/35*y+6/7)+(1/5*y+1)*(6/25*y+1)*(3/10*y+1)*(2/5*y+1)*(3/5*y+1)*(6/5*y+1)*(-6/5*y+1)*(-3/5*y+1)*(-2/5*y+1)*(-3/10*y+1)*(-6/25*y+1)*(-1/5*y+1)+216/305*(6/35*y+6/7)*(1/5*y+5/6)*(6/25*y+4/5)*(3/10*y+3/4)*(2/5*y+2/3)*(3/5*y+1/2)*y*(-6/5*y+2)*(-3/5*y+3/2)*(-2/5*y+4/3)*(-3/10*y+5/4)*(-6/25*y+6/5)+27/170*(3/20*y+3/4)*(6/35*y+5/7)*(1/5*y+2/3)*(6/25*y+3/5)*(3/10*y+1/2)*(2/5*y+1/3)*y*(6/5*y-1)*(-6/5*y+3)*(-3/5*y+2)*(-2/5*y+5/3)*(-3/10*y+3/2)+8/145*(2/15*y+2/3)*(3/20*y+5/8)*(6/35*y+4/7)*(1/5*y+1/2)*(6/25*y+2/5)*(3/10*y+1/4)*y*(3/5*y-1/2)*(6/5*y-2)*(-6/5*y+4)*(-3/5*y+5/2)*(-2/5*y+2)+27/1090*(3/25*y+3/5)*(2/15*y+5/9)*(3/20*y+1/2)*(6/35*y+3/7)*(1/5*y+1/3)*(6/25*y+1/5)*y*(2/5*y-1/3)*(3/5*y-1)*(6/5*y-3)*(-6/5*y+5)*(-3/5*y+3)+216/16525*(6/55*y+6/11)*(3/25*y+1/2)*(2/15*y+4/9)*(3/20*y+3/8)*(6/35*y+2/7)*(1/5*y+1/6)*y*(3/10*y-1/4)*(2/5*y-2/3)*(3/5*y-3/2)*(6/5*y-4)*(-6/5*y+6)+1/130*(1/10*y+1/2)*(6/55*y+5/11)*(3/25*y+2/5)*(2/15*y+1/3)*(3/20*y+1/4)*(6/35*y+1/7)*y*(6/25*y-1/5)*(3/10*y-1/2)*(2/5*y-1)*(3/5*y-2)*(6/5*y-5)}

Using the above equations, we generate plots (as show in the picture below) of the function for selected values of

3. The following picture is generated using the Matlab code below and from the graph we can observe that the value of does not converge with increasing value of
For each projected dotted line from X-axis on to the blue curve, we have a distinct numerical value of on the Y-axis. The Exact Integral- is the green straight line on the plot. We can clearly see that there is no convergence in the value of (on Y-axis) as (on X-axis) value increases.

4. The Values of weights are evaluated by integrated the Lagrange polynomials within the integration limits and they are presented in the table below. It can be noted that the Bold weights in the table are negative

Weights of the function


W0 Value

W1 Value

W2 Value

W3 Value

W4 Value

W5 Value

W6 Value

W7 Value

W8 Value

W9 Value

W10 Value

W11 Value

W12 Value

W13 Value

W14 Value

W15 Value

8 989/2835 5888/2835 -928/2835 10496/2835 -908/567 10496/2835 -928/2835 5888/2835 989/2835
9 2857/8960 15741/8960 27/224 1209/560 2889/4480 2889/4480 1209/560 27/224 15741/8960 2857/8960
10 80335/299376 132875/74844 -80875/99792 28375/6237 -24125/5544 89035/12474 -24125/5544 28375/6237 -80875/99792 132875/74844 80335/299376
11 434293/1741824 4495513/2903040 -3237113/8709120 560593/193536 -1599257/1451520 2582261/1451520 2582261/1451520 -1599257/1451520 560593/193536 -3237113/8709120 4495513/2903040 434293/1741824
12 1364651/6306300 25008/15925 -210774/175175 1786256/315315 -1144251/140140 2431008/175175 -1045204/75075 2431008/175175 -1144251/140140 1786256/315315 -210774/175175 25008/15925 1364651/6306300
13 8181904909/40236134400 56280729661/40236134400 -1737125143/2235340800 11148172711/2874009600 -6066382933/1609445376 22964826443/4470681600 -3592666051/3353011200 -3592666051/3353011200 22964826443/4470681600 -6066382933/1609445376 11148172711/2874009600 -1737125143/2235340800 56280729661/40236134400 8181904909/40236134400
14 90241897/500385600 44436679/31274100 -770720657/500385600 109420087/15637050 -6625093363/500385600 789382601/31274100 -5600756791/166795200 101741867/2606175 -5600756791/166795200 789382601/31274100 -6625093363/500385600 109420087/15637050 -770720657/500385600 44436679/31274100 90241897/500385600
15 25221445/147603456 147529925/114802688 -129408925/114802688 1746295975/344408064 -124034975/16400384 1367713705/114802688 -10001664025/1033224192 566004225/114802688 566004225/114802688 -10001664025/1033224192 1367713705/114802688 -124034975/16400384 1746295975/344408064 -129408925/114802688 147529925/114802688 25221445/147603456

The plot of for with


To generate the values of numerical Intergrals:

%To generate Lagrange polynomials l(x)%

for n=1:15
    for i=1:n+1
        x(n,i) = -5+(i-1)*10/n;
        f(n,i) = 1/(1+x(n,i)^2);
syms y;
for n=1:15
    for i=1:n+1
        for j=1:n+1
            if j~=i

%To generate Fn(x)for numerically integrating%

for n=1:15
    for i=1:n+1
for n=1:15
    for i=1:n+1
for n=1:15

%for calculating Exact Integral and Numerical Integral%

for n=1:15
legend('I=Numerical Integral(I_n)','IE=Exact Integral(I)');
xlabel('n-Value (Degree of the Newton-Cotes appoximating polynomial)');
ylabel('Numerical Value of Exact Integral (I) and Numerical Integrals (I_n)');

%code for calculating percentage error%
for n=1:15

%code for plotting f,f1,f2,f3,f8 and f12 that are represented by Te, T(1,1), T(2,1), T(3,1), T(8,1), T(12,1) respectively in this code%
figure (2);
hold on;
hold on;
hold on;
hold on;
hold on;
hold on;
xlabel('x- Value ');
ylabel('f(x),f1(x),f2(x),f3(x),f8(x) and f12(x)');

%code for calculating the Weights by integrating the lagrange polnomial%
for n=1:15
    for i=1:n+1
%code for plotting L0,L1,L2,L3,L4...L7 and L8 for n=8%
figure (3);
hold on;
hold on;
hold on;
hold on;
hold on;
hold on;
hold on;
hold on;
hold on;
xlabel('x- Value ');
ylabel('L0(x),L1(x),L2(x),L3(x)....L7(x) and L8(x)');

Solution for problem 16: Srikanth Madala 07:04, 11 February 2010 (UTC)

Proofread problem 16:

Contributing Authors[edit | edit source]

Solutions for problem 5 and proofread problems: 3,6,8,and 12--Egm6341.s10.team2.patodon 16:42, 10 February 2010 (UTC)

--Egm6341.s10.Team2.GV 21:55, 10 February 2010 (UTC)

Solutions for problems 1,6,11 and proofread 5,9,14--Niki Nachappa Chenanda Ganapathy

Solutions for problems 4,9,12,13 and proofread 2,10,11--Pengxiang Jiang

Solutions for problems 2,7,14,16 and proofread 1,8,13--Srikanth Madala 07:04, 11 February 2010 (UTC)

Problem Assignments
Problem Solution Proofread
Problem 1 NN SM
Problem 2 SM JP
Problem 3 GV PO
Problem 4 JP GV
Problem 5 PO NN
Problem 6 NN PO
Problem 7 SM GV
Problem 8 PO SM
Problem 9 JP NN
Problem 10 GV JP
Problem 11 NN JP
Problem 12 GV PO
Problem 13 JP SM
Problem 14 SM NN
Problem 15 PO GV
Problem 16 SM PO