This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: ME 218: ENGR COMPUTATIONAL METHODS
Lecture Notes (Set #2) Methods for solving nonlinear eguations l. Bisection Method
Assume that the real function f(x) is continuous on the interval [a, b] and that f(a) and f(b) have different signs. Then, at least one root of f(x) lies in the interval [a, b]. Let xL = a and xR = b. Deﬁne xM to be the midpoint of [a, b]. Thus, xM = (xL+xR)/2. If f(xM) = 0, xM is the exact solution! If ﬂaw) is not equal to 0, either f(xL).f(xM)<0 or f(xM)f(xR)<0. In other words, a root lies either in the interval [xL, xM] or [xM, xR]. By using this step, a
root of f(x) can be located in an interval (b — a)/2, which is half the original interval.
Repeating this process leads to convergence towards a root of f(x). The process can be stopped when the length of the interval becomes less than a desired tolerance value, c. Algorithm:
Given the above assumptions,
Input xL, xR and stopping criterion/criteria
n=0;
REPEAT
n=n+l;
xM = (xL+xR)/2
IFf(xL).f(xM)<0, THEN xR = xM ELSE xL = xM
UNTIL STOPPING CRITERION IS MET Note that after n iterations, your solution is enclosed within an interval of width
(XL  xR)/2" (you reduce the width of the interval by one half with each section). Hence, aﬁer n iterations, you will be within (XL  xR)/2n of the actual solution!!! Possible stopping criteria 0 xL — le < e for some small “e” (means we have narrowed down the interval so
much that for all intents and purposes we do not need to continue. 0 n>Nnmit (means we have exceeded the maximal allowed number of iterations
Nlimit) o  f(xM) < e2 for some small e2 (this means that my middle point is almost the root of this function, so no need to continue ...
View
Full Document
 Fall '08
 Unknown

Click to edit the document details