Chapter 21

Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

Newton-Cotes Integration Formulas

Chapter 21-page 601 (from part 6/page584)


• The Newton-Cotes formulas are the most common
numerical integration schemes.

• They are based on the strategy of replacing a


complicated function or tabulated data with an
approximating function that is easy to integrate:
b b
I   f ( x)dx   f n ( x)dx where n is
the order of
a a the
polynomial
f n ( x)  a0  a1 x    an 1 x n 1  an x n
1
by Lale Yurttas, Texas Chapter 21
A&M University Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Approximating the integral by the area under: (a) one straight line segment (first
order polynomial). (b) a single parabola

by Lale Yurttas, Texas Chapter 21 2


A&M University
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The approximation of the integral by the area under three straight-line segments

by Lale Yurttas, Texas Chapter 21 3


A&M University
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The Trapezoidal Rule
• The Trapezoidal rule is the first of the Newton-Cotes
closed integration formulas, corresponding to the
case where the polynomial is first order:
b b f (b)
f (a)
I   f ( x)dx   f1 ( x)dx a b
a a
• The area under this first order polynomial is an
estimate of the integral of f(x) between the limits of
a and b: I ∼ = (b − a) × average height
f (a)  f (b)
I  (b  a) Trapezoidal rule
2 4
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Graphical depiction of the trapezoidal rule

by Lale Yurttas, Texas Chapter 21 5


A&M University
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Error of the Trapezoidal Rule/
• When we employ the integral under a straight line
segment to approximate the integral under a curve,
error may be substantial:

1
Ea   f (x )(b  a) 3 Approximate error
12
where x lies somewhere in the interval from a to b.
Note f ' ' (x ) is the average value of the second
b
derivative in the interval [a,b]
a f ' ' ( x)dx
f ' ' (x ) 
(b  a )
by Lale Yurttas, Texas Chapter 21 6
A&M University
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example:
Use trapezoidal rule (1 segment) to numerically integrate

f ( x)  0.2  25 x  200 x  675 x  900 x  400 x 2 3 4 5

from a = 0 to b = 0.8. Recall that the exact value of this integration is 1.640533.
Find the exact and approximate errors.

Solution: f(0)=0.2, f(0.8)=0.232

f (a)  f (b) 0.2  0.232


I  (b  a)  0.8  0.1728
2 2
Et  1.640533  0.1728  1.467733 89.4UdOUY

1.467733
relative _ error  100 %  89.5%
1.640533
7
Chapter 21
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
•To find the approximate error: 4050 X-10,000X40x
=400
+

f ( x)  0.2  25x  200 x 2  675x3  900 x 4  400 x 5

f ' ( x)  25  400 x  2025x 2  3600 x3  2000 x 4

f ' ' ( x)  400  4050 x  10,800 x 2  8000 x3


•The average value of f’’(x) in the interval [0 , 0.8] is:
1
Ea   f (x )(b  a)3
12
b

 f ' ' ( x)dx


f ' ' (x )  a
#floo
(b  a ) 0.5

0.8

    
2 3
( 400 4050 x 10,800 x 8000 x )dx
f ' ' ( x)  0
 60
(0.8  0)
1 1
Ea   f ' ' (x )(b  a)3   (60)(0.8  0)3  2.56
12 Yurttas, Texas
by Lale 12 8
A&M University Chapter 21
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
[ 0r](08-9)3 =-400X 110.0093 orme
-

-
+ neso

The Multiple Application Trapezoidal Rule/

• One way to improve the accuracy of the trapezoidal rule is to


divide the integration interval from a to b into a number of
segments and apply the method to each segment.
• The areas of individual segments can then be added to yield
the integral for the entire interval.
ba
h a  x0 b  xn
n
x1 x2 xn

I  f ( x)dx   f ( x)dx     f ( x)dx


x0 x1 xn1

Substituting the trapezoidal rule for each integral yields:


f ( x0 )  f ( x1 ) f ( x1 )  f ( x2 ) f ( xn 1 )  f ( xn )
I h h  h
2 2 2 9
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Grouping the terms gives:
n 1
h
I  [ f ( xo )  2 f ( xi )  f ( xn )]
2 i 1

ba
Where h
n

The error for the multiple application trapezoidal rule is obtained by summing the
individual errors for each segment.

(b  a)3 n (b  a)3
Ea   3 
12n i 1
f (xi )  
12n 2
f ''

Where f '' is the average of f’’ over the entire interval [a,b]

by Lale Yurttas, Texas Chapter 21 10


A&M University
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
by Lale Yurttas, Texas Chapter 21 11
A&M University
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example:
Use the two segment trapezoidal rule to numerically integrate

f ( x)  0.2  25x  200 x 2  675x3  900 x 4  400 x 5


from a=0 to b=0.8. Recall that the exact value of this integration is 1.640533.
Find the exact and approximate errors.

Solution: f(0)=0.2, f(0.4)=2.456, f(0.8)=0.232


