Восьмиэлементные ассоциативные кольца
Дипломная работа - Педагогика
Другие дипломы по предмету Педагогика
;
end;
for i1:=0 to 7 do begin
for i2:=0 to 7 do write(f2,a[i1,i2],' ');
writeln(f2);
end;
writeln(f2);
reset(f1);
rewrite(f);
d:=1;
while d<=p do begin
for i1:=1 to 8 do begin
for i2:=1 to 8 do read(f1,y[i1,i2]);
readln(f1);
end;
for i1:=1 to 8 do begin
for i2:=1 to 8 do write(f,y[i1,i2],' ');
writeln(f);
end;
writeln(f);
readln(f1);
inc(d);
end;
{readln(f1);
writeln(f);
inc(n);
end;}
close(f);
close(f1);
close(f2);
writeln('ok');
readln;
end.
2. Текст программы поиска колец, имеющих аддитивную группу .
Программа 1. Нахождение всех базисов данной аддитивной группы:
program basis;
uses crt;
type mas=array [1..3] of integer;
var a,b,c,d,e,f,g:char;
i,j,n,k:integer;
x:mas;
f1,f2:text;
begin
assign(f2,'a:\28.txt');
reset(f2);
assign(f1,'a:\new168.txt');
rewrite(f1);
n:=1;
while n<=28 do begin
for i:=1 to 3 do read(f2,x[i]);
write(f1,x[1],' ',x[2],' ',x[3]);
writeln(f1);
write(f1,x[1],' ',x[3],' ',x[2]);
writeln(f1);
write(f1,x[3],' ',x[1],' ',x[3]);
writeln(f1);
write(f1,x[3],' ',x[2],' ',x[1]);
writeln(f1);
write(f1,x[2],' ',x[3],' ',x[1]);
writeln(f1);
write(f1,x[2],' ',x[1],' ',x[3]);
writeln(f1);
readln(f2);
writeln(f1);
inc(n);
end;
close(f2);
close(f1);
writeln('ok');
readln;
end.
Программа 2. Формирование полугрупп, с учетом ассоциативности:
program assZ2;
uses crt;
type mas=array [0..7,0..7] of integer;
var a,a1:mas;
i1,i2,i3,i4,i5,i6,i7,i8,i9,k1,k2,k3,r:integer;
n:real;
f,f1:text;
procedure sc(var a1:mas);
var i,j:integer;
begin
assign(f1,'a:\z2summ.txt');
reset(f1);
for i:=0 to 7 do begin
for j:=0 to 7 do read(f1,a1[i,j]);
readln(f1);
end;
close(f1);
end;
procedure zap(i1,i2,i3,i4,i5,i6,i7,i8,i9:integer;a1:mas; var r:integer);
var i,j,t1,t2,t3,t4,q:integer;
begin
q:=0;
for t1:=0 to 7 do a[0,t1]:=0;
for t2:=1 to 7 do a[t2,0]:=0;
a[1,1]:=i1; a[1,2]:=i2; a[1,3]:=i3;
a[2,1]:=i4; a[2,2]:=i5; a[2,3]:=i6;
a[3,1]:=i7; a[3,2]:=i8; a[3,3]:=i9;
for t3:=1 to 3 do begin
a[t3,4]:=a1[a[t3,1],a[t3,2]];
a[t3,5]:=a1[a[t3,1],a[t3,3]];
a[t3,6]:=a1[a[t3,2],a[t3,3]];
a[t3,7]:=a1[a[t3,1],a[t3,6]];
end;
for t4:=1 to 7 do begin
a[4,t4]:=a1[a[1,t4],a[2,t4]];
a[5,t4]:=a1[a[1,t4],a[3,t4]];
a[6,t4]:=a1[a[2,t4],a[3,t4]];
a[7,t4]:=a1[a[1,t4],a[6,t4]];
end;
{for i:=0 to 7 do begin
for j:=0 to 7 do write(a[i,j],' ');
writeln;
end;}
for k1:=0 to 7 do
for k2:=0 to 7 do
for k3:=0 to 7 do
if a[k1,a[k2,k3]]<>a[a[k1,k2],k3] then q:=1;
{writeln(q);}
if q=0 then begin
inc(r);
{for i:=0 to 2 do begin
for j:=0 to 2 do write(f,a[i,j],' ');
writeln(f);
end;
writeln(f);
end;
q:=0;}
end;
end;
begin
clrscr;
r:=0;
sc(a1);
assign(f,'a:\z2.txt');
rewrite(f);
{ i1:=6;i2:=6;i3:=6;i4:=6;i5:=6;i6:=6;i7:=6;i8:=6;i9:=6;}
for i1:=0 to 7 do
for i2:=0 to 7 do
for i3:=0 to 7 do
for i4:=0 to 7 do
for i5:=0 to 7 do
for i6:=0 to 7 do
for i7:=0 to 7 do
for i8:=0 to 7 do
for i9:=0 to 7 do begin
zap(i1,i2,i3,i4,i5,i6,i7,i8,i9,a1,r);
writeln(r);
end;
writeln(' ',r);
close(f);
writeln('ok');
readln;
end.
Программа 3. Нахождение изоморфных колец:
program izomorf;
uses crt;
const p=1;
type mas=array [0..7,0..7] of integer;
mas1=array [1..3] of integer;
var a,b,a1:mas;
y:mas1;
n,j1,i2,t,h,g,d:integer;
f,f1,f2,f3,f8:text;
procedure basis(var y:mas1);
var i:integer;
begin
for i:=1 to 3 do read(f2,y[i]);
readln(f2);
end;
procedure sc(var a:mas);
var i,j:integer;
begin
reset(f1);
for i:=0 to 7 do begin
for j:=0 to 7 do read(f1,a[i,j]);
readln(f1);
end;
end;
{procedure glav(b:mas);
var q,i,j,x,k:integer;
begin
x:=0;k:=1;
reset(f1);
rewrite(f8);
while n<=t do begin
q:=0;
for i:=0 to 7 do begin
for j:=0 to 7 do read(f1,a1[i,j]);
readln(f1);
end;
for i:=0 to 7 do
for j:=0 to 7 do
if a1[i,j]=b[i,j] then inc(q);
if q=64 then begin inc(h);
x:=1;
end
else
for i:=0 to 7 do begin
for j:=0 to 7 do write(f8,a1[i,j],' ');
writeln(f8);
end;
inc(n);
readln(f1);
writeln(f8);
end;
if x=1 then t:=t-2 else t:=t-1;
reset(f8);
rewrite(f1);
while k<=t do begin
for i:=0 to 7 do begin
for j:=0 to 7 do read(f8,a1[i,j]);
readln(f8);
end;
for i:=0 to 7 do begin
for j:=0 to 7 do write(f1,a1[i,j],' ');
writeln(f1);
end;
inc(k);
end;
end;}
procedure newb(y:mas1;a:mas; var b:mas);
var i,j,z1,z2,z3:integer;
begin
for i:=0 to 7 do begin
z1:=a[1,i]; a[1,i]:=a[y[1],i]; a[y[1],i]:=z1;
z2:=a[2,i]; a[2,i]:=a[y[2],i]; a[y[2],i]:=z2;
z3:=a[3,i]; a[3,i]:=a[y[3],i]; a[y[3],i]:=z3;
end;
for j:=0 to 7 do begin