      PROGRAM NEWTON

      IMPLICIT NONE
      
      REAL EPSILON
      REAL DERV
      REAL X, Y
      PARAMETER (EPSILON = 0.00000001)
      
      PRINT *, 'INPUT X'
      READ *, X
      PRINT *, 'X STARTS AT ', X
      
      Y = X ** 2 - 3.0 * X + 2.0
      
      DO WHILE (ABS(Y) .GT. EPSILON)
        DERV = 2.0 * X - 3.0
        PRINT *, 'X = ', X, ' DERV = ', DERV, ' Y = ', Y
        X = X - Y / DERV
        Y = X ** 2 - 3.0 * X + 2.0
      ENDDO
      
      PRINT *, 'THE SOLUTION IS ', X
      
      STOP
      END    
      
     