Question: 1. Implement the bisection method (textbook $2.1). Your function should have the following signature, function r -bisection(f, a, b, tol, maxits) where f is a

 1. Implement the bisection method (textbook $2.1). Your function should have

1. Implement the bisection method (textbook $2.1). Your function should have the following signature, function r -bisection(f, a, b, tol, maxits) where f is a function handle and a, b, tol, maxits, and r are numbers. Your implementation can assume that . sign(f(a))sign(f(b)) f is continuous on [a, bl. tol is nonnegative, and maxits is a positive integer Your implementation should estimate the absolute error as one-half the width of the current search interval and terminate once this estimate no longer exceeds tol. Additionally, your implementation should perform at most maxits iterations, and should report a warning to the user if your error estimate still exceeds tol after maxits iterations. (This matches the functionality in the textbook's implementation, Algorithm 2.1.) (a) Test your code by using it to approximate the root of sin(z). (Pick a and b to 'bracket' this root.) Find values of tol and maxits so that the six leading digits of r are correct (3.14159). (b) Use your code to try to find a root of tan(x) on the interval [1,2. Explain what happens. (c) Challenge (optional/ungraded) Implement bisection using recursion (vs. iteration) d) Challenge (optional/ungraded The textbook claims that it is preferable (in floating point) to compute the midpoint as c a+(b-a)/2, rather than c - (a+b)/2. Find an interval [a, bl where this makes a difference, and explain what might go wrong when using the latter formula

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!