	program zero_finder
	implicit none
	double precision A(0:100)
        DOUBLE PRECISION P(0:1)
        double precision x
        double precision PI
           parameter (PI = 3.1415926535897932384626d0)
	INTEGER n,k,i,j
C Define polynomial
	n = 9
	A(9) = 0.d0
	A(8) = 9.d0
	A(7) = 0.d0
	A(6) =-120.d0
	A(5) = 0.d0
	A(4) = 432.d0
	A(3) = 0.d0
	A(2) =-576.d0
	A(1) = 0.d0
	A(0) = 256.d0
C  compute roots (positive ones)
        write(*,*) 'positive zeros of T',n
        do i = 0, int(n/2)-1
          write(*,*) i, cos(PI*(2.d0*i+1.d0)/(2.d0*n))
        end do
        write(*,*) 'positive zeros of T^',n
        do i = 0, int(n/2)-1
          write(*,*) i, cos(PI*i/n)
        end do
 60	write(*,*) 'give x'
	read(*,*) x
        if (x .eq. 69) STOP
	write(*,*) 'give k'
	read(*,*) k
        DO J = 0,K
          P(J) = A(0)
        END DO
        DO I = 1,N-k
            P(0) = A(i) + x*P(0)
            P(1) = P(0) + x*P(1)
        END DO
        DO I = N-k+1,N
            P(0) = A(N) + x*P(0)
        END DO
        write(*,*) 'values of poly and ',k,' derivatives at ',x 
        write(*,*),(P(i), i=0,k)
        go to 60
        end
