Second Term 05/061 Roots of Equations Bracketing Methods.

Slides:



Advertisements
Similar presentations
Lecture 5 Newton-Raphson Method
Advertisements

CSE 330: Numerical Methods
Roots of Equations Our first real numerical method – Root finding
Civil Engineering Majors Author(s): Autar Kaw, Jai Paul
Open Methods Chapter 6 The Islamic University of Gaza
ROOTS OF EQUATIONS Student Notes ENGR 351 Numerical Methods for Engineers Southern Illinois University Carbondale College of Engineering Dr. L.R. Chevalier.
Regula-Falsi Method. Type of Algorithm (Equation Solver) The Regula-Falsi Method (sometimes called the False Position Method) is a method used to find.
Optimization Introduction & 1-D Unconstrained Optimization
Bisection Method (Midpoint Method for Equations).
Open Methods Chapter 6 The Islamic University of Gaza
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 7 Roots of Equations Bracketing Methods.
Chapter 4 Roots of Equations
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Chapter 51.
Roots of Equations Open Methods (Part 2).
Chapter 6 Open Methods.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 6 Roots of Equations Bracketing Methods.
Open Methods (Part 1) Fixed Point Iteration & Newton-Raphson Methods
Roots of Equations Bracketing Methods.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 9 Roots of Equations Open Methods.
Open Methods Chapter 6 The Islamic University of Gaza
Dr. Marco A. Arocha Aug,  “Roots” problems occur when some function f can be written in terms of one or more dependent variables x, where the.
NUMERICAL METHODS WITH C++ PROGRAMMING
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 8 Roots of Equations Open Methods.
Bracketing Methods Chapter 5 The Islamic University of Gaza
Roots of Equations Open Methods Second Term 05/06.
MATH 175: NUMERICAL ANALYSIS II Lecturer: Jomar Fajardo Rabajante IMSP, UPLB 2 nd Semester AY
Solving Non-Linear Equations (Root Finding)
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 2 Roots of Equations Why? But.
Lecture Notes Dr. Rakhmad Arief Siregar Universiti Malaysia Perlis
Chapter 3 Roots of Equations. Objectives Understanding what roots problems are and where they occur in engineering and science Knowing how to determine.
Numerical Methods for Engineering MECN 3500
Numerical Methods.
CHAPTER 3 NUMERICAL METHODS
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 ~ Roots of Equations ~ Bracketing Methods Chapter 5.
Today’s class Roots of equation Finish up incremental search
4 Numerical Methods Root Finding Secant Method Modified Secant
ROOTS OF EQUATIONS. Bracketing Methods The Bisection Method The False-Position Method Open Methods Simple Fixed-Point Iteration The Secant Method.
Lecture 5 - Single Variable Problems CVEN 302 June 12, 2002.
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 5 Bracketing Methods.
Solving Non-Linear Equations (Root Finding)
Numerical Methods Solution of Equation.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Applied Numerical Methods With MATLAB ® for Engineers.
Today’s class Numerical differentiation Roots of equation Bracketing methods Numerical Methods, Lecture 4 1 Prof. Jinbo Bi CSE, UConn.
Roots: Bracketing Methods
4 Numerical Methods Root Finding Secant Method Modified Secant
1/29/ Bisection Method Computer Engineering Majors Authors: Autar Kaw, Jai Paul
SOLVING NONLINEAR EQUATIONS. SECANT METHOD MATH-415 Numerical Analysis 1.
CSE 330: Numerical Methods. What is true error? True error is the difference between the true value (also called the exact value) and the approximate.
Numerical Methods and Optimization C o u r s e 1 By Bharat R Chaudhari.
Solution of Nonlinear Equations ( Root Finding Problems ) Definitions Classification of Methods  Analytical Solutions  Graphical Methods  Numerical.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 2 / Chapter 5.
Solution of Nonlinear Equations ( Root Finding Problems )
Lecture Notes Dr. Rakhmad Arief Siregar Universiti Malaysia Perlis
4 Numerical Methods Root Finding Secant Method Modified Secant
Numerical Methods and Analysis
Newton’s Method for Systems of Non Linear Equations
~ Roots of Equations ~ Bracketing Methods Chapter 5
Lecture 4: Numerical Methods
Part 2 / Chapter 5.
Computers in Civil Engineering 53:081 Spring 2003
Bisection Method.
MATH 175: Numerical Analysis II
Roots: Bracketing Methods
ROOTS OF EQUATIONS.
Mechanical Engineering Majors Authors: Autar Kaw, Jai Paul
Roots: Bracketing Methods
Industrial Engineering Majors Authors: Autar Kaw, Jai Paul
Major: All Engineering Majors Authors: Autar Kaw, Jai Paul
Presentation transcript:

Second Term 05/061 Roots of Equations Bracketing Methods

Second Term 05/062 Root We are given f(x), a function of x, and we want to find α such that f(α) = 0 α is called the root of the equation f(x) = 0, or the zero of the function f(x)

Second Term 05/063 Example: Interest Rate Suppose you want to buy an electronic appliance from a shop and you can either pay an amount of 12,000 or have a monthly payment of 1,065 for 12 months. What is the corresponding interest rate? A is the monthly payment P is the loan amount x is the interest rate per period of time n is the loan period To find the yearly interest rate, x, you have to find the zero of We know the payment formulae is:

Second Term 05/064 Finding Roots Graphically Not accurate However, graphical view can provide useful info about a function. –Multiple roots? –Continuous? –etc.

Second Term 05/065 The following root finding methods will be introduced: A. Bracketing Methods A.1. Bisection Method A.2. Regula Falsi B. Open Methods B.1. Fixed Point Iteration B.2. Newton Raphson's Method B.3. Secant Method

