Numerical Integration Gerald Recktenwald Portland State University Mechanical Engineering Department gerry@me.pdx.edu These slides are a supplement to the book Numerical Methods with Matlab : Implementations and Applications , by Gerald W. Recktenwald, c c � 2002, Prentice-Hall, Upper Saddle River, NJ. These slides are � 2002 Gerald W. Recktenwald. The PDF version of these slides may be downloaded or stored or printed only for noncommercial, educational use. The repackaging or sale of these slides in any form, without written consent of the author, is prohibited. The latest version of this PDF file, along with other supplemental material for the book, can be found at www.prenhall.com/recktenwald . Version 0.01 March 9, 2002
Primary Topics • Basic concepts • Newton Cotes Rules ⊲ Trapezoid rule ⊲ Simpson’s rule • Gaussian Quadrature • Adaptive Quadrature • Improper Integrals NMM: Numerical Integration page 1
Figure 11.2 a b L NMM: Numerical Integration page 2
Figure 11.3 f ( x ) a b NMM: Numerical Integration page 3
Figure 11.4 Composite Rule: N panels f ( x ) 1 2 ... N a b Basic Rule: m nodes 1 2 ... m NMM: Numerical Integration page 4
Figure 11.5 f ( x ) f 2 f 1 P 1 ( x ) h = x 2 – x 1 x 1 x 2 NMM: Numerical Integration page 5
Figure 11.6 f n –1 f n –2 f n f 3 f 2 f 1 h h h h x 1 x 2 x 3 x n –2 x n –1 x n a b NMM: Numerical Integration page 6
Figure 11.7 0.4 3 panels error = -0.208654 0.2 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 0.4 4 panels error = -0.124097 0.2 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 0.4 5 panels error = -0.081554 0.2 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 NMM: Numerical Integration page 7
Figure 11.8 P 2 ( x ) f 3 f ( x ) f 2 f 1 h h x 1 x 2 x 3 NMM: Numerical Integration page 8
Figure 11.9 f n –3 f 5 f n –2 f 3 f n f 1 h h h h x 1 x 3 x 5 x n –2 x n x n –3 NMM: Numerical Integration page 9
Figure 11.10 0.4 3 panels error = -0.007070 0.2 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 0.4 4 panels error = -0.002368 0.2 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 0.4 5 panels error = -0.000997 0.2 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 NMM: Numerical Integration page 10
Figure 11.11 h = b – a h = b – a Three point closed rule Three point open rule 2 4 f 3 f 3 f 2 f 2 f 1 f 1 h h h h h h x 1 x 2 x 3 a x 1 x 2 x 3 b a b NMM: Numerical Integration page 11
Figure 11.12 Order 2 Order 2 Order 2 Order 2 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 Order 3 Order 3 Order 3 Order 3 0.5556 0.5556 0.5556 0.5556 0.8889 0.8889 0.8889 0.8889 0.5556 0.5556 0.5556 0.5556 Order 4 Order 4 Order 4 Order 4 0.3479 0.3479 0.3479 0.3479 0.6521 0.6521 0.6521 0.6521 0.6521 0.6521 0.6521 0.6521 0.3479 0.3479 0.3479 0.3479 Order 5 Order 5 Order 5 Order 5 0.2369 0.2369 0.2369 0.2369 0.4786 0.4786 0.4786 0.4786 0.5689 0.5689 0.5689 0.5689 0.4786 0.4786 0.4786 0.4786 0.2369 0.2369 0.2369 0.2369 Order 6 0.1713 0.1713 0.1713 0.1713 0.3608 0.3608 0.3608 0.3608 0.4679 0.4679 0.4679 0.4679 0.4679 0.4679 0.4679 0.4679 0.3608 0.3608 0.3608 0.3608 0.1713 0.1713 0.1713 0.1713 -1 -0.5 0 0.5 1 NMM: Numerical Integration page 12
Figure 11.13 f ( x ) f ( z ) H H 1 1 2 2 2 2 * * * * x 4 z 1 z 2 z 3 z 4 x 1 x 2 x 3 x i x m , i x i +1 –1 0 1 NMM: Numerical Integration page 13
Figure 11.14 0 10 trapezoid simpson GL 4 node -5 10 Truncation error -10 10 -15 10 0 1 2 3 10 10 10 10 Number of function evaluations NMM: Numerical Integration page 14
Figure 11.15 H for level 1 level 1 a d c e b left right level 2 a d c e b a d c e b left right level 3 a d c e b a d c e b level 4 a b a b NMM: Numerical Integration page 15
Figure 11.16 100 80 y = humps(x) 60 40 20 0 -20 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 0.07 Space between f(x) evaluations 0.06 0.05 0.04 0.03 0.02 0.01 0 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 x NMM: Numerical Integration page 16
Figure 11.17 0 10 quad quad8 -2 10 tol -4 10 -6 10 -10 -8 -6 -4 -2 0 10 10 10 10 10 10 Absolute error 5 10 quad quad8 4 10 flops 3 10 2 10 -10 -8 -6 -4 -2 0 10 10 10 10 10 10 Absolute error NMM: Numerical Integration page 17
Recommend
More recommend