Is a method that to search in each stage of the process of the gaussian elimination that the multiplier (Aik/Akk) be as small as possible, that is, to search to replace the largest element in the principal diagonal. Above mentioned to solve the problem of an element of diagonal near to 0 that to be in the simple gaussian elimination.
Next the row operations are enunciated again:
How the method works:
Basically, the method woks how the simple gaussian elimination with an operation more in each stage, search the largest element in the principal diagonal. Then, given a system of equations AX=b, where A represent the matrix of coefficients of size nxn, X the vector column of unknown quantity and b the vector of term independent terms; will proceed in the following way:
1. To get the matrix increase Ab of the system.
2. To search the largest element in absolute value of the first column and to exchange the line that to have it with the first line, otherwise that the first line has it.
3. To convert all elements under of A11 in zeros using the second operation introduce before. In the process to find a multiplier.
4. Again, to search the largest element in absolute value of the second column that to be in positions largest or equal to A22. Then, to exchange the line that contain that with the second line, otherwise that the second line has it.
5. To convert in zeros all elements under A22.
6. To do a similar process of the steps 2,3, 4 and 5 until to find a triangular superior matrix.
7. To find the value of the Xn term, with this value to find Xn-1 and like this with regressive substitution until get the X1 term.
Mean feature:
This method solves problems that can happen in the execution and the solution of the simple gaussian elimination. That is, this method doesn’t have problems in the execution when to find a zero in the principal diagonal, unless the elements below that number are also zeros, which indicates that the system hasn’t unique solution. Equally, the method reduces the rounding effect that occurs in the divisions with the numerator close to 0.
Pseudo-code
As in the method mentioned, A is the matrix of coefficients nxn, b is the vector of independent terms and K is the counter of the stages.
Function eliminacon gaussiana con pivoteop (A,b,n)
Ab=Matriz aumentada [Ab]
For k=1 to n-1 do
mayor=|Abkk|
FilaMayor=k
for s=k+1 to n
if |Absk|>mayor then
mayor=|Abs,k|
FilaMayor=s
end if
end for
if mayor==0
write(‘El Sistema tiene mas de una solucion’)
return
else
if FilaMayor ≠ k then
FilaK=Abk(1 to n+1)
FilaM=Ab(FilaMayor)(1 to n+1)
Abk(1 to n+1)=FilaM
Ab(FilaMayor)(1 to n+1)= FilaK
end if
end if
for i=k+1 to n do
multiplcador=Abij/Abkk
for j=k to n+1
Abij=Abij-multiplicador*Abkj
end for
end for
end for
Xn1=Abnn+1/Abnn
for i=n-1 to 1 step=-1 do
sumatoria=0
for p=i+1 to n
sumatoria=sumatoria+Abip*Xp1
end for
Xi1=(Abin+1- sumatotia)/Abii
end for
end function
Code
function [x]=eliminacion_gaussiana_con_pivoteop(A,b,n)
Ab=[A,b];
for k=1:n-1
mayor=abs(Ab(k,k)); %
FilaMayor=k;
for s=k+1:n
if abs(Ab(s,k))>mayor
mayor=(Ab(s,k));
FilaMayor=s;
end
end
if mayor==0
disp('El sistema tiene mas de una solucion')
return
else
if FilaMayor~=k
Filak=Ab(k,:);
FilaM=Ab(FilaMayor,:);
Ab(k,:)=FilaM;
Ab(FilaMayor,:)=Filak;
end
end %
for i=k+1:n
multiplicador=Ab(i,k)/Ab(k,k);
for j=k:n+1
Ab(i,j)=Ab(i,j)-multiplicador*Ab(k,j);
end
end
end
x(n,1)=(Ab(n,n+1))/(Ab(n,n)); %%
for i=n-1:-1:1
sumatoria=0;
for p=i+1:n
sumatoria=sumatoria + Ab(i,p)*x(p,1);
end
x(i,1)=(Ab(i,n+1)-sumatoria)/Ab(i,i);
end %%
end