# Action of a permutation on a list (and other objects)

Hi, i'm a beginner user in Sage and I am currently trying to do a few exercises about the Rubik's Cube from the book "Adventures in Group Theory" from D. Joyner

from a general move on the rubik cube (defined as a permutation of its 48 facets) i want to define its restriction to the subset of corner (or edge) facets.

rubik=CubeGroup()
r=rubik.R()
l=rubik.L()
r*l^(-1)


(1,40,41,17)(3,38,43,19)(4,37,44,20)(5,36,45,21)(6,35,46,22)(8,33,48,24)\ (9,14,16,11)(10,12,15,13)(25,27,32,30)(26,29,31,28)

corner_list=[1,3,6,8,9 ,11,14,16,17,19,22,24,25,27,30,32,33,35,38,40,41,43,46,38]
edge_list  =[2,4,5,7,10,12,13,15,18,20,21,23,26,28,29,31,34,36,37,39,42,44,45,47]


basically i would like to look at the action of this permutation on those lists, and i should have for the corners (1,40,41,17)(3,38,43,19)( 6,35,46,22 )(8,33,48,24)(9,14,16,11)(25,27,32,30)

and for the edges (4,37,44,20)(5,36,45,21)(10,12,15,13)(26,29,31,28)

i see there is a method called _r_action but it doesn't look like its working here

(r*l^(-1))._r_action(corner_list)


Traceback (click to the left of this block for traceback) ... AttributeError: 'sage.groups.perm_gps.permgroup_element.PermutationGroupElement' object has no attribute '_r_action'

I guess another way of doing it would be to define a (surjective) homomorphism from S(48) into S(edges) and S(corners) but i don't know how to do it

EDIT: i am trying a solution along these lines by trying to define an homomorphism. lets try with a simpler example

G=SymmetricGroup(5)
G.gens()


[(1,2,3,4,5), (1,2)]

H=PermutationGroup([(3,4,5),(3,4)])
phi = PermutationGroupMorphism_im_gens(G, H,[(3,4,5),()])
phi


Permutation group morphism: From: Symmetric group of order 5! as a permutation group To: Permutation Group with generators [(3,4), (3,4,5)] Defn: [(1,2,3,4,5), (1,2)] -> [(3,4,5), ()]

g=G([(1,2,3,4,5)])
g


(1,2,3,4,5)

phi(g)


Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "_sage_input_68.py", line 10, in <module> exec compile(u'open("___code___.py","w").write("# -- coding: utf-8 --\n" + _support_.preparse_worksheet_cell(base64.b64decode("cGhpKGcp"),globals())+"\n"); execfile(os.path.abspath("___code___.py")) File "", line 1, in <module> File "/private/var/folders/gm/z065gk616xg6g0xgn4c7_bvc0000gn/T/tmpg7JGoB/___code___.py", line 2, in <module> exec compile(u'phi(g) File "", line 1, in <module> File "/Applications/SageMath/local/lib/python2.7/site-packages/sage/groups/perm_gps/permgroup_morphism.py", line 136, in __call__ return self.image(g) File "/Applications/SageMath/local/lib/python2.7/site-packages/sage/groups/perm_gps/permgroup_morphism.py", line 115, in image G = self._gap_().Image(J) File "/Applications/SageMath/local/lib/python2.7/site-packages/sage/interfaces/interface.py", line 632, in __call__ return self._obj.parent().function_call(self._name, [self._obj] + list(args), kwds) File "/Applications/SageMath/local/lib/python2.7/site-packages/sage/interfaces/gap.py", line 921, in function_call res = self.eval(marker+cmd) File "/Applications/SageMath/local/lib/python2.7/site-packages/sage/interfaces/gap.py", line 573, in eval result = Expect.eval(self, input_line, **kwds) File "/Applications/SageMath/local/lib/python2.7/site-packages/sage/interfaces/expect.py", line 1239, in eval for L in code.split('\n') if L != '']) File "/Applications/SageMath/local/lib/python2.7/site-packages/sage/interfaces/gap.py", line 771, in _eval_line raise RuntimeError(message) RuntimeError: Gap produced error output Error, usage: Image(<map>), Image(<map>,<elm>), Image(<map>,<coll>)

executing __SAGE_LAST__:="__SAGE_LAST__";;Image($sage20,$sage19);;

I think i tried the same syntax than here http://doc.sagemath.org/html/en/refer...

surely i must have done something wrong , but what ?

thanks

edit retag close merge delete

Sort by ยป oldest newest most voted

You can write the action yourself:

sage: p = r*l^(-1)
sage: [p(i) for i in corner_list]
[40, 38, 35, 33, 14, 9, 16, 11, 1, 3, 6, 8, 27, 32, 25, 30, 48, 46, 43, 41, 17, 19, 22, 43]
sage: [p(i) for i in edge_list]
[2, 37, 36, 7, 12, 15, 10, 13, 18, 4, 5, 23, 29, 26, 31, 28, 34, 45, 44, 39, 42, 20, 21, 47]


If you want to use some additional methods by viewing p as an element of the symmetric group $S_48$, or as a permutation, you can to:

sage: p.parent()
The Rubik's cube group with generators R,L,F,B,U,D in SymmetricGroup(48).
sage: S = SymmetricGroup(48)
sage: s = S(p) ; s
(1,40,41,17)(3,38,43,19)(4,37,44,20)(5,36,45,21)(6,35,46,22)(8,33,48,24)(9,14,16,11)(10,12,15,13)(25,27,32,30)(26,29,31,28)
sage: s.parent()
Symmetric group of order 48! as a permutation group

sage: P = Permutation(p) ; P
[40, 2, 38, 37, 36, 35, 7, 33, 14, 12, 9, 15, 10, 16, 13, 11, 1, 18, 3, 4, 5, 6, 23, 8, 27, 29, 32, 26, 31, 25, 28, 30, 48, 34, 46, 45, 44, 43, 39, 41, 17, 42, 19, 20, 21, 22, 47, 24]
sage: P.parent()
Standard permutations

more

thank you , but you are not really answering to my question. There are 24 edge facets and 24 corner facets, and i want to see the 2 natural projections of p on S(24) _r_action doesn't work on P

( 2016-11-27 12:03:15 +0200 )edit

@tmonteil could you have a second look please ? thanks

( 2016-12-03 17:58:15 +0200 )edit