C     $Id$
      IMPLICIT REAL*8 (A-F,H,O-Z)
      PARAMETER (NXM=101)
      DIMENSION GX(NXM),GY(NXM,2)
C
      CALL GSOPEN
C
      NXMAX=101
      DX=2*3.1415927/(NXMAX-1)
      Y0=0.0
      YA=1.0
C
    1 WRITE(6,*) '## INPUT Y0,YA ?'
      READ(5,*,ERR=1,END=9000) Y0,YA
C
      DO 100 N=1,NXMAX
        GX(N)  =GUCLIP((N-1)*DX)
        GY(N,1)=GUCLIP(Y0+YA*SIN(GX(N)))
        GY(N,2)=GUCLIP(Y0+YA*COS(GX(N)))
  100 CONTINUE
C
      CALL PAGES
      CALL GRAPH1(4.0,24.0,2.0,17.0,GX,GY,NXM,NXMAX,2)
      CALL PAGEE
      GOTO 1
C
 9000 CALL GSCLOS
      STOP
      END
C
      SUBROUTINE GRAPH1(PXMIN,PXMAX,PYMIN,PYMAX,GX,GY,NXM,NXMAX,NGMAX)
C
      DIMENSION GX(NXM),GY(NXM,NGMAX)
C
      CALL GMNMX1(GX,1,NXMAX,1,XMIN,XMAX)
      CALL GMNMX1(GY(1,1),1,NXMAX,1,YMIN,YMAX)
      DO 100 NG=2,NGMAX
         CALL GMNMX1(GY(1,NG),1,NXMAX,1,YMIN1,YMAX1)
         YMIN=MIN(YMIN,YMIN1)
         YMAX=MAX(YMAX,YMAX1)
  100 CONTINUE
      CALL GQSCAL(XMIN,XMAX,GXMIN,GXMAX,GXSCAL)
      CALL GQSCAL(YMIN,YMAX,GYMIN,GYMAX,GYSCAL)
C
C     Origin should have a scale mark
C
      IF(GXMIN*GXMAX.GT.0.0) THEN
         GXORG=GXMIN
      ELSE
         GXORG=0.0
      ENDIF
      IF(GYMIN*GYMAX.GT.0.0) THEN
         GYORG=GYMIN
      ELSE
         GYORG=0.0
      ENDIF
C
C     symbol font has better minus sign
C
      CALL SETFNT(44)
      CALL SETCHS(0.35,0.0)
      CALL GDEFIN(PXMIN,PXMAX,PYMIN,PYMAX,GXMIN,GXMAX,GYMIN,GYMAX)
      CALL GFRAME
C
C     NGULEN choose appropriate format of scale values
C
      CALL GSCALE(GXORG,GXSCAL,0.0,0.0,0.3,9)
      CALL GVALUE(GXORG,2*GXSCAL,0.0,0.0,NGULEN(2*GXSCAL))
      CALL GSCALE(0.0,0.0,GYORG,GYSCAL,0.3,9)
      CALL GVALUE(0.0,0.0,GYORG,2*GYSCAL,NGULEN(2*GYSCAL))
      DO 200 NG=1,NGMAX
         CALL SETLIN(-1,-1,7-MOD(NG-1,5))
         CALL GPLOTP(GX,GY(1,NG),1,NXMAX,1,0,0,MOD(NG-1,8))
  200 CONTINUE
      CALL SETLIN(-1,-1,7)
      RETURN
      END
