      SUBROUTINE INITAL
C...  
C..,  BOUNDARY VALUE ODE INTEGRATED AS AN INITIAL VALUE ODE
C...
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      COMMON/T/S,NFIN,NORUN/Y/Y1,Y2/F/DY1DS,DY2DS/PARM/A,DA,FLAGM,FLAGP
C...
C...  INITIAL PARAMETER A, INCREMENT DA, CONTROL VARIABLES FOR
C...  ITERATION ON A
      IF(NORUN.EQ.1)THEN
         A=1.0D0
         DA=2.0D0
         FLAGM=-1.0D0
         FLAGP=-1.0D0
C...
C...  INITIAL CONDITIONS
      END IF
      Y1=0.3D0
      Y2=0.0D0
      RETURN
      END
      SUBROUTINE DERV
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      COMMON/T/S,NFIN,NORUN/Y/Y1,Y2/F/DY1DS,DY2DS/PARM/A,DA,FLAGM,FLAGP
C...
C...  ODES
      DY2DS=-A*((1.0D0-Y2**2)**0.5D0)*Y1
      DY1DS=Y2
      RETURN
      END
      SUBROUTINE PRINT(NI,NO)
      IMPLICIT DOUBLE PRECISION (A-H,O-Z)
      COMMON/T/S,NFIN,NORUN/Y/Y1,Y2/F/DY1DS,DY2DS/PARM/A,DA,FLAGM,FLAGP
C...
C...  TEST FOR THE END OF THE RUN
      IF(S.LT.0.95D0)RETURN
C...
C...  MONITOR THE RUN
      WRITE(*,*)NORUN,A,Y1
C...
C...  AT THE END OF THE RUN, PRINT Y1 TO DETERMINE HOW CLOSELY THE
C...  BOUNDARY CONDITION IS SATISFIED
      WRITE(NO,1)NORUN,S,A,Y1
1     FORMAT(10X,' NORUN = ',I5,/,
     +       10X,'     S = ',F10.2,/,
     +       10X,'     A = ',F10.6,/,
     +       10X,'    Y1 = ',F10.6,/)
C...
C...  AT THE END OF THE RUN, INCREMENT A DEPENDING ON THE SIGN DEVIATION
C...  FROM THE PRESCRIBED HOMOGENEOUS BOUNDARY CONDITION, Y1(1) = 0
C...
C...       IF Y1(1) IS POSITIVE, INCREASE A
           IF(Y1.LT.0.0D0)GO TO 2
C...
C...            IF A SMALLER INCREMENT IN A IS REQUIRED, HALVE DA
                IF(FLAGM.LT.0.0D0)GO TO 3
                DA=DA/2.
C...
C...            INCREMENT A POSITIVELY FOR THE NEXT RUN
3               A=A+DA
                FLAGP=1.0D0
                RETURN
C...
C...       IF Y1(1) IS NEGATIVE, DECREASE A
C...
C...            IF A SMALLER INCREMENT IN A IS REQUIRED, HALVE 
2               IF(FLAGP.LT.0.0D0)GO TO 4
                DA=DA/2.0D0
C...
C...            INCREMENT A NEGATIVELY FOR THE NEXT RUN
4               A=A-DA
                FLAGM=1.0D0
                RETURN
      END

