Cari
×

Daftarkan diri

Use your Facebook account for quick registration

OR

Create a Shvoong account from scratch

Already a Member? Masuk!
×

Masuk

Sign in using your Facebook account

OR

Not a Member? Daftarkan diri!
×

Daftarkan diri

Use your Facebook account for quick registration

OR

Masuk

Sign in using your Facebook account

Halaman Utama Shvoong>Sains>Matematika>Program pascal matriks

Program pascal matriks

oleh: goldeoz    
ª
 
MODUL PRAKTIKUM
TOPIK : ARRAY 2 DIMENSI (MATRIKS)

1. Mengentrikan dan menampilkan matriks sebarang

program hitung_matriks_sebarang;
type matriks = array[1..10,1..10] of integer;
var A,B : matriks;
k,j,bar,kol : integer;
begin
write('Tentukan ordo matriks (baris kolom) : '); readln(bar,kol);
{ mengentrikan matriks }
For j:=1 to kol do
begin
write('Entri kolom ke ',j,' matriks A :(Tekan enter setelah entri satu bil)');
For k:= 1 to bar do readln(A[k,j]);
end;
{ Menampilkan matriks }
For k:=1 to bar do
begin
For j:=1 to kol do write(A[k,j]:5);
writeln;
end;
end.

2. Teruskan program di atas dengan mengentrikan dan menampilkan matriks B, kemudian tampilkan matriks A+B
3. Menghitung Determinan matriks 2x2
program determinan;
var A : array[1..2,1..2] of integer;
j,k,D : integer;
begin
For j:=1 to 2 do
begin
write('Entrikan baris ',j,' matriks A : ');
readln(A[j,1] , A[j,2]);
end;
For j:=1 to 2 do
begin
For k:=1 to 2 do write(A[j,k] : 5);
writeln;
end;
writeln;writeln;writeln;
D := A[1,1]*A[2,2] - A[1,2]*A[2,1];
writeln('Det(A) = ',D);
end.

4. Tambahkan Program di atas dengan program Perkalian Matriks 2x2
For j:=1 to 2 do
For k:=1 to 2 do
For i:=1 to 2 do C[i,k] := C[i,k] + A[i,j]*B[j,k];

For j:=1 to 2 do
begin
For k:=1 to 2 do write(C[j,k] : 5);
writeln;
end;
end.

5. Dua langkah Operasi Baris Elementer (optional)
program matriks2;
var A : array[1..3,1..3] of real;
j,k : integer;
p1,p2 : real;
begin
For j:=1 to 3 do
begin
write('input baris ',j,' matriks A : ');
readln(A[j,1],A[j,2],A[j,3]);
end;
writeln;writeln;writeln;
For j:=1 to 3 do
begin
For k:=1 to 3 do write(A[j,k]:6:1);
writeln;
end;
writeln;writeln;
If (A[2,1] <> 0) and (A[3,1] <> 0) Then
begin
p1 := A[2,1] / A[1,1];
For k:=1 to 3 do A[2,k] := A[2,k] - p1*A[1,k];
p2 := A[3,1] / A[1,1];
For k:=1 to 3 do A[3,k] := A[3,k] - p2*A[1,k];
end;
For j:=1 to 3 do
begin
For k:=1 to 3 do write(A[j,k]:6:1);
writeln;
end;
readln;
end.

Tugas
1. Buat program untuk menghitung transpos dari matriks sebarang
2. Buat program untuk menghitung perkalian matriks 3x3
3. Buat program untuk menghitung determinan matriks dengan metode ekspansi kofaktor sepanjang baris

Diterbitkan di: 04 Maret, 2011   
Mohon dinilai : 1 2 3 4 5
Terjemahkan Kirim Link Cetak
X

.