%wilkinson
clear all, clf
r=[1,2,3,4,5]'
poly(r); p=poly(r); r2=roots(p)
format long
r2
eps
1+eps
roots(p)-flipud(r)
(roots(p)-flipud(r))/eps
n=7; r=[n:-1:1]'; p=poly(r); r2=roots(p)
n=7; r=[n:-1:1]'; p=poly(r); r2=roots(p); max(abs(r-r2))
h=[];for n=8:22, r=[n:-1:1]; p=poly(r); r2=roots(p); h=[h,max(abs(r'-r2))]; end
semilogy([8:22],h), shg
grid on, title('Maximum error of roots'), shg
%lookfor factorial
factorial(20)