Root Approximation - Bisection
Root approximation through bisection is a simple method for determining the root of a function. By testing different -values in a function, the root can be gradually found by simply narrowing down the range of the function's sign change.
Assumption: The function is continuous and continuously differentiable in the given range where we see the sign change. This assumption is key as it will guarantee a root exists in the range by the intermediate value theorem.
Contents
The Algorithm
Below is a graph of the function
In order to find the root between , for example, -values can be plugged into the function starting with the original domain:
Because the function is continuous and there is a sign change, by intermediate value theorem, there must be a root between . The midpoint between every domain is halved until the approximation becomes sufficiently close. In the previous example, the domain can be narrowed down through the midpoint, i.e. :
The root has been established to lie within (0.25, 0.5). Bisection can be further continued:
Now, the root's domain lies somewhere within (0.375, 0.4375). Bisection can be continued as precision dictates.
Can you find the root of the equation in the interval between and ?
By the intermediate value theorem you might expect that since the sign changes between and , that there should be a root between these two values; however, this equation is not continuous on this interval. Specifically, at .
Therefore, this method cannot be used to find a root in this interval.
Can you find the root of the equation in the interval between and ?
Although, clearly a root exists in this interval, specifically , and the function is continuous and continuously differentiable in this range, the root approximation bisection method can't be used in this case since y never takes on a negative value in this range.
So this method cannot be used to find a root in this interval.
Given that the function has a root between 0 and -2, find the root to one decimal place.
First we evaluate the function at both intervals:
Now we bisect and repeat:
We know the root lies somewhere between -1.5 and -1.375. Taking the midpoint, . So we know the value to 1 decimal place of the root between 0 and -2 of the equation is
Given that the function has a root between and , find the root to one decimal place.
Your first reaction might be to say, "Hey wait, this function isn't continuous or differentiable at . However, isn't in the interval between and , so this method can be used.
Now we bisect and repeat:
\[\begin{align} f(2.5)&=-.067\\ f(3.25)&=0.025\\ f(2.875)&=-0.014\\ f(3.0625)&=0.0068\\ f(2.969)&=-0.0035.
\end{align}\]
This has narrowed the search to between and . Taking the midpoint gives us an answer of to within a decimal point.
For the last example, we could see from the equation that the root would approach 3. However, for this example, it is not so obvious. In fact, it might be quite difficult to find the roots without the use of this bisection method.
Given that the function has a root between and , find the root to one decimal place.
Now we bisect and repeat:
This has narrowed the search to between and . Taking the midpoint gives us an answer of to within a decimal point.
Implementation
Here is a Python implementation of the algorithm:
1 2 3 4 5 6 7 8 9 |
|
Now we could run it like this, for example:
1 2 |
|