[comp.sys.handhelds] Bisection Alg HP-28

JJL101@psuvm.psu.edu (J.J. Lehett) (02/04/90)

    In the vein of my fixed point alogorithm, comes another roots estimating
algorithm, the ole' bisection algorithm.

    In the global variable, 'G', place the function of X, as in 'X:2-4'
       stack level  ->   4: lower endpoint
                         3: upper endpoint
                         2: tolerance level (maximum error)
                         1: maximum number of iteration

<< 1 -> a b tol n0 i
   << WHILE i n0 <= REPEAT
      b a - 2 / a + 'p' STO p 'X' STO
      IF G EVAL 0 == b a - 2 / tol < OR
         THEN p { p X } PURGE ABORT
      END
      i 1 + 'i' STO
      IF G EVAL a 'X' STO g EVAL * 0 >
         THEN p 'a' STO
         ELSE p 'b' STO
      END
      i p b a - ABS p 'X' STO G EVAL
      4 ->LIST SHON HALT DROP
   END
   'Failed'
   { p X } PURGE
   >>
>>


For SHON - see my previous artical - all it does is turn on the shift key -
makes life easier....

      Anyways.... as always....send any questions, comments, etc. to me....
I'd love to hear from you.

         Happy HP-ing!
********************************************************************
*       J.J.        *             JJL101@psuvm.bitnet              *
*                   *    Penn State Center for Academic Computing  *
*    John Lehett    *          Computational Mathematics           *
********************************************************************