section 2 solutions of equations in one variable root
play

Section 2 Solutions of Equations in One Variable (Root-Finding) - PowerPoint PPT Presentation

Section 2 Solutions of Equations in One Variable (Root-Finding) Numerical Analysis I Xiaojing Ye, Math & Stat, Georgia State University 21 Root-finding Definition Let f : R R (univariate), then x is called a root , or zero , of f


  1. Section 2 Solutions of Equations in One Variable (Root-Finding) Numerical Analysis I – Xiaojing Ye, Math & Stat, Georgia State University 21

  2. Root-finding Definition Let f : R → R (univariate), then x is called a root , or zero , of f if f ( x ) = 0. Example (Roots of a function) Find the root(s) of f ( x ) defined by (a) ( x − 1)( x + 1); (b) ( x − 1) 2 ; (c) x 2 + 1; (d) ax 2 + bx + c ; (e) cos( x ). Question : Given a general function f , how can we find its root/roots? Numerical Analysis I – Xiaojing Ye, Math & Stat, Georgia State University 22

  3. Bisection method Suppose f is continuous on [ a , b ], and f ( a ) f ( b ) < 0 (WLOG f ( a ) < 0 , f ( b ) > 0). Then f has at least one root in ( a , b ) by IVT. y f ( b ) y � f ( x ) p 3 f ( p 1 ) p p 1 x a � a 1 p 2 b � b 1 f ( p 2 ) f ( a ) a 1 p 1 b 1 a 2 p 2 b 2 a 3 p 3 b 3 Numerical Analysis I – Xiaojing Ye, Math & Stat, Georgia State University 23

  4. Bisection method Suppose f is continuous on [ a , b ], and f ( a ) f ( b ) < 0 (WLOG f ( a ) < 0 , f ( b ) > 0). Then f has at least one root in ( a , b ) by IVT. Bisection method ◮ Input. Endpoints a , b . Tolerance ǫ tol . Maximum number of iterations N max . Set iteration counter N = 1. ◮ While N ≤ N max , do 1. Set p = a + b 2 , compute f ( p ). If f ( p ) = 0 or b − a < ǫ tol , break. 2. If f ( p ) > 0, set b = p . If f ( p ) < 0, set a = p . 3. N ← N + 1. ◮ Output. If i = N max , print(“Maximum iteration reached.”). Return p . Numerical Analysis I – Xiaojing Ye, Math & Stat, Georgia State University 24

  5. Termination condition Bisection method can run forever if we do not set termination condition (e.g., ǫ tol , N max ). Common choices of termination condition : ◮ Fixed number of iterations N max . ◮ | p N − p N − 1 | < ǫ tol ◮ | f ( p N ) | < ǫ tol | p N − p N − 1 | ◮ < ǫ tol | p N | Numerical Analysis I – Xiaojing Ye, Math & Stat, Georgia State University 25

  6. Example Example (Bisection method) f ( x ) = x 3 + 4 x 2 − 10. Find a root in [1 , 2] using the bisection method. Solution. First check if f (1) f (2) < 0 (if not, bisection method may not apply). Numerical Analysis I – Xiaojing Ye, Math & Stat, Georgia State University 26

  7. Bisection method Theorem Suppose f ∈ C [ a , b ] and f ( a ) f ( b ) < 0 , then p n generated by the bisection method converges to p, a root of f , with | p n − p | < b − a 2 n Drawbacks of the bisection method: ◮ inefficient ◮ may discard some roots Numerical Analysis I – Xiaojing Ye, Math & Stat, Georgia State University 27

Recommend


More recommend