GAPError when using .molien_series()

88 views
Skip to first unread message

Jonas Guru

unread,
Dec 8, 2022, 6:55:15 PM12/8/22
to sage-devel
Hi, 
i ran into a bug while trying to compute the molien series of a permutation group. 

SageMath version 9.3, Release Date: 2021-05-09,  Using Python 3.7.10. 
Operating system: Windows 11, 64-bit

It works fine for most permutation groups but calling: 

PermutationGroup(["(1,2,3,4,5,6,7)","(5,6,7)"]).molien_series()

gives an GAP Error which doesn't make sense to me in the given context. 

GAPError: Error, ^ cannot be used here to compute roots (use `RootInt' instead?)

Similar examples which also produce the same bug are:

PermutationGroup(["(1,2,3,4,5,7)","(5,6,7)"]).molien_series()
PermutationGroup(["(1,2,3,4,7)","(5,6,7)"]).molien_series()
PermutationGroup(["(1,2,3,4,7)","(5,7,8)"]).molien_series()
  
Thanks for looking into it. 
Kind regards, 
Jonas


Travis Scrimshaw

unread,
Dec 8, 2022, 9:55:45 PM12/8/22
to sage-devel
By running the code in molien_series() directly in Sage, I can do the computation, but not by calling the method. So it seems to be something within Sage with the interface with libgap.

Best,
Travis

Dima Pasechnik

unread,
Dec 9, 2022, 6:49:55 AM12/9/22
to sage-...@googlegroups.com
On Fri, Dec 9, 2022 at 2:55 AM 'Travis Scrimshaw' via sage-devel
<sage-...@googlegroups.com> wrote:
>
> By running the code in molien_series() directly in Sage, I can do the computation, but not by calling the method. So it seems to be something within Sage with the interface with libgap.

not really, it's just the character tables in Sage that need work, for
a proper conversion to use libgap - they cause the issue with
moilen_series.
The following (avoiding Sage's characters all together) works just fine:

sage: p=PermutationGroup(["(1,2,3,4,5,6,7)","(5,6,7)"])
sage: ms=libgap(p).PermutationCharacter([1..7],libgap.OnPoints).MolienSeries();
ms
( 1-z^3+z^6-z^9+z^12-z^15+z^18 ) / (
(1-z^7)*(1-z^5)*(1-z^4)*(1-z^3)^2*(1-z^2)*(1-z) )
sage: type(ms)
<class 'sage.libs.gap.element.GapElement'>
sage: ms.sage()
(x_1^18 - x_1^15 + x_1^12 - x_1^9 + x_1^6 - x_1^3 + 1)/(-x_1^25 +
x_1^24 + x_1^23 + x_1^22 - x_1^21 - 2*x_1^20 - x_1^19 + x_1^17 +
x_1^16 + x_1^15 + x_1^13 - x_1^12 - x_1^10 - x_1^9 - x_1^8 + x_1^6 +
2*x_1^5 + x_1^4 - x_1^3 - x_1^2 - x_1 + 1)
sage: type(ms.sage())
<class 'sage.rings.fraction_field_element.FractionFieldElement'>

I'm working on https://trac.sagemath.org/ticket/26902 (fixing
character tables would be a part of it) - and it needs more hands.
Dima
>
> Best,
> Travis
>
>
> On Friday, December 9, 2022 at 8:55:15 AM UTC+9 guru....@gmail.com wrote:
>>
>> Hi,
>> i ran into a bug while trying to compute the molien series of a permutation group.
>>
>> SageMath version 9.3, Release Date: 2021-05-09, Using Python 3.7.10.
>> Operating system: Windows 11, 64-bit
>>
>> It works fine for most permutation groups but calling:
>>
>> PermutationGroup(["(1,2,3,4,5,6,7)","(5,6,7)"]).molien_series()
>>
>> gives an GAP Error which doesn't make sense to me in the given context.
>>
>> GAPError: Error, ^ cannot be used here to compute roots (use `RootInt' instead?)
>>
>> Similar examples which also produce the same bug are:
>>
>> PermutationGroup(["(1,2,3,4,5,7)","(5,6,7)"]).molien_series()
>> PermutationGroup(["(1,2,3,4,7)","(5,6,7)"]).molien_series()
>> PermutationGroup(["(1,2,3,4,7)","(5,7,8)"]).molien_series()
>>
>> Thanks for looking into it.
>> Kind regards,
>> Jonas
>>
>>
> --
> You received this message because you are subscribed to the Google Groups "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/2c1fcce4-946f-43cd-9ae4-a04c73434192n%40googlegroups.com.

Travis Scrimshaw

unread,
Dec 12, 2022, 6:58:34 PM12/12/22
to sage-devel
The entire computation in PermutationGroup.molien_series() all appears to be done in libgap. Sage's wrapper around characters is never really invoked at all AFAICS. Here is a curious data point:

sage: PG = PermutationGroup(["(1,2,3,4,5,6,7)","(5,6,7)"])
sage: g = PG._libgap_()
sage: pi = g.NaturalCharacter()
sage: pi += g.TrivialCharacter() * len(PG.fixed_points())
sage: pi2 = libgap.VirtualCharacter(g.CharacterTable(), pi)
sage: pi2.MolienSeries()

( 1-z^3+z^6-z^9+z^12-z^15+z^18 ) / ( (1-z^7)*(1-z^5)*(1-z^4)*(1-z^3)^2*(1-z^2)*(1-z) )
sage: PG.molien_series()
(-x^18 + x^15 - x^12 + x^9 - x^6 + x^3 - 1)/(x^25 - x^24 - x^23 - x^22 + x^21 + 2*x^20 + x^19 - x^17 - x^16 - x^15 - x^13 + x^12 + x^10 + x^9 + x^8 - x^6 - 2*x^5 - x^4 + x^3 + x^2 + x - 1)

I just ran the code in PG.molien_series() directly first, and then calling it now works.

Best,
Travis

Dima Pasechnik

unread,
Dec 17, 2022, 9:02:09 AM12/17/22
to sage-devel


On Mon, 12 Dec 2022, 23:58 'Travis Scrimshaw' via sage-devel, <sage-...@googlegroups.com> wrote:
The entire computation in PermutationGroup.molien_series() all appears to be done in libgap. Sage's wrapper around characters is never really invoked at all AFAICS. Here is a curious data point:

sage: PG = PermutationGroup(["(1,2,3,4,5,6,7)","(5,6,7)"])
sage: g = PG._libgap_()
sage: pi = g.NaturalCharacter()
sage: pi += g.TrivialCharacter() * len(PG.fixed_points())
sage: pi2 = libgap.VirtualCharacter(g.CharacterTable(), pi)
sage: pi2.MolienSeries()
( 1-z^3+z^6-z^9+z^12-z^15+z^18 ) / ( (1-z^7)*(1-z^5)*(1-z^4)*(1-z^3)^2*(1-z^2)*(1-z) )
sage: PG.molien_series()
(-x^18 + x^15 - x^12 + x^9 - x^6 + x^3 - 1)/(x^25 - x^24 - x^23 - x^22 + x^21 + 2*x^20 + x^19 - x^17 - x^16 - x^15 - x^13 + x^12 + x^10 + x^9 + x^8 - x^6 - 2*x^5 - x^4 + x^3 + x^2 + x - 1)

I just ran the code in PG.molien_series() directly first, and then calling it now works.

I can't reproduce this, to me it Molien series of a virtual character breaks.
sage: PG = PermutationGroup(["(1,2,3,4,5,6,7)","(5,6,7)"])
sage: pi = PG._libgap_().NaturalCharacter()
sage: M = libgap.VirtualCharacter(PG._libgap_().CharacterTable(), pi).MolienSeries()
---------------------------------------------------------------------------
GAPError                                  Traceback (most recent call last)
Cell In [6], line 1
----> 1 M = libgap.VirtualCharacter(PG._libgap_().CharacterTable(), pi).MolienSeries()

File /mnt/opt/Sage/sage-dev/src/sage/libs/gap/element.pyx:2678, in sage.libs.gap.element.GapElement_MethodProxy.__call__()
   2676     return GapElement_Function.__call__(self, * ([self.first_argument] + list(args)))
   2677 else:
-> 2678     return GapElement_Function.__call__(self, self.first_argument)
   2679
   2680

File /mnt/opt/Sage/sage-dev/src/sage/libs/gap/element.pyx:2524, in sage.libs.gap.element.GapElement_Function.__call__()
   2522 try:
   2523     sig_GAP_Enter()
-> 2524     sig_on()
   2525     if n == 0:
   2526         result = CALL_0ARGS(self.value)


GAPError: Error, ^ cannot be used here to compute roots (use `RootInt' instead?)
sage: pi.MolienSeries()

( 1-z^3+z^6-z^9+z^12-z^15+z^18 ) / ( (1-z^7)*(1-z^5)*(1-z^4)*(1-z^3)^2*(1-z^2)*(1-z) )

I also don't understand what it means mathematically, Molien series of a virtual character. Is it just the difference of Molien
series of the respective characters?
Why do you even need a virtual character here - you have a "normal" character.
GAP docs are silent on whether this works, and it seems it does not, at least in GAP 4.12:

gap> v:=VirtualCharacter(CharacterTable(PG),-pi);
VirtualCharacter( CharacterTable( Alt( [ 1 .. 7 ] ) ), [ -7, 0, 0, -3, -1, -1, -4, 0, -2 ] )
gap> MolienSeries(v); # this hangs for me - so it's a GAP bug, they should check it out

As to your example, it might be some caching in (lib)GAP that trips you up: in GAP docs you see
"The  return  value  of  MolienSeries  stores a value for the attribute MolienSeriesInfo (72.12-2)."




Dima Pasechnik

unread,
Dec 17, 2022, 9:49:40 AM12/17/22
to sage-devel

Dima Pasechnik

unread,
Dec 17, 2022, 2:42:34 PM12/17/22
to sage-devel
On Sat, Dec 17, 2022 at 2:49 PM Dima Pasechnik <dim...@gmail.com> wrote:
>
> See https://trac.sagemath.org/ticket/34854 to fix this.

Ready for review

Dima Pasechnik

unread,
Jan 16, 2023, 9:22:23 AM1/16/23
to sage-devel
On Saturday, December 17, 2022 at 7:42:34 PM UTC Dima Pasechnik wrote:
On Sat, Dec 17, 2022 at 2:49 PM Dima Pasechnik <dim...@gmail.com> wrote:
>
> See https://trac.sagemath.org/ticket/34854 to fix this.

has been merged, should be in Sage 9.8. 
Reply all
Reply to author
Forward
0 new messages