function sum=deriv(xx,x,f)
%
% compute the derivative of a Lagrange polynomial at xx using
% a divided difference table stored in f
%
n=size(x,1);
nd=n-1;
sum=f(1,2);
for i=2:nd
  sump=0;
  for k=1:i
    p=1;
    for l=1:i
       if (l==k)
       else
         p=p*(xx-x(l));
       end
    end
    sump=sump+p;	
  end
  sum=sum+f(1,i+1)*sump;
end



  
           