C$TEST QODD
C TO RUN AS A MAIN PROGRAM REMOVE NEXT LINE
      SUBROUTINE QODD
C***********************************************************************
C
C  EXAMPLE OF USE OF THE PORT PROGRAM DODEQ
C
C***********************************************************************
C
      EXTERNAL F
C
      INTEGER I1MACH,K,IWRITE
      DOUBLE PRECISION TWOPI,EM1,ANS(10),EPS
      DOUBLE PRECISION CHK1,CHK2,DK,DTEMP
      DOUBLE PRECISION DATAN, DEXP, DSIN, DCOSP
C
C  INITIALIZE 2*PI AND EXP - 1
C
      TWOPI = 8.0D0*DATAN(1.0D0)
      EM1 = DEXP(1.0D0) - 1.0D0
C
C  SET OUTPUT WRITE UNIT
C
      IWRITE = I1MACH(2)
C
C  SET ACCURACY PARAMETER
C
      EPS = 1.0D-10
C
      WRITE(IWRITE,97) EPS
 97   FORMAT(11H FOR EPS = ,1PD10.2,21H THE COEFFICIENTS ARE)
      WRITE(IWRITE,98)
 98   FORMAT(/7X,1HK,11X,9HSIN COEFF,16X,9HCOS COEFF,10X,9HMAX ERROR)
C
      CALL DODEQ(10,F,0.0D0,1.0D0,EPS,ANS)
C
      DO 10 K=1,5
      DK=K
      DTEMP = 1.D0 + (TWOPI*DK)**2
      CHK1 = TWOPI*DK*(-EM1)/DTEMP - ANS(2*K-1)
      CHK2 = EM1/DTEMP - ANS(2*K)
C
      DTEMP = DMAX1( DABS(CHK1), DABS(CHK2) )
C
 10   WRITE(IWRITE,99) K, ANS(2*K-1), ANS(2*K), DTEMP
 99   FORMAT (1H0,2X,I5,2D25.14,1PD15.4)
      STOP
      END
      SUBROUTINE F(X,Y,N,FVAL)
C
      INTEGER J, N
      DOUBLE PRECISION TWOPI,X,Y,EXPX,ANGL,FVAL(10)
C
C  INITIALIZE 2*PI AND E**X
C
      TWOPI = 8.0D0*DATAN(1.0D0)
      EXPX = DEXP(X)
C
C  COMPUTE THE TWO INTEGRANDS, E**X * SIN AND E**X * COS,
C
      DO 20 J=1,5
         ANGL   = J
         ANGL   = TWOPI*ANGL*X
         FVAL(2*J-1)   = EXPX*DSIN(ANGL)
  20     FVAL(2*J)     = EXPX*DCOS(ANGL)
C
      RETURN
      END
