# 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