Sei sulla pagina 1di 9

Bicol University

College of Engineering
DEPARTMENT OF CHEMICAL ENGINEERING
S.Y 2016-2017

FOR : Engr. John Raymond B. Barajas


Professor, Department of Chemical Engineering
FROM : Neil Dominic D. Careo
BSChE 4
SUBJECT : Advanced Engineering Mathematics for Chemical Engineers
DATE : March 27, 2017

Numerical Integration Approximation Using Simpsons Rule via


Microsoft Excel 2013
I. Introduction
Simpson's rule is a Newton-Cotes formula for approximating definite integral of a
function using quadratic polynomials. By quadratic, we refer to the use of parabolic arcs instead
of straight line segments used in trapezoidal rule. Simpson's rule can be derived by integrating a
third-order Lagrange interpolating polynomial fit to the function at three equally spaced points.
Since it uses quadratic polynomials to approximate functions, Simpson's rule actually gives exact
results when approximating integrals of polynomials up to cubic degree.
Below is the derivation of the formula regarding the area under a parabola of equation,
y = ax + bx + c, passing through the three points: (h, y0), (0, y1), (h, y2).
2
Since the points (h, y0), (0, y1), (h, y2) are on the parabola, they satisfy the equation,
y = ax2 + bx + c.

Therefore, 0 = 2 +
1 =
2 = 2 + +
Observe that,
0 + 41 + 2 = (2 + ) + 4 + (2 + + ) = 22 + 6.

Therefore, the area under the parabola is = (0 + 41 + 2 ) = (0 + 41 + 2 )
3 3

Considering the definite integral,



f(x) dx.

We assume that f(x) is continuous on [a, b] and we divide [a, b] into an even number n of
subintervals of equal length,

=

using the n + 1 points,
x0 = a, x1 = a + x,
x2 = a + 2x, ..., xn = a + nx = b.

We can compute the value of f(x) at these points.


y0 = f(x0), y1 = f(x1),
y2 = f(x2), ..., yn= f(xn).
We can estimate the integral by adding the areas under the parabolic arcs through three
successive points.


( ) (0 + 41 + 2 ) + (2 + 43 + 4 ) + + ( + 41 + )
3 3 3 2
By simplifying, Simpsons rule formula is as stated below.


( ) ( + 41 + 22 + 43 + 24 + + 41 + )
3 0

II. Objectives
The main objective of this project is to the devise a software for approximating definite
integrals using Simpsons rule which generally produces more accurate and exact results compared
to other numerical integration methods.
III. Methodology
Procedure:
1. Given a certain function, type the function in the first cell of the f(x) column. In this
case its cell M12 of the program.
Note:
The procedure in typing functions in Microsoft Excel must be strictly followed to
avoid errors in the answer.
The program is limited to Continuous functions only thus any Undefined or
Discontinuous functions will not work on the program.

Example:
5
Given a function 1 ( ) = 4 2 + 2

1.1

Note that the variable x is taken to be cell L12 which is the first cell in the x column

1.2
Check the function in the FORMULA BAR of Microsoft Excel

2. The program will automatically copy the inputted function in the FUNCTION cell.
Since the M12 cell will only show you the evaluated function, you can always check
here if you have the correct function.

3. On the upper right part of the program, you will see table for the limits of the function.
Row a equates the lower limit while row b equates the upper limit. Input the lower
and upper limits in cells N7 and N8 respectively. The table also requires the number
of intervals. Input the preferred intervals in cell N9 which is the row no. of intervals
(n)

3
Note: The number of intervals must be EVEN and LESS THAN 100

4. The interval size will automatically be computed by the program.

4.
4

You can see in the FORMULA BAR of Microsoft Excel that it follows the formula in computing
the interval size.
5. Click the Replicate formula to f(x) cells to automatically iterate the function on the
following cells under row f(x)

5
You can observe that the succeeding cells will follow the function and will
give the values needed.

6. The program will readily give you the solution on the ANS cell.

Note that if the answer is CANT SOLVE. Use other limits to make the function
continuous.

Figure-1 shows the overview of the program.


IV. Manual vs. Program Solving
The following functions are solved manually will give the following results.

1. ACTUAL VALUE = 4

a=0
b=2
n = 10
x f(x)
0 0
0.2 0.008
0.4 0.064
0.6 0.216
0.8 0.512
1 1
1.2 1.728
1.4 2.744
1.6 4.096
1.8 5.831

0.2
3
[(0) + 4(0.008) + 2(0.064) + 4(216) + 2(0.512) + 4(1) + 2(1.728) + 4(2.744) +
2(4.096) + 2(5.831) = 4
44
PERCENT ERROR = 100 = 0%
4


2. . + ACTUAL VALUE = 50.4

a=0
b=2
n = 10

x f(x)
0 0.2
0.2 5.2
0.4 10.2
0.6 15.2
0.8 20.2
1 25.2
1.2 30.2
1.4 35.2
1.6 40.2
1.8 45.2

0.2
[(0.2) + 4(5.2) + 2(10.2) + 4(15.2) + 2(20.2) + 4(205.2) + 2(30.2) + 4(35.2) +
3
2(40.2) + 2(45.2) = 50.4
50.450.4
PERCENT ERROR = 100 = 0%
50.4


3. + ACTUAL VALUE = 28

a=1
b=3
n = 10

x f(x)
1 0
1.2 1.728
1.4 3.744
1.6 6.096
1.8 8.832
2 12
2.2 15.648
2.4 19.824
2.6 24.576
2.8 29.952

0.2
[(0) + 4(1.728) + 2(3.744) + 4(6.096) + 2(8.832) + 4(12) + 2(15.648)4(19.824) +
3
2(24.576) + 2(29.952) = 28

2828
PERCENT ERROR = 100 = 0%
28

The following functions are solved by program will give the following results


1. ACTUAL VALUE = 4

a=0 b=2 n = 10
x f(x)
0 0
0.2 0.00824
0.4 0.06431
0.6 0.21534
0.8 0.51179
1 1
1.2 1.72912
1.4 2.74369
1.6 4.09631
1.8 5.83112

ANSWER: 4

44
PERCENT ERROR = 100 = 0%
4


2. . + ACTUAL VALUE = 50.4

a=0
b=2
n = 10
x f(x)
0 0.2
0.2 5.2
0.4 10.2
0.6 15.2
0.8 20.2
1 25.2
1.2 30.2
1.4 35.2
1.6 40.2
1.8 45.2

ANSWER: 50.4

50.450.4
PERCENT ERROR = 100 = 0%
50.4


3. + ACTUAL VALUE = 28
a=1 b=3 n = 10
x f(x)
1 0.2
1.2 1.72822
1.4 3.74379
1.6 6.09684
1.8 8.8328
2 12
2.2 15.64794
2.4 19.82431
2.6 24.57612
2.8 29.95242

ANSWER: 28

2828
PERCENT ERROR = 100 = 0%
28

V. Conclusion
A software designed, by the members, to approximate definite integrals using Simpsons
Rule is proved to be functional and produces accurate results upon input of the given function.
However, the software is limited to solving continuous functions. It is beyond its capacity to handle
undefined and discontinuous functions.
VI. Recommendation
It is recommended to improve the programs interface and to add more functions such as
automatic graphing and solver for percentage error of values solved by the program compared to
the actual values using the calculator.

Potrebbero piacerti anche