n 1
h
I  [ f ( xo )  2 f ( xi )  f ( xn )]
2 i 1
b  a 0 .8  0
h   0.4
n 2
h
I  [ f ( xo )  2 f ( x1 )  f ( x2 )]
2
 0.2[0.2  2(2.456)  0.232]  1.0688
Et  1.640533  1.0688  0.57173
0.57173
relative _ error  100%  34.9% 12
1.640533
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
•To find the approximate error:

f ' ' ( x)  400  4050 x  10,800 x 2  8000 x3

•The average value of f’’(x) in the interval [0,0.8] is:


(b  a)3 n (b  a)3
Ea   3 
12n i 1
f (xi )  
12n 2
f ''

0.8

    
2 3
( 400 4050 x 10,800 x 8000 x )dx
f ' ' ( x)  0
 60
(0.8  0)
(b  a )3 0.83
Ea   2
f ''  2
(60)  0.64
12n 12(2 )

Chapter 21 13
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Simpson’s Rules
• More accurate estimate of an integral is
obtained if a high-order polynomial is used to
connect the points. The formulas that result
from taking the integrals under such
polynomials are called Simpson’s rules.

Simpson’s 1/3 Rule


• Results when a second-order interpolating
polynomial is used.
by Lale Yurttas, Texas Chapter 21 14
A&M University
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Simpson 1/3 rule Simpson 3/8 rule

by Lale Yurttas, Texas Chapter 21 15


A&M University
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
b b
I   f ( x)dx   f 2 ( x)dx
a a

a  x0 b  x2
x2
 ( x  x1 )( x  x2 ) ( x  x0 )( x  x2 ) ( x  x0 )( x  x1 ) 
I   f ( x0 )  f ( x1 )  f ( x2 )dx
x0 
( x0  x1 )( x0  x2 ) ( x1  x0 )( x1  x2 ) ( x2  x0 )( x2  x1 ) 

h ba
I  f ( x0 )  4 f ( x1 )  f ( x2 ) h
3 2

Simpson’s 1/3 Rule

The approximate error in the Simpson 1/3 rule is: The label “1/ 3” stems
from the fact that
(b  a )5 ( 4 ) (b  a )5 ( 4 )
y(/)//
h is divided by 3
Ea   f (x )   f
2880 2880
f (4)
is the average of the fourth derivative of f in the
interval [a,b] 16
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example:
Use the single application of Simpson’s 1/3 rule to numerically integrate

f ( x)  0.2  25 x  200 x 2  675 x3  900 x 4  400 x 5

from a=0 to b=0.8. Recall that the exact value of this integration is 1.640533.
Find the exact and approximate errors.

Solution: b  a 0. 8  0
f(0)=0.2 h   0 .4
f(0.4)=2.456 2 2
f(0.8)=0.232 h
I  [ f ( xo )  4 f ( x1 )  f ( x2 )]
3
0 .4
 [0.2  4(2.456 )  0.232 ]  1.367467
3
Et  1.640533  1.367467  0.273066
0.273066
relative _ error  100 %  16.6%
1.640533
17
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
•To find the approximate error:
f ' ' ( x)  400  4050 x  10,800 x 2  8000 x 3
f ' ' ' ( x)  4050  21,600 x  24,000 x 2
f ( 4 ) ( x)  21,600  48,000 x
•The average value of f (4) (x) in the interval [0,0.8] is:

0.8

 (21600  48,000 x)dx


f ( 4 ) ( x)  0
 2400
(0.8  0)
(b  a)5 ( 4 ) (b  a)5 ( 4 ) 0.85
Ea   f (x )   f  (2400 )  0.2730667
2880 2880 2880

Notice Ea is very close to Et.

Chapter 21 18
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The Multiple Application Simpson’s 1/3 Rule
•The accuracy of Simpson’s rule can be improved by further dividing the interval into
smaller segment (n segments).

ba Simpson’s 1/3 rule


h
n

HAHA
x2 x4 x6 xn

I  f ( x)dx   f ( x)dx   f ( x)dx  ....    f ( x)dx


xo x2 x4 xn2

h h
 [ f ( xo )  4 f ( x1 )  f ( x2 )]  [ f ( x2 )  4 f ( x3 )  f ( x4 )]
3 3
h h Graphical representation
 [ f ( x4 )  4 f ( x5 )  f ( x6 )]  ....  [ f ( xn  2 )  4 f ( xn 1 )  f ( xn )] of the multiple application
3 3
h of Simpson’s 1/3 rule.
 [ f ( xo )  4 f ( x1 )  2 f ( x2 )  4 f ( x3 )  2 f ( x4 )  4 f ( x5 )  2 f ( x6 ) Note that the method can
3
be employed only if the
 .....  2 f ( xn  2 )  4 f ( xn 1 )  f ( xn )]
number of segments is
n 1 n2
h even.
I  [ f ( xo )  4  f ( xi )  2  f ( x j )  f ( xn )]
3 i 1, 3, 5 j  2, 4, 6 (Even-segment–Odd-point)
ba
h
n
The error estimate is obtained by summing all (b  a )5
Ea   f ( 4)
the individual errors for the segments. 180 n 4
19
Chapter 21 Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example:
Use the multiple application of Simpson’s 1/3 rule (N=4) to numerically integrate

