(Meta 4) ejemplo calcular la mitad de un numero dev c++
programa Polinomio de newton
1. Programa para hacer polinomio por el método de Newton en matlab
disp(' ');
x=input('Digite vector de valores de X: ');
y=input('Digite vector de valores de Y: ');
b=size(1,length(x));
b(1)=y(1);
%tabla=size(2,length(x));
for n=1:(length(x)-1)
for i=1:(length(x)-n)
f(i)=(y(i+1)-y(i))/(x(i+n)-x(i));
i=i+1;
end
y=f;
b(n+1)=y(1);
n=n+1;
end
%fprintf('Los coeficientes son b=%f n',b);
disp(' ');
disp('Coeficientes: ');
b
syms X P;
P(1)=1;
for j=1:n-1
P(j+1)=(X-x(j))*P(j);
end
%fprintf('n El polinomio final es');
P=simplify(sum(P.*b));
x=subs(X,x(1):0.001:x(length(x)));
y=subs(P,x);
disp('Polinomio de Newton: '); vpa(P)
plot(x,y,'r');
% Falta terminar detalles