离散代数系统上机求幺元逆元

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

#includeiostream#includeiomanipusingnamespacestd;intjudgejiehe(chara[][4],charb[]){inti,j,k,l,x,y,flag=1;for(i=0;i4;i++)for(j=0;j4;j++)for(k=0;k4;k++){for(l=0;l4;l++){if(a[i][j]==b[l])x=l;//a[i][j]=a*bif(a[j][k]==b[l])y=l;//a[j][k]=b*c}if(a[i][y]!=a[x][k])//a[i[[y]=a*(b*c){cout(b[i]*b[j])*b[k]=a[x][k],b[i]*(b[j]*b[k])=a[i][y],该运算不可结合!endl;flag=0;//不满足结合return2;}}if(flag)cout\n\n运算可结合!A,*构成半群endl;return0;}intjudgeyaoniyuan(chara[][4],charb[]){inti,j,flag=1,counter=0;charc;for(i=0;i4;i++){if((a[i][0]==b[0])&&(a[i][1]==b[1])&&(a[i][2]=b[2])&&(a[i][3]==b[3])){for(j=0;j4;j++){if((a[0][j]==b[0])&&(a[1][j]==b[1])&&(a[2][j]=b[2])&(a[3][j]==b[3])){cout幺元为a[i][j],故A,*是独异点endl;flag=0;c=a[i][j];}}}}if(flag){cout无幺元!endl;return0;}for(i=0;i4;i++){for(j=0;j4;j++){if(a[i][j]==c){if(i==j){coutb[i]自身互为逆元endl;counter++;}if(i!=j){coutb[i]、b[j]互为逆元endl;counter++;}}}}if(counter==4)cout每个元素都存在逆元,A,*构成群endl;}intjudgerepeat(chara[][4],charb[]){inti,j,counter=0,counter1=0,counter2=0,counter3=0,counter4=0;for(i=0;i4;i++){for(j=0;j4;j++){if(a[i][j]==b[0])counter1++;if(a[i][j]==b[1])counter2++;if(a[i][j]==b[2])counter3++;if(a[i][j]==b[3])counter4++;}}counter=counter1+counter2+counter3+counter4;if(counter16)cout该二元运算的二维矩阵中某行列中有重复元素,故该二元运算不是群endl;if(counter==16)cout该二元运算的二维矩阵中每行每列没有重复元素endl;}intmain(){chara[4][4]={'a','b','c','e','b','a','e','c','c','e','b','a','e','c','a','b'};charb[4]={'a','b','c','e'};charc;inti,j,counter=0,count1;cout\n设集合A={a,b,c,e},“*”是A上的二元运算(满足封闭性),运算表通过二维矩阵进行赋值.\nendl;cout*|setw(6)asetw(12)bsetw(12)csetw(12)eendl;cout------------------------------------------------------endl;coutasetw(6)|;for(i=0;i4;i++){for(j=0;j4;j++){couta[i][j]setw(12);counter++;switch(counter){case4:cout\nbsetw(6)|;break;case8:cout\ncsetw(6)|;break;case12:cout\nesetw(6)|;break;default:break;}}}count1=judgejiehe(a,b);if(count1)return0;judgerepeat(a,b);judgeyaoniyuan(a,b);return0;}

1 / 3
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功