# 5.

2

Simpson’s 1/3rd Rule

5.2.1 Simpson’s Rule:
A wide variety of numerical methods have been developed to simplify the
integral. Here, we will discuss Simpson’s 1/3rd Rule of integral approximation,
which improves upon the accuracy of the Trapezoidal 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
non-approximated by a second order polynomial.
5.2.2 Deriving Simpson's Rule
Hence
b

I 

b

f ( x) dx 

a

f

2

( x) dx

a

where f 2 ( x ) is a second order polynomial.
f 2 ( x)  a 0  a1 x  a 2 x 2

 ab  ab
, f

 2 
 2

Choose (a, f ( a )), 

 , and (b, f (b)) as the three points of the

function to evaluate a 0 , a1 and a 2 .
f (a)  f 2 (a)  a0  a1 a  a 2 a 2
 ab
 ab
 ab
 ab
f
  f2
  a 0  a1 
  a2 

 2 
 2 
 2 
 2 

2

f (b)  f 2 (b)  a 0  a1b  a 2 b 2

Solving the above three equations for unknowns, a 0 , a1 and a 2 give

the interval  a. the segment width h ba 2 Hence the Simpson’s 1/3rd rule is given by b h  f ( x )dx  3    a b   f (b)  2   f (a )  4 f  a Since the above form has 1/3 in its formula. it is also called Simpson’s 1/3rd Rule. a1 and a 2 give b f 2 ( x) dx  a  ba  ab f (a)  4 f    f (b)  6   2   Since for Simpson’s 1/3rd Rule.Chapter 5  ab 2   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    ab 2 f (a)  2 f    f (b)   2   a2   2 2 a  2ab  b a 2 f (b)  abf (b)  4abf  Then b I  f 2 ( x) dx a b     a 0  a1 x  a 2 x 2 dx a b  x2 x3    a 0 x  a1  a2  2 3 a  b2  a2 b3  a 3  a 0 (b  a )  a1  a2 2 3 Substituting values of a 0 . b  is broken into 2 segments. 2 .

017 f (50)  9. 172  x  200 a) Use Simpson’s 1/3rd Rule to find the integration.7961  10 3 x 2  2.6778  0. 100 I   f ( x )dx 0 where f(x)  0 .8487  10 1 x  9. it can be done and to do this.6778.1688  10 6  (100) 3  2. b) Find the true error.6778. 0  x  30  9.7961  10 3  (100) 2  2. 0  x  30  9. Solution:  ba   ab I f (a)  4 f    f (b) a)  6   2   c) t .6778 3 .1688  10 6 x 3  2. integration of vector fields is required. a0 b  100 ab  50 2 f(x)  0 .8487  10 1 x  9. 30  x  172  0.8487  10 1  (50)  9. E t Find the absolute relative true error. The intriguing question is: can we replicate some of these abilities on a computer? Yes.7961  10 3 x 2  2.7961  10 3  (50) 2  2.1688  10 6 x 3  2. The following integral needs to integrated. 30  x  172  0. 172  x  200 f (0)  0 f (100)  9.Simpson’s Rule Example 1: Human vision has the remarkable ability to infer 3D shapes from 2D images.1688  10 6  (50) 3  2.8487  10 1  (100)  9.

94667 b) The exact value of the above integral is found using Maple for calculating the true error and relative true error.7926  39.2784)  (0.Chapter 5  1. b into n segments and apply Simpson’s 1/3rd Rule repeatedly over every 4 .73% 5.1540 c) The absolute relative true error.2784   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. would then be True Error  100 True Value 60.7926  (84. one can subdivide the interval  a.2.7926  (84.017)  6   84. 100 I   f ( x)dx 0  60.7926 so the true error is Et  True Value  Approximat e Value  60. t   t .3 Multiple Segment Simpson’s 1/3rd Rule Just like in multiple-segment Trapezoidal Rule.94667)  100 60.94667)  24.

