You are on page 1of 3

Integration by Simpson's 3-Point Rule

This spreadsheet has a general program for numerical integration by Simpson's 3-point rule. The
user inputs the upper bounds, the lower bounds and number of intervals. A greater interval number
increases the accuracy. The spreadsheet also has an example calculated with just a spreadsheet
calculation to demonstrate what the program is doing. The general formula for Simpsons rule is:
UB

f (x )dx=i=2,4,6 . .. ( h/3)( xi 2 +4x i1+x i )


LB

Where,
LB =
UB =
X=
n=
h=
i=

Lower bounds of integration


Upper bounds of integration
Independent variable
number of intervals
step size
index for the interval

Simpson's Rule Program


This sheet uses a general purpose macro for Simpsons Rule 3-pt. Integration
Input
Example:
f(x) = X2+2X-0.15
lower bounds =
Upper bounds =
number of increments=
h=

0.00
2.4
12
0.2

input values in the yellow-shaded cells

calculated step size

Calculation
The "change function" button takes you to the location in the macro to change the function.
Close window when complete. The "integrate function" button actives the integration program.

Change Function

Integrate Function

Results
area under curve =

10.008

by VBA program

Example Sheet
This sheet shows a demonstration example calculated out using only the spreadsheet

Example: f(x) = X2+2X-0.15


lower bounds =
0.00
Upper bounds =
2.4
number of increments
12
h=
0.2
i

x
0
1
2
3
4
5
6
7
8
9
10
11
12

f(x)
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
2.2
2.4

Trapazoidal
Rule

-0.15
0.29
0.81
1.41
2.09
2.85
3.69
4.61
5.61
6.69
7.85
9.09
10.41

area=
compares to an analytic solution of:

0.014
0.11
0.222
0.35
0.494
0.654
0.83
1.022
1.23
1.454
1.694
1.95
10.0240

Simpson Simpson
3 pt.
4 pt

0.121333
0.342
0.569333
1.145333

1.494

1.849333
3.078
2.681333
3.641333

5.094

10.0080

10.0080

10.0080

You might also like