      program deriv1
      dimension xran(101),yran(101),xran1(101),yran1(101)
      dimension xran2(101),yran2(101)
      character*60 ctit
      ctit='numericka derivacia'
      x=-5.0
      write(*,*) 'zadaj sum'
      read(*,*) ampl
      do i=1,101
         a=ampl*rand()
c         write(1,*) i,a
         xran(i)=x
         yran(i)=sin(x)+a
         x=x+10.e-2
      end do
      do i=1,99
         xran1(i)=xran(i)
         yran1(i)=(yran(i+1)-yran(i))/(xran(i+1)-xran(i))
      end do
      do i=1,99
         xran2(i)=xran(i)+5.e-2
         yran2(i)=(yran(i+2)-yran(i))/(xran(i+2)-xran(i))
      end do
c
c      kresliaca cast
c
      call metafl('cons')
      CALL SETPAG('DA4L')
      CALL DISINI
      CALL TITLIN(CTIT,1)
      CALL AXSLEN(2500,700)
      CALL AXSPOS(200,800)
      CALL GRAF(-5.,5.,-5.,2.,-1.,1.,-1.,4.e-1)
           NX=NXPOSN(-3.)
           NY=NYPOSN(1.2)
      CALL MESSAG('Funkcia',NX,NY)
      CALL COLOR('red')
      CALL curve(xran,yran,101)
      CALL COLOR('white')
      CALL ENDGRF
      CALL AXSLEN(2500,700)
      CALL AXSPOS(200,1800)
      CALL GRAF(-5.,5.,-5.,2.,-1.,1.,-1.,4.e-1)
           NX=NXPOSN(-3.)
           NY=NYPOSN(1.2)
      CALL MESSAG('Numericka derivacia',NX,NY)
      CALL COLOR('red')
      CALL curve(xran1,yran1,99)
      CALL COLOR('yellow')
      CALL curve(xran2,yran2,99) 
      CALL DISFIN
      END 
