I am working on a project which requires me to discern if the cayley tables in my text files, have identity, associative, inverse, and abelian properties.. I am currently working on the identity function, and while I believe I must use two nested for loops to cycle through the rows and columns of the tables. I am unable to find anything which may push me in the right direction, any help is appreciated. Thanks Jessica
Just wanted to add an update: This is what I finally came up with, posting just in case it could still use work. Many thanks.
group_el Group::getIdentity()
{
for (int i=0; i<order; i++)
{
bool identIsi = true;
for (int j=0; j<order; j++)
{
if ((op(i,j)==i) && (op(j,i)==i)) //if i*j =i same as j*i = i then i is identity
{
return i;
}
else
{
identIsi = false;
}
}
}
return NO_IDENTITY; }
C++ won't be the easiest language to work with, but it will be doable.
I took a class on abstract algebra a few years ago and from what I recall, you just have to write out the expression for every possible combination (since some groups are non-commutative you will need to do
A*B
andB*A
, where*
is an arbitrary operator) and work from there.In order to decrease complexity, I'd do it in this order: