Presentation on theme: "Bisection Method (Midpoint Method for Equations)."— Presentation transcript:
Bisection Method (Midpoint Method for Equations)
Bisection Method The bisection method (sometimes called the midpoint method for equations) is a method used to estimate the solution of an equation. Like the Regula-Falsi Method (and others) we approach this problem by writing the equation in the form f(x) = 0 for some function f(x). This reduces the problem to finding a root for the function f(x). Like the Regula-Falsi Method the Bisection Method also needs a closed interval [a,b] for which the function f(x) is positive at one endpoint and negative at the other. In other words f(x) must satisfy the condition f(a) f(b) < 0. This means that this algorithm can not be applied to find tangential roots. There are several advantages that the Bisection method has over the Regula- Falsi Method. The number of steps required to estimate the root within the desired error can be easily computed before the algorithm is applied. This gives a way to compute how long the algorithm will compute. (Real-time applications) The way that you get the next point is a much easier computation than how you get the regula-falsi point ( rfp ).
Bisection Algorithm The idea for the Bisection Algorithm is to cut the interval [ a, b ] you are given in half (bisect it) on each iteration by computing the midpoint x mid. The midpoint will replace either a or b depending on if the sign of f(x mid ) agrees with f(a) or f(b). Step 1: Compute x mid = ( a + b )/2 Step 2: If sign ( f(x mid ) ) = 0then end algorithm else If sign ( f(x mid ) ) = sign ( f(a) ) then a = x mid else b = x mid Step 3: Return to step 1 f(a) f(b) ab root x mid This shows how the points a, b and x mid are related. f(x)
Lets apply the Bisection Method to the same function as we did for the Regula- Falsi Method. The equation is: x 3 -2 x -3=0, the function is: f ( x )= x 3 -2 x -3. This function has a root on the interval [0,2] Iteration abx mid f(a)f(b)f(x mid ) 1021-31-4 2121.5-41 -2.262 31.521.75 -2.262 1 -1.140 41.7521.875 -1.140 1 -.158
As we mentioned earlier we mentioned that we could compute exactly how many iterations we would need for a given amount of error. The error is usually measured by looking at the width of the current interval you are considering (i.e. the distance between a and b ). The width of the interval at each iteration can be found by dividing the width of the starting interval by 2 for each iteration. This is because each iteration cuts the interval in half. If we let the error we want to achieve err and n be the iterations we get the following: