Numerical Integration 01
Numerical Integration 01
f ( x )dx wi f ( xi )
i 0
Rectangular Rule
f(x)
height=f(x1*)
x=a
x=x1*
height=f(xn*)
x=b
Approximate
the integration,
b
a f ( x )dx , that is the area under
the curve by a series of
rectangles as shown.
The base of each of these
rectangles is x=(b-a)/n and
its height can be expressed as
f(xi*) where xi* is the midpoint
of each rectangle
x=xn*
f ( x )dx f ( x1*) x f ( x2 *) x .. f ( xn *) x
x[ f ( x1*) f ( x2 *) .. f ( xn *)]
Trapezoidal Rule
f(x)
x=a
x=x1
x=b
x=xn-1
x
x
x
a f ( x)dx 2 [ f (a ) f ( x1 )] 2 [ f ( x1 ) f ( x2 )] .. 2 [ f ( xn1) f (b)]
1
1
x[ f (a ) f ( x1 ) .. f ( xn 1 ) f (b)]
2
2
b
Simpsons Rule
Still, the more accurate integration formula can be achieved by
approximating the local curve by a higher order function, such as
a quadratic polynomial. This leads to the Simpsons rule and the
formula is given as:
x
a f ( x )dx 3 [ f (a ) 4 f ( x1 ) 2 f ( x2 ) 4 f ( x3 ) ..
..2 f ( x2 m2 ) 4 f ( x2 m 1 ) f (b)]
b
Examples
Integrate f ( x ) x 3 between x 1 and x 2.
1
1
x 3dx= x 4 |12 (24 14 ) 3.75
4
4
2-1
Using 4 subdivisions for the numerical integration: x=
0.25
4
Rectangular rule:
i
xi*
f(xi*)
1.125 1.42
1.375 2.60
1.625 4.29
1.875 6.59
x 3dx
Trapezoidal Rule
i
xi
1
f(xi)
1
1 1.25
1.95
2 1.5
3.38
3 1.75
5.36
x 3dx
1
1
f (1) f (1.25) f (1.5) f (1.75) f (2)]
2
2
0.25(15.19) 3.80
x[
Simpsons Rule
x 3dx
x
[ f (1) 4 f (1.25) 2 f (1.5) 4 f (1.75) f (2)]
3
0.25