Simpson's 1/3 Rule of Integration

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 32

Simpson’s 1/3rd Rule of

Integration
What is Integration?
b

Integration  f ( x )dx
a
f(x)
y
The process of measuring
the area under a curve.

b
I   f ( x )dx
a

Where:
f(x) is the integrand
a= lower limit of integration
a b x
b= upper limit of integration

2 http://numericalmethods.eng.usf.edu
Simpson’s 1/3rd Rule

3 http://numericalmethods.eng.usf.edu
Basis of Simpson’s 1/3rd Rule
Trapezoidal rule was based on approximating the integrand by a first
order polynomial, and then integrating the polynomial in the interval of
integration. Simpson’s 1/3rd rule is an extension of Trapezoidal rule
where the integrand is approximated by a second order polynomial.

Hence
b b
I   f ( x )dx   f 2 ( x )dx
a a

Where f2( x ) is a second order polynomial.

f 2 ( x )  a0  a1 x  a2 x 2

4 http://numericalmethods.eng.usf.edu
Basis of Simpson’s 1/3rd Rule
Choose
 a  b  a  b 
( a , f ( a )),  ,f  , and ( b , f ( b ))
 2  2 
as the three points of the function to evaluate a0, a1 and a2.

f ( a )  f 2 ( a )  a 0  a1a  a 2 a 2
2
a  b a  b a b a b
f   f2   a0  a1    a2  
 2   2   2   2 

f ( b )  f 2 ( b )  a0  a1b  a 2 b 2
5 http://numericalmethods.eng.usf.edu
Basis of Simpson’s 1/3rd Rule
Solving the previous equations for a0, a1 and a2 give

a  b
a f ( b )  abf ( b )  4abf 
2
  abf ( a )  b f ( a )
2

a0   2 
a 2  2ab  b 2
a  b a  b
af ( a )  4af    3af ( b )  3bf ( a )  4bf    bf ( b )
a1    2   2 
a 2  2ab  b 2
 a  b 
2 f ( a )  2 f    f ( b ) 
  2  
a2 
a 2  2ab  b 2
6 http://numericalmethods.eng.usf.edu
Basis of Simpson’s 1/3rd Rule
Then
b
I   f 2 ( x )dx
a

   a0  a1 x  a 2 x 2  dx
b

b
 x x 
2 3
 a0 x  a1  a 2 
 2 3 a

b2  a2 b3  a3
 a0 ( b  a )  a1  a2
2 3

7 http://numericalmethods.eng.usf.edu
Basis of Simpson’s 1/3rd Rule
Substituting values of a0, a1, a 2 give

b
ba a  b 
 f 2 ( x )dx   f ( a )  4 f    f ( b )
a 6   2 

Since for Simpson’s 1/3rd Rule, the interval [a, b] is broken


into 2 segments, the segment width

ba
h
2
8 http://numericalmethods.eng.usf.edu
Basis of Simpson’s 1/3rd Rule

Hence

b
h a  b 
 2
f ( x )dx   f ( a )  4 f    f ( b )
a 3  2 

Because the above form has 1/3 in its formula, it is called Simpson’s 1/3rd Rule.

9 http://numericalmethods.eng.usf.edu
Example 1

The distance covered by a rocket from t=8 to t=30 is given by


30
 140000  
x    2000 ln    9 .8t dt
8 140000  2100t  

a) Use Simpson’s 1/3rd Rule to find the approximate value of x

b) Find the true error, Et

c) Find the absolute relative true error, t

10 http://numericalmethods.eng.usf.edu
Solution
a) 30
x  f (t )dt
8
 b  a  a  b 
x  f ( a )  4 f    f ( b )
 6   2 
 30  8 
  f ( 8 )  4 f ( 19 )  f ( 30 )
 6 

 22 
  177.2667  4( 484.7455 )  901.6740
 6
 11065 .72 m
11 http://numericalmethods.eng.usf.edu
Solution (cont)
b) The exact value of the above integral is


30
 140000  
x    2000 ln    9.8t dt
8 140000  2100t  

 11061 .34 m
True Error

Et  11061 .34  11065 .72


 4.38 m
