Professional Documents
Culture Documents
Chapter 21
1
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
• Calculus is the mathematics of change. Since engineers continuously deal with
systems and processes that change, calculus is an essential tool of engineering.
• Standing at the heart of calculus are the concepts of:
Differentiation
and Integration
y f ( xi x) f ( xi ) b
I f ( x)dx
x x a
dy f ( xi x) f ( xi )
lim
dx x0 x
2
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Newton-Cotes Integration Formulas
b b
• Based on the strategy of replacing a
I f ( x)dx f n ( x)dx
complicated function or tabulated data
a a
with an approximating function that is
easy to integrate: f n ( x) a0 a1 x an x n
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The Trapezoidal Rule
b b
I
a
f ( x ) dx f1 ( x ) dx
a
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Error Estimate of the Trapezoidal Rule
Error:
1
Et f (x )(b a)3
12
where x lies somewhere in the
interval from a to b
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Example 21.1 Single Application of the Trapezoidal Rule
f(x) = 0.2 +25x – 200x2 + 675x3 – 900x4 + 400x5
f (a ) f (b)
Trapezoida l Rule : I (b a )
2
0.2 0.232
0.8 0.1728
2
which represents an error of :
f ( x0 ) f ( x1 ) f ( x1 ) f ( x2 ) f ( x ) f ( xn )
I h h h n1
2 2 2
ba n 1
I
2n
f ( x 0 ) f ( x n ) 2 i 1 i
f ( x )
Width Average height 7
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The Error Estimate for
The Multiple-Application Trapezoidal Rule
h3 n "
Ea f (x i ) since f "
(x i ) nf "
12 i 1
h3 "
Ea nf where f " is the mean of the second derivative over the interval
12
(b a ) (b a) 3 " (b a) 2 "
Since h Ea 2
f h f O( h 2
)
n 12n 12
Thus, if the number of segments is doubled,
the truncation error will be quartered.
8
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. These formulas are called Simpson’s rules.
Using a x0 b x2
( x x1 )( x x2 ) ( x x0 )( x x2 ) ( x x0 )( x x1 )
x2
I f ( x0 ) f ( x1 ) f ( x2 )dx
x0
( x0 x1 )( x0 x 2 ) ( x1 x0 )( x1 x 2 ) ( x 2 x0 )( x 2 x1 )
after integration and algebraic manipulation, the following formula results :
ba
I
h
f ( x0 ) 4 f ( x1 ) f ( x2 ) h SIMPSON' S 1/3 RULE
3 2
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
The Multiple-Application Simpson’s 1/3 Rule
• Just as the trapezoidal rule, Simpson’s rule can be improved by dividing the
integration interval into a number of segments of equal width.
• However, it is limited to cases where values are equispaced, there are an even
number of segments and odd number of points.
ba
h n # of seg. a x0 b xn
n
x2 x4 xn
I f ( x)dx f ( x)dx f n 2 ( x) dx
0 2
x0 x2 xn2
h
I f ( x0 ) 4 f ( x1 ) f ( x2 )
3
h
f ( x2 ) 4 f ( x3 ) f ( x4 )
3
h
f ( xn 2 ) 4 f ( xn 1 ) f ( xn )
3
h n 1 n2
I f ( x0 ) 4 f ( xi ) 2 f ( x j ) f ( xn )
3 i 1, 3, 5... j 2 , 4 , 6...
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Simpson’s 3/8 Rule
Simpson’s 1/3 and 3/8 rules can be
Fit a 3rd order Lagrange interpolating applied in tandem to handle
polynomial to four points and integrate multiple applications with odd
number of intervals
b b
I f ( x)dx f 3 ( x)dx
a a
I f ( x0 ) 3 f ( x1 ) 3 f ( x2 ) f ( x3 )
3h
8
(b a )
h
3
f ( x0 ) 3 f ( x1 ) 3 f ( x2 ) f ( x3 )
I (b a )
8 11
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Newton-Cotes Closed Integration Formulas
Same order,
but Simpson’s 3/8 is more accurate
In engineering practice, higher order (greater than 4-point) formulas are rarely used
12
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Integration with Unequal Segments
Using Trapezoidal Rule
f ( x0 ) f ( x1 ) f ( x1 ) f ( x2 ) f ( xn 1 ) f ( xn )
I h1 h2 hn
2 2 2
Example 21.7
1.309 0.2 1.305 1.309 0.363 3.181 0.232 2.363
I 0.12 0.10 0.06 0.10
2 2 2 2
0.0905 0.1307 0.12975 1.594
which represents a relative error of = 2.8%
x f(x) x f(x)
0.0 0.2 0.44 2.842
0.40 2.456
13
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Compute Integrals Using MATLAB
x f(x) x f(x) First, create a file called fx.m which contains f(x):
0.2
function y = fx(x)
0.0 0.44 2.842
y = 0.2+25*x-200*x.^2+675*x.^3-900*x.^4+400*x.^5 ;
0.12 1.309 0.54 3.507
0.22 1.305 0.64 3.181
Then, execute in the command window:
0.32 1.743 0.70 2.363 >> Q=quad('fx', 0, 0.8) % true integral
0.36 2.074 0.80 0.232
0.40 2.456 Q =1.6405 true value
>> x=[0 .12 .22 .32 .36 .4 .44 .54 .64 .7 .8]
>> y = fx(x)
y = 0.200 1.309 1.305 1.743 2.074 2.456
2.843 3.507 3.181 2.363 0.232
Integral =1.5948
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.