
% here's the more elegant (and hence harder to read) code.

% define how high a degree polynomial you want.
n = 8;
%n = 6;
n = n/2;

% a(1) = a0 = 1
a(1) = 1;
for i=1:n
% want a(2) = a1 = -1/(3!3)
% want a(3) = a2 = -1/(5!5)
  ii = 2*i+1;
  a(i+1) = (-1)^i/(gamma(ii+1)*ii); 	
end

for i=1:11
  x(i) = 0 + (i-1)*1/10;
  u = x(i)^2;
  p(i) = a(n)+a(n+1)*u;
  for j=1:n-1
     p(i) = a(n-j) + u*p(i);
  end
end
