1 | initial version |

Hi,

I reproduce here the answer I got from Travis Scrimshaw on the mailing list sage-combinat devel.

**First method**

```
sage: S3 = SymmetricGroup(3)
sage: SGA = GroupAlgebra(S3, QQ)
sage: MS = MatrixSpace(QQ,2)
sage: mtx = [MS([[0,-1],[1,-1]]), MS([[1,-1],[0,-1]])]
sage: f = lambda x: MS.prod(mtx[i-1] for i in x.reduced_word())
sage: phi = SGA.module_morphism(f, codomain=MS)
```

Where the -1 is needed because of indexing. Now you can check:

```
sage: elt = SGA.gen(0) + SGA.gen(1); elt
(1,2) + (1,2,3)
sage: phi(elt)
[-1 -1]
[ 0 0]
```

**Second method**
An alternative method is to build a group morphism and then build the associate algebra morphism. There is a subtle issue as there is currently no method to express an element of a finite group in terms of generators. In particular, a morphism can not be built by providing only the image of the generators.

```
sage: MG = MatrixGroup(mtx) # take some time because it launches GAP
sage: H = Hom(S3, MG)
sage: psi = H(lambda x: MG.prod(MG.gen(i-1) for i in x.reduced_word()))
sage: kappa = SGA.module_morphism(lambda x: MS(psi(x)), codomain=MS)
```

You can again check

```
sage: elt = SGA.gen(0) + SGA.gen(1); elt
(1,2) + (1,2,3)
sage: kappa(elt)
[-1 -1]
[ 0 0]
```

**Alternative to the second method**
The following shows how in general, given a finite group, one may express a given element in terms of generators using the Cayley graph:

```
sage: G = S3.cayley_graph(generators=S3.gens())
sage: path = G.shortest_path(S3.one(), prod(S3.gens())); path
[(), (1,2,3), (2,3)]
sage: labels = [G.edge_label(path[i], path[i+1]) for i in range(len(path)-1)]; labels
[(1,2,3), (1,2)]
sage: map(lambda x: list(S3.gens()).index(x), labels)
[0, 1]
```

2 | No.2 Revision |

Hi,

I reproduce here the answer I got from Travis Scrimshaw on the mailing list sage-combinat devel.

**First method**

```
sage: S3 = SymmetricGroup(3)
sage: SGA = GroupAlgebra(S3, QQ)
sage: MS = MatrixSpace(QQ,2)
sage: mtx = [MS([[0,-1],[1,-1]]), MS([[1,-1],[0,-1]])]
sage: f = lambda x: MS.prod(mtx[i-1] for i in x.reduced_word())
sage: phi = SGA.module_morphism(f, codomain=MS)
```

Where the -1 is needed because of indexing. Now you can check:

```
sage: elt = SGA.gen(0) + SGA.gen(1); elt
(1,2) + (1,2,3)
sage: phi(elt)
[-1 -1]
[ 0 0]
```

**Second method**
An alternative method is to build a group morphism and then build the associate algebra morphism. There is a subtle issue as there is currently no method to express an element of a finite group in terms of generators. In particular, a morphism can not be built by providing only the image of the generators.

```
sage: MG = MatrixGroup(mtx) # take some time because it launches GAP
sage: H = Hom(S3, MG)
sage: psi = H(lambda x: MG.prod(MG.gen(i-1) for i in x.reduced_word()))
sage: kappa = SGA.module_morphism(lambda x: MS(psi(x)), codomain=MS)
```

You can again check

```
sage: elt = SGA.gen(0) + SGA.gen(1); elt
(1,2) + (1,2,3)
sage: kappa(elt)
[-1 -1]
[ 0 0]
```

**Alternative to the second method**
The following shows how in general, given a finite group, one may express a given element in terms of generators using the Cayley graph:

```
sage: G = S3.cayley_graph(generators=S3.gens())
sage: path = G.shortest_path(S3.one(), prod(S3.gens())); path
[(), (1,2,3), (2,3)]
sage: labels = [G.edge_label(path[i], path[i+1]) for i in range(len(path)-1)]; labels
[(1,2,3), (1,2)]
sage: map(lambda x: list(S3.gens()).index(x), labels)
[0, 1]
```

3 | No.3 Revision |

Hi,

I reproduce here the answer I got from Travis Scrimshaw on the ~~mailing list sage-combinat ~~~~devel~~.devel.

**First method**

```
sage: S3 = SymmetricGroup(3)
sage: SGA = GroupAlgebra(S3, QQ)
sage: MS = MatrixSpace(QQ,2)
sage: mtx = [MS([[0,-1],[1,-1]]), MS([[1,-1],[0,-1]])]
sage: f = lambda x: MS.prod(mtx[i-1] for i in x.reduced_word())
sage: phi = SGA.module_morphism(f, codomain=MS)
```

Where the -1 is needed because of indexing. Now you can check:

```
sage: elt = SGA.gen(0) + SGA.gen(1); elt
(1,2) + (1,2,3)
sage: phi(elt)
[-1 -1]
[ 0 0]
```

**Second method**
An alternative method is to build a group morphism and then build the associate algebra morphism. There is a subtle issue as there is currently no method to express an element of a finite group in terms of generators. In particular, a morphism can not be built by providing only the image of the generators.

```
sage: MG = MatrixGroup(mtx) # take some time because it launches GAP
sage: H = Hom(S3, MG)
sage: psi = H(lambda x: MG.prod(MG.gen(i-1) for i in x.reduced_word()))
sage: kappa = SGA.module_morphism(lambda x: MS(psi(x)), codomain=MS)
```

You can again check

```
sage: elt = SGA.gen(0) + SGA.gen(1); elt
(1,2) + (1,2,3)
sage: kappa(elt)
[-1 -1]
[ 0 0]
```

**Alternative to the second method**
The following shows how in general, given a finite group, one may express a given element in terms of generators using the Cayley graph:

```
sage: G = S3.cayley_graph(generators=S3.gens())
sage: path = G.shortest_path(S3.one(), prod(S3.gens())); path
[(), (1,2,3), (2,3)]
sage: labels = [G.edge_label(path[i], path[i+1]) for i in range(len(path)-1)]; labels
[(1,2,3), (1,2)]
sage: map(lambda x: list(S3.gens()).index(x), labels)
[0, 1]
```

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.