lesson 2 quadrature rules
play

Lesson 2 Quadrature rules 1 Quadrature is the computation of - PowerPoint PPT Presentation

Lesson 2 Quadrature rules 1 Quadrature is the computation of integrals Z b f ( x ) d x a Only in very special cases can integrals be computed exactly, otherwise, we must compute them numerically (i.e., approximately) The


  1. Lesson 2 Quadrature rules 1

  2. 
 
 • Quadrature is the computation of integrals Z b f ( x ) d x a • Only in very special cases can integrals be computed exactly, otherwise, we must compute them numerically (i.e., approximately) • The goal of standard quadrature methods is to express the integral as a finite sum n � w n,k f ( x n,k ) k =1 so that the approximation converges: � b � � n � � � lim w n,k f ( x n,k ) − f ( x ) d x � = 0 � � � � n →∞ a � i =1 2

  3. 
 SIMPLEST METHOD: RIGHTPOINT RULE • The standard definition for an integral from Z 1 introductory calculus is cos x d x 0 � b n = 3 n � � b − a a + k b − a � 1.0 f ( x ) d x = lim f n n - n →∞ a k =1 0.8 f ( h ) 0.6 0.4 0.2 0.0 0.2 0.4 0.6 0.8 1.0 h = b − a n

  4. 
 
 SIMPLEST METHOD: RIGHTPOINT RULE • The standard definition for an integral from Z 1 introductory calculus is cos x d x 0 � b n = 3 n � � b − a a + k b − a � 1.0 f ( x ) d x = lim f n n n →∞ a k =1 0.8 • Idea: use the sum with finite n 
 f ( h ) 0.6 � b n x k = a + k b − a 0.4 � f ( x ) d x ≈ Q R n = h f ( x k ) for n a k =1 0.2 • This is equivalent to approximating the integral 0.0 0.2 0.4 0.6 0.8 1.0 by small rectangles h = b − a n

  5. 
 LEFTPOINT RULE Z 1 cos x d x 0 • Alternatively, we can evaluate f on n = 3 1.0 the left: 
 0.8 � b n f (0) � f ( x ) d x ≈ Q L 0.6 n = h f ( x k ) a k =1 0.4 x k = a + ( k − 1) b − a for 0.2 n 0.0 0.2 0.4 0.6 0.8 1.0 h = b − a n

  6. TRAPEZOIDAL RULE • Instead of rectangles, we can use trapezoids Z 1 cos x d x • We then have 
 0 n = 3 4 1.0 � b � x k +1 n − 1 � f ( x k ) + ( x − x k ) f ( x k +1 ) − f ( x k ) � � 0.8 f ( x ) d x ≈ d x x k +1 − x k a x k k =1 0.6 � � 0.4 0.2 0.0 0.2 0.4 0.6 0.8 1.0 for h = b − a and x k = a + ( k − 1) h n − 1 6

  7. TRAPEZOIDAL RULE • Instead of rectangles, we can use trapezoids Z 1 cos x d x • We then have 
 0 n = 3 4 1.0 � b � x k +1 n − 1 � f ( x k ) + ( x − x k ) f ( x k +1 ) − f ( x k ) � � 0.8 f ( x ) d x ≈ d x x k +1 − x k a x k k =1 0.6 n − 1 � � f ( x k ) h + hf ( x k +1 ) − f ( x k ) � = 2 0.4 k =1 n − 1 0.2 � 0.0 0.2 0.4 0.6 0.8 1.0 for h = b − a and x k = a + ( k − 1) h n − 1 7

  8. TRAPEZOIDAL RULE • Instead of rectangles, we can use trapezoids Z 1 cos x d x • We then have 
 0 n = 3 4 1.0 � b � x k +1 n − 1 � f ( x k ) + ( x − x k ) f ( x k +1 ) − f ( x k ) � � 0.8 f ( x ) d x ≈ d x x k +1 − x k a x k k =1 0.6 n − 1 � � f ( x k ) h + hf ( x k +1 ) − f ( x k ) � = 2 0.4 k =1 n − 1 = h 0.2 � [ f ( x k ) + f ( x k +1 )] 2 k =1 0.0 0.2 0.4 0.6 0.8 1.0 for h = b − a and x k = a + ( k − 1) h n − 1 8

  9. TRAPEZOIDAL RULE • Instead of rectangles, we can use trapezoids Z 1 cos x d x • We then have 
 0 n = 3 4 1.0 � b � n − 1 � f ( a ) f ( x k ) + f ( b ) � f ( x ) d x ≈ Q T n = h + 0.8 2 2 a k =2 0.6 0.4 0.2 0.0 0.2 0.4 0.6 0.8 1.0 for h = b − a and x k = a + ( k − 1) h n − 1 9

  10. Experiments of quadrature error 10

  11. • We’ve introduced three quadrature rules – Left point rule, right point rule and trapezoidal rule • Each use precisely n function evaluations • How fast will they converge to the true integral as n increases? • Let’s try some experiments 11

  12. � 1 Error approximating � x � x = � − 1 0 0.4 0.3 0.2 0.1 1000 n 200 400 600 800 Right-point rule, Left-point rule, Trapezoidal rule 12

  13. � 1 Error approximating � x � x = � − 1 0 Log-scale plot 0.4 0.01 0.3 10 - 4 0.2 10 - 6 0.1 1000 n 5000 n 200 400 600 800 1000 2000 3000 4000 Right-point rule, Left-point rule, Trapezoidal rule 13

  14. � 1 Error approximating � x � x = � − 1 0 Log-log-scale plot 0.4 0.01 0.3 10 - 4 0.2 10 - 6 0.1 1000 n 5000 n 200 400 600 800 100 200 500 1000 2000 Right-point rule, Left-point rule, Trapezoidal rule 14

  15. � 1 Error approximating � x � x = � − 1 0 1 Log-log-scale plot n 0.4 0.01 0.3 1 10 - 4 n 2 0.2 10 - 6 0.1 1000 n n 200 400 600 800 100 200 500 1000 2000 5000 Right-point rule, Left-point rule, Trapezoidal rule 15

  16. � x 0.01 10 - 4 10 - 6 n 100 200 500 1000 2000 5000 16

  17. ��� 500 x � x 0.1 0.01 0.001 10 - 4 10 - 5 10 - 6 10 - 7 n n 100 200 500 1000 2000 5000 100 200 500 1000 2000 5000 16

  18. ��� 500 x � x 0.1 0.01 0.001 10 - 4 10 - 5 10 - 6 10 - 7 n n 100 200 500 1000 2000 5000 100 200 500 1000 2000 5000 | x − . 1 | 0.1 0.001 10 - 5 10 - 7 n 100 200 500 1000 2000 5000 16

  19. ��� 500 x � x 0.1 0.01 0.001 10 - 4 10 - 5 10 - 6 10 - 7 n n 100 200 500 1000 2000 5000 100 200 500 1000 2000 5000 | x − . 1 | ��� ( x − . 1) 0.1 0.1 0.001 0.001 10 - 5 10 - 5 10 - 7 10 - 7 n n 100 200 500 1000 2000 5000 100 200 500 1000 2000 5000 16

  20. � x 0.01 10 - 4 10 - 6 n 100 200 500 1000 2000 5000 17

  21. � x ��� 10 π x 1 0.01 0.001 10 - 6 10 - 4 10 - 9 10 - 12 10 - 6 10 - 15 n 100 n 100 200 500 1000 2000 5000 5 10 20 50 17

  22. � x ��� 10 π x 1 0.01 0.001 10 - 6 10 - 4 10 - 9 10 - 12 10 - 6 10 - 15 n 100 n 100 200 500 1000 2000 5000 5 10 20 50 ��� 50 π x 1 0.001 10 - 6 10 - 9 10 - 12 10 - 15 n 5 10 20 50 100 17

  23. � x ��� 10 π x 1 0.01 0.001 10 - 6 10 - 4 10 - 9 10 - 12 10 - 6 10 - 15 n 100 n 100 200 500 1000 2000 5000 5 10 20 50 ��� 50 π x ��� ��� 2 π x 1 0.1 0.001 10 - 4 10 - 6 10 - 7 10 - 9 10 - 10 10 - 12 10 - 13 10 - 15 n n 5 10 20 50 100 5 10 20 50 100 17

  24. Warning! • Only use these methods for periodic functions!! • Much better methods exist for non-periodic smooth functions • We will see this later in the course • The better method is not Simpson’s rule 18

  25. Convergence of quadrature rules 19

  26. • We want to prove the observed behaviour � Left and right point rules converge like O (1/ n ) � Trapezoidal rule converges like O � 1/ n 2 � � All rules converge a lot faster for periodic and smooth functions • The key is integration by parts 20

  27. � � � � Right-hand rule • Assume for simplicity that f is smooth (infinitely differentiable in [ a, b ] ) • We start with the error in one panel: � x k +1 � x k +1 ( x − x k ) � [ f ( x ) − f ( x k +1 )] � x [ f ( x ) − f ( x k +1 )] � x = x k x k � 21

  28. � � � Right-hand rule • Assume for simplicity that f is smooth (infinitely differentiable in [ a, b ] ) • We start with the error in one panel: � x k +1 � x k +1 ( x − x k ) � [ f ( x ) − f ( x k +1 )] � x [ f ( x ) − f ( x k +1 )] � x = x k x k � x k +1 = [( x − x k )( f ( x ) − f ( x k +1 ))] x k +1 ( x − x k ) f � ( x ) � x − x k x k � 22

  29. � � Right-hand rule • Assume for simplicity that f is smooth (infinitely differentiable in [ a, b ] ) • We start with the error in one panel: � x k +1 � x k +1 ( x − x k ) � [ f ( x ) − f ( x k +1 )] � x [ f ( x ) − f ( x k +1 )] � x = x k x k � x k +1 = [( x − x k )( f ( x ) − f ( x k +1 ))] x k +1 ( x − x k ) f � ( x ) � x − x k x k � x k +1 = − 1 ( x − x k ) 2 � � f � ( x ) � x � 2 x k � 23

  30. � Right-hand rule • Assume for simplicity that f is smooth (infinitely differentiable in [ a, b ] ) • We start with the error in one panel: � x k +1 � x k +1 ( x − x k ) � [ f ( x ) − f ( x k +1 )] � x [ f ( x ) − f ( x k +1 )] � x = x k x k � x k +1 = [( x − x k )( f ( x ) − f ( x k +1 ))] x k +1 ( x − x k ) f � ( x ) � x − x k x k � x k +1 = − 1 ( x − x k ) 2 � � f � ( x ) � x � 2 x k � x k +1 = − 1 + 1 � x k +1 ( x − x k ) 2 f � ( x ) ( x − x k ) 2 f �� ( x ) � x � 2 x k 2 x k � x 2 24

  31. Right-hand rule • Assume for simplicity that f is smooth (infinitely differentiable in [ a, b ] ) • We start with the error in one panel: � x k +1 � x k +1 ( x − x k ) � [ f ( x ) − f ( x k +1 )] � x [ f ( x ) − f ( x k +1 )] � x = x k x k � x k +1 = [( x − x k )( f ( x ) − f ( x k +1 ))] x k +1 ( x − x k ) f � ( x ) � x − x k x k � x k +1 = − 1 ( x − x k ) 2 � � f � ( x ) � x � 2 x k � x k +1 = − 1 + 1 � x k +1 ( x − x k ) 2 f � ( x ) ( x − x k ) 2 f �� ( x ) � x � 2 x k 2 x k � x k +1 = − h 2 2 f � ( x k +1 ) + 1 ( x − x k ) 2 f �� ( x ) � x 2 x k 25

  32. � � ��� � ��� • We can bound the first term � 1 � 2 h 2 � ≤ h 2 � � � b − a � � � 2 f � ( x k +1 ) x | f � ( x ) | = x | f � ( x ) | = O � � 2 ��� n 2 n � • we can also bound the second term • Summing over all panels we get 26

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend