INTERPOLATION OF NEWTON WITH DIVIDED DIFFERENCES
Newton's interpolation method with divided differences is one of the methods to find the n-1 degree polynomial that passes through n points. The use of divided differences allows us to calculate several versions of the desired polynomial. This method uses the points given incrementally to obtain an interpolating polynomial in each step.
The equation obtained by adjusting the polynomial can be developed sequentially for higher order versions with the addition of a single term to the following lower order equation. When new terms are added sequentially, it can be determined when a return decrease point is reached, that is, when the addition of higher order terms no longer significantly improves the estimate, or in other situations it distances it.
In practice it is very common for engineers to obtain by sample or experiment a series of data {(𝑥𝑖, 𝑦𝑖), 𝑖 = 0,1,2, ..., 𝑛}, however, when wanting to estimate intermediate values between the data obtained , there is not an analytical expression 𝑓 (𝑥) that allows you to make said projection.
The polynomial interpolation consists of determining a unique polynomial 𝑃 (𝑥) of nth degree that passes through the 𝑛 + 1 points measured. This polynomial is called an interpolating polynomial.
Pseudo-code
In the following pseudo-code for the subscripts that give the location of the element in a matrix or vector, the parentheses were used.
function Coeficientes_Netown (px,py)
tam=size(px)
n=tam1
tabla=zeros(n, n+1)
fila_1_de_tabla=px
fila__de_tabla=px
b11=tabla12
for j=3: n+1
for i=j-1: n
tabla (i,j)= (tabla (i,j-1)-tabla(i-1,j-1))/(tabla (i,1)-tabla (i-j+2, 1)
if i==j-1
b(i,1)=tabla(i,j)
end if
end for
end for
define x as variable
puntosx=(px)^T
for c=2:n
mult=1
for d=c:-1:c-1
polinomio (1,c)=mult*polinomio(1,d)
mult=polinomio(1,c)
end for
end for
btrans=(b)^T
PoliNew=dot(b,polinomio)
return PoliNew
end function
Code
function [PoliNew]=Coeficientes_Newton(px,py)
tam=size(px);
n=tam(1);
tabla=zeros(n,n+1);
tabla(:,1)=px;
tabla(:,2)=py;
b(1,1)=tabla(1,2);
for j=3:n+1
for i=j-1:n
tabla(i,j)=(tabla(i,j-1)-tabla(i-1,j-1))/(tabla(i,1)-tabla(i-j+2,1));
if i==j-1
b(i,1)=tabla(i,j);
end
end
end
syms x
puntosx=px';
for a=2:n
polinomio(1,a)=x-puntosx(1,a-1);
end
polinomio(1,1)=1;
for c=2:n
mult=1;
for d=c:-1:c-1
polinomio(1,c)=mult*polinomio(1,d);
mult=polinomio(1,c);
end
end
btrans=b';
PoliNew=dot(b,polinomio);
end