1 | initial version |
For #1:
sage: G = groups.permutation.Symmetric(3)
sage: for x in G:
....: (do stuff with x)
For example:
sage: G = groups.permutation.Symmetric(3)
sage: d = {}
sage: for x in G:
....: for y in G:
....: if x*y != y*x:
....: if x in d:
....: d[x].append(y)
....: else:
....: d[x] = [y]
....:
At this point, d
is a dictionary. The keys are the non-identity elements of G
, and the value corresponding to x
is the list of elements y
that do not commute with x
. So for #2:
sage: gr = Graph(d)
sage: view(gr)