function L = newton_interp(x,xdata,ydata)
% Lagrange sub forma lui newton
%
% ISA 2017-2018


n = length(xdata)-1;


D = divdiff_distinct_1(xdata,ydata);

L = ydata(1);
P = 1;
for k=1:n
  % LAGRANGE DIN FORMA LUI NEWTON
  
  P = P.*(x-xdata(k));
  L = L + D(k+1,k+1)*P;
end;
