In [1]:
from IPython.display import Image, VimeoVideo
VimeoVideo("164623027")
Out[1]:

Today, we've encounter two concepts from group theory(Permutations group and homomorphism). It is instructive to manipulate permutations. Assume that you have $$ \begin{pmatrix} 1 & 2 & 3 & 4 & 5 & 6 & 7\\ 2 & 3 & 1 & 5 & 6 & 7 & 4 \end{pmatrix} $$ To check if your cycle decompositions is correct, plug list thact contains pair (element, its image), in our case $$[(1,2), (2,3), (3,1), (4,5), (5, 6), (6,7), (7,4)]$$

In [2]:
from sage.all import * #Because we are using Jupyter not sagemath's worksheet
from permutations import permutations #Leave it
print permutations([(1,2), (2,3), (3,1), (4,5), (5, 6), (6,7), (7,4)]) #Edit the input
[(1, 2, 3), (4, 5, 6, 7)]

For permutations group, you need to define the group first, then define an element by passing its representaion as string to the created group. Now you can do what ever you like.

In [3]:
G = SymmetricGroup(8) #Edit the group size
r = G("(1, 2, 3), (4, 5, 6, 7)")
s = G("(5,8)(4,7,3)")
r*s
Out[3]:
(1,2,4,8,5,6,3)

$\mathbb{Z}_n$

In [4]:
Z10 = AbelianGroup([10])
Z10.cayley_table(names='elements')
Out[4]:
  *    1   f f^2 f^3 f^4 f^5 f^6 f^7 f^8 f^9
   +----------------------------------------
  1|   1   f f^2 f^3 f^4 f^5 f^6 f^7 f^8 f^9
  f|   f f^2 f^3 f^4 f^5 f^6 f^7 f^8 f^9   1
f^2| f^2 f^3 f^4 f^5 f^6 f^7 f^8 f^9   1   f
f^3| f^3 f^4 f^5 f^6 f^7 f^8 f^9   1   f f^2
f^4| f^4 f^5 f^6 f^7 f^8 f^9   1   f f^2 f^3
f^5| f^5 f^6 f^7 f^8 f^9   1   f f^2 f^3 f^4
f^6| f^6 f^7 f^8 f^9   1   f f^2 f^3 f^4 f^5
f^7| f^7 f^8 f^9   1   f f^2 f^3 f^4 f^5 f^6
f^8| f^8 f^9   1   f f^2 f^3 f^4 f^5 f^6 f^7
f^9| f^9   1   f f^2 f^3 f^4 f^5 f^6 f^7 f^8
In [5]:
H = SymmetricGroup(4) #Show all methods for G
r = H("(1,3)")
print len(dir(H)) #To see the methods remove len
print len(dir(r))
print len([meth for meth in dir(r) if meth not in dir(H)])
385
210
116
In [6]:
T = AbelianGroup([4,4])
T.cayley_graph().show( color_by_label=True, edge_labels=True) #It doesn't work here, please go to PermutationsNotes.sagews file and run it
Graphics object consisting of 81 graphics primitives

Appendix: permutations source code

In [7]:
import permutations as pr
pr??
In [ ]: