Numeric Computation of Integrals

Part 1.  Left-Hand and Right-Hand Sums

Answer questions 1 and 2 here.

Define the "parabola" function to use in steps 3 and 4:

\(Clear[f, x\ ]; 
f[x_] = \((x^2 + 5)\)/6\)

Do the calculations for step 3 below.  Note that a cell containing a command to compute the LHS  for n=5 rectangles is provided.  You need to do the one for n = 10.

LHS = 
      f[0.0]*1.0 + f[1.0]*1.0 + f[2.0]*1.0 +   f[3.0]*1.0 + f[4.0]*1.0

Do the RHS calculations for step 4 below:

Answer question 5 here.

Below, find the commands that calculate a left-hand sum.  By changing the value of n, and re-entering the cell, you can calculate the sum for the number of subintervals you desire.  You can enter a new function f[x] and new endpoints a and b to calculate an approximation to any integral(∫_( a)^b)f(x) dx.

Clear[f, x, a, b, n, xpt];
f[x_]=(x^2 + 5)/6n=40;
a=0;   b= 5 ;
delx = (b - a)/n;
Do[  xpt[i] = a + (i - 1)*delx  ,   {i, 1, n} ];  
LHS = Sum[ f[ xpt[i] ]*delx ,  {i, 1, n}];
N[LHS, 20]

Comment on your results for step 6 below:

Do the calculations for step 7 and fill in the table below.
(Give answers to ten decimal places.)

({{Subintervals n, LHS Approximation of (∫_( 1)^3)(1/x) \[DifferentialD]x}, {5, 1.2436008440}, {10, \[Placeholder]}, {20, \[Placeholder]}, {40, \[Placeholder]}})

Copy the left-hand sum commands below and then modify them to 
calculate right-hand sums.

Do the calculations for step 8 below:

Do the calculations for step 9 and fill in the table below.
(Give answers to ten decimal places.)

({{Subintervals n, RHS Approximation of (∫_( 1)^3)(1/x) \[DifferentialD]x}, {5, 0.9769341769}, {10, \[Placeholder]}, {20, \[Placeholder]}, {40, \[Placeholder]}})

Part 2.  Trapezoidal Sums

Answer questions 1 and 2 here.

Do the calculations for step 3 below:

Answer question 4 below:

Below, find the commands that calculate a trapezoidal sum.  By changing the value of n, and re-entering the cell, you can calculate the sum for the number of subintervals you desire.  You can enter a new function f[x] and new endpoints a and b to calculate an approximation to any integral(∫_( a)^b)f(x) dx.

Clear[f, x, a, b, n, xpt];
f[x_]=(x^2 + 5)/6n=40;
a=0;   b= 5 ;
delx = (b - a)/n;
Do[  xpt[i] = a + i*delx  ,   {i, 0, n} ];
TRAP = Sum[ (f[xpt[i - 1]] + f[xpt[i]])/2*delx ,  {i, 1, n}];
N[TRAP, 20]

Comment on your results for step 5 below:

Do the calculations for step 6 and fill in the table below.
(Give answers to ten decimal places.)

({{Subintervals n, TRAP Approximation of (∫_( 1)^3)(1/x) \[DifferentialD]x}, {5, 1.1102675103}, {10, \[Placeholder]}, {20, \[Placeholder]}, {40, \[Placeholder]}})

Answer the questions in steps 7 and 8 below:

Part 3.  Midpoint Sums

Hand in your hand-drawn diagram on a separate piece of paper.  Answer the questions in step 1 below:

Answer the questions in steps 2 and 3 below:

Do the calculations for step 4 below:

Answer question 5 below:

Below, find the commands that calculate a midpoint sum.  By changing the value of n, and re-entering the cell, you can calculate the sum for the number of subintervals you desire.  You can enter a new function f[x] and new endpoints a and b to calculate an approximation to any integral(∫_( a)^b)f(x) dx.

Clear[f, x, a, b, n, xpt];
f[x_]=(x^2 + 5)/6n=40;
a=0;   b= 5 ;
delx = (b - a)/n;
Do[  xpt[i] = a + (i - 1/2)*delx  ,   {i, 1, n} ];
MID = Sum[ f[xpt[i]]*delx ,  {i, 1, n}];
N[MID, 20]

Comment on your results for step 6 below:

Do the calculations for step 7 and fill in the table below.(Give answers to ten decimal places.)

({{Subintervals n, MID Approximation of (∫_( 1)^3)(1/x) \[DifferentialD]x}, {5, 1.0928571430}, {10, \[Placeholder]}, {20, \[Placeholder]}, {40, \[Placeholder]}})