f ( x)  0.2  25 x  200 x 2  675 x3  900 x 4  400 x 5

from a=0 to b=0.8. Recall that the exact value of this integration is 1.640533.
Find the exact and approximate errors.

Solution: f(0)=0.2 , f(0.2)=1.288, f(0.4)=2.456, f(0.6)=3.464, f(0.8)=0.232

b  a 0 .8  0
n 1 n2
h
I  [ f ( xo )  4  f ( xi )  2  f ( x j )  f ( xn )]
h  7 -  0. 2 3 i 1, 3, 5 j  2, 4, 6

n WE v
4 depends typar h  b  a

a
on

-Y n
h
I  { f ( xo )  4[ f ( x1 )  f ( x3 )]  2 f ( x2 )  f ( x4 )}
3
0.2
 [0.2  4(1.288  3.464)  2( 2.456)  0.232]  1.623467
3
Et  1.640533  1.623467  0.017067
0.017067
relative _ error  100%  1.04%
1.640533 20
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
•To find the approximate error:
f ' ' ( x)  400  4050 x  10,800 x 2  8000 x 3
f ' ' ' ( x)  4050  21,600 x  24,000 x 2
f ( 4 ) ( x)  21,600  48,000 x
•The average value of f (4) (x) in the interval [0,0.8] is:

0.8

 (21600  48,000 x)dx


f ( 4) ( x)  0
 2400
(0.8  0)
(b  a )5 ( 4 ) 0.85
Ea   4
f  4
(2400)  0.017067
180n 180(4)
Notice Ea is very close to Et.

Chapter 21 21
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Simpson’s 3/8 Rule
Results when a third-order interpolating polynomial is used.
b b
I   f ( x)dx   f 3 ( x)dx
a a

a  x0 b  x3

&
 ( x  x1 )( x  x2 )( x  x3 ) ( x  x0 )( x  x2 )( x  x3 ) 
f ( x )  f ( x )
x  ( x  x )( x  x )( x  x ) ( x1  x0 )( x1  x2 )( x1  x3 ) 
0 1

I   dx
3
0 1 0 2 0 3

x  ( x  x0 )( x  x1 )( x  x3 ) ( x  x0 )( x  x1 )( x  x2 ) 
 f ( x )  f ( x )
0

 ( x  x )( x  x )( x  x ) 2
( x3  x0 )( x3  x1 )( x3  x2 )
3 
 2 0 2 1 2 3 

3h ba
-> I  f ( x0 )  3 f ( x1 )  3 f ( x2 )  f ( x3 ) h
8 3

Simpson’s 3/8 Rule


The approximate error in the Simpson 3/8 rule is:

(b  a )5 ( 4 ) (b  a )5 ( 4 )
Ea   f (x )   f
6480 6480
f (4) is the average of the fourth derivative of f in the interval [a,b] 22
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Simpson 1/3 rule Simpson 3/8 rule
by Lale Yurttas, Texas Chapter 21 23
A&M University
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example:
Use the single application of Simpson’s 3/8 rule to numerically integrate

f ( x)  0.2  25 x  200 x 2  675 x3  900 x 4  400 x 5

from a=0 to b=0.8. Recall that the exact value of this integration is 1.640533.
Find the exact and approximate errors.

Solution: f(0)=0.2 , f(0.2667)=1.432724, f(0.5333)=3.487177, f(0.8)=0.232


b  a 0.8  0
h   0.2667
3 3
3h
I  [ f ( xo )  3 f ( x1 )  3 f ( x2 )  f ( x3 )]
8
3(0.2667 )
 [0.2  3(1.432724  3.487177 )  0.232 ]  1.519170
8
Et  1.640533  1.519170  0.1213630
0.1213630
relative _ error  100 %  7.4%
1.640533
24
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
•To find the approximate error:
f ' ' ( x)  400  4050 x  10,800 x 2  8000 x 3
f ' ' ' ( x)  4050  21,600 x  24,000 x 2
f ( 4 ) ( x)  21,600  48,000 x
•The average value of f (4) (x) in the interval [0,0.8] is:

0.8

 (21600  48,000 x)dx


f ( 4 ) ( x)  0
 2400
(0.8  0)
(b  a)5 ( 4 ) 0.85
Ea   f  (2400 )  0.1213629
6480 6480

Notice Ea is very close to Et.

Simpson 3/8 rule is slightly more accurate than Simpson 1/3 rule

Chapter 21 25
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The Multiple Application Simpson’s 3/8 Rule

•What is the formula for the integration if we divide the interval


[a,b] to n segments using 3/8 rule???
3h n2 n 1 n 3
ba
I  [ f ( xo )  3  f ( xi )  3  f ( x j )  2  f ( xk )  f ( xn )]...........h 
8 i 1, 4 , 7 ,... j  2 , 5,8,.. k  3, 6 , 9 ,... n

Odd-segment–Even-point

(b  a)5 ( 4)
Ea   4
f (x ) n must be multiple of 3
80n

Chapter 21 26
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

You might also like