How to use Gap interface for permutation groups?

42 views
Skip to first unread message

Peter Mueller

unread,
Mar 30, 2023, 1:25:03 PM3/30/23
to sage-support
When working with finite permutation groups, it seems to me that one has the choice to either use the groups as sage objects like `SymmetricGroup(4)`, or as a Gap object via `libgap.SymmetricGroup(4)`. The former has rather limited functionality (and quite a few bugs as reported earlier), so the advise was to use the latter concept.

So after setting `g = libgap.SymmetricGroup(4)`, things like `g.Stabilizer(1)` work as expected. However, I have difficulties to figure out how for instance the equivalent of the Gap code `Stabilizer(g, [1,2], OnSets)` would look like. Something like `g. Stabilizer([1, 2], 'OnSets')` raises a GapError.

Are these things documented somewhere? I couldn't find anything.

-- Peter Mueller

Dima Pasechnik

unread,
Mar 30, 2023, 1:38:47 PM3/30/23
to sage-support


On Thu, 30 Mar 2023, 18:25 'Peter Mueller' via sage-support, <sage-s...@googlegroups.com> wrote:
When working with finite permutation groups, it seems to me that one has the choice to either use the groups as sage objects like `SymmetricGroup(4)`, or as a Gap object via `libgap.SymmetricGroup(4)`. The former has rather limited functionality (and quite a few bugs as reported earlier), so the advise was to use the latter concept.

So after setting `g = libgap.SymmetricGroup(4)`, things like `g.Stabilizer(1)` work as expected. However, I have difficulties to figure out how for instance the equivalent of the Gap code `Stabilizer(g, [1,2], OnSets)` would look like. Something like `g. Stabilizer([1, 2], 'OnSets')` raises a GapError.

it is

g. Stabilizer([1, 2], libgap.OnSets)

(which makes sense, as in GAP you also don't pass a string to Stabilizer, but you pass a GAP action)



Are these things documented somewhere? I couldn't find anything.

(and source code, eg in src/sage/graphs/)

 - pull requests welcome 😁

 
Dima



-- Peter Mueller

--
You received this message because you are subscribed to the Google Groups "sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/9702a206-d4d9-4d05-95eb-3a2b729ec4c5n%40googlegroups.com.
Message has been deleted

Hongyi Zhao

unread,
Apr 4, 2023, 1:08:02 PM4/4/23
to sage-support
On Friday, March 31, 2023 at 1:38:47 AM UTC+8 Dima Pasechnik wrote:


On Thu, 30 Mar 2023, 18:25 'Peter Mueller' via sage-support, <sage-s...@googlegroups.com> wrote:
When working with finite permutation groups, it seems to me that one has the choice to either use the groups as sage objects like `SymmetricGroup(4)`, or as a Gap object via `libgap.SymmetricGroup(4)`. The former has rather limited functionality (and quite a few bugs as reported earlier), so the advise was to use the latter concept.

So after setting `g = libgap.SymmetricGroup(4)`, things like `g.Stabilizer(1)` work as expected. However, I have difficulties to figure out how for instance the equivalent of the Gap code `Stabilizer(g, [1,2], OnSets)` would look like. Something like `g. Stabilizer([1, 2], 'OnSets')` raises a GapError.

it is

g. Stabilizer([1, 2], libgap.OnSets)

In lengthy code, calling too many keywords such as "libgap" is not elegant in my opinion.

Zhao

John H Palmieri

unread,
Apr 4, 2023, 2:49:39 PM4/4/23
to sage-support
In lengthy code, you could start with a line like

OnSets = libgap.OnSets

and then in the rest of the code, you could do `g.Stabilizer([1,2], OnSets)`. That is, predefine whatever you want from libgap, giving each item a meaningful name, and then use that name in the rest of the code.

Hongyi Zhao

unread,
Apr 4, 2023, 7:47:29 PM4/4/23
to sage-support
On Wednesday, April 5, 2023 at 2:49:39 AM UTC+8 John H Palmieri wrote:
In lengthy code, you could start with a line like

OnSets = libgap.OnSets

and then in the rest of the code, you could do `g.Stabilizer([1,2], OnSets)`. That is, predefine whatever you want from libgap, giving each item a meaningful name, and then use that name in the rest of the code.

Thanks for this tip. It does the trick:

werner@X10DAi:~$ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 10.0.beta3, Release Date: 2023-03-02              │
│ Using Python 3.10.7. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Warning: this is a prerelease version, and it may be unstable.     ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
sage: g = libgap.SymmetricGroup(4)
sage: OnSets = libgap.OnSets
sage: g.Stabilizer([1,2], OnSets)
Group([ (3,4), (1,2) ])
Reply all
Reply to author
Forward
0 new messages