12 http://numericalmethods.eng.usf.edu
Solution (cont)
c) Absolute relative true error,
a)

11061.34  11065.72
t   100%
11061.34

 0.0396%

13 http://numericalmethods.eng.usf.edu
Multiple Segment Simpson’s 1/3rd
Rule

14 http://numericalmethods.eng.usf.edu
Multiple Segment Simpson’s 1/3rd
Rule
Just like in multiple segment Trapezoidal Rule, one can subdivide the interval
[a, b] into n segments and apply Simpson’s 1/3rd Rule repeatedly over
every two segments. Note that n needs to be even. Divide interval
[a, b] into equal segments, hence the segment width

b xn
ba
h  f ( x )dx   f ( x )dx
n a x0

where

x0  a xn  b

15 http://numericalmethods.eng.usf.edu
Multiple Segment Simpson’s 1/3rd
Rule
f(x)

b x2 x4
 f ( x )dx   f ( x )dx   f ( x )dx  .....
a x0 x2
. . .
xn  2 xn
....   f ( x )dx   f ( x )dx x

xn  4 xn  2 x0 x2 xn-2 xn

Apply Simpson’s 1/3rd Rule over each interval,


b
 f ( x0 )  4 f ( x1 )  f ( x2 )
 f ( x )dx  ( x 2  x )
0    ...
a  6 
 f ( x2 )  4 f ( x3 )  f ( x4 )
 ( x4  x2 )   ...
 6 
16 http://numericalmethods.eng.usf.edu
Multiple Segment Simpson’s 1/3rd
Rule
 f ( xn  4 )  4 f ( xn  3 )  f ( xn  2 ) 
...  ( xn  2  xn  4 )   ...
 6 

 f ( xn  2 )  4 f ( xn 1 )  f ( xn )
 ( xn  xn 2 ) 
 6

Since

xi  xi  2  2 h i  2 , 4 , ..., n

17 http://numericalmethods.eng.usf.edu
Multiple Segment Simpson’s 1/3rd
Rule
Then
b
 f ( x0 )  4 f ( x1 )  f ( x2 )
 f ( x )dx  2h    ...
a  6 
 f ( x2 )  4 f ( x3 )  f ( x4 )
 2h    ...
 6 
 f ( x n  4 )  4 f ( xn  3 )  f ( xn  2 ) 
 2h    ...
 6 
 f ( xn  2 )  4 f ( xn 1 )  f ( xn )
 2h  
 6
18 http://numericalmethods.eng.usf.edu
Multiple Segment Simpson’s 1/3rd
Rule
b h
 f ( x )dx  3  f ( x0 )  4 f ( x1 )  f ( x3 )  ...  f ( xn 1 )  ...
a

...  2 f ( x2 )  f ( x4 )  ...  f ( xn  2 )  f ( xn )}]


 
h n 1 n  2
 f ( x 0 )  4  f ( xi )  2  f ( xi )  f ( x n ) 
3 i 1 i 2 
 i odd i  even 
 
ba n 1 n  2
 f ( x 0 )  4  f ( xi )  2  f ( x i )  f ( x n ) 
3n  i 1 i 2 
 i  odd i  even 
19 http://numericalmethods.eng.usf.edu
Example 2
Use 4-segment Simpson’s 1/3rd Rule to approximate the distance

covered by a rocket from t= 8 to t=30 as given by

30
  140000  
x    2000 ln    9.8t dt
8 140000  2100t  

a) Use four segment Simpson’s 1/3rd Rule to find the approximate


value of x.
b) Find the true error, Et for part (a).
c) Find the absolute relative true error, a for part (a).
20 http://numericalmethods.eng.usf.edu
Solution
a) Using n segment Simpson’s 1/3rd Rule,

30  8
h  5.5
4
So
f (t 0 )  f (8)
f (t1 )  f (8  5.5)  f (13.5)
f (t 2 )  f (13.5  5.5)  f (19)
f (t 3 )  f (19  5.5)  f (24.5)

f (t 4 )  f (30)

21 http://numericalmethods.eng.usf.edu
Solution (cont.)
 
ba n 1 n  2
x f (t 0 )  4  f (t i )  2  f (t i )  f (t n )
3n  i 1 i 2 
 i  odd i  even 
 
