Error in Multiple-segment Simpson`s 1/3 rule

advertisement
Chapter 07.03
Simpson’s 1/3 Rule of Integration
After reading this chapter, you should be able to
1. derive the formula for Simpson’s 1/3 rule of integration,
2. use Simpson’s 1/3 rule it to solve integrals,
3. develop the formula for multiple-segment Simpson’s 1/3 rule of integration,
4. use multiple-segment Simpson’s 1/3 rule of integration to solve integrals, and
5. derive the true error formula for multiple-segment Simpson’s 1/3 rule.
What is integration?
Integration is the process of measuring the area under a function plotted on a graph. Why
would we want to integrate a function? Among the most common examples are finding the
velocity of a body from an acceleration function, and displacement of a body from a velocity
function. Throughout many engineering fields, there are (what sometimes seems like)
countless applications for integral calculus. You can read about some of these applications in
Chapters 07.00A-07.00G.
Sometimes, the evaluation of expressions involving these integrals can become daunting, if
not indeterminate. For this reason, a wide variety of numerical methods has been developed
to simplify the integral. Here, we will discuss Simpson’s 1/3 rule of integral approximation,
which improves upon the accuracy of the trapezoidal rule.
Here, we will discuss the Simpson’s 1/3 rule of approximating integrals of the form
b
I   f x dx
a
where
f (x ) is called the integrand,
a  lower limit of integration
b  upper limit of integration
Simpson’s 1/3 Rule
The trapezoidal rule was based on approximating the integrand by a first order polynomial,
and then integrating the polynomial over interval of integration. Simpson’s 1/3 rule is an
07.03.1
07.03.2
Chapter 07.03
extension of Trapezoidal rule where the integrand is approximated by a second order
polynomial.
Figure 1 Integration of a function
Method 1:
Hence
b
b
a
a
I   f ( x)dx   f 2 ( x)dx
where f 2 ( x) is a second order polynomial given by
f 2 ( x)  a0  a1 x  a 2 x 2
.
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 a 2 .
f (a )  f 2 (a )  a 0  a1 a  a 2 a 2
ab
ab
ab
ab
f
  f2 
  a 0  a1 
  a2 

 2 
 2 
 2 
 2 
f (b)  f 2 (b)  a 0  a1b  a 2 b 2
2
Solving the above three equations for unknowns, a0 , a1 and a2 give
ab
2
a 2 f (b)  abf (b)  4abf 
  abf (a)  b f (a )
 2 
a0 
2
a  2ab  b 2
ab
ab
af (a )  4af 
  3af (b)  3bf (a)  4bf 
  bf (b)
2 
2 


a1  
a 2  2ab  b 2
Simpson’s 1/3 Rule of Integration
07.03.3


ab
2 f (a)  2 f 
  f (b) 
 2 

a2  
2
2
a  2ab  b
Then
b
I   f 2 ( x)dx
a
b


  a0  a1 x  a2 x 2 dx
a
b

x2
x3 
 a 0 x  a1
 a2 
2
3 a

b2  a2
b3  a3
 a0 (b  a)  a1
 a2
2
3
Substituting values of a 0 , a1 and a 2 give
b
f
a
2
( x)dx 

ba 
ab
f (a)  4 f 
  f (b)

6 
 2 

Since for Simpson 1/3 rule, the interval a, b is broken into 2 segments, the segment width
ba
h
2
Hence the Simpson’s 1/3 rule is given by
b

h
ab
a f ( x)dx  3  f (a)  4 f  2   f (b)
Since the above form has 1/3 in its formula, it is called Simpson’s 1/3 rule.
Method 2:
Simpson’s 1/3 rule can also be derived by approximating f (x) by a second order polynomial
using Newton’s divided difference polynomial as
ab

f 2 ( x)  b0  b1 ( x  a)  b2 ( x  a) x 

2 

where
b0  f (a)
ab
f
  f (a)
2 

b1 
ab
a
2
07.03.4
Chapter 07.03
ab
ab
f (b)  f 
 f
  f (a)
 2   2 
ab
ab
b
a
2
2
b2 
ba
Integrating Newton’s divided difference polynomial gives us
b
b

f ( x)dx   f 2 ( x)dx
a
a

a  b 

  b0  b1 ( x  a)  b2 ( x  a) x 
 dx
2 

a
b
b

 x2

 x 3 (3a  b) x 2 a(a  b) x 

 b0 x  b1   ax   b2  

4
2
 2

 3
 a

 b2  a 2

 b0 (b  a )  b1 
 a (b  a ) 
 2

 b3  a 3 (3a  b)(b 2  a 2 ) a (a  b)(b  a ) 

 b2 


4
2
 3

Substituting values of b0 , b1 , and b2 into this equation yields the same result as before
b
 f ( x)dx 
a


ba
ab
f (a)  4 f 
  f (b)

6 
 2 


h
ab
f (a)  4 f 
  f (b)

3
 2 

Method 3:
One could even use the Lagrange polynomial to derive Simpson’s formula. Notice any
method of three-point quadratic interpolation can be used to accomplish this task. In this
case, the interpolating function becomes
ab
ab


( x  a) x 
x 
( x  b )

( x  a)( x  b)
2 
2 
ab


f 2 ( x) 
f (a) 
f
f (b)

ab
ab

ab
 a  b
  2 

 a 
 b
(b  a) b 
a 
( a  b )


2 
2 

 2
 2


Integrating this function gets
Simpson’s 1/3 Rule of Integration
07.03.5
b
 x 3 (a  3b) x 2 b(a  b) x

x 3 ( a  b) x 2



 abx

 a  b 
4
2
2
f (a)  3
f
 3

ab

ab
 a  b
  2 

 a 
 b
a 
( a  b )

b


2 

 2
 2

f
(
x
)
dx



a 2
3
(3a  b) x 2 a (a  b) x
 x


 3 

4
2
f (b)


ab



(b  a ) b 

2 


 a
3
3
2
2
b a
(a  3b)(b  a ) b(a  b)(b  a )


3
4
2

f (a)
a

b


a 
( a  b )
2 

b 3  a 3 (a  b)(b 2  a 2 )

 ab(b  a )
ab
3
2

f

2 
ab
 a  b


 a 
 b

 2
 2

3
3
2
2
b a
(3a  b)(b  a ) a (a  b)(b  a )


3
4
2

f (b)
ab

(b  a ) b 

2 

Believe it or not, simplifying and factoring this large expression yields you the same result as
before
b

ba
ab
a f ( x)dx  6  f (a)  4 f  2   f (b)


h
ab
f (a)  4 f 
  f (b) .

3
 2 

Method 4:
Simpson’s 1/3 rule can also be derived by the method of coefficients. Assume
b
ab
a f ( x)dx  c1 f (a)  c2 f  2   c3 f (b)
b
b
Let the right-hand side be an exact expression for the integrals  1dx,  xdx, and
a
a
b
 x dx .
2
This
a
implies that the right hand side will be exact expressions for integrals of any linear
combination of the three integrals for a general second order polynomial. Now
b
1dx  b  a  c
1
a
 c 2  c3
07.03.6
Chapter 07.03
b
 xdx 
a
b2  a2
ab
 c1a  c2
 c3 b
2
2
b3  a 3
ab
2
x
dx

 c1 a 2  c2 
  c3 b
a
3
2


2
b
2
Solving the above three equations for c 0 , c1 and c2 give
ba
c1 
6
2(b  a)
c2 
3
ba
c3 
6
This gives
b
ba
2(b  a)  a  b  b  a
a f ( x)dx  6 f (a)  3 f  2   6 f (b)


ba
ab
f (a)  4 f 
  f (b)

6 
 2 



h
ab
f (a)  4 f 
  f (b)

3
 2 

The integral from the first method
b

b
f ( x)dx   (a0  a1 x  a2 x 2 )dx
a
a
can be viewed as the area under the second order polynomial, while the equation from
Method 4
b
ba
2(b  a)  a  b  b  a
a f ( x)dx  6 f (a)  3 f  2   6 f (b)
can be viewed as the sum of the areas of three rectangles.
Example 1
The distance covered by a rocket in meters from t  8 s to t  30 s is given by
30


140000


x    2000 ln 
 9.8t dt

140000  2100t 

8
a) Use Simpson’s 1/3 rule to find the approximate value of x .
b) Find the true error, E t .
c) Find the absolute relative true error, t .
Simpson’s 1/3 Rule of Integration
Solution
a)

ba
ab
f (a)  4 f 
  f (b)

6 
 2 

a 8
b  30
ab
 19
2
140000


f (t )  2000 ln 
 9.8t
140000  2100t 


140000
f (8)  2000 ln 
  9.8(8)  177.27m / s
140000  2100(8) 
x


140000
f (30)  2000 ln 
  9.8(30)  901.67m / s
140000  2100(30) 


140000
  9.8(19)  484.75m / s
f (19)  2000 ln 
 140000  2100(19) 
x

ba
ab
f (a)  4 f 
  f (b)

6 
 2 

 30  8 

 f (8)  4 f (19)  f (30)
 6 
22
 177.27  4  484.75  901.67
6
=11065.72 m
b) The exact value of the above integral is
30


140000


x    2000 ln 
 9.8t dt

140000  2100t 

8
=11061.34 m
So the true error is
Et  True Value  Approximate Value
=11061.34-11065.72
 4.38 m
c) Absolute Relative true error,
True Error
t 
 100
True Value
 4.38

 100
11061.34
07.03.7
07.03.8
Chapter 07.03
 0.0396%
Multiple-segment Simpson’s 1/3 Rule
Just like in multiple-segment trapezoidal rule, one can subdivide the interval a, b into n
segments and apply Simpson’s 1/3 rule repeatedly over every two segments. Note that n
needs to be even. Divide interval a, b into n equal segments, so that the segment width is
given by
ba
h
.
n
Now
b
xn
a
x0
 f ( x)dx   f ( x)dx
where
x0  a
xn  b
b
x2
x4
xn  2
xn
a
x0
x2
xn  4
xn  2
 f ( x)dx   f ( x)dx   f ( x)dx  ......   f ( x)dx   f ( x)dx
Apply Simpson’s 1/3rd Rule over each interval,
b
 f ( x)dx  ( x
a
2
 f ( x0 )  4 f ( x1 )  f ( x2 ) 
 f ( x 2 )  4 f ( x3 )  f ( x 4 ) 
 x0 ) 
 ( x4  x2 ) 

  ...
6
6



 f ( x n  4 )  4 f ( x n 3 )  f ( x n  2 ) 
 f ( xn 2 )  4 f ( xn 1 )  f ( xn ) 
 ( xn2  xn4 )
 ( xn  xn2 )


6
6




Since
x i  x i  2  2h
i  2, 4, ..., n
then
b
 f ( x )  4 f ( x1 )  f ( x2 ) 
 f ( x 2 )  4 f ( x3 )  f ( x 4 ) 
 2h 
a f ( x)dx  2h  0

  ...
6
6


 f ( x n  4 )  4 f ( x n 3 )  f ( x n  2 ) 
 f ( x n 2 )  4 f ( x n 1 )  f ( xn ) 
 2h 
 2h 


6
6





h
 f ( x0 )  4 f ( x1 )  f ( x3 )  ...  f ( xn1 )  2 f ( x2 )  f ( x4 )  ...  f ( xn2 )  f ( xn )
3
Simpson’s 1/3 Rule of Integration
07.03.9


n 1
n2
h

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
ba 
f ( x )dx 
f ( x 0 )  4  f ( xi )  2  f ( xi )  f ( x n ) 


3n
i 1
i 2


i odd
i  even
Example 2
Use 4-segment Simpson’s 1/3 rule to approximate the distance covered by a rocket in meters
from t  8 s to t  30 s as given by
30


140000


x    2000 ln 
 9.8t dt

140000  2100t 

8
a) Use four segment Simpson’s 1/3rd Rule to find the probability.
b) Find the true error, Et for part (a).
c) Find the absolute relative true error, t for part (a).
Solution:
a) Using n segment Simpson’s 1/3 rule,


n 1
n2
ba
x
f (t 0 )  4  f (t i )  2  f (t i )  f (t n )


3n
i 1
i 2
i  odd
i  even


n4
a 8
b  30
ba
h
n
30  8

4
 5.5
140000


f (t )  2000 ln 
 9.8t
140000  2100t 
So
f (t 0 )  f (8)


140000
f (8)  2000 ln 
  9.8(8)  177.27m / s
140000  2100(8) 
f (t1 )  f (8  5.5)  f (13.5)
07.03.10
Chapter 07.03


140000
f (13.5)  2000 ln 
  9.8(13.5)  320.25m / s
140000  2100(13.5) 
f (t 2 )  f (13.5  5.5)  f (19)


140000
  9.8(19)  484.75m / s
f (19)  2000 ln 
 140000  2100(19) 
f (t 3 )  f (19  5.5)  f (24.5)


140000
f (24.5)  2000 ln 
  9.8(24.5)  676.05m / s
140000  2100(24.5) 
f (t 4 )  f (t n )  f (30)


140000
f (30)  2000 ln 
  9.8(30)  901.67m / s
140000  2100(30) 


n 1
n2
ba
x
f (t 0 )  4  f (t i )  2  f (t i )  f (t n )

3n 
i 1
i 2


i  odd
i  even


3
2
30  8 

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
11
  f (8)  4 f (13.5)  4 f (24.5)  2 f (19)  f (30)
6
11
 177.27  4(320.25)  4(676.05)  2(484.75)  901.67
6
 11061.64 m
b) The exact value of the above integral is
30


140000


x    2000 ln 
 9.8t dt

140000  2100t 

8
=11061.34 m
So the true error is
Et  True Value  Approximate Value
Et  11061.34  11061.64
 0.30 m
Simpson’s 1/3 Rule of Integration
07.03.11
c) Absolute Relative true error,
True Error
t 
 100
True Value
 0.3

 100
11061.34
= 0.0027%
Table 1 Values of Simpson’s 1/3 rule for Example 2 with multiple-segments
t
n
Approximate Value E 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.02
0.0002%
10
11061.34
-0.01
0.0001%
Error in Multiple-segment Simpson’s 1/3 rule
The true error in a single application of Simpson’s 1/3rd Rule is given1 by
(b  a) 5 ( 4)
Et  
f ( ), a    b
2880
In multiple-segment Simpson’s 1/3 rule, the error is the sum of the errors in each application
of Simpson’s 1/3 rule. The error in the n segments Simpson’s 1/3rd Rule is given by
( x 2  x0 ) 5 ( 4)
E1  
f ( 1 ), x0   1  x 2
2880
h 5 ( 4)

f ( 1 )
90
( x  x2 ) 5 ( 4)
E2   4
f ( 2 ), x2   2  x4
2880
h 5 ( 4)

f ( 2 )
90
:
( x2i  x2(i 1) ) 5 ( 4)
Ei  
f ( i ), x2(i 1)   i  x2i
2880
h 5 ( 4)

f ( i )
90
:
1
The f(4) in the true error expression stands for the fourth derivative of the function f(x).
07.03.12
Chapter 07.03
En
2
1

( xn2  xn4 ) 5 ( 4) 

f   n , x n  4   n  x n  2
1
2880
2
 2 1 
h5

f
90
( 4)


 n 
 1 
 2 
( xn  xn  2 )5 ( 4)  
f   n , xn  2   n  xn
2880
2
2
 2
Hence, the total error in the multiple-segment Simpson’s 1/3 rule is
h 5 ( 4)  

f   n 
90
 2
En  
n
2
Et   Ei
i 1
5
n
2

h
f ( 4) ( i )

90 i 1

(b  a )
90n 5
5
n
2
f
n
2
f
( 4)
i 1
( i )
( 4)
( i )
i 1
n
2
(b  a )

90n 4
( 4)
5
f
i 1
n
( i )
is an approximate average value of f ( 4) ( x), a  x  b . Hence
n
(b  a ) 5 ( 4 )
Et  
f
90n 4
The term
where
n
2
f
( 4)

f
i 1
( 4)
( i )
n
INTEGRATION
Topic
Simpson’s 1/3 rule
Summary Textbook notes of Simpson’s 1/3 rule
Major
General Engineering
Authors
Autar Kaw, Michael Keteltas
Date
February 5, 2016
Web Site http://numericalmethods.eng.usf.edu
Download