. b into n equal segments...Simpson’s Rule two segments. ..... Note that n needs to be even.. hence the segment width h  xn b  ba ... Divide interval  a.  f ( xn1 )  2 f ( x2 )  f ( x4 )  . 4.. n  f ( x)dx f ( x)dx  a x0 where x0  a xn  b x2 b   f ( x)dx  a f ( x)dx  x0 x4  f ( x)dx  .  f ( xn2 )  f ( x n ) 3 5 .. n then b  f ( x0 )  4 f ( x1 )  f ( x 2 )   f ( x 2 )  4 f ( x3 )  f ( x 4 )   2h     ..  x2 xn  2  xn  4 f ( x )dx  xn  f ( x)dx xn  2 Apply Simpson’s 1/3rd Rule over each interval. 6 6     x0 )  2 a  f ( x n  4 )  4 f ( x n 3 )  f ( x n  2 )   f ( x n  2 )  4 f ( x n 1 )  f ( x n )   ( x n  x n 2 )    6 6      ( x n2  xn 4 )  Since x i  xi  2  2h i  2... 6 6    f ( x )dx  2h  a  f ( x n  4 )  4 f ( x n 3 )  f ( x n  2 )   f ( x n  2 )  4 f ( x n 1 )  f ( x n )   2h    6 6      2h   h  f ( x0 )  4 f ( x1 )  f ( x3 )  .. b  f ( x )dx  ( x  f ( x0 )  4 f ( x1 )  f ( x 2 )   f ( x 2 )  4 f ( x3 )  f ( x 4 )   ( x4  x2 )     .

1688  10 6 x 3  2. 100 I   f ( x )dx 0 where f(x)  0 . 172  x  200 a) Use four segment Simpson’s 1/3rd Rule to find the value of the integral. Et for part (a). integration of vector fields is required.W: Draw a flow chart to calculate the integral of the function f(x) from a to b using n equal intervals by Simpson Rule.6778.Chapter 5   b   n 1 n2 n1 n 2 h ba   f ( x0 )  4  f ( xi )  2  f ( xi )  f ( xn )  f ( x)dx   f ( x0 )  4  f ( xi )  2  f ( xi )  f ( xn ) 3    3n i 1 i 2 i 1 i2 a i odd i even i  odd i  even     H. 0  x  30  9. b) Find the true error. 30  x  172  0. it can be done and to do this. Solution: a) Using I n segment Simpson’s 1/3rd Rule.8487  10 1 x  9. c) Find the absolute relative true error for part (a). 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.   n 1 n 2 ba f ( x 0 )  4  f ( x i )  2  f ( x i )  f ( x n )   3n i 1 i 2 i odd i even   n4 a0 b  100 6 .7961  10 3 x 2  2. The following integral needs to integrated.

Simpson’s Rule ba n 100  0  4 h  25 f(x)  0 .7961  10 3  (75) 2  2.8487  10 1 x  9.6778  0.1688  10 6  (50) 3  2.2784 f ( x3 )  f (50  25)  f (75) f (75)  9. 172  x  200 So f ( x 0 )  f ( 0) f (0)  0 f ( x1 )  f (0  25)  f (25) f ( 25)  0 f ( x 2 )  f (25  25)  f (50) f (50)  9.8487  10 1  (50)  9.7961  10 3  (50) 2  2.6778  0.1688  10 6  (75) 3  2.17252 f ( x 4 )  f ( y n )  f ( 270) f (100)  9.8487  10 1  (75)  9.6778.7961  10 3 x 2  2.7961  10 3  (100) 2  2.1688  10 6 x 3  2.1688  10 6  (100) 3  2.8487  10 1  (100)  9.6778  1. 30  x  172  0.017 I   n 1 n 2 ba f ( x 0 )  4  f ( x i )  2  f ( x i )  f ( x n )   3n i 1 i 2   i odd i even 7 . 0  x  30  9.

7926  55. 100 I   f ( x)dx 0  60.7926 so the true error is Et  True Value  Approximat e Value  60. t   t .731% 4 26.94667 -24.2784)  (0.17252)  2(1. would then be True Error  100 True Value 60.91667)  33.7926  ( 26.723% Table 1: Values of Simpson’s 1/3rd Rule for Example 2 with multiple segments n Approximate Value Et t 2 84.7926  (26.723% 8 .Chapter 5    2 100  0  3 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 ( x 2 )  f (100) 12 25   f (0)  4 f (25)  4 f (75)  2 f (50)  f (100) 3 25   0  4(0)  4(0.875 55.017) 3   26.91667)  100 60.91667 33.8759 c) The absolute relative true error.154 39.91667 b) The exact value of the above integral is found using Maple for calculating the true error and relative true error.

6063 -5.Simpson’s Rule 6 66.5088% 9 .5632% 8 62.5251 2.3177 -1.8137 9.