A wiggly function and its best approximations
Ken Lord, whose doctoral supervisor was the Chebyshev technology wizard Charles Clenshaw, has explored functions of the form
where is the Chebyshev polynomial of degree , as challenging functions for minimax approximation by polynomials of lower order. We can construct such functions in a single Chebfun command:
text
fmn = @(m,n) sum(chebpoly(m:n),2);For example, here we plot f(30,40) and its best approximation of degree $29$:
text
LW = 'linewidth'; FS = 'fontsize'; fs = 14;
tic, m = 30; n = 40;
f = fmn(m,n);
subplot(2,2,1), plot(f,LW,1)
grid on, title('f(30,40)',FS,fs)
subplot(2,2,2), plot(f,'interval',[.8,1],LW,1.6)
grid on, title('closeup',FS,fs)
p = remez(f,m-1); err = f-p;
subplot(2,2,3), plot(err,'r',LW,1.2)
grid on, title('f - p',FS,fs)
subplot(2,2,4), plot(err{.8,1},'r',LW,1.6)
grid on, title('closeup',FS,fs), toctext
Elapsed time is 2.744878 seconds.
Here are f(200,220) and its best approximation of degree $199$:
text
tic, m = 200; n = 220;
f = fmn(m,n);
subplot(2,2,1), plot(f,LW,1)
grid on, title('f(200,220)',FS,fs)
subplot(2,2,2), plot(f{.995,1},LW,1.6)
grid on, title('closeup',FS,fs), xlim([.995 1])
p = remez(f,m-1); err = f-p;
subplot(2,2,3), plot(err,'r',LW,1)
grid on, title('f - p',FS,fs)
subplot(2,2,4), plot(err{.995,1},'r',LW,1.6)
grid on, title('closeup',FS,fs), xlim([.995 1]), toctext
Elapsed time is 1.239600 seconds.