0% found this document useful (0 votes)
47 views9 pages

4.3.numerical Integration Simpson3by8

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views9 pages

4.3.numerical Integration Simpson3by8

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

SUPPLEMENTARY MATERIAL

Simpson 3/8 Rule for Integration

After reading this lecture notes, you should be able to


1. derive the formula for Simpson’s 3/8 rule of integration,
2. use Simpson’s 3/8 rule it to solve integrals,
3. develop the formula for multiple-segment Simpson’s 3/8 rule of integration,
4. use multiple-segment Simpson’s 3/8 rule of integration to solve integrals,
5. compare true error formulas for multiple-segment Simpson’s 1/3 rule and multiple-
segment Simpson’s 3/8 rule, and
6. use a combination of Simpson’s 1/3 rule and Simpson’s 3/8 rule to approximate
integrals.

Introduction
The main objective of this lecture is to develop appropriate formulas for approximating the
integral of the form
b
I  f ( x)dx
a
(1)

Most (if not all) of the developed formulas for integration are based on a simple concept of
approximating a given function f (x) by a simpler function (usually a polynomial function)
f i (x) , where i represents the order of the polynomial function. In the previous method,
Simpsons 1/3 rule for integration was derived by approximating the integrand f (x) with a
2nd order (quadratic) polynomial function. f 2 ( x )
f 2 ( x)  a0  a1 x  a2 x 2 (2)

1
Numerical Analysis MATH351/352

~
Figure 1 f ( x) Cubic function.

In a similar fashion, Simpson 3/8 rule for integration can be derived by approximating the
given function f (x) with the 3rd order (cubic) polynomial f 3 ( x )
f 3 ( x )  a0  a1 x  a 2 x 2  a3 x 3 

a0  
a  

 1, x, x , x 
(3)
2 3  1

a 2  
  
 a3  
which can also be symbolically represented in Figure 1.
Method 1
The unknown coefficients a0 , a1 , a2 and a3 in Equation (3) can be obtained by substituting 4
known coordinate data points {x0 , f x0 },{x1 , f x1 },{x2 , f x2 } and {x3 , f x3 } into
Equation (3) as follows.
f ( x0 )  a0  a1 x0  a 2 x02  a3 x02 

f ( x1 )  a 0  a1 x1  a 2 x12  a3 x12 
 (4)
f ( x 2 )  a0  a1 x 2  a 2 x 22  a3 x 22 
f ( x3 )  a 0  a1 x3  a 2 x32  a3 x32 
Equation (4) can be expressed in matrix notation as
1 x0 x02 x03  a0   f x0 
 3    
1 x1 x1 x1   a1    f x1 
2
(5)
1 x 2 x 22 x 23  a 2   f x 2 
 3    
1 x3 x3 x3   a3   f x3 
2

The above Equation (5) can symbolically be represented as



A44 a41  f 41 (6)
Thus,

2
Numerical Analysis Simpson 3/8 Rule for Integration
 a1 
a  

a   2   A  f
1
(7)
 a3 
 
a 4 
Substituting Equation (7) into Equation (3), one gets

 
f 3 x   1, x, x 2 , x 3  A  f
1
(8)
As indicated in Figure 1, one has
x0  a 
x1  a  h 

ba 
a 
3 
2a  b 
 
3

x 2  a  2h 
2b  2a  (9)
a
3 
a  2b 
 
3

x3  a  3h 
3b  3a 
a 
3 
b 
Note that you may use any known symbolic tool(eg. MATLAB, MATHEMATICA) to solve the

unknown vector a (shown in Equation 7).

Method 2
Using Lagrange interpolation, the cubic polynomial function f 3 x  that passes through 4
data points (see Figure 1) can be explicitly given as
x  x1 x  x2 x  x3  x  x0 x  x2 x  x3 
f 3 x    f  x0    f x1 
x0  x1 x0  x2 x0  x3  x1  x0 x1  x2 x1  x3 
(10)
x  x0 x  x1 x  x3  x  x0 x  x1 x  x2 
  f  x3    f  x3 
x2  x0 x2  x1 x2  x3  x3  x0 x3  x1 x3  x2 

Simpsons 3/8 Rule for Integration


Substituting the form of f 3 x  from Method (1) or Method (2),
b
I   f  x dx
a
b
  f 3  x dx
a
Numerical Analysis MATH351/352
 b  a  
