0% found this document useful (0 votes)
26 views2 pages

Var X: Vector

The document describes a procedure for Gaussian elimination to solve systems of linear equations. The procedure takes a matrix A, vector b, and solves for vector x. It performs the steps of Gaussian elimination by pivoting, calculating multipliers, and updating the matrix and vector during each iteration to obtain an upper triangular system that can be solved back-substitution to find x. The code sample demonstrates calling the procedure to solve a system based on user input values for A and b.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views2 pages

Var X: Vector

The document describes a procedure for Gaussian elimination to solve systems of linear equations. The procedure takes a matrix A, vector b, and solves for vector x. It performs the steps of Gaussian elimination by pivoting, calculating multipliers, and updating the matrix and vector during each iteration to obtain an upper triangular system that can be solved back-substitution to find x. The code sample demonstrates calling the procedure to solve a system based on user input values for A and b.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Program Solusi GAUSS6;

Type
Matrix = Array [1..7,1..7] of Real;
Vector = Array [1..7] of Real;

Var
iarg : integer;
i,j,k,neq : integer;
A : Matrix;
b,x : Vector;

Procedure EGauss(n: Integer;


A: Matrix;
Var x: Vector; kalo ada Var (memberi juga meminta)
b: Vector); tidak ada var (memberi nilai)

Var
PIVOT,MULT,TOP : Real;
i,j,k : Integer;

Begin
For j := 1 to n-1 do
Begin
PIVOT := A[j,j];
For i := j+1 to n do
Begin
MULT := A[i,j]/PIVOT;
For k := j+1 to n do
A[i,k] := A[i,k] - MULT*A[j,k];
b[i] := b[i] - MULT*b[j];
End;
End;

x[n] := b[n]/A[n,n];
For i := n-1 downto 1 do
Begin
TOP := b[i];
For k := i+1 to n do TOP := TOP - A[i,k]*x[k];
x[i] := TOP/A[i,i];
End;
End;

Begin
Write('jumlah Pers.:'); Readln(neq);
For i := 1 to neq do
Begin
For j := 1 to neq do
Begin
Write('A(',i,',',j,'):');
Readln(A[i,j]);
End;
Write('b(',i,')=');
Readln(b[i]);
End;
EGauss(neq,A,x,b);
{Pemaparan Hasil Perhitungan}
For i := 1 to neq do
Writeln('x(',i,')=',x[i]);
End.

You might also like