TI-85 Program: The Bisection Method
This is a program which uses the bisection method to
approximate roots of an equation f(x)=0.
The input consists of an equation for the function f(x) and
values a and b for which f(a) and f(b)
have opposite signs. (In the program, we test whether f(a) and
f(b) have opposite signs by checking whether the product
f(a)f(b) is negative).
The program then checks the midpoint c of a and b
to determine whether f(c) is opposite in sign to f(a) or
to f(b). In the first case, b is replaced by c,
while in the second a is replaced by c. At this point, the
program prints out the current value of a (which represents an
approximation to the root) and of b-a (which represents the accuracy
of the approximation). The process is then
repeated in an unending loop.
Here is the code (suitable for the TI-85).
[In the code typed above, the symbols
"St>Eq(" and "evalF("
can be found on the CATALOG menu. The symbol
"->" is accessed
using the "STO>" key which is the second key from the lefthand
bottom of the calculator. Many of the other command words can be
found on the I/O and CTL menus. The greater than and less than symbols
may be found on the TEST menu.]
After you have entered the program into your TI-85,
try applying it with
:Disp "This program uses"
:Disp "the bisection method"
:Disp "to approximate a"
:Disp "root of f(x)=0 given"
:Disp "x-values a and b"
:Disp "where f(a)f(b)<0."
:Disp "Press enter to continue"
:Pause
:Disp ""
:
:InpSt "f(x)= ",f
:St>Eq(f,F)
:Input "a= ",A
:Input "b= ",B
:
:Lbl HERE
:.5*(A+B)->C
:evalF(F,x,A)->FA
:evalF(F,x,C)->FC
:
:If FA*FC>0
:Then
:C->A
:Else
:C->B
:End
:
:Disp "There is a root at ",A
:Disp "accurate to within ",B-A
:Disp ""
:Pause
:
:Goto HERE
This document was created in November 1996 and last revised on August 15, 1998.
Your questions, comments or suggestions are welcomed. Please direct correspondence to:
Andy Miller
URL: http://www.math.ou.edu/~amiller/ti85/bisect.htm