Question: Figure out the corresponding recursion, and then design and code an algorithm in Matlab. The bisection method for finding roots of functions is based on
Figure out the corresponding recursion, and then design and code an algorithm in Matlab.
The bisection method for finding roots of functions is based on the following idea: Suppose f is a continuous function on (at least) the interval [a,b], and that f(a) and f(b) differ in sign. Then by the Intermediate Value Theorem, f has at least one root between a and b. To find that root, evaluate f at (a+b)/2 (i.e., the midpoint of interval [a,b]), and check the sign of the result. If the result differs in sign from f(a), then find the root in the smaller interval [a,(a+b)/2]; if the result differs in sign from f(b), find the root in the interval [(a+b)/2,b]; in the highly unlikely event that f( (a+b)/2 ) is exactly equal to 0, then (a+b)/2 is the root.
Bisection is usually implemented iteratively, but the above description suggests a way to express it recursively. Do so. The base case for the recursion should be that b-a is less than some tolerance.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
