%
%  tcheby.m -- djm, 05 july 2005
%

N = 5;

x = -1:0.002:1;

figure(1);  clf
subplot(2,1,1)
plot(x,x.^N,'r',x,(x.^N)-(2^(1-N))*cos(N*acos(x)),'b')
title('\bf best uniform polynomial of deg N for f(x)=x^{N+1}')
xlabel('\bf x-axis')
ylabel(['\bf N=' num2str(N-1)])
subplot(2,1,2);  hold on
plot(x,(2^(1-N))*cos(N*acos(x)),'b')
title('\bf f(x)-F_N(x)')
xlabel('\bf x-axis')

error = (2^(1-N))*cos(N*acos(x));
maxE = max(abs(error));
plot([-1 1], [1 1]*maxE,'k:')
plot([-1 1],-[1 1]*maxE,'k:')

figure(2);  clf

