nonlinear equations and continuous optimization
play

Nonlinear Equations and Continuous Optimization Sanzheng Qiao - PowerPoint PPT Presentation

Intro Bisection Newton Systems Optimization Software Summary Nonlinear Equations and Continuous Optimization Sanzheng Qiao Department of Computing and Software McMaster University March, 2014 Intro Bisection Newton Systems


  1. Intro Bisection Newton Systems Optimization Software Summary Nonlinear Equations and Continuous Optimization Sanzheng Qiao Department of Computing and Software McMaster University March, 2014

  2. Intro Bisection Newton Systems Optimization Software Summary Outline Introduction 1 Bisection Method 2 Newton’s Method 3 Systems of Nonlinear Equations 4 5 Continuous Optimization Software Packages 6

  3. Intro Bisection Newton Systems Optimization Software Summary Outline Introduction 1 Bisection Method 2 Newton’s Method 3 Systems of Nonlinear Equations 4 5 Continuous Optimization Software Packages 6

  4. Intro Bisection Newton Systems Optimization Software Summary Problem setting Find roots f ( x ) = 0 Often, methods are iterative (roots cannot be found in finite number of steps). Example Compute square roots x 2 − A = 0

  5. Intro Bisection Newton Systems Optimization Software Summary Problem setting Find roots f ( x ) = 0 Often, methods are iterative (roots cannot be found in finite number of steps). Example Compute square roots x 2 − A = 0 Find the side of the square whose area is A

  6. Intro Bisection Newton Systems Optimization Software Summary Compute square roots Start with a rectangle whose one side is x c , then the other side is A / x c so that its area is A . Make the rectangle “more square” by setting the new side: � � x + = 1 x c + A 2 x c Then x c = x + and iterate.

  7. Intro Bisection Newton Systems Optimization Software Summary Compute square roots Start with a rectangle whose one side is x c , then the other side is A / x c so that its area is A . Make the rectangle “more square” by setting the new side: � � x + = 1 x c + A 2 x c Then x c = x + and iterate. A better form x + = x c − 1 � x c − A � 2 x c

  8. Intro Bisection Newton Systems Optimization Software Summary Compute square roots Three issues to be addressed Initialization ( x 0 ) Convergence ( x k → x ∗ ?) and rate (how fast?) Termination

  9. Intro Bisection Newton Systems Optimization Software Summary Initialization Write A in base 4: A = m × 4 e , 0 . 25 ≤ m < 1 √ A = √ m × 2 e . then Now we can assume 4 − 1 ≤ A < 1. √ Linear interpolation of f ( A ) = A at A = 0 . 25 , 1 . 0: p ( A ) = ( 1 + 2 A ) / 3 . 1 0.95 0.9 0.85 0.8 0.75 0.7 0.65 0.6 0.55 0.5 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1

  10. Intro Bisection Newton Systems Optimization Software Summary Initialization (cont.) Initial error bound: Differentiating √ A − 1 + 2 A 3 with respect to A and then setting the derivative to zero to find the maximum, it can be shown that √ � � A − ( 1 + 2 A ) / 3 � ≤ 0 . 05 � � �

  11. Intro Bisection Newton Systems Optimization Software Summary Initialization (cont.) Initial error bound: Differentiating √ A − 1 + 2 A 3 with respect to A and then setting the derivative to zero to find the maximum, it can be shown that √ � � A − ( 1 + 2 A ) / 3 � ≤ 0 . 05 � � � Initial value: x 0 = ( 1 + 2 A ) / 3 Initial error: e 0 ≤ 0 . 05

  12. Intro Bisection Newton Systems Optimization Software Summary Convergence A relation between x k + 1 and x k : x k + 1 = 1 � x k + A � 2 x k √ Denote the error e k = | x k − A | , then the relation between e k + 1 and e k : √ � 2 � √ A | = 1 x k − A e k + 1 = | x k + 1 − √ x k 2 1 2 | x k | e 2 = k

  13. Intro Bisection Newton Systems Optimization Software Summary Convergence A relation between x k + 1 and x k : x k + 1 = 1 � x k + A � 2 x k √ Denote the error e k = | x k − A | , then the relation between e k + 1 and e k : √ � 2 � √ A | = 1 x k − A e k + 1 = | x k + 1 − √ x k 2 1 2 | x k | e 2 = k It can be shown that 0 . 5 ≤ x k ≤ 1 . 0.

  14. Intro Bisection Newton Systems Optimization Software Summary Convergence (cont.) Since the initial error e 0 ≤ 0 . 05, k − 1 ≤ · · · ≤ e 2 k 0 ≤ ( 0 . 05 ) 2 k e k ≤ e 2 We have shown the convergence ( e k → 0 as k → ∞ ).

  15. Intro Bisection Newton Systems Optimization Software Summary Convergence (cont.) Since the initial error e 0 ≤ 0 . 05, k − 1 ≤ · · · ≤ e 2 k 0 ≤ ( 0 . 05 ) 2 k e k ≤ e 2 We have shown the convergence ( e k → 0 as k → ∞ ). How fast? Rate: quadratic e k + 1 ≤ ce 2 k , each iteration doubles the accuracy.

  16. Intro Bisection Newton Systems Optimization Software Summary Termination Recall: e k ≤ ( 0 . 05 ) 2 k < 10 − 2 k .

  17. Intro Bisection Newton Systems Optimization Software Summary Termination Recall: e k ≤ ( 0 . 05 ) 2 k < 10 − 2 k . When k = 3, e k < 10 − 8 . When k = 4, e k < 10 − 16 .

  18. Intro Bisection Newton Systems Optimization Software Summary Termination Recall: e k ≤ ( 0 . 05 ) 2 k < 10 − 2 k . When k = 3, e k < 10 − 8 . When k = 4, e k < 10 − 16 . Three iterations are enough for IEEE single precision (2 − 24 ). Four iterations are enough for IEEE double precision (2 − 53 ).

  19. Intro Bisection Newton Systems Optimization Software Summary Example √ Compute 3

  20. Intro Bisection Newton Systems Optimization Software Summary Example √ Compute 3 Scale: 3 = 0 . 75 × 4 1

  21. Intro Bisection Newton Systems Optimization Software Summary Example √ Compute 3 Scale: 3 = 0 . 75 × 4 1 Initial: x 0 = ( 1 + 2 × 0 . 75 ) / 3 = 2 . 5 / 3

  22. Intro Bisection Newton Systems Optimization Software Summary Example √ Compute 3 Scale: 3 = 0 . 75 × 4 1 Initial: x 0 = ( 1 + 2 × 0 . 75 ) / 3 = 2 . 5 / 3 Iterate: x n + 1 = x n − ( x n − 0 . 75 / x n ) / 2 n x n error 3 . 3 × 10 − 2 0 0.8333... 6 . 4 × 10 − 4 1 0.8667... 2 . 4 × 10 − 7 2 0.8660... 3 . 2 × 10 − 14 3 0.8660... < 10 − 16 4 0.8660... x 5 = x 4 .

  23. Intro Bisection Newton Systems Optimization Software Summary Example √ Compute 3 Scale: 3 = 0 . 75 × 4 1 Initial: x 0 = ( 1 + 2 × 0 . 75 ) / 3 = 2 . 5 / 3 Iterate: x n + 1 = x n − ( x n − 0 . 75 / x n ) / 2 n x n error 3 . 3 × 10 − 2 0 0.8333... 6 . 4 × 10 − 4 1 0.8667... 2 . 4 × 10 − 7 2 0.8660... 3 . 2 × 10 − 14 3 0.8660... < 10 − 16 4 0.8660... x 5 = x 4 . Scale back: x 4 × 2 1

  24. Intro Bisection Newton Systems Optimization Software Summary Outline Introduction 1 Bisection Method 2 Newton’s Method 3 Systems of Nonlinear Equations 4 5 Continuous Optimization Software Packages 6

  25. Intro Bisection Newton Systems Optimization Software Summary Generic algorithm If f ( a ) ∗ f ( b ) ≤ 0 and f ( x ) is continuous on [ a , b ] , then f ( x ) has a root on [ a , b ] . while (b-a)>tol m = (a+b)/2; if f(a)*f(m)<=0 b = m; else a = m; end; end; r = (a + b)/2;

  26. Intro Bisection Newton Systems Optimization Software Summary Generic algorithm Two problems in the generic algorithm: The while-loop may not terminate.

  27. Intro Bisection Newton Systems Optimization Software Summary Generic algorithm Two problems in the generic algorithm: The while-loop may not terminate. When a and b are two neighboring floating-point numbers and (b-a)>tol , (a+b)/2 is rounded to either a or b .

  28. Intro Bisection Newton Systems Optimization Software Summary Generic algorithm Two problems in the generic algorithm: The while-loop may not terminate. When a and b are two neighboring floating-point numbers and (b-a)>tol , (a+b)/2 is rounded to either a or b . Redundant function evaluations.

  29. Intro Bisection Newton Systems Optimization Software Summary An improved algorithm fa = f(a); while (b-a)>tol + eps*max(|a|,|b|) m = (a + b)/2; fm = f(m); if fa*fm<=0 b = m; else a = m; fa = fm; end; end; r = (a + b)/2;

  30. Intro Bisection Newton Systems Optimization Software Summary An improved algorithm fa = f(a); while (b-a)>tol + eps*max(|a|,|b|) m = (a + b)/2; fm = f(m); if fa*fm<=0 b = m; else a = m; fa = fm; end; end; r = (a + b)/2; Note: eps*max(|a|,|b|) is about the distance between two consecutive floating-point numbers near max(|a|,|b|) . (ulp)

  31. Intro Bisection Newton Systems Optimization Software Summary Convergence Since b k − a k ≤ ( b − a ) / 2 k , x ∗ ∈ [ a k , b k ] , and x k = ( a k + b k ) / 2, we have e k = | x k − x ∗ | ≤ b k − a k = b − a → 0 2 2 k + 1 In this case, e k + 1 ≤ 0 . 5 e k . Improve accuracy by 1 bit per iteration or 1 decimal digit for every three or so iterations.

  32. Intro Bisection Newton Systems Optimization Software Summary Convergence In general, linear convergence rate: e k + 1 ≤ ce k for some constant c < 1.

  33. Intro Bisection Newton Systems Optimization Software Summary Convergence In general, linear convergence rate: e k + 1 ≤ ce k for some constant c < 1. Difficulty: Locate the interval [ a , b ] .

  34. Intro Bisection Newton Systems Optimization Software Summary Outline Introduction 1 Bisection Method 2 Newton’s Method 3 Systems of Nonlinear Equations 4 5 Continuous Optimization Software Packages 6

  35. Intro Bisection Newton Systems Optimization Software Summary Idea The tangent line of f ( x ) at x c : y = f ( x c ) + ( x − x c ) f ′ ( x c ) Set y = 0 2 1.5 1 0.5 0 -0.5 -1 -1.5 -2 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2

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