function y = div_dif(x,y)
%
% Given vectors of interpolation points x and interpolation values 
% y, this produces a vector of divided differences. The x and y vectors 
% must have the same size. 
%
if size(x) ~= size(y) 
  error('The input vectors x and y must have the same size.'); 
end
n = length(x);
for j = 2:n 
  y(j:n) = (y(j:n) - y(j-1:n-1))./(x(j:n) - x(1:n-j+1)); 
end
