PROGRAM FINDROT2
C=======================================================================
C         FIND ROOT OF THE FOLLOWING FUNCTIONS
C             TAN(LAMBDA)/TANH(LAMBDA)-1=0   FIXED ----- ROLLER
C=======================================================================
      IMPLICIT REAL*8 ( A-H , O-Z )
      PARAMETER ( MXN=1200, DX=0.001D0, DXNEWTON=DX/10.D0  )
      DIMENSION ROOT(MXN)
C---------- DX = INCREMENTAL VALUE
C=======================================================================
      EPS = 1.D-13
C=======================================================================
C------ INITIALIZATION
      NROOT = 100
      PI = 4.D0*DATAN(1.D0)
      X = 0.D0
      DO I = 1 , NROOT
      X = X + PI
      CALL NEWTON ( X, DXNEWTON, EPS  )
      ROOT(I) = X
      WRITE (*,*) I, X
      END DO
C
      OPEN ( 1, FILE='ROOT2.DAT', STATUS='UNKNOWN' )
      DO I = 1 , NROOT
      WRITE (1,*) I, ROOT (I)
      END DO
      CLOSE (1)
C=======================================================================
      STOP 'NORMAL TERMINATION'
      END
C
C
      SUBROUTINE NEWTON (X, DX, EPS )
      IMPLICIT REAL*8 ( A-H , O-Z )
      DELTAX = X
      DO WHILE ( DABS(DELTAX) .GT. EPS )
      DFDX = (FX(X+DX)-FX(X-DX))/(2.D0*DX)
      DELTAX = - FX(X)/DFDX
      X = X + DELTAX
      END DO
      RETURN
      END
C
C
      FUNCTION FX(FLAMBDA)
      IMPLICIT REAL*8 ( A-H , O-Z )
      FX = DTAN(FLAMBDA)/DTANH(FLAMBDA)-1.D0
      RETURN
      END