% compute the condition # vers n^4 of second-order Chebyshev deriv. matrix

for i=2:7
for j=1:2^i+1
x(j)=cos((j-1)*pi/2^i);
end
dm=derivmatrix(2^i,2,x);
d=dm(2:2^i,2:2^i,2);
%x=eig(d)

z(i)=cond(d)/(16^i);
z(i)=max(abs(eig(d)))/(min(abs(eig(d)))*16^i);
fprintf(1,      '%9.0f          %15.11f  \n', [i;  z(i)]);

end
