A continuous function, positive at one endpoint of an interval and negative at the other, must have a root somewhere in between according to the Intermediate Value Theorem. The Bisection Method finds a succession of closed intervals, each one being either the left half or the right half of the preceding one, always with the given function having opposite signs at the two endpoints. In this way, the location of a root is narrowed down to within smaller and smaller intervals.

In the script below, enter a function f(x) and the endpoints of an interval [a,b] so that f(a) and f(b) have opposite signs. When entering f(x), you can use +, -, *, /, ^, ( ), abs(), sin(), cos(), tan(), exp(), log(), log10(), asin(), acos(), atan(), pi, e. Take care to remember the * in all multiplications and avoid discontinuities. Also, note that here, log() stands for the natural logarithm, while log10() stands for the common logarithm. When entering a and b, you can use integers and decimals. The script finds a root in [a,b], accurate to 0.00001. It also shows the succession of intervals that contain the root and gives a diagram illustrating the intervals (until they become too small to be displayed accurately). For example,

1.50000 2.00000 +________________- 1.50000 1.75000 +________-

indicates that f(x) is positive at the left endpoint and negative at the right endpoint of [1.50, 2.00], and that f(x) is negative at the midpoint 1.75. Thus, the next interval chosen is [1.50, 1.75] because then f(x) will have opposite signs at its endpoints.