30  8  3 2
 f (8)  4  f (t i )  2  f (t i )  f (30)
3(4)  i 1 i 2 
 i  odd i  even 

22
  f (8)  4 f (t1 )  4 f (t 3 )  2 f (t 2 )  f (30)
12

22 http://numericalmethods.eng.usf.edu
Solution (cont.)
cont.

11
  f (8)  4 f (13.5)  4 f (24.5)  2 f (19)  f (30)
6

11
 177.2667  4(320.2469)  4(676.0501)  2(484.7455)  901.6740
6

 11061 .64 m

23 http://numericalmethods.eng.usf.edu
Solution (cont.)
b) In this case, the true error is

Et  11061 .34  11061 .64  0.30 m

c) The absolute relative true error

11061.34  11061.64
t   100%
11061.34

 0.0027%

24 http://numericalmethods.eng.usf.edu
Solution (cont.)

Table 1: Values of Simpson’s 1/3rd Rule for Example 2 with multiple segments

n Approximate Value Et |Єt |


2 11065.72 4.38 0.0396%
4 11061.64 0.30 0.0027%
6 11061.40 0.06 0.0005%
8 11061.35 0.01 0.0001%
10 11061.34 0.00 0.0000%

25 http://numericalmethods.eng.usf.edu
26 http://numericalmethods.eng.usf.edu
Excersize 1
In an attempt to understand the mechanism of the
depolarization process in a fuel cell, an electro-kinetic model
for mixed oxygen-methanol current on platinum was
developed in the laboratory at FAMU. A very simplified model
of the reaction developed suggests a functional relation in an
integral form. To find the time required for 50% of the
oxygen to be consumed, the time, T(s) is given by:
 6.73x  4.3025  10 7 
0.6110  6
T    dx
1.2210 6  11
 2.316  10 x 

27 http://numericalmethods.eng.usf.edu
Error in the Multiple Segment
Simpson’s 1/3rd Rule
The true error in a single application of Simpson’s 1/3rd Rule is given as

(b  a ) 5 ( 4)
Et   f ( ), a    b
2880
In Multiple Segment Simpson’s 1/3rd Rule, the error is the sum of the errors
in each application of Simpson’s 1/3rd Rule. The error in n segment Simpson’s
1/3rd Rule is given by

( x2  x0 )5 ( 4 ) h5 ( 4 )
E1   f ( 1 )   f ( 1 ), x0  1  x2
2880 90
( x4  x2 )5 ( 4 ) h5 ( 4 )
E2   f (  2 )   f (  2 ), x2   2  x4
2880 90
28 http://numericalmethods.eng.usf.edu
Error in the Multiple Segment
Simpson’s 1/3rd Rule
( x2i  x2( i 1 ) )5 (4) h 5
Ei   f (  i )  f ( 4 ) (  i ), x2( i 1 )   i  x2i
2880 90
.
.
.

( xn  2  xn  4 )5 ( 4 )  
f   n    f ( 4 )   n  , x n  4   n  x n  2
5
En   h
1 2880  2 1  90  1  1
2  2  2

( xn  xn  2 )5 4   h 5   , x  x
En    
f n    f   n 
( 4) n2 n n
2
2880  2 90  2 2

29 http://numericalmethods.eng.usf.edu
Error in the Multiple Segment
Simpson’s 1/3rd Rule
Hence, the total error in Multiple Segment Simpson’s 1/3rd Rule is

n n n
2
5
h 2 (b  a ) 5 2 ( 4)
Et   Ei   f
( 4)
( i )   f ( i )
i 1 90 i 1 90n 5 i 1

n
2 ( 4)
( i )
(b  a ) 5 
f
i 1

90n 4 n

30 http://numericalmethods.eng.usf.edu
Error in the Multiple Segment
Simpson’s 1/3rd Rule
n
2 ( 4)
f ( i )
The term i 1 is an approximate average value of
n
f ( 4) ( x), a  x  b

Hence
(b  a) 5 ( 4 )
Et   4
f
90n
n
where 2
f
( 4)
( i )
( 4)
f  i 1
n http://numericalmethods.eng.usf.edu
31
THE END

You might also like