f x0   3 f x1   3 f x2   f x3  (11)
8
Since
ba
h
3
b  a  3h
and Equation (11) becomes
  f x0   3 f x1   3 f x2   f x3 
3h
I (12)
8
Note the 3/8 in the formula, and hence the name of method as the Simpson’s 3/8 rule.
The true error in Simpson 3/8 rule can be derived as [Ref. 1]
(b  a) 5
Et    f   , where a    b (13)
6480
Example 1
The vertical distance covered by a rocket from x  8 to x  30 seconds is given by
 
30
 140000 
s    2000 ln    9.8 x dx
8 140000  2100t  
Use Simpson 3/8 rule to find the approximate value of the integral.
Solution
ba
h
n
ba

3
30  8

3
 7.3333

  f x0   3 f x1   3 f x2   f x3 


3h
I
8
x0  8
 
f x0   2000 ln 
140000
  9.8  8
 140000  2100  8 
 177.2667

x  x  h
 1 0

  8  7.3333

  15.3333

 f x1   2000 ln  
140000
  9.8  15.3333
  140000  2100  15.3333 
  372.4629

4
Numerical Analysis Simpson 3/8 Rule for Integration

 x  x  2h
 2 0

  8  2(7.3333)

  22.6666

 f x 2   2000 ln  
140000
  9.8  22.6666
  140000  2100  22.6666 
  608.8976


 x  x  3h
 3 0

  8  3(7.3333)

  30

 f x3   2000 ln  
140000
  9.8  30
  140000  2100  30 
  901.6740

Applying Equation (12), one has


I   7.3333  177.2667  3  372.4629  3  608.8976  901.6740
3
8
 11063.3104
The exact answer can be computed as
I exact  11061.34

Multiple Segments for Simpson 3/8 Rule


Using n = number of equal segments, the width h can be defined as
ba
h (14)
n
The number of segments need to be an integer multiple of 3 as a single application of
Simpson 3/8 rule requires 3 segments.
The integral shown in Equation (1) can be expressed as
b
I   f  x dx
a
b
  f 3  x dx
a
x3 x6 xn  b

  f x dx   f x dx  ........   f x dx


x0  a
3
x3
3
xn  3
3 (15)

Using Simpson 3/8 rule (See Equation 12) into Equation (15), one gets
3h  f x0   3 f x1   3 f x2   f x3   f x3   3 f x4   3 f x5   f x6 
I   (16)
8  .....  f xn3   3 f xn2   3 f xn 1   f xn  
Numerical Analysis MATH351/352
3h  n 2 n 1 n 3

  f x0   3  f xi   3  f xi   2  f xi   f xn  (17)
8  i 1, 4 , 7 ,.. i  2,5,8,.. i 3, 6, 9 ,.. 

Example 2
The vertical distance covered by a rocket from x  8 to x  30 seconds is given by
 
30
 140000 
s    2000 ln    9.8 x dx
8 140000  2100t  
Use Simpson 3/8 multiple segments rule with six segments to estimate the vertical distance.
Solution
In this example, one has (see Equation 14):
30  8
h  3.6666
6
x0 , f x0   8,177.2667
x1 , f x1   11.6666,270.4104where x1  x0  h  8  3.6666  11.6666
x2 , f x2   15.3333,372.4629 where x2  x0  2h  15.3333
x3 , f x3   19,484.7455 where x3  x0  3h  19
x4 , f x4   22.6666,608.8976 where x4  x0  4h  22.6666
x5 , f x5   26.3333,746.9870 where x5  x0  5h  26.3333
x6 , f x6   30,901.6740 where x6  x0  6h  30
Applying Equation (17), one obtains:
 n 24 n 15 n  3 3

I  3.6666177.2667  3  f xi   3  f xi   2  f xi   901.6740
3
8  i 1, 4,.. i  2 , 5,.. i 3, 6,.. 
177.2667  3  270.4104  608.8976 
 

 1.3750   
3  372.4629  746.9870   2  484.7455  901.6740
 
 11,601.4696
Example 3
Compute
b 30
  140,000  
I  2000 ln 140,000  2100 x   9.8xdx,
a 8

using Simpson 1/3 rule (with n1  4), and Simpson 3/8 rule (with n2  3).
Solution
The segment width is
ba
h
n
ba

n1  n2

6
Numerical Analysis Simpson 3/8 Rule for Integration
30  8

4  3
 3.1429
