# Revision history [back]

You can get the documentation of PermutationGroupMorphism_im_gens (which i admit is pretty poor) as follows:

sage: PermutationGroupMorphism_im_gens?


As you can see, you have only 3 arguments:

1. the group that serves as the domain
2. the group that serves as the codomain
3. the list of images (in the codomain) of "the" generators of the domain by the morphism you want to construct

So in your case, i do not have a copy of the book, but i guess that you want to define the inner automorphism (a.k.a. conjugacy), from G to G that maps $g$ to $hgh^{-1}$.

So the first argument is G, the second is G and the third is the list of images of G.gens() by the inner automorphism, that is [h*g*h^(-1) for g in gensG] (which you named gensG_h). Hence, you can define your morphism as:

sage: phi = PermutationGroupMorphism_im_gens(G,G,gensG_h)
sage: phi
Permutation group endomorphism of Symmetric group of order 4! as a permutation group
Defn: [(1,2,3,4), (1,2)] -> [(1,3,2,4), (2,4)]
sage: phi.image(G)
Subgroup of (Symmetric group of order 4! as a permutation group) generated by [(2,4), (1,3,2,4)]


However, there is no range method (which would have lead to the same result anyway).

Cou can check that phi a bijection:

sage: phi.kernel()
Subgroup of (Symmetric group of order 4! as a permutation group) generated by [()]
sage: phi.image(G) == G
True