Simpson`s 1/3 Rule for Integration

advertisement
07.03
Simpson’s 1/3 Rule for Integration-More Examples
Computer Engineering
Example 1
Human vision has the remarkable ability to infer 3D shapes from 2D images. The intriguing
question is: can we replicate some of these abilities on a computer? Yes, it can be done and
to do this, integration of vector fields is required. The following integral needs to integrated.
100
I
 f ( x)dx
0
where
f ( x)  0, 0  x  30
 9.1688  10 6 x 3  2.7961  10 3 x 2  2.8487  10 1 x  9.6778, 30  x  172
 0, 172  x  200
a) Use Simpson’s 1/3 Rule to find the probability.
b) Find the true error, E t , for part (a).
c) Find the absolute relative true error for part (a).
Solution
a)

ba 
ab
f (a)  4 f 
  f (b)

6 
 2 

a0
b  100
ab
 50
2
f x   0, 0  x  30
I
 9.1688  10 6 x 3  2.7961  10 3 x 2  2.8487  10 1 x  9.6778, 30  x  172
 0, 172  x  200
f 0  0
f 100  9.1688  10 6  100  2.7961  10 3  100  2.8487  10 1  100  9.6778
 0.017000
3
2
f 50  9.1688  10 6  50  2.7961  10 3  50  2.8487  10 1  50  9.6778
 1.2784
3
07.03.1
2
07.03.2
Chapter 07.03

 b  a 
ab
I 
  f a   4 f 
  f b 
 6 
 2 

100

0



 f 0   4 f 50   f 100 
 6 
 100 

0  41.2784   0.017 
 6 
 84.947
b) The exact value of the above integral is found using Maple for calculating the true error
and relative true error.
100
I
 f ( x)dx
0
 60.793
so the true error is
Et  True Value  Approximate Value
 60.793  84.947
 24.154
c) The absolute relative true error, t , would then be
True Error
 100 %
True Value
60.793  84.947 

 100 %
60.793
 39.732 %
t 
Example 2
Human vision has the remarkable ability to infer 3D shapes from 2D images. The intriguing
question is: can we replicate some of these abilities on a computer? Yes, it can be done and
to do this, integration of vector fields is required. The following integral needs to integrated.
100
I
 f ( x)dx
0
where
f x   0, 0  x  30
 9.1688  10 6 x 3  2.7961  10 3 x 2  2.8487  10 1 x  9.6778, 30  x  172
 0, 172  x  200
a) Use four segment Simpson’s 1/3 Rule to find the value of the integral
b) Find the true error, E t , for part (a).
c) Find the absolute relative true error for part (a).
Simpsons 1/3 Rule for Integration-More Examples: Computer Engineering
07.03.3
Solution
a) Using n segment Simpson’s 1/3 Rule,


n 1
n2
ba
I
f ( x 0 )  4  f ( xi )  2  f ( xi )  f ( x n ) 


3n
i 1
i 2
i  odd
i  even


n4
a0
b  100
ba
h
n
100  0

4
 25
f x   0, 0  x  30
 9.1688  10 6 x 3  2.7961  10 3 x 2  2.8487  10 1 x  9.6778, 30  x  172
 0, 172  x  200
So
f x0   f 0
f 0  0
f  x1   f 0  25
 f 25
f 25  0
f x2   f 25  25
 f 50
f 50  9.1688  10 6  50  2.7961  10 3  50  2.8487  10 1  50  9.6778
 1.2784
3
2
f x3   f 50  25
 f 75
f 75  9.1688  10 6  75  2.7961  10 3  75  2.8487  10 1  75  9.6778
 0.17253
3
f x4   f xn 
 f 100
2
07.03.4
Chapter 07.03
f 100  9.1688  10 6  100  2.7961  10 3  100  2.8487  10 1  100  9.6778
 0.017000
3
2


n 1
n2
ba
I
f ( x 0 )  4  f ( xi )  2  f ( xi )  f ( x n ) 


3n
i 1
i 2


i  odd
i  even


3
2
100  0 

f 0  4  f xi   2  f xi   f 100

34 
i 1
i 2
i  odd
i  even


100
 f 0  4 f x1   4 f x3   2 f x2   f 100

12
25
 f 0  4 f 25  4 f 75  2 f 50  f 100

3
25
0  40  40.17253  21.2784   0.017000

3
 26.917
b) The exact value of the above integral is found using Maple for calculating the true error
and relative true error.
100
I
 f ( x)dx
0
 60.793
so the true error is
Et  True Value  Approximate Value
 60.793  26.917
 33.873
c) The absolute relative true error, t , would then be
True Error
 100 %
True Value
60.793  26.917 

 100 %
60.793
 55.724 %
t 
Simpsons 1/3 Rule for Integration-More Examples: Computer Engineering
Table 1 Values of Simpson’s 1/3 Rule for Example 2 with multiple segments.
n
Approximate Value
Et
t %
2
4
6
8
10
84.947
26.917
66.606
62.318
85.820
24.154
33.876
5.8138
1.5252
25.023
39.732
55.724
9.5633
2.5088
41.169
07.03.5
Download