Está en la página 1de 6

14 DE FEBRERO 2020

UNIVERSIDAD AUTÓNOMA DE COAHUILA


FACULTAD DE CIENCIAS QUÍMICAS

LABORATORIO DE MÉTODOS NUMÉRICOS


PROFESOR: EFRAÍN VIESCA VILLANUEVA.

Javier Enrique Mancillas Rojas


Matrícula: 18280853
Ingeniería Química, 4to Semestre
Semestre Enero-Junio 2020
14 DE FEBRERO 2020
MÉTODO DE GAUSS-SEIDEL
4 x1 + x2 − x3 = 6
2 x1 + 5 x2 + 2 x3 = 3
x1 + 2 x2 + 4 x3 = 11
 POLYMATH:
Linear Equations Solution
Variable Value
1 x1 2.627119
2 x2 -1.610169
3 x3 2.898305
 EXCEL:
SISTEMA DESPEJES
4X1 + X2 - X3 = 6  X1=(6-X2+X3)/4
2X1 + 5X2 + 2X3 = 3  X2=(3-2X1-2X3)/5
X1 + 2X2 + 4X3 = 11  X3=(11-X1-2X2)/4

i 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
x1 0 1.500 2.038 2.294 2.459 2.5332.579 2.601 2.613 2.620 2.623 2.625 2.626 2.627 2.627 2.627 2.627
- - - - - - - - -
x2 0 0.600 -1.100 -1.045 -1.434 -1.463 -1.554 1.571 1.593 1.599 1.605 1.607 1.609 1.609 1.610 1.610 -1.610
x3 0 2.750 2.075 2.791 2.699 2.852 2.848 2.882 2.885 2.893 2.895 2.897 2.897 2.898 2.898 2.898 2.898
 3.189 1.906 0.762 0.432 0.173 0.102 0.044 0.026 0.012 0.007 0.003 0.002 0.001 0.001 0.000 0.0001

 MATLAB:

% METODO ITERATIVO DE GAUSS SEIDEL


clc %permite borrar el area de trabajo
clear %permite borrar las variables almacenadas
format long %permite utilizar la maxima capacidad de la maquina
fprintf('METODO ITERATIVO DE GAUSS SEIDEL\n\n\n')
%fprintf me permite ingresar comentarios de manera textual que pueden
%orientar al usuario en el uso del programa
%input es un comando de solicitud de entrada de datos del usuario.
a=input('Ingrese la matriz de coeficientes:\n ');
b=input('\nIngrese los términos independientes:\n ');
x=input('\nIngrese el vector con las aproximacimaciones Iniciales:\n ');
iter=input('\nIngrese el número máximo de iteraciones:\n ');
tol=input('\nIngrese la tolerancia:\n ');
k=norm(a)*norm(a^-1);%Se calcula el condicional de la matriz de coeficientes
disp('condicional=')
disp(k)
% la funcion disp nos permite imprimir una variable en el espacio de trabajo
determinante=det(a);%se calcula el determinante de la matriz de coeficientes
if determinante==0
disp('El determinante es cero, el problema no tiene solución única')
end
n=length(b); %numero de elementos del vector b
d=diag(diag(a)); %obtencion de la matriz diagonal
l=d-tril(a); %obtencion de la matriz diagonal superior L
u=d-triu(a); %obtencion de la matriz diagonal inferior u
fprintf('\n SOLUCION:\n')
14 DE FEBRERO 2020
fprintf('\nLa matriz de transicion de gauss seidel:\n')
T=((d-l)^-1)*u; % matriz de transicion de gauss
disp(T)
re=max(abs(eig(T))) %calculo del radio espectral
if re>1
disp('Radio Espectral mayor que 1')
disp('el método no converge')
return
end
fprintf('\nEl vector constante es::\n')
C=((d-l)^-1)*b; % vector constante C, para el metodo
disp(C)
i=0;
err=tol+1;
z=[i,x(1),x(2),x(3),err]; %vector que me permite graficar la tabla while err>tol &
i<iter
xi=T*x+C;
%disp(xi)
i=i+1;
err=norm(xi-x); %norma 2
%err=max(abs(xi-x)); %norma 1
%err=norm(xi-x)/norm(xi); %norma relativa
x=xi;
z(i,1)=i;
z(i,2)=x(1);
z(i,3)=x(2);
z(i,4)=x(3);
z(i,5)=err;
end
fprintf('\nTABLA:\n\n n x1 x2 x3 Error\n\n ')
disp(z) %impresion de la tabla.
14 DE FEBRERO 2020
MÉTODO DE LA MATRIZ INVERSA
4 x1 + x2 − x3 = 6
2 x1 + 5 x2 + 2 x3 = 3
x1 + 2 x2 + 4 x3 = 11
 POLYMATH:
Linear Equations Solution
Variable Value
1 x1 2.627119
2 x2 -1.610169
3 x3 2.898305

 EXCEL:
14 DE FEBRERO 2020
MÉTODO DE D.G.O.
5a + 6b − 2c + 2d = 1
6a − 5b − 2c + 2d = 0
−2𝑎 − 2𝑏 + 3𝑐 − 𝑑 = 0
−2𝑎 + 2𝑏 − 𝑐 − 3𝑑 = 0
 POLYMATH:
Linear Equations Solution
Variable Value
1 x1 0.1715976
2 x2 0.1065089
3 x3 0.1538462
4 x4 -0.0946746

 EXCEL:

5 6 -2 2 1 X4 X3 X2 X1 I
6 -5 -2 2 0 338 -32  X4= -0.27118644
-2 -2 3 -1 0 13 -135 -22  X3= 0.15384615
-2 2 -1 -3 0 -61 2 -2 -6  X2= 0.10650888
-61 2 -2 -6 5 6 -2 2 1  X1= 0.17159763
2 11 -1 2
22 -9 -11 2
-135 13 -22
101 143 2
338 -32
14 DE FEBRERO 2020
MÉTODO DE PUNTO FIJO MULTIVARIABLE
 EXCEL

𝑓1 𝑥, 𝑦 = 𝑥 2 − 10𝑥 + 𝑦 2 + 8 = 0  𝑔1 𝑥, 𝑦 = 𝑥 =
𝑥 2 +𝑦2 +8 CRITERIO DE CONVERGENCIA
10
2 𝑥𝑦 2 +𝑥+8 𝑥 𝑦2 + 1 1 1
𝑓2 𝑥, 𝑦 = 𝑥𝑦 − 10𝑦 + 𝑥 + 8 = 0  𝑔2 𝑥, 𝑦 = 𝑦 = + =0+ = <1
10 5 0,0 10 0,0
10 10
𝟐 𝑦 𝑥𝑦
𝛛𝐠 𝟏 𝐱 𝛛𝐠 𝟐 𝐲 + 𝟏 𝛛𝐠 𝟏 𝐲 𝛛𝐠 𝟐 𝐱𝐲
= − = − = − = + =0+0=0<1
𝛛𝐱 𝟓 𝛛𝐱 𝟏𝟎 𝛛𝐲 𝟓 𝛛𝐲 𝟓 5 0,0 5 0,0

i xi yi error
0 0 0 ~
1 0.8 0.88 1.1892855
2 0.94144 0.97699072 0.17150065
3 0.98408201 0.9945521 0.04611663
4 0.99575513 0.99860855 0.01235785
5 0.99887473 0.99963596 0.00328443
6 0.99970228 0.99990406 0.00086989
7 0.99992128 0.99997466 0.0002301
8 0.99997919 0.9999933 6.0837E-05
9 0.9999945 0.99999823 1.6083E-05

También podría gustarte