      program cheby
      dimension xray(101),yray(101)
      call metafl('cons')
      CALL DISINI
      CALL GRAF(-1.,1.,-1.,2.e-1,-1.,1.,-1.,2.e-1)
           NX=NXPOSN(-0.25)
           NY=NYPOSN(1.2)
      CALL MESSAG('Chebyshev polynoms',NX,NY)
      call rline(-1.0,0.0,1.0,0.0)
      call rline(0.0,-1.0,0.0,1.0) 
      CALL COLOR('red')
      n=4
      do j=1,n
         x=-1.0 
         do i=1,101
            xray(i)=x
            yray(i)=t(x,j)
            x=x+0.02
         end do  
         CALL curve(xray,yray,101)
      end do
      call DISFIN
      end
c
      function t(x,n)
      dimension tt(0:20)
      if (n.EQ.0) then
         t=1.0
         return
      end if
      if (n.EQ.1) then
         t=x
         return
      end if
      tt(0)=1.
      tt(1)=x
      do i=2,n
         tt(i)=2.*x*tt(i-1)-tt(i-2)
      end do
      t=tt(n)
      return
      end
