% WILKEXTRA  Solution to extra credit for Exercise 2, A#7.

errorzero = [];
for m=4:20
  j = 0:m;
  x = j + 0.141;
  y = x - 1;
  for k = 2:m
    y = y .* (x - k);
  end
  a_computed = polyfit(x,y,m);       % generates lots of warnings
  exact = (-1).^m * factorial(m);    % exact constant term in poly
  errorzero = [errorzero abs(a_computed(end)-exact)];
end
semilogy(4:20, errorzero,'o','markersize',14), grid on
xlabel('degree'), ylabel('error in constant term')
