# The Bisection Method

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 applet below, you should enter (leaving no blanks) the coefficients of the polynomial p(x) and the endpoints of an interval [a,b] so that p(a) and p(b) have opposite signs. The applet finds a root in [a,b], accurate to 0.00001. Furthermore, it 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 p(x) is positive at the left endpoint and negative at the right endpoint of [1.50, 2.00], and that p(x) is negative at the midpoint 1.75. Thus, the next interval chosen is [1.50, 1.75] because then p(x) will have opposite signs at its endpoints.

source code