Recently I have been working on group theory and I have found checking for associativity for specific Cayley tables to be rather tedious so I wrote a program to do it for me. Most of the time I would make the Cayley tables first and then run the program to check if it is associative. However, I recently decided to put it all together into one Manipulate[]
to speed up my productivity. By doing so though, things got a little glitchy. The problem I am having is with creating the rules. I think I managed to narrowed it down to one line of code(?) and so below is my code without the actual function for checking associativity, only the part which seems to make the program to malfunction.
alphabet = "IABCDEFGHJKLMNOPQRSTUVWXYZ";
Manipulate[
aList = StringJoin[#] & /@Tuples[Table[StringTake[alphabet, {n}], {n, letters}], {2}];
bList = Table["I",{letters},{letters}];
rules = Thread[aList -> Flatten[bList]]; (*If I comment out this line everything works fine*)
Row[{Grid[
Prepend[Map[Flatten[#] &,
Transpose[{Table[StringTake[alphabet, {n}], {n, letters}],
Table[With[{n = n, m = m},
PopupMenu[Dynamic[bList[[n, m]]],
Table[StringTake[alphabet, {o}], {o, letters}]]], {n,
letters}, {m, letters}]}]],
Prepend[Table[StringTake[alphabet, {n}], {n, letters}], ""]],
Dividers -> {2 -> True, 2 -> True}], Spacer[50],
Dynamic[bList]}], {letters, 1, 8, 1}]
When I run this program and set a value for a particular element in the grid; bList
will update, but quickly switch back to it's initial state. However if I remove
rules = Thread[aList -> Flatten[bList]];
the value changes as it should. I tried placing Dynamic[]
in various places without success. I'm not sure how to proceed, so any help on how to fix the problem would be greatly appreciated.