Ask Your Question
1

what is the equivalent command of gap in sage

asked 2016-01-28 12:29:05 +0200

grammar001 gravatar image

updated 2016-01-28 13:11:22 +0200

vdelecroix gravatar image

gap command,

g1:=Group((2, 3)(4, 5));
g2:=Group((1, 5)(3, 4));
cg:=AllHomomorphisms(g1,g2);

i see that sage seems need to define GF or other things, what is the sage command of above gap command

i am finding an input for this function

K.<x> = FunctionField(cg[3]);
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-01-28 13:11:44 +0200

tmonteil gravatar image

Here is the beginning of an attempt (unfortunately not a solution). You can construct the groups as follows:

sage: g1 = PermutationGroup([[(2, 3), (4, 5)]])
sage: g1
Permutation Group with generators [(2,3)(4,5)]
sage: g2 = PermutationGroup([[(1, 5), (3, 4)]])
sage: g2
Permutation Group with generators [(1,5)(3,4)]

However, i could not find the Sage equivalent of AllHomomorphisms. So we can try to pass from Sage to Gap to Sage again:

sage: G1 = gap(g1)
sage: G2 = gap(g2)
sage: CG = gap.function_call('AllHomomorphisms',[G,H])
sage: CG
[ GroupHomomorphismByImages( Group( [ (2,3)(4,5) ] ), Group( 
    [ (1,5)(3,4) ] ), [ (2,3)(4,5) ], [ () ] ), 
  GroupHomomorphismByImages( Group( [ (2,3)(4,5) ] ), Group( 
    [ (1,5)(3,4) ] ), [ (2,3)(4,5) ], [ (1,5)(3,4) ] ) ]
sage: cg = CG.sage()
NotImplementedError: Unable to parse output: [ GroupHomomorphismByImages( Group( [ (2,3)(4,5) ] ), Group(      [ (1,5)(3,4) ] ), [ (2,3)(4,5) ], [ () ] ),    GroupHomomorphismByImages( Group( [ (2,3)(4,5) ] ), Group(      [ (1,5)(3,4) ] ), [ (2,3)(4,5) ], [ (1,5)(3,4) ] ) ]

So, you have to tell Sage that it is a list:

sage: list(cg)
[GroupHomomorphismByImages( Group( [ (2,3)(4,5) ] ), Group( [ (1,5)(3,4) ] ), 
 [ (2,3)(4,5) ], [ () ] ),
 GroupHomomorphismByImages( Group( [ (2,3)(4,5) ] ), Group( [ (1,5)(3,4) ] ), 
 [ (2,3)(4,5) ], [ (1,5)(3,4) ] )]

Then we can access some element of the list:

sage: M = list(cg)[0]
sage: M
GroupHomomorphismByImages( Group( [ (2,3)(4,5) ] ), Group( [ (1,5)(3,4) ] ), 
[ (2,3)(4,5) ], [ () ] )
sage: type(M)
<class 'sage.interfaces.gap.GapElement'>

But this particular morphism can not be put back into Sage:

sage: M.sage()
NotImplementedError: Unable to parse output: GroupHomomorphismByImages( Group( [ (2,3)(4,5) ] ), Group( [ (1,5)(3,4) ] ),  [ (2,3)(4,5) ], [ () ] )

Note that there exists a PermutationGroupMorphism_im_gens that works similarly to gap's GroupHomomorphismByImages, so the last step could be to parse M.str() and use PermutationGroupMorphism_im_gens as a replacement of GroupHomomorphismByImages (see PermutationGroupMorphism_im_gens? for the documentation).

This is of course unsatisfactory handiwork. The right way is of course to interface GroupHomomorphismByImages in Sage.

edit flag offensive delete link more

Comments

i run cg = CG.sage() list(cg) M = list(cg)[0], in cloud sage got error, can not run

grammar001 gravatar imagegrammar001 ( 2016-01-28 15:16:40 +0200 )edit

if uisng gap function can not work, how about how to use sage's own function to do? how to do?

grammar001 gravatar imagegrammar001 ( 2016-01-28 15:18:23 +0200 )edit

from sage.groups.perm_gps.permgroup_morphism import PermutationGroupMorphism_from_gap phi = PermutationGroupMorphism_im_gens(G1, G2, map(G2, G1.gens())) phi FunctionField(phi[2]);

when run in cloud sage, got error, how to do?

grammar001 gravatar imagegrammar001 ( 2016-01-28 15:24:49 +0200 )edit

i would like to understand the mechanism, which book do this FunctionField reference from?

grammar001 gravatar imagegrammar001 ( 2016-01-28 17:43:24 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2016-01-28 12:29:05 +0200

Seen: 761 times

Last updated: Jan 28 '16