0% found this document useful (0 votes)
16 views

Persamaan Linier Metode Jacobi

The document describes the Jacobi iterative method to solve a system of linear equations. It provides the equations to calculate values of x1 and x2 iteratively until the difference between successive iterations is less than a threshold value E. The code takes initial values of x1 and x2 as input, calculates updated values in each iteration and tracks the residuals until convergence is reached.

Uploaded by

Denny Paat
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Persamaan Linier Metode Jacobi

The document describes the Jacobi iterative method to solve a system of linear equations. It provides the equations to calculate values of x1 and x2 iteratively until the difference between successive iterations is less than a threshold value E. The code takes initial values of x1 and x2 as input, calculates updated values in each iteration and tracks the residuals until convergence is reached.

Uploaded by

Denny Paat
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Persamaan linier metode jacobi

uses crt;
const E=0.001;
var
R:real;
x1,x2:array[0..20] of real;
i,Y,j:integer;
procedure judul;
begin
textcolor(white);
writeln('====================================================================');
writeln(' iterasi | X1 = 1.6+0.4 X2 | X2 = 1.8-0.4 X1 | R= |(xi-x(i-1)/xi |');
writeln('--------------------------------------------------------------------');
end;
begin
clrscr;
Y:=7;
i:=1;
j:=1;
write('masukkan nilai X1 = ');readln(x1[i]);
write('masukkan nilai x2 = ');readln(x2[i]);
write; judul;
repeat
begin
x1[i]:=1.6+0.4*x2[i-1];
x2[i]:=1.8-0.4*x1[i-1];
r:=Abs((x1[i]-x1[i-1])/x1[i]);
gotoxy(1,Y);write('|',J);
gotoxy(12,Y);write('|',x1[i]:1:3);
gotoxy(31,Y);write('|',x2[i]:1:3);
gotoxy(50,Y);write('|',R:1:3);
J:=J+1;
Y:=Y+1;
i:=i+1;
end;
until R<=E;
gotoxy(1,Y+1);write('--------------------Menggunakan metode jacob-------------------------');
readln;
end.
Output metode jacobi

masukkan nilai X1 = 0
masukkan nilai x2 = 0
====================================================
iterasi | X1 = 1.6+0.4 X2 | X2 = 1.8-0.4 X1 | R=
----------------------------------------------------

|1 |1.600 |1.800 |1.000


|2 |2.320 |1.160 |0.310
|3 |2.064 |0.872 |0.124
|4 |1.949 |0.974 |0.059
|5 |1.990 |1.020 |0.021
|6 |2.008 |1.004 |0.009
|7 |2.002 |0.997 |0.003
|8 |1.999 |0.999 |0.001
|9 |2.000 |1.001 |0.001

--------------------Menggunakan metode jacob--------

You might also like