130 likes | 161 Views
Chapter 5: Roots: Bracketing Methods. Uchechukwu Ofoegbu Temple University. Roots. “Roots” problems occur when some function f can be written in terms of one or more dependent variables x , where the solutions to f(x)=0 yields the solution to the problem.
E N D
Chapter 5: Roots: Bracketing Methods Uchechukwu Ofoegbu Temple University
Roots • “Roots” problems occur when some function f can be written in terms of one or more dependent variables x, where the solutions to f(x)=0 yields the solution to the problem. • These problems often occur when a design problem presents an implicit equation for a required parameter. • For instance, for the bungee jumper problem, • we could never solve for m directly (getting m to the left side). In order to obtain a solution, we could write: • The solution for m would then be the value of m for which the function is 0.
Graphical Methods • Simple method estimating roots, f(x)=0 : • Graph the function • Select an interval with lower bound xl and upper bound xu. • Observe where it crosses the x-axis within the interval. • Graphing the function can also indicate where roots may be and where some root-finding methods may fail: • Same sign, no roots • Different sign, one root (or odd roots) • Same sign, two roots (or even roots) • Different sign, three roots
Graphing Example • In MATLAB, graphically estimate the roots of the following functions within the interval [-10,10]: • X2 + 5 • (X-2)2
Bracketing Methods • Bracketing methods are based on making two initial guesses that “bracket” the root (that are on either side of the root). • Brackets are formed by finding two guesses xl and xu where the sign of the function changes; that is, where • f(xl ) f(xu ) < 0 • If f(x) is real and continuous in the interval (xl ,xu), and f(xl ) f(xu ) < 0, then there is at least one real root within the interval. • The incremental search method tests the value of the function at evenly spaced intervals and finds brackets by identifying function sign changes between neighboring points.
Incremental Search Hazards • If the spacing between the points of an incremental search are too far apart, brackets may be missed due to closely spaced roots. • Incremental searches cannot find brackets containing multiple roots regardless of spacing.
Incremental Search –Example • Use the incsearch function to estimate the locations of the roots of the following functions within the interval [-10,10]: • X2 + 5 • (X-2)2 • Plot and observe
Bisection • The bisection method is a variation of the incremental search method in which the interval is always divided in half. • If a function changes sign over an interval, the function value at the midpoint is evaluated. • The location of the root is then determined as lying within the subinterval where the sign change occurs. • The absolute error is reduced by a factor of 2 for each iteration.
Bisection Example • Using the brackets determined from the previous example, use the bisection method to find the roots of the problem (step by step in Matlab)
False Position • The false position method is another bracketing method. • It determines the next guess not by splitting the bracket in half but by connecting the endpoints with a straight line and determining the location of the intercept of the straight line (xr). • The value of xr then replaces whichever of the two initial guesses yields a function value with the same sign as f(xr).
Bisection vs. False Position • Bisection does not take into account the shape of the function; this can be good or bad depending on the function! • Bad:
False Position - Lab • Use the false position method (step-by-step in Matlab) to determine the roots of the following functions: • X2 + 5 • (X-2)2 • Determine the brackets using the incsearch function • Plot the function and the roots on the same graph