CoCalc Public Filessage_worksheets / summer.sagews
Author: Ken Levasseur
Description: Worksheets related to Applied Discrete Structures


triangle = SymmetricGroup(3)
triangle.list()

[(), (1,2), (1,2,3), (1,3,2), (2,3), (1,3)]
triangle.cayley_graph(generators=[(1,2),(1,2,3)]).show(edge_labels=True)

triangle.cayley_graph(generators=[(1,2),(1,3)]).show(edge_labels=True)


G=PermutationGroup([[(1,2,3,4),(5,6,7,8)],[(1,5,8,4),(2,6,7,3)]])

G.list()

[(), (1,2,3,4)(5,6,7,8), (1,5,8,4)(2,6,7,3), (1,3)(2,4)(5,7)(6,8), (1,6,3)(4,5,7), (1,6,8)(2,7,4), (1,8)(2,7)(3,6)(4,5), (1,7)(2,3)(4,6)(5,8), (1,7)(2,8)(3,4)(5,6), (1,4,3,2)(5,8,7,6), (1,2)(3,5)(4,6)(7,8), (1,7)(2,6)(3,5)(4,8), (1,5)(2,8)(3,7)(4,6), (1,4,8,5)(2,3,7,6), (2,4,5)(3,8,6), (1,3,8)(2,7,5), (1,3,6)(4,7,5), (1,6)(2,5)(3,8)(4,7), (2,5,4)(3,6,8), (1,8,3)(2,5,7), (1,8,6)(2,4,7), (1,5,6,2)(3,4,8,7), (1,4)(2,8)(3,5)(6,7), (1,2,6,5)(3,7,8,4)]
G.cayley_graph().show()


G.list()

[(), (1,2,3,4)(5,6,7,8), (1,2,6,5)(3,7,8,4), (1,5,8,4)(2,6,7,3), (1,6,8)(2,7,4), (1,3,8)(2,7,5), (1,6,3)(4,5,7), (1,6)(2,5)(3,8)(4,7), (2,5,4)(3,6,8), (1,3)(2,4)(5,7)(6,8), (1,8)(2,7)(3,6)(4,5), (1,7)(2,3)(4,6)(5,8), (1,5,6,2)(3,4,8,7), (1,7)(2,6)(3,5)(4,8), (1,7)(2,8)(3,4)(5,6), (1,4,3,2)(5,8,7,6), (1,4)(2,8)(3,5)(6,7), (1,5)(2,8)(3,7)(4,6), (1,4,8,5)(2,3,7,6), (1,2)(3,5)(4,6)(7,8), (1,8,6)(2,4,7), (1,3,6)(4,7,5), (2,4,5)(3,8,6), (1,8,3)(2,5,7)]
PermutationGroup?G=A

cc=G.conjugacy_classes()

for c in cc:
print c,"---", len(c.list())

Conjugacy class of () in Alternating group of order 5!/2 as a permutation group --- 1 Conjugacy class of (1,2)(3,4) in Alternating group of order 5!/2 as a permutation group --- 15 Conjugacy class of (1,2,3) in Alternating group of order 5!/2 as a permutation group --- 20 Conjugacy class of (1,2,3,4,5) in Alternating group of order 5!/2 as a permutation group --- 12 Conjugacy class of (1,2,3,5,4) in Alternating group of order 5!/2 as a permutation group --- 12
G

sigma=G.list()[2]



sigma.sign

map(lambda g:[g,sigma.conjugate(g)],G.list())

Error in lines 1-1 Traceback (most recent call last): File "/projects/sage/sage-7.5/local/lib/python2.7/site-packages/smc_sagews/sage_server.py", line 995, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> File "", line 1, in <lambda> File "sage/structure/element.pyx", line 459, in sage.structure.element.Element.__getattr__ (/projects/sage/sage-7.5/src/build/cythonized/sage/structure/element.c:4254) return self.getattr_from_category(name) File "sage/structure/element.pyx", line 472, in sage.structure.element.Element.getattr_from_category (/projects/sage/sage-7.5/src/build/cythonized/sage/structure/element.c:4363) return getattr_from_other_class(self, cls, name) File "sage/structure/misc.pyx", line 300, in sage.structure.misc.getattr_from_other_class (/projects/sage/sage-7.5/src/build/cythonized/sage/structure/misc.c:1928) raise dummy_attribute_error AttributeError: 'sage.groups.perm_gps.permgroup_element.PermutationGroupElement' object has no attribute 'conjugate'