ccccccccccccccccccccccccc     Program 2.6     cccccccccccccccccccccccccc
c
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c                                                                      c
c Please Note:                                                         c
c                                                                      c
c (1) This computer program is part of the book, "An Introduction to   c
c     Computational Physics," written by Tao Pang and published and    c
c     copyrighted by Cambridge University Press in 1997.               c
c                                                                      c
c (2) No warranties, express or implied, are made for this program.    c
c                                                                      c
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
c
      PROGRAM BISECTION
C
C This program uses the bisection method to find the root of
C f(x)=exp(x)*ln(x)-x*x=0.
C
      DL = 1.0E-06
      A  = 1.0
      B  = 2.0
      DX = B - A
      ISTEP = 0
      DO    100  WHILE (ABS(DX).GT.DL)
        X0 = (A+B)/2.0
        IF ((F(A)*F(X0)).LT.0) THEN
          B  = X0
          DX = B - A
        ELSE
          A  = X0
          DX = B - A
        END IF
        ISTEP = ISTEP + 1
  100 END DO
      WRITE (6,999) ISTEP,X0,DX
      STOP
  999 FORMAT (I4,2F16.8)
      END
C
      FUNCTION F(X)
        F = EXP(X)*ALOG(X) - X*X
      RETURN
      END
