Author: Ken Levasseur
Description: Worksheets related to Applied Discrete Structures
G=SymmetricGroup(4);G

Symmetric group of order 4! as a permutation group
G.list()

[(), (1,2), (1,2,3,4), (1,3)(2,4), (1,3,4), (2,3,4), (1,4,3,2), (1,3,4,2), (1,3,2,4), (1,4,2,3), (1,2,4,3), (2,4,3), (1,4,3), (1,4)(2,3), (1,4,2), (1,3,2), (1,3), (3,4), (2,4), (1,4), (2,3), (1,2)(3,4), (1,2,3), (1,2,4)]
map(lambda f:[f,f.sign()],G.list())

[[(), 1], [(1,2), -1], [(1,2,3,4), -1], [(1,3)(2,4), 1], [(1,3,4), 1], [(2,3,4), 1], [(1,4,3,2), -1], [(1,3,4,2), -1], [(1,3,2,4), -1], [(1,4,2,3), -1], [(1,2,4,3), -1], [(2,4,3), 1], [(1,4,3), 1], [(1,4)(2,3), 1], [(1,4,2), 1], [(1,3,2), 1], [(1,3), -1], [(3,4), -1], [(2,4), -1], [(1,4), -1], [(2,3), -1], [(1,2)(3,4), 1], [(1,2,3), 1], [(1,2,4), 1]]
for f in G.list():
print [f,f.sign()]

[(), 1] [(1,2), -1] [(1,2,3,4), -1] [(1,3)(2,4), 1] [(1,3,4), 1] [(2,3,4), 1] [(1,4,3,2), -1] [(1,3,4,2), -1] [(1,3,2,4), -1] [(1,4,2,3), -1] [(1,2,4,3), -1] [(2,4,3), 1] [(1,4,3), 1] [(1,4)(2,3), 1] [(1,4,2), 1] [(1,3,2), 1] [(1,3), -1] [(3,4), -1] [(2,4), -1] [(1,4), -1] [(2,3), -1] [(1,2)(3,4), 1] [(1,2,3), 1] [(1,2,4), 1]
map(lambda H:H.order(),G.subgroups())

[1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 6, 6, 6, 6, 8, 8, 8, 12, 24]


G.subgroups()[-2].list()

[(), (1,3)(2,4), (2,4,3), (1,4)(2,3), (1,2)(3,4), (1,4,2), (1,2,3), (1,3,4), (2,3,4), (1,3,2), (1,4,3), (1,2,4)]
D=PermutationGroup([(1,2,3,4),(1,3)]);D

Permutation Group with generators [(1,2,3,4), (1,3)]
D.order()

8
D.cayley_graph().show()

D.cayley_table()

* a b c d e f g h +---------------- a| a b c d e f g h b| b a f h g c e d c| c e d g h b a f d| d h g a f e c b e| e c b f a d h g f| f g h e d a b c g| g f a c b h d e h| h d e b c g f a
D.cayley_table(names="elements")

* () (1,3) (1,2,3,4) (1,3)(2,4) (1,2)(3,4) (1,4)(2,3) (1,4,3,2) (2,4) +---------------------------------------------------------------------------------------- ()| () (1,3) (1,2,3,4) (1,3)(2,4) (1,2)(3,4) (1,4)(2,3) (1,4,3,2) (2,4) (1,3)| (1,3) () (1,4)(2,3) (2,4) (1,4,3,2) (1,2,3,4) (1,2)(3,4) (1,3)(2,4) (1,2,3,4)| (1,2,3,4) (1,2)(3,4) (1,3)(2,4) (1,4,3,2) (2,4) (1,3) () (1,4)(2,3) (1,3)(2,4)| (1,3)(2,4) (2,4) (1,4,3,2) () (1,4)(2,3) (1,2)(3,4) (1,2,3,4) (1,3) (1,2)(3,4)| (1,2)(3,4) (1,2,3,4) (1,3) (1,4)(2,3) () (1,3)(2,4) (2,4) (1,4,3,2) (1,4)(2,3)| (1,4)(2,3) (1,4,3,2) (2,4) (1,2)(3,4) (1,3)(2,4) () (1,3) (1,2,3,4) (1,4,3,2)| (1,4,3,2) (1,4)(2,3) () (1,2,3,4) (1,3) (2,4) (1,3)(2,4) (1,2)(3,4) (2,4)| (2,4) (1,3)(2,4) (1,2)(3,4) (1,3) (1,2,3,4) (1,4,3,2) (1,4)(2,3) ()