Part 4.   Accuracy and Simpson's Rule

Describe your calculations for step 1 using the FTC.

Use the applets for calculations and fill in the table below
(use n = 40 subintevals for each method):

({{Method, Approx, Exact Integral, Error}, {LHS, 10.8529, 11.1111, -0.2582}, {RHS, 11.3737, 11.1111, 0.2626}, {TRAP, \[Placeholder], 11.1111, \[Placeholder]}, {MID, \[Placeholder], 11.1111, \[Placeholder]}})

Step 3:  Below, give your rank ordering of the four methods according to accuracy.

Step 4:  Use your results for approximations of (∫_( 1)^3)(1/x) dx from the tables you filled in in Parts 1 through 3 to fill in the following table.
(Again, use n = 40 subintevals for each method and provide 10 decimal places of accuracy.)

({{Method, Approx, Exact Int, Error}, {LHS, 1.1154640890, 1.0986122887, 0.0168518003}, {RHS, 1.0821307560, 1.0986122887, -0.0164815327}, {TRAP, \[Placeholder], 1.0986122887, \[Placeholder]}, {MID, \[Placeholder], 1.0986122887, \[Placeholder]}})

Below, give your rank ordering of the four methods for approximating (∫_( 1)^3)(1/x) dx according to accuracy.  Is your ranking the same as that in step 3?

Step 5:  Show your calculations below:

Step 6:  Below, do the Simpson's Rule approximation calculations for n = 40 for both the  (∫_( 1)^3)((((x^2)  + 5))/6) dx and the (∫_( 1)^3)(1/x) dx integrals by using the tables above.  The weighted average calculation is easy if you fill in the blanks below.

\(TRAP = \(?
MID\ =\ ?\)\)\(S\  = \ \((2*MID + TRAP)\)/3; 
N[S, 20]\)

Step 7: By using the weighted averages of your results for TRAP from Part 2 and MID from Part 3 fill in the table below for Simpson's Rule approximations to (∫_( 1)^3)(1/x) dx. The calculation for n=5 is shown below.  (Give answers to ten decimal places.)

\(TRAP = 1.11026751; 
MID\  = \ 1.092857143; 

    S\  = \ \((2*MID + TRAP)\)/3; 
N[S, 20]\)

({{Subintervals n, SIMP Approximation of (∫_( 1)^3)(1/x) \[DifferentialD]x}, {5, 1.0986605987}, {10, \[Placeholder]}, {20, \[Placeholder]}, {40, \[Placeholder]}})

Part 5.   Increasing the Number of Subintervals

Step 1:  Use your  LHS approximation results for  (∫_( 1)^3)(1/x) dx in the table of Part 1 to fill in the table below for the left-hand sum errors.

({{n for LHS, Error, Improvement Ratio}, {5, 0.1449885549, ----}, {10, 0.0696167046, 2.08}, {20, 0.0340732550, \[Placeholder]}, {40, \[Placeholder], \[Placeholder]}})

Answer the questions in step 1 below:

Step 2:  Use your  TRAP approximation results for  (∫_( 1)^3)(1/x) dx in the table of Part 2 to fill in the table below for the trapezoidal sum errors.

({{n for TRAP, Error, Improvement Ratio}, {5, 0.0116552216, ----}, {10, \[Placeholder], \[Placeholder]}, {20, \[Placeholder], \[Placeholder]}, {40, \[Placeholder], \[Placeholder]}})

Answer the questions in step 2 below:

Step 3:  Use your  MID approximation results for  (∫_( 1)^3)(1/x) dx in the table of Part 3 to fill in the table below for the midpoint sum errors.

({{n for MID, Error, Improvement Ratio}, {5, -0.0057551458, ----}, {10, \[Placeholder], \[Placeholder]}, {20, \[Placeholder], \[Placeholder]}, {40, \[Placeholder], \[Placeholder]}})

Answer the questions in step 3 below:

Step 4:  Use your  Simpson's Rule approximation results for  (∫_( 1)^3)(1/x) dx in the table of Part 4 to fill in the table below for the Simpson's Method errors.

({{n for SIMP, Error, Improvement Ratio}, {5, 0.0000483100, ----}, {10, \[Placeholder], \[Placeholder]}, {20, \[Placeholder], \[Placeholder]}, {40, \[Placeholder], \[Placeholder]}})

Answer the questions in step 4 below:

Part 6.  Summary

Answer the questions in the Summary below: