The Bisection Method

The use of a while loop to enforce input constraints, while both instructive and useful, is not exactly inspiring. Let's revisit the bisection method, which you encountered in an earlier Maple lesson, and implement it in C using a while loop. If you don't remember how what the bisection method is, you should review before continuing.

Where in the implementation of the bisection method is a while loop required?

Click here for the answer

Let's work on the key parts of a C implementation of the bisection method. Suppose that we have a function f, defined in C, that takes a floating-point number as its parameter and returns a floating-point number as its result. We wish to use the bisection method to find a root for that function. Accordingly, we write a function called bisection. Each of the subsections that follows contributes a little bit to the implementation of that function.

Joseph L. Zachary
Hamlet Project
Department of Computer Science
University of Utah