Numerical Differentiation and Integration Part 6

advertisement
Numerical Differentiation and
Integration
• Standing in the heart of calculus are the mathematical concepts
of differentiation and integration:
y f ( xi  x)  f ( xi )

x
x
f ( xi  x)  f ( xi )
dy
 x lim 0
dx
x
b
I   f ( x)dx
a
1
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Figure PT6.1
by Lale Yurttas, Texas
A&M University
Chapter 21
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
2
Figure PT6.2
by Lale Yurttas, Texas
A&M University
Chapter 21
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
3
Noncomputer Methods for
Differentiation and Integration
• The function to be differentiated or integrated
will typically be in one of the following three
forms:
– A simple continuous function such as polynomial,
an exponential, or a trigonometric function.
– A complicated continuous function that is difficult
or impossible to differentiate or integrate directly.
– A tabulated function where values of x and f(x) are
given at a number of discrete points, as is often the
case with experimental or field data.
by Lale Yurttas, Texas
A&M University
Chapter 21
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
4
Figure PT6.4
by Lale Yurttas, Texas
A&M University
Chapter 21
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
5
Figure PT6.7
by Lale Yurttas, Texas
A&M University
Chapter 21
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
6
Newton-Cotes Integration Formulas
Chapter 21
• 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
a
a
I   f ( x)dx   f n ( x)dx
f n ( x)  a0  a1 x    an1 x n1  an x n
by Lale Yurttas, Texas
A&M University
Chapter 21
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
7
Figure 21.1
by Lale Yurttas, Texas
A&M University
Chapter 21
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
8
Figure 21.2
by Lale Yurttas, Texas
A&M University
Chapter 21
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
9
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
a
a
I   f ( x)dx   f1 ( x)dx
• The area under this first order polynomial is an
estimate of the integral of f(x) between the limits of a
and b:
f (a )  f (b)
I  (b  a )
2
Trapezoidal rule
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
10
Figure 21.4
by Lale Yurttas, Texas
A&M University
Chapter 21
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
11
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
3


Et  
f (x )(b  a)
12
where x lies somewhere in the interval from a to b.
by Lale Yurttas, Texas
A&M University
Chapter 21
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
12
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.
h
I
ba
n
a  x0
b  xn
x1
x2
xn
x0
x1
xn1
 f ( x)dx   f ( x)dx     f ( x)dx
Substituting the trapezoidal rule for each integral yields:
f ( x0 )  f ( x1 )
f ( xn 1 )  f ( xn )
f ( x1 )  f ( x2 )
I h
h
 h
2
2
2
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
13
Figure 21.8
by Lale Yurttas, Texas
A&M University
Chapter 21
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
14
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
A&M University
Chapter 21
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
15
Figure 21.10
by Lale Yurttas, Texas
A&M University
Chapter 21
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
16
b
b
a
a
I   f ( x)dx   f 2 ( x)dx
a  x0
b  x2
 ( x  x1 )( x  x2 )

( x  x0 )( x  x2 )
( x  x0 )( x  x1 )
I  
f ( x0 ) 
f ( x1 ) 
f ( x2 )dx
(
x

x
)(
x

x
)
(
x

x
)(
x

x
)
(
x

x
)(
x

x
)
0
1
0
2
1
0
1
2
2
0
2
1

x0 
x2
I
h
 f ( x0 )  4 f ( x1 )  f ( x2 )
3
h
ba
2
Simpson’s 1/3 Rule
17
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Download