x0  a  8 
x1  x0  1h  8  3.1429  11.1429 

x2  x0  2h  8  23.1429   14.2857  Simpson' s 1/3 rule
x3  x0  3h  8  33.1429   17.4286 

x4  x0  4h  8  43.1429   20.5714 
x5  x0  5h  8  53.1429  23.7143
x6  x0  6h  8  63.1429  26.8571
x7  x0  7h  8  73.1429  30
 
f x0  8  2000 ln 
140,000
  9.8  8  177.2667
 140,000  2100  8 
Similarly:
f  x1  11.1429  256.5863
f  x2   342.3241
f  x3   435.2749
f  x4   536.3909
f  x5   646.8260
f  x6   767.9978
f  x7   901.6740
For multiple segments n1  first 4 segments  , using Simpson 1/3 rule, one obtains (See
Equation 19):
 h  
n1 13 n1  2  2
I 1     f  x0   4  f  xi   2  f xi   f xn1 
 3  i 1, 3,... i  2 ,... 
 3.1429 
 177.2667  4256.5863  435.2749   2342.3241  536.3909
 3 
 4364.1197
For multiple segments n2  last 3 segments  , using Simpson 3/8 rule, one obtains (See
Equation 17):
 3h   
n2  2 1 n2 1 2 n2 30
I 2     f x0   3  f xi   3  f xi   2  f xi   f xn1 
 8  i 1, 3,... i  2 ,... i 3 , 6 ,... 
3 
   3.1429 177.2667  3256.5863  3342.3241  no contribution   435.2749
8 
 6697.2748

The mixed (combined) Simpson 1/3 and 3/8 rules give


Numerical Analysis MATH351/352
I  I1  I 2
 4364.1197  6697.2748
 11,061.3946
Comparing the truncated error of Simpson 1/3 rule

Et  
 b  a
5
 f   (18)
2880
With Simpson 3/8 rule (See Equation 12), it seems to offer slightly more accurate answer
than the former. However, the cost associated with Simpson 3/8 rule (using 3rd order
polynomial function) is significantly higher than the one associated with Simpson 1/3 rule
(using 2nd order polynomial function).
The number of multiple segments that can be used in the conjunction with Simpson
1/3 rule is 2, 4, 6, 8, … (any even numbers).
h
I 1    f x0   4 f x1   f x2   f x2   4 f x3   f x4   .....  f xn 2   4 f xn 1   f xn 
 3
 h  n 1 n 2

    f x0   4  f xi   2  f xi   f xn  (19)
 3  i 1, 3,... i  2 , 4 , 6... 
However, Simpson 3/8 rule can be used with the number of segments equal to 3,6,9,12,..
(can be certain odd or even numbers that are multiples of 3).
If the user wishes to use, say 7 segments, then the mixed Simpson 1/3 rule (for the first 4
segments), and Simpson 3/8 rule (for the last 3 segments) would be appropriate.

Computer Algorithm for Mixed Simpson 1/3 and 3/8 Rule for Integration
Based on the earlier discussion on (single and multiple segments) Simpson 1/3 and 3/8
rules, the following “pseudo” step-by-step mixed Simpson rules can be given as
Step 1
User inputs information, such as
f (x) = integrand
n1 = number of segments in conjunction with Simpson 1/3 rule (a multiple of 2 (any
even numbers)
n2 = number of segments in conjunction with Simpson 3/8 rule (a multiple of 3)
Step 2
Compute
n  n1  n2
ba
h
n

8
Numerical Analysis Simpson 3/8 Rule for Integration
x0  a
x1  a  1h
x 2  a  2h
.
.
xi  a  ih
.
.
x n  a  nh  b
Step 3
Compute result from multiple-segment Simpson 1/3 rule (See Equation 19)
 h  
n1 1 n1  2
 
I1     f x0   4  f xi   2  f xi   f xn1  (19, repeated)
 3  i 1, 3,... i 2 , 4 , 6... 
Step 4
Compute result from multiple segment Simpson 3/8 rule (See Equation 17)
 3h  
n2  2 n2 1 n2  3
 
I 2     f  x 0   3  f  x i   3  f  x i   2  f  x i   f x n2  (17, repeated)
 8  i 1, 4, 7... i  2, 5,8... i 3, 6 , 9 ,... 
Step 5
I  I1  I 2 (20)
and print out the final approximated answer for I .

You might also like