      SUBROUTINE INITAL
C...
C...  NUMERICAL INTEGRATION OF THE COMPLETE ELLIPTIC INTEGRALS
C...
C...  THE INTEGRALS TO BE EVALUATED ARE
C...
C...          PI/2            DT
C...     E1 = INT -----------------------------
C...           0  (1 - (K**2)*(SIN(T)**2))**0.5
C...
C...          PI/2
C...     E2 = INT (1 - (K**2)*(SIN(T)**2))**0.5 DT
C...           0
C...
C...          PI/2                DT
C...     E3 = INT ---------------------------------
C...           0  (1 - (1 - K**2)*(SIN(T)**2))**0.5
C...
C...          PI/2
C..      E4 = INT (1 - (1 - K**2)*(SIN(T)**2))**0.5 DT
C...           0
C...
C...  THESE INTEGRALS ARE TABULATED BELOW FOR COMPARISON WITH THE
C...  NUMERICAL VALUES (REFERENCE - HANDBOOK OF MATHEMATICAL SCIENCES,
C...  CRC PRESS, INC., WEST PALM BEACH, FL, 5TH EDITION, 1975, PP 535
C...  -547).  IN ALL CASES, WE TAKE K = 0.5.
C...
C...                               E1 = 1.6858
C...
C...                               E2 = 1.4675
C...
C...                               E3 = 2.1565
C...
C...                               E4 = 1.2111
C...
      PARAMETER (N=4)
      COMMON/T/      T,  NSTOP,  NORUN
     +      /Y/   E(N)
     +      /F/DEDT(N)
     +      /C/      K
      REAL           K
C...
C...  CONSTANT K
      K=0.5
C...
C...  INITIAL CONDITION
      DO 1 I=1,N
        E(I)=0.
1     CONTINUE
      RETURN
      END
      SUBROUTINE DERV
      PARAMETER (N=4)
      COMMON/T/      T,  NSTOP,  NORUN
     +      /Y/   E(N)
     +      /F/DEDT(N)
     +      /C/      K
      REAL           K
C...
C...  EVALUATE THE INTEGRANDS
         ARG1=SQRT(1.0-(K**2)*(SIN(T)**2))
         ARG2=SQRT(1.0-(1.0-K**2)*(SIN(T)**2))
         DEDT(1)=1.0/ARG1
         DEDT(2)=    ARG1
         DEDT(3)=1.0/ARG2
         DEDT(4)=    ARG2
      RETURN
      END
      SUBROUTINE PRINT(NI,NO)
      PARAMETER (N=4)
      COMMON/T/      T,  NSTOP,  NORUN
     +      /Y/   E(N)
     +      /F/DEDT(N)
     +      /C/      K
      REAL           K
C...
C...  WRITE THE VALUES OF THE FOUR ELLIPTIC INTEGRALS
      IF(T.GT.1.0)THEN
         WRITE(NO,1)T,(E(I),I=1,N)
1        FORMAT(//,5F10.5)
C...
C...     LEGENDRE*S RELATION
         R=E(1)*E(4)+E(2)*E(3)-E(1)*E(3)-1.5707693
C...
C...     WRITE THE RESIDUAL FOR LEGENDRE*S RELATION
         WRITE(NO,2)R
2        FORMAT(/,' RESIDUAL = ',F8.5)
      END IF
      RETURN
      END

