PROGRAM IN JAVASCRIPT




click!

This program is all about bracketing methods because they "bracket" x between the endpoints of a closed interval [a,b]. All bracketing methods start with an interval [a,b] for which
L=f(a) and R=f(b) have opposite sign
The basic iterative step of a bracketing method is to find a test value xtest in the open interval(a,b) and then replace [a,b] by whichever of [a,xtest] or [xtest,b] contains x. The correct replacement is easily determined by the sign of Y=f(xtest):
IF sign(Y)=sign(L) THEN replace (a,L) by (xtest,Y)
ELSE {sign(Y)!=sign(L)} replace (b,R) by (xtest,Y)
This iterative step is then repeated for the new (smaller) [a,b] until Y=0. The two most popular choices are:
xtest=xmid=(a+b)/2 (Bisection (BIS) Method)
xtest=xFP=(bL-aR)/(L-R) (False Position (FP) Method)
In Bisection Method, xtest bisects[a,b]. In the False Position Method, xtest is the x-intercept of the secant line from (a,L) to (b,R).