Se Cere de Elaborate Algoritm, Care Efectuiaza Produs Cartezian Dintre Grupoid (Q1, ) Si (Q2, O) Conform Regulei
Se Cere de Elaborate Algoritm, Care Efectuiaza Produs Cartezian Dintre Grupoid (Q1, ) Si (Q2, O) Conform Regulei
Procedure paramedial(gr:masiv);
var l,i,j,k,t:integer;
begin
l:=0;
for i:=1 to n do
for j:=1 to n do
for k:=1 to n do
for t:=1 to n do
begin
d:=gr[i,j];
r:=gr[k,t];
d1:=gr[t,j];
r1:=gr[k,i];
if gr[d,r]<>gr[d1,r1] then inc(l);end;
if l=0 then writeln('este paramedial') else
writeln('nu este paramedial');end;
Procedure bicomutativ(gr:masiv);
var l,i,j,k,t:integer;
begin
l:=0;
for i:=1 to n do
for j:=1 to n do
for k:=1 to n do
for t:=1 to n do
begin
d:=gr[i,j];
r:=gr[k,t];
d1:=gr[t,k];
r1:=gr[j,i];
if gr[d,r]<>gr[d1,r1] then inc(l);end;
if l=0 then writeln('este bicomutativ') else
writeln('nu este bicomutativ')end;
Procedure AG_grupoid(gr:masiv);
var l,i,j,k,t:integer;
begin
l:=0;
for i:=1 to n do
for j:=1 to n do
for k:=1 to n do
begin
d:=gr[i,j];
d1:=gr[k,j];
if gr[d,k]<>gr[d1,i] then inc(l);end;
if l=0 then writeln('este AG grupoid') else
writeln('nu este AG grupoid'); end;
Procedure GA_grupoid(gr:masiv);
var l,i,j,k,t:integer;
begin
l:=0;
for i:=1 to n do
for j:=1 to n do
for k:=1 to n do
begin
d:=gr[i,j];
d1:=gr[j,i];
if gr[d,k]<>gr[k,d1] then inc(l);end;
if l=0 then writeln('este GA grupoid') else
writeln('nu este GA grupoid');end;
Procedure AD_grupoid(gr:masiv);
var l,i,j,k,t:integer;
begin
l:=0;
for i:=1 to n do
for j:=1 to n do
for k:=1 to n do
begin
d:=gr[i,j];
if gr[d,k]<>gr[k,d] then inc(l);end;
if l=0 then writeln('este AD grupoid') else
writeln('nu este AD grupoid');end;
Procedure DA_grupoid(gr:masiv);
var l,i,j,k,t:integer;
begin
l:=0;
for i:=1 to n do
for j:=1 to n do
for k:=1 to n do
begin
d:=gr[j,k];
d1:=gr[j,i];
if gr[i,d]<>gr[k,d1] then inc(l);end;
if l=0 then writeln('este DA grupoid') else
writeln('nu este DA grupoid');end;
Procedure hexagonal(gr:masiv);
var l,i,j,k,t:integer;
begin
l:=0;
for i:=1 to n do
for j:=1 to n do
for k:=1 to n do
for t:=1 to n do
begin
d:=gr[i,j];
r:=gr[k,t];
d1:=gr[i,k];
r1:=gr[j,t];
if (gr[d,r]<>gr[d1,r1]) or (gr[i,i]<>i)
then inc( l);end;
if l=0 then writeln('este hexagonal') else
writeln('nu este hexagonal');end;
Procedure dist_dreapta(gr:masiv);
var l,i,j,k,t:integer;
begin
l:=0;
for i:=1 to n do
for j:=1 to n do
for k:=1 to n do
begin
d:=gr[i,j];
d1:=gr[i,k];
r1:=gr[j,k];
if gr[d,k]<>gr[d1,r1] then inc(l);end;
if l=0 then writeln('este distributiv la dreapta') else
writeln('nu este distributiv la dreapta');end;
Procedure dist_stinga(gr:masiv);
var l,i,j,k,t:integer;
begin
l:=0;
for i:=1 to n do
for j:=1 to n do
for k:=1 to n do
begin
d:=gr[i,j];
d1:=gr[k,i];
r1:=gr[k,j];
if gr[k,d]<>gr[d1,r1] then inc(l);end;
if l=0 then writeln('este distributiv la stinga') else
writeln('nu este distributiv la stinga');end;
Procedure unitate_dreapta(gr:masiv);
var l,i,j,k,t:integer;
begin
j:=0;
r:=0;
for i:=1 to n do begin
l:=0;
inc(j);
if gr[j,i]=i then begin
for k:=1 to n do begin
if gr[k,j]=k then inc(l);
if l=n then r:=j;end;end;end;
if r<>0 then writeln('Este unitate de dreapta ', r) else
writeln('Nu este unitate de dreapta'); end;
Procedure unitate_stanga(gr:masiv);
var l,i,j,k,t:integer;
begin
j:=0;
r2:=0;
for i:=1 to n do begin
l:=0;
inc(j);
if gr[i,j]=i then begin
for k:=1 to n do begin
if gr[j,k]=k then inc(l);
if l=n then r2:=j;
end;end;end;
if r2<>0 then writeln('Este unitate de stanga ', r2) else
writeln('Nu este unitate de stanga');
end;
Procedure unitate;
begin
if (r=r2) and (r>0) then writeln('Este unitate ',r) else
writeln('Nu este unitate');
end;
procedure Afisare;
var i,j:integer;
Begin
for i:=1 to n do
begin
writeln;
for j:=1 to n do
begin
write(a[i,j],' '); end; end;
writeln;
writeln;
for i:=1 to m do
begin
writeln;
for j:=1 to m do
begin
write(b[i,j],' ');
end;end;
writeln;
writeln;end;
BEGIN
clrscr;
write('dati n=');
readln(n);
for i:=1 to n do
for j:=1 to n do
begin
write('a[',i,',',j,']=');
readln(a[i,j]);
end;
writeln;
write('dati m=' );
readln(m);
for i:=1 to m do
for j:=1 to m do
begin
write('b[',i,',',j,']=');
readln(b[i,j]);
end;
writeln('afisare grupoid Q1 si Q2');
readkey;
afisare;
readkey;
writeln('afisare produs cartezian');
produs_cartez(rez);
for i:=1 to n*m do
begin
for j:=1 to n*m do
begin
write(rez[i,j],' ');end;
writeln;end;
writeln;
writeln;
readkey;
writeln('grupoidul rezultat verifica urmatoarele proprietati:');
writeln;
n:=n*m;
medial(rez);
paramedial(rez);
asociativ(rez);
AG_grupoid(rez);
GA_grupoid(rez);
AD_grupoid(rez);
DA_grupoid(rez);
bicomutativ(rez);
hexagonal(rez);
dist_dreapta(rez);
dist_stinga(rez);
unitate_dreapta(rez);
unitate_stanga(rez);
unitate;
readkey;end.
Ex 1 dati n=2
a[1,1]=1
a[1,2]=2
a[2,1]=2
a[2,2]=1
dati m=3
b[1,1]=1
b[1,2]=2
b[1,3]=3
b[2,1]=3
b[2,2]=1
b[2,3]=2
b[3,1]=2
b[3,2]=3
b[3,3]=1
afisare grupoid Q1 si Q2
1 2
2 1
1 2 3
3 1 2
2 3 1
afisare produs cartezian
1 2 3 4 5 6
3 1 2 6 4 5
2 3 1 5 6 4
4 5 6 1 2 3
6 4 5 3 1 2
5 6 4 2 3 1
grupoidul rezultat verifica urmatoarele proprietati:
este medial
este paramedial
nu este asociativ
este AG grupoid
nu este GA grupoid
nu este AD grupoid
nu este DA grupoid
este bicomutativ
nu este hexagonal
nu este distributiv la dreapta
nu este distributiv la stinga
Nu este unitate de dreapta
Este unitate de stanga 1
Nu este unitate
Ex 2 dati n=4
a[1,1]=2
a[1,2]=3
a[1,3]=1
a[1,4]=4
a[2,1]=4
a[2,2]=1
a[2,3]=3
a[2,4]=2
a[3,1]=3
a[3,2]=2
a[3,3]=4
a[3,4]=1
a[4,1]=1
a[4,2]=4
a[4,3]=2
a[4,4]=3
dati m=7
b[1,1]=1
b[1,2]=4
b[1,3]=7
b[1,4]=3
b[1,5]=6
b[1,6]=2
b[1,7]=5
b[2,1]=6
b[2,2]=2
b[2,3]=5
b[2,4]=1
b[2,5]=4
b[2,6]=7
b[2,7]=3
b[3,1]=4
b[3,2]=7
b[3,3]=3
b[3,4]=6
b[3,5]=2
b[3,6]=5
b[3,7]=1
b[4,1]=2
b[4,2]=5
b[4,3]=1
b[4,4]=4
b[4,5]=7
b[4,6]=3
b[4,7]=6
b[5,1]=7
b[5,2]=3
b[5,3]=6
b[5,4]=2
b[5,5]=5
b[5,6]=1
b[5,7]=4
b[6,1]=5
b[6,2]=1
b[6,3]=4
b[6,4]=7
b[6,5]=3
b[6,6]=6
b[6,7]=2
b[7,1]=3
b[7,2]=6
b[7,3]=2
b[7,4]=5
b[7,5]=1
b[7,6]=4
b[7,7]=7
afisare grupoid Q1 si Q2
2 3 1 4
4 1 3 2
3 2 4 1
1 4 2 3
1 4 7 3 6 2 5
6 2 5 1 4 7 3
4 7 3 6 2 5 1
2 5 1 4 7 3 6
7 3 6 2 5 1 4
5 1 4 7 3 6 2
3 6 2 5 1 4 7
Ex 3
dati n=4
a[1,1]=1
a[1,2]=2
a[1,3]=4
a[1,4]=3
a[2,1]=2
a[2,2]=3
a[2,3]=1
a[2,4]=4
a[3,1]=4
a[3,2]=1
a[3,3]=3
a[3,4]=2
a[4,1]=3
a[4,2]=4
a[4,3]=2
a[4,4]=1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 3 6 2 5
6 2 5 1 4 7 3
4 7 3 6 2 5 1
2 5 1 4 7 3 6
7 3 6 2 5 1 4
5 1 4 7 3 6 2
3 6 2 5 1 4 7
1 2 3
3 1 2
2 3 1
afisare produs cartezian
1 2 3 10 11 12 19 20 21 7 8 9 16 17 18 4 5 6 13 14 15
3 1 2 12 10 11 21 19 20 9 7 8 18 16 17 6 4 5 15 13 14
2 3 1 11 12 10 20 21 19 8 9 7 17 18 16 5 6 4 14 15 13
16 17 18 4 5 6 13 14 15 1 2 3 10 11 12 19 20 21 7 8 9
18 16 17 6 4 5 15 13 14 3 1 2 12 10 11 21 19 20 9 7 8
17 18 16 5 6 4 14 15 13 2 3 1 11 12 10 20 21 19 8 9 7
10 11 12 19 20 21 7 8 9 16 17 18 4 5 6 13 14 15 1 2 3
12 10 11 21 19 20 9 7 8 18 16 17 6 4 5 15 13 14 3 1 2
11 12 10 20 21 19 8 9 7 17 18 16 5 6 4 14 15 13 2 3 1
4 5 6 13 14 15 1 2 3 10 11 12 19 20 21 7 8 9 16 17 18
6 4 5 15 13 14 3 1 2 12 10 11 21 19 20 9 7 8 18 16 17
5 6 4 14 15 13 2 3 1 11 12 10 20 21 19 8 9 7 17 18 16
19 20 21 7 8 9 16 17 18 4 5 6 13 14 15 1 2 3 10 11 12
21 19 20 9 7 8 18 16 17 6 4 5 15 13 14 3 1 2 12 10 11
20 21 19 8 9 7 17 18 16 5 6 4 14 15 13 2 3 1 11 12 10
13 14 15 1 2 3 10 11 12 19 20 21 7 8 9 16 17 18 4 5 6
15 13 14 3 1 2 12 10 11 21 19 20 9 7 8 18 16 17 6 4 5
14 15 13 2 3 1 11 12 10 20 21 19 8 9 7 17 18 16 5 6 4
7 8 9 16 17 18 4 5 6 13 14 15 1 2 3 10 11 12 19 20 21
9 7 8 18 16 17 6 4 5 15 13 14 3 1 2 12 10 11 21 19 20
8 9 7 17 18 16 5 6 4 14 15 13 2 3 1 11 12 10 20 21 19
dati m=4
b[1,1]=1
b[1,2]=4
b[1,3]=2
b[1,4]=3
b[2,1]=3
b[2,2]=2
b[2,3]=4
b[2,4]=1
b[3,1]=4
b[3,2]=1
b[3,3]=3
b[3,4]=2
b[4,1]=2
b[4,2]=3
b[4,3]=1
b[4,4]=4
afisare grupoid Q1 si Q2
2 1 3 4
3 4 2 1
4 3 1 2
1 2 4 3
1 4 2 3
3 2 4 1
4 1 3 2
2 3 1 4
afisare produs cartezian
5 8 6 7 1 4 2 3 9 12 10 11 13 16 14 15
7 6 8 5 3 2 4 1 11 10 12 9 15 14 16 13
8 5 7 6 4 1 3 2 12 9 11 10 16 13 15 14
6 7 5 8 2 3 1 4 10 11 9 12 14 15 13 16
9 12 10 11 13 16 14 15 5 8 6 7 1 4 2 3
11 10 12 9 15 14 16 13 7 6 8 5 3 2 4 1
12 9 11 10 16 13 15 14 8 5 7 6 4 1 3 2
10 11 9 12 14 15 13 16 6 7 5 8 2 3 1 4
13 16 14 15 9 12 10 11 1 4 2 3 5 8 6 7
15 14 16 13 11 10 12 9 3 2 4 1 7 6 8 5
16 13 15 14 12 9 11 10 4 1 3 2 8 5 7 6
14 15 13 16 10 11 9 12 2 3 1 4 6 7 5 8
1 4 2 3 5 8 6 7 13 16 14 15 9 12 10 11
3 2 4 1 7 6 8 5 15 14 16 13 11 10 12 9
4 1 3 2 8 5 7 6 16 13 15 14 12 9 11 10
2 3 1 4 6 7 5 8 14 15 13 16 10 11 9 12
Ex 7
dati n=4
a[1,1]=1
a[1,2]=4
a[1,3]=2
a[1,4]=3
a[2,1]=3
a[2,2]=2
a[2,3]=4
a[2,4]=1
a[3,1]=4
a[3,2]=1
a[3,3]=3
a[3,4]=2
a[4,1]=2
a[4,2]=3
a[4,3]=1
a[4,4]=4
dati m=4
b[1,1]=2
b[1,2]=1
b[1,3]=3
b[1,4]=4
b[2,1]=3
b[2,2]=4
b[2,3]=2
b[2,4]=1
b[3,1]=4
b[3,2]=3
b[3,3]=1
b[3,4]=2
b[4,1]=1
b[4,2]=2
b[4,3]=4
b[4,4]=3
afisare grupoid Q1 si Q2
1 4 2 3
3 2 4 1
4 1 3 2
2 3 1 4
2 1 3 4
3 4 2 1
4 3 1 2
1 2 4 3
1 2 3 4 5 6 7
asociativ - - - - - - -
medial + - - - + - -
paramedial + - - - - - -
bicomutati + - + - - - -
v
AG-grupoid + - - - - - -
GA-grupoid - - - - - - -
AD-grupoid - - - - - - -
DA-grupoid - - - - - - -
Distr de - - - - - - -
dreapta
Distr de - - - - - - -
stinga
Hexagonal - - - - - - -
Unitate - - - - - - -
dreapta
Unitate - - - - - - -
Stinga
Unitate - - - - - - -