Second Term 05/066 Bracketing Methods By Mean Value Theorem, we know that if a function f(x) is continuous in the interval [a, b] and f(a)f(b) < 0, then the equation f(x) = 0 has at least one real root in the interval (a, b).

Second Term 05/067 Usually f(a)f(b) > 0 implies zero or even number of roots –[figure (a) and (c)] f(a)f(b) < 0 implies odd number of roots –[figure (b) and (d)]

Second Term 05/068 Exceptional Cases Multiple roots –Roots that overlap at one point. –e.g.: f(x) = (x-1)(x-1)(x-2) has a multiple root at x=1. Functions that discontinue within the interval

Second Term 05/069 Algorithm for bracketing methods Step 1: Choose two points x l and x u such that f(x l )f(x u ) < 0 Step 2: Estimate the root x r (note: x l < x r < x u ) Step 3: Determine which subinterval the root lies: if f(x l )f(x r ) < 0 // the root lies in the lower subinterval set x u to x r and goto step 2 if f(x l )f(x r ) > 0 // the root lies in the upper subinterval set x l to x r and goto step 2 if f(x l )f(x r ) = 0 x r is the root

Second Term 05/0610 How to select x r in step 2? 1.Bisection Method Guess without considering the characteristics of f(x) in (xl, xu) 2.False Position Method (Regula Falsi) Use "average slope" to predict the root

Second Term 05/0611 A.1. Bisection Method Each guess reduce the search interval by half

Second Term 05/0612 Bisection Method – Example Find the root of f(x) = 0 with an approximated error below 0.5%. (True root: α= )

Second Term 05/0613 Example (continue) nxlxl xrxr xuxu f(xl)f(xl)f(xr)f(xr)f(xu)f(xu)f(xl)f(xu)f(xl)f(xu)εaεa > < % > % > % < % < %

Second Term 05/0614 Error Bounds The true root, α, must lie between x l and x u. xlxl xuxu xrxr x l (1) x u (1) After the 1 st iteration, the solution, x r (1), should be within an accuracy of x r (1) Let x r (n) denotes x r in the n th iteration

Second Term 05/0615 Error Bounds x l (2) x u (1) x u (2) Suppose the root lies in the lower subinterval. x r (2) After the 2 nd iteration, the solution, x r (2), should be within an accuracy of

Second Term 05/0616 Error Bounds In general, after the n th iteration, the solution, x r (n), should be within an accuracy of If we want to achieve an absolute error of no more than E α

Second Term 05/0617 Implementation Issues The condition f(x l )f(x r ) = 0 (in step 3) is difficult to achieve due to errors. We should repeat until x r is close enough to the root, but we don't know what the root is! Therefore, we have to estimate the error as and repeat until e a < e s (acceptable error)

Second Term 05/0618 Bisection Method (as C function) // xl, xu: Lower and upper bound of the interval // es: Acceptable relative percentage error // xr: Estimated root in zero iteration (can simply // take xl or xu) // iter_max: Maximum # of iterations double Bisect(double xl, double xu, double es, double xr, int iter_max) { double xr_old; // Est. root in the previous step double ea; // Est. error int iter = 0; // Keep track of # of iterations do { iter++; xr_old = xr;

Second Term 05/0619 xr = (xl + xu) / 2; // Estimate root if (xr != 0) ea = fabs((xr – xr_old) / xr) * 100; test = f(xl) * f(xr); if (test < 0) xu = xr; else if (test > 0) xl = xr; else ea = 0; } while (ea > es && iter < iter_max); return xr; }

Second Term 05/0620 Additional Implementation Issues Function call is a relatively slow operation. In the previous example, function f() is called twice in each iteration. Is it necessary? –We only need to update one of the bounds (see step 3 in the algorithm for the bracketing method).

Second Term 05/0621 Revised Bisection Method (as C function) double Bisect(double xl, double xu, double es, double xr, int iter_max) { double xr_old; // Est. root in the previous step double ea; // Est. error int iter = 0; // Keep track of # of iterations double fl, fr; // Save values of f(xl) and f(xr) fl = f(xl); do { iter++; xr_old = xr; xr = (xl + xu) / 2; // Estimate root fr = f(xr);

Second Term 05/0622 if (xr != 0) ea = fabs((xr – xr_old) / xr) * 100; test = fl * fr; if (test < 0) xu = xr; else if (test > 0) { xl = xr; fl = fr; } else ea = 0; } while (ea > es && iter < iter_max); return xr; }

Second Term 05/0623 Comments on Bisection Method The method is guaranteed to converge. However, the convergence is slow as we gain only one binary digit in accuracy in each iteration.

Second Term 05/0624 A.2. Regula Falsi Method Also known as the false-position method, or linear interpolation method. Unlike the bisection method which divides the search interval by half, regula falsi interpolates f(x u ) and f(x l ) by a straight line and the intersection of this line with the x-axis Is used as the new search position. The slope of the line connecting f(x u ) and f(x l ) represents the "average slope" (i.e., the value of f'(x)) of the points in [x l, x u ].

Second Term 05/0625

Second Term 05/0626 False-position vs Bisection False position in general performs better than bisection method. Exceptional Cases: –(Usually) When the deviation of f'(x) is high and the end points of the interval are selected poorly. –For example,

Second Term 05/0627 Iteration xlxl xuxu xrxr ε a (%)ε t (%) Iteration xlxl xuxu xrxr ε a (%)ε t (%) Bisection Method (Converge quicker) False-position Method

Second Term 05/0628

Second Term 05/0629 Summary Bracketing Methods –f(x) has the be continuous in the interval [ x l, x u ] and f(x l )f(x u ) < 0 –Always converge –Usually slower than open methods Bisection Method –Slow but guarantee the best worst-case convergent rate. False-position method –In general performs better than bisection method (with some exceptions).