7

I have been working with SAGE online, and have made some programs to test some hypothesis about finite groups. However, the pre-defined "named" groups in SAGE are quite limited (basically, the symmetric, dihedral, and alternating groups, plus PSL/PSU/PGUs and a couple sporadics). SAGE evidently interfaces with GAP, so what I would like to do is pull some groups out of GAP's SmallGroups library so that I can run them through my SAGE code.

I am able to create a GAP group in SAGE with

A = gap.SmallGroup(27,4)

which returns

Group( [ f1, f2, f3 ] )

I can get its elements using

A.Elements()

which are then given to me in symbolic form, e.g.

[ <identity> of ..., f1, f2, f3, f1^2, f1*f2, f1*f3, f2^2, ... etc. ]

I just don't know how to turn these elements into permutations that SAGE can work with. In other words, I want to take the gap.SmallGroup(27,4) and turn it into something of the form

Permutation Group with generators [(2,4,3), (1,3)(2,4), (1,4)(2,3)]

Could anyone show me how to do this?

  • You might consider cross-posting this to Sage's dedicated stackoverflow-esque sage question site asksage. – JSchlather Aug 22 '12 at 18:28
  • Is it a stack-exchange faux pas to ask here how you got gap.SmallGroup to run? I am having some difficulty with this - I have posted a question here: http://math.stackexchange.com/questions/1366086/how-to-call-gaps-smallgroup-from-sage-i-am-getting-an-error-though-the-correc – Elle Najt Jul 19 '15 at 02:02
  • Never mind, I resolved it. – Elle Najt Jul 19 '15 at 21:09

2 Answers2

8

You can now do this easily (i.e. without string processing) in Sage:

A = gap.SmallGroup(27,4)    
PermutationGroup(gap_group = A.AsPermGroup())

Edit: The above no longer works on Sage Cell Server. But the solution provided by Levi works:

A = gap.Image(gap.IsomorphismPermGroup(gap.SmallGroup(27,4)))    
PermutationGroup(gap_group = A)
L.Z. Wong
  • 447
  • 6
    This raises RuntimeError: Gap produced error output Error, Variable: 'AsPermGroup' must have a value for me. Has some syntax changed since this answer was posted 5 years ago? – Levi Jul 18 '20 at 08:21
  • This still seems to work for me, at least on Sage Cell Server: https://sagecell.sagemath.org/?z=eJxzVLBVSE8s0AvOTczJcS_KLy3QMDLXMdFUAAKugNSi3NKSxJLM_DyIFFBlfDqIBdTlqOdYDFIAkdHUBABvWBgb&lang=sage&interacts=eJyLjgUAARUAuQ== – L.Z. Wong Jul 18 '20 at 08:26
  • 4
    Interesting, in my Jupyter notebook run from the Docker file sagemath/sagemath this does not work ...

    A = gap.Image(gap.IsomorphismPermGroup(gap.SmallGroup(27,4))) PermutationGroup(gap_group = A)

    does, though.

    – Levi Jul 18 '20 at 08:27
6

After a bit of inspection, gap groups have a function AsPermGroup built in. Which in your instance returns

Group( 
[ ( 1,10,19, 2,11,20, 3,12,21)( 4,14,24, 5,15,22, 6,13,23)( 7,18,26,
8,16,27,
      9,17,25), ( 1, 4, 7)( 2, 5, 8)( 3, 6,
9)(10,13,16)(11,14,17)(12,15,18)
    (19,22,25)(20,23,26)(21,24,27), ( 1, 2, 3)( 4, 5, 6)( 7, 8,
9)(10,11,12)
    (13,14,15)(16,17,18)(19,20,21)(22,23,24)(25,26,27) ] )

Presumably you could then pass this into a sage group. A simple hacky way to do this would be to turn the gap permutation group into a string, and remove the group and (). Although I would imagine that Gap has more functionality for groups than Sage does.

JSchlather
  • 15,825
  • Better to turn not the group, but its individual generators - try S:=Group((1,2),(1,2,3));; gens:=GeneratorsOfGroup(S);; List(gens,String); to see how it works. One can also use OpenMath package to have an output like e.g. <OMOBJ> <OMA> <OMS cd="permut1" name="permutation"/> <OMI>2</OMI> <OMI>1</OMI> </OMA> </OMOBJ> (see OMString from the OpenMath package). – Olexandr Konovalov Apr 23 '13 at 22:26