Misalkan A dan B adalah dua matriks yang berordo 2
× 2 dan memenuhi
persamaan
AB = BA = I2 maka matriks A adalah matriks invers dari
matriks
B atau matriks B adalah matriks invers dari
matriks A.
Contoh Program + Scripnnya :
program matriks_ordo;
uses wincrt;
var
a,b,c,d,i:real;
invers,p,q,r,s:real;
jawab:char;
begin
clrscr;
gotoxy(10,18);
writeln('-----------------------Invers Matriks Ordo 2x2---------------------');
gotoxy(10,5);write('A=');read(a);
gotoxy(18,5);write('B=');read(b);
gotoxy(10,7);write('C=');read(c);
gotoxy(18,7);write('D=');read(d);
i:=(a*d)-(b*c);
if not(i=0) then
begin
invers:=1/((a*d)-(b*c));
p:=d*invers;
q:=-b*invers;
r:=-c*invers;
s:=a*invers;
gotoxy(25,10);writeln('Invers matriks A =');
gotoxy(10,13);write(p:0:3);
gotoxy(18,13);write(q:0:3);
gotoxy(10,16);write(r:0:3);
gotoxy(18,16);write(s:0:3);
end
else
begin
gotoxy(15,5);
writeln('Tidak ada invers matriks');
end;
gotoxy(10,18);
writeln('-------------------------Terimakasih---------------------');
jawab:=readkey;
end.
uses wincrt;
var
a,b,c,d,i:real;
invers,p,q,r,s:real;
jawab:char;
begin
clrscr;
gotoxy(10,18);
writeln('-----------------------Invers Matriks Ordo 2x2---------------------');
gotoxy(10,5);write('A=');read(a);
gotoxy(18,5);write('B=');read(b);
gotoxy(10,7);write('C=');read(c);
gotoxy(18,7);write('D=');read(d);
i:=(a*d)-(b*c);
if not(i=0) then
begin
invers:=1/((a*d)-(b*c));
p:=d*invers;
q:=-b*invers;
r:=-c*invers;
s:=a*invers;
gotoxy(25,10);writeln('Invers matriks A =');
gotoxy(10,13);write(p:0:3);
gotoxy(18,13);write(q:0:3);
gotoxy(10,16);write(r:0:3);
gotoxy(18,16);write(s:0:3);
end
else
begin
gotoxy(15,5);
writeln('Tidak ada invers matriks');
end;
gotoxy(10,18);
writeln('-------------------------Terimakasih---------------------');
jawab:=readkey;
end.
COntoh Aplikasinya :
Created By: M. Alif Romadhoni
jujur saya bingung -,-
BalasHapusga ngerti.
BalasHapusKomentar ini telah dihapus oleh pengarang.
BalasHapusAmpun Guruu... Dosen Kasi tugas buat program Matrix ordo 2x2 x_x . uda lupa betol2 ane.
BalasHapusitu aplikasii buat programnya pake apa.....bales gan..?
BalasHapusKo ga ada adjoinsih ??
BalasHapusAdjoin paling mudah ya gan, yuk kunjungi blog ane yg mau tau android
BalasHapusAndroid App
pke aplikasi program TPW -_-
BalasHapusgajelas
BalasHapus#include
BalasHapus#include
#include
main(){
//ini untuk bahasa c
float m[3][3];
int x,y;
float det,temp;
system("cls");
//input matriks
for(x=1;x<=2;x++){
for(y=1;y<=2;y++){
printf("Masukan nilai baris ke-%i kolom ke-%i : ",x,y);
scanf("%f",&m[x][y]);
system("cls");
}
}
//perhitungan determinan
det = (m[1][1]*m[2][2])-(m[1][2]*m[2][1]);
if(det==0){
printf("Matriks tidak memiliki invers...!!!");
getch();
return 0;
}
//mencetak matriks awal
printf("Matriks awal\n");
for(x=1;x<=2;x++){
printf("| ");
for(y=1;y<=2;y++){
printf("%0.2f ",m[x][y]);
}
printf("|\n");
}
//pertukaran posisi determinan
temp=m[1][1];
m[1][1]=m[2][2];
m[2][2]=temp;
//perkalian determinan
for(x=1;x<=2;x++){
for(y=1;y<=2;y++){
if(x!=y){
m[x][y]=m[x][y]/(-det);
}
else{
m[x][y]=m[x][y]/det;
}
}
}
//pencetakan matriks
printf("\nMatriks invers\n");
for(x=1;x<=2;x++){
printf("| ");
for(y=1;y<=2;y++){
printf("%0.2f ",m[x][y]);
}
printf("|\n");
}
}
Prett
BalasHapusPrett
BalasHapusdi luar topik -_-
BalasHapus