Professional Documents
Culture Documents
UNIVERSIDAD SURCOLOMBIANA
NEIVA
2016
MTODOS DE APROXIMACIN A LA SOLUCIN DE UNA ECUACIN
UNIVERSIDAD SURCOLOMBIANA
NEIVA
2016
INTERPOLACIONES NEWTON
COMANDOS
clear;clc;
CODIGO
disp('metodos numericos');
disp('interpolacion');
disp('interpolacion');
for i=1:n+1
fprintf('x%.0f=',i-1);
X(i)=input(' ');
fprintf('y%.0f=',i-1);
Y(i)=input(' ');
end
DD=zeros(n+1);
DD(:,1)=Y;
for k=2:n+1
for J=k:n+1
DD(J,k)=[DD(J,k-1)-DD(J-1,k-1)]/[X(J)-X(J-k+1)];
end
end
disp(DD);
disp('El polinomio de newton es');
syms x;
polnew=DD(1,1);
P=1;
for i=1:n
P=P*(x-X(i));
polnew=polnew+P*DD(i+1,i+1);
end
polnew=expand(polnew);
pretty(polnew);
vi=eval(polnew);
hold on;
ezplot(polnew,[X(1) X(n+1)]);
plot(x,vi,'r+');
metodos numericos
interpolacion
interpolacion
ingrese el grado del polinomio, n=3
Se necesitan 4 puntos
ingrese los puntos
x0= 8.1
y0= 16.94410
x1= 8.3
y1= 17.56492
x2= 8.6
y2= 18.50515
x3= 8.7
y3= 18.82091
La matriz de diferencias divididas es:
16.9441 0 0 0
17.5649 3.1041 0 0
18.5052 3.1341 0.0600 0
18.8209 3.1576 0.0588 -0.0021
El polinomio de newton es
3 2
600479950319367 x 32305821327096495 x
- ------------------ + -------------------- +
288230376151711744 288230376151711744
1215038153065179528651 x
------------------------ -
720575940379279360000
10667307142151117099153/3602879701896396800000
ingrese el valor de x a interpolar,x=8.4
el valor interpolado es 17.877142500
>>
18.8
18.6
18.4
18.2
18
17.8
17.6
17.4
17.2
17
16.8
8.1 8.2 8.3 8.4 8.5 8.6 8.7
x
b) metodos numericos
interpolacion
interpolacion
ingrese el grado del polinomio, n=3
Se necesitan 4 puntos
ingrese los puntos
x0= 0.6
y0= -0.17694460
x1= 0.7
y1= 0.02375227
x2= 0.8
y2= 0.22363362
x3= 1.0
y3= 065809197
La matriz de diferencias divididas es:
1.0e+09 *
-0.0000 0 0 0
0.0000 0.0000 0 0
0.0000 0.0000 -0.0000 0
0.0658 0.3290 1.0968 2.7420
El polinomio de newton es
3 2
2875247662598291 x 2074647906046388276994966843 x
------------------- - ------------------------------- +
1048576 360287970189639680
14423742592213650526326974783 x
------------------------------- -
3602879701896396800
16597183273442241458716748679/18014398509481984000
ingrese el valor de x a interpolar,x=0.9
el valor interpolado es 16452299.517461777
>>
7
(14423742592213650526326974783
x 10 x)/3602879701896396800 -...- 16597183273442241458716748679/18014398509481984000
7
X F(x)
0.0 -6.00000
0.1 -5.89483
0.3 -5.65014
0.6 -5.17788
1.0 -4.28172
METODOS NUMERICOS
interpolacin
Ingrese el grado del polinomio, n=3
Se necesitan 4 puntos
ingrese los puntos
x0= 0.0
y0= -6.00000
x1= 0.1
y1= -5.89483
x2= 0.3
y2= -5.65014
x3= 0.6
y3= -5.17788
La matriz de diferencias divididas es:
-6.0000 0 0 0
-5.8948 1.0517 0 0
-5.6501 1.2234 0.5725 0
-5.1779 1.5742 0.7015 0.2150
El polinomio de newton es
3 2
3873095679539377 x 10955006093577979 x
------------------- + -------------------- +
18014398509481984 22517998136852480
45076528670351426207 x
---------------------- - 6
45035996273704960000
ingrese el valor de x a interpolar,x=3.5
el valor interpolado es 12.680900000
-5.2
-5.3
-5.4
-5.5
-5.6
-5.7
-5.8
-5.9
-6
METODOS NUMERICOS
interpolacion
interpolacion
ingrese el grado del polinomio, n=5
Se necesitan 6 puntos
ingrese los puntos
x0= 0.0
y0= -6.00000
x1= 0.1
y1= -5.89483
x2= 0.3
y2= -5.65014
x3= 0.6
y3= -5.17788
x4= 1.0
y4= -4.28172
x5= 1.1
y5= -3.99583
La matriz de diferencias divididas es:
-6.0000 0 0 0 0 0
-5.8948 1.0517 0 0 0 0
-5.6501 1.2234 0.5725 0 0 0
-5.1779 1.5742 0.7015 0.2150 0 0
-4.2817 2.2404 0.9517 0.2780 0.0630 0
-3.9958 2.8589 1.2370 0.3566 0.0786 0.0142
El polinomio de newton es
5 4 3
8162368155838225 x 10000720627040287 x 391916366949670343 x
------------------- + -------------------- + --------------------- +
576460752303423488 288230376151711744 2305843009213693952
2
1799409136934182813 x 1441181546027799292669 x
---------------------- + ------------------------ - 6
3602879701896396800 1441151880758558720000
ingrese el valor de x a interpolar,x=3.5
el valor interpolado es 23.549010303
(1441181546027799292669 x)/1441151880758558720000 +...- 6
-4
-4.2
-4.4
-4.6
-4.8
-5
-5.2
-5.4
-5.6
-5.8
-6
COMANDOS
CODIGO:
clear;
clc;
fprintf('Interpolacion con el Metodo del Polinomio de Lagrange\n\n');
n=input('grado del polinolio: ');
for i=1:n+1
x(1,i)=input('dame los valores de xi:');
end
for i=1:n+1
xi(1,i)=input('dame los valores de f(xi):');
end
x
xi
xint=input('Numero para el que desea interpolar x: '); fxint=0;
i=1;
while i<=n+1
L=1;
J=0;
while J<=n
if i~=J+1
L=L*(xint-x(1,J+1))/(x(1,i)-x(1,J+1));
end
J=J+1;
end
fxint=fxint+L*xi(1,i);
i=i+1;
end
C) f(x)=ln (x*1)
x= 0 0.6000 0.9000
Xi 0 0.4700 0.6400
0.6
0.5
0.4
y
0.3
0.2
0.1
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9
x
3) Use los polinomios interpolantes de Lagrange apropiados de grado tres para aproximar
lo siguiente:
16
14
12
10
y
0
8.1 8.2 8.3 8.4 8.5 8.6 8.7
x
D) INTERPOLACION CON EL METODO DEL POLINOMIO DE LAGRANGE
0.6
0.5
0.4
0.3
y
0.2
0.1
-0.1
-0.2
0.6 0.65 0.7 0.75 0.8 0.85 0.9 0.95 1
x
11) Use los siguientes valores y aritmtica de redondeo a cuatro dgitos para
construir una aproximacin del tercer polinomio de Lagrange a f( 1.09). La
tan
( x )
FUNCION QUE VA SE APRoximada es f(x) .Conociendo lo anterior,
log 10
0.36
0.34
0.32
0.3
0.28
y
0.26
0.24
0.22
0.2
0.18
1 1.05 1.1 1.15
x