C  EXAMPLE FOR THE CALL OF SUBROUTINE DIFEXM
C  VAN DER POL PROBLEM
C  WITH PARAMETER ALPHA
C
      IMPLICIT REAL*8(A-H,O-Z)
      DIMENSION Y(2)
      COMMON /PAR/ ALPHA
      EXTERNAL FCN
C
      ALPHA =  10.D0
C
C  PRINT-PARAMETER KFLAG
C  KFLAG=0 : NO OUTPUT
C  KFLAG=1 : INTEGRATION MONITOR
C  KFLAG>1 : ADDITIONALLY INTERMEDIATE SOLUTION POINTS T,Y(1),...
C
      KFLAG=1
C  NUMBER OF SECOND ORDER EQUATIONS
      N=1
      NN=N+N
C  STARTING POINT OF INTEGRATION
      T=0.D0
C  INITIAL VALUES Y(T)
      Y(1)=2.D0
      Y(2)=0.D0
C  FINAL POINT OF INTEGRATION
      PI = 3.14159265 D0
      IF (ALPHA .LE. 1.D0) THEN
         TEND = 2.D0*(2.D0*PI + PI*0.125D0 * ALPHA*ALPHA)
      ELSE
         TEND = 2.D0 * (3.D0 - DLOG(2.D0)) * ALPHA
      ENDIF
C  DESIRED ACCURACY
      EPS=1.D-8
C  MAXIMUM PERMITTED STEPSIZE
      HMAX=TEND-T
C  INITIAL STEPSIZE GUESS
      H=1.D-3
C
      WRITE(6,101) ALPHA,T,(Y(I),I=1,NN)
C  CALL OF DIFEXM WITH THESE PARAMETERS
      CALL DIFEXM (N,FCN,T,Y,TEND,EPS,HMAX,H,KFLAG)
C
      WRITE(6,201) T,(Y(I),I=1,NN)
101   FORMAT('  DIFEXM: VAN DER POL PROBLEM (', E12.2, ')', /,
     $       '  ===========================', //,
     $       '  INITIAL VALUES  ',D25.16,/,10X,4D25.16)
201   FORMAT('  SOLUTION AT T=  ',D25.16,/,10X,4D25.16)
      STOP
      END
C
C
      SUBROUTINE FCN (N, T, Y, DF, DLAM)
C
      IMPLICIT LOGICAL (A-P,R-Z), REAL (Q)
      INTEGER N
      DOUBLE PRECISION DLAM, DF, T, ALPHA, Y
      DIMENSION DLAM(N), DF(N), Y(N)
C
      COMMON /PAR/ ALPHA
C
      DF(1) = -Y(1)
      DLAM(1) = ALPHA*(1.0D0 - Y(1)*Y(1))
C
      RETURN
      END
