Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

advertise for libgap in src/doc #38656

Merged
merged 4 commits into from
Sep 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/doc/de/tutorial/interactive_shell.rst
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,9 @@ dem man nachgehen sollte.
sage: time g = maple('1938^99484')
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 0.11
sage: gap(0)
sage: libgap(0)
0
sage: time g = gap.eval('1938^99484;;')
sage: time g = libgap.eval('1938^99484;')
CPU times: user 0.00 s, sys: 0.00 s, total: 0.00 s
Wall time: 1.02

Expand Down Expand Up @@ -742,7 +742,7 @@ nicht erlaubt.

::

sage: a = gap(2)
sage: a = libgap(2)
sage: a.save('a')
sage: load('a')
Traceback (most recent call last):
Expand Down
52 changes: 23 additions & 29 deletions src/doc/en/constructions/groups.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,31 +124,25 @@ You can compute conjugacy classes of a finite group using "natively"::

You can use the Sage-GAP interface::

sage: gap.eval("G := Group((1,2)(3,4),(1,2,3))")
'Group([ (1,2)(3,4), (1,2,3) ])'
sage: gap.eval("CG := ConjugacyClasses(G)")
'[ ()^G, (2,3,4)^G, (2,4,3)^G, (1,2)(3,4)^G ]'
sage: gap.eval("gamma := CG[3]")
'(2,4,3)^G'
sage: gap.eval("g := Representative(gamma)")
'(2,4,3)'
sage: libgap.eval("G := Group((1,2)(3,4),(1,2,3))")
Group([ (1,2)(3,4), (1,2,3) ])
sage: libgap.eval("CG := ConjugacyClasses(G)")
[ ()^G, (2,3,4)^G, (2,4,3)^G, (1,2)(3,4)^G ]
sage: libgap.eval("gamma := CG[3]")
(2,4,3)^G
sage: libgap.eval("g := Representative(gamma)")
(2,4,3)

Or, here's another (more "pythonic") way to do this type of computation::

sage: G = gap.Group('[(1,2,3), (1,2)(3,4), (1,7)]')
sage: G = libgap.eval("Group([(1,2,3), (1,2)(3,4), (1,7)])")
sage: CG = G.ConjugacyClasses()
sage: gamma = CG[2]
sage: g = gamma.Representative()
sage: CG; gamma; g
[ ConjugacyClass( SymmetricGroup( [ 1, 2, 3, 4, 7 ] ), () ),
ConjugacyClass( SymmetricGroup( [ 1, 2, 3, 4, 7 ] ), (4,7) ),
ConjugacyClass( SymmetricGroup( [ 1, 2, 3, 4, 7 ] ), (3,4,7) ),
ConjugacyClass( SymmetricGroup( [ 1, 2, 3, 4, 7 ] ), (2,3)(4,7) ),
ConjugacyClass( SymmetricGroup( [ 1, 2, 3, 4, 7 ] ), (2,3,4,7) ),
ConjugacyClass( SymmetricGroup( [ 1, 2, 3, 4, 7 ] ), (1,2)(3,4,7) ),
ConjugacyClass( SymmetricGroup( [ 1, 2, 3, 4, 7 ] ), (1,2,3,4,7) ) ]
ConjugacyClass( SymmetricGroup( [ 1, 2, 3, 4, 7 ] ), (4,7) )
(4,7)
[ ()^G, (4,7)^G, (3,4,7)^G, (2,3)(4,7)^G, (2,3,4,7)^G, (1,2)(3,4,7)^G, (1,2,3,4,7)^G ]
(3,4,7)^G
(3,4,7)

.. index::
pair: group; normal subgroups
Expand All @@ -162,29 +156,29 @@ If you want to find all the normal subgroups of a permutation group
:math:`G` (up to conjugacy), you can use Sage's interface to GAP::

sage: G = AlternatingGroup( 5 )
sage: gap(G).NormalSubgroups()
[ AlternatingGroup( [ 1 .. 5 ] ), Group( () ) ]
sage: libgap(G).NormalSubgroups()
[ Alt( [ 1 .. 5 ] ), Group(()) ]

or

::

sage: G = gap("AlternatingGroup( 5 )")
sage: G = libgap.AlternatingGroup( 5 )
sage: G.NormalSubgroups()
[ AlternatingGroup( [ 1 .. 5 ] ), Group( () ) ]
[ Alt( [ 1 .. 5 ] ), Group(()) ]

Here's another way, working more directly with GAP::

sage: print(gap.eval("G := AlternatingGroup( 5 )"))
sage: libgap.eval("G := AlternatingGroup( 5 )")
Alt( [ 1 .. 5 ] )
sage: print(gap.eval("normal := NormalSubgroups( G )"))
sage: libgap.eval("normal := NormalSubgroups( G )")
[ Alt( [ 1 .. 5 ] ), Group(()) ]
sage: G = gap.new("DihedralGroup( 10 )")
sage: G = libgap.eval("DihedralGroup( 10 )")
sage: G.NormalSubgroups().SortedList()
[ Group( <identity> of ... ), Group( [ f2 ] ), Group( [ f1, f2 ] ) ]
sage: print(gap.eval("G := SymmetricGroup( 4 )"))
[ Group([ ]), Group([ f2 ]), <pc group of size 10 with 2 generators> ]
sage: libgap.eval("G := SymmetricGroup( 4 )")
Sym( [ 1 .. 4 ] )
sage: print(gap.eval("normal := NormalSubgroups( G );"))
sage: libgap.eval("normal := NormalSubgroups( G );")
[ Sym( [ 1 .. 4 ] ), Alt( [ 1 .. 4 ] ), Group([ (1,4)(2,3), ... ]),
Group(()) ]

Expand All @@ -201,7 +195,7 @@ How do you compute the center of a group in Sage?
Although Sage calls GAP to do the computation of the group center,
``center`` is "wrapped" (i.e., Sage has a class PermutationGroup with
associated class method "center"), so the user does not need to use
the ``gap`` command. Here's an example::
the ``libgap`` command. Here's an example::

sage: G = PermutationGroup(['(1,2,3)(4,5)', '(3,4)'])
sage: G.center()
Expand Down
2 changes: 1 addition & 1 deletion src/doc/en/constructions/interface_issues.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ Sage and other computer algebra systems

If ``foo`` is a Pari, GAP ( without ending semicolon), Singular,
Maxima command, resp., enter ``gp("foo")`` for Pari,
``gap.eval("foo")}`` ``singular.eval("foo")``, ``maxima("foo")``, resp..
``libgap.eval("foo")}`` ``singular.eval("foo")``, ``maxima("foo")``, resp..
These programs merely send the command string to the external
program, execute it, and read the result back into Sage. Therefore,
these will not work if the external program is not installed and in
Expand Down
6 changes: 3 additions & 3 deletions src/doc/en/constructions/linear_algebra.rst
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,11 @@ Finally, you can use Sage's GAP interface as well to compute

::

sage: print(gap.eval("A := [[1,2,3],[4,5,6],[7,8,9]]"))
sage: A = libgap([[1,2,3],[4,5,6],[7,8,9]]); A
[ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ]
sage: print(gap.eval("v := Eigenvectors( Rationals,A)"))
sage: libgap(QQ).Eigenvectors(A)
[ [ 1, -2, 1 ] ]
sage: print(gap.eval("lambda := Eigenvalues( Rationals,A)"))
sage: libgap(QQ).Eigenvalues(A)
[ 0 ]

.. _section-rref:
Expand Down
25 changes: 13 additions & 12 deletions src/doc/en/constructions/polynomials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,24 @@ Another approach to this:
sage: a = S.gen()
sage: a^20062006
80*a
sage: print(gap.eval("R:= PolynomialRing( GF(97))"))
sage: libgap.eval("R:= PolynomialRing( GF(97))")
GF(97)[x_1]
sage: print(gap.eval("i:= IndeterminatesOfPolynomialRing(R)"))
sage: libgap.eval("i:= IndeterminatesOfPolynomialRing(R)")
[ x_1 ]
sage: gap.eval("x:= i[1];; f:= x;;")
''
sage: print(gap.eval("PowerMod( R, x, 20062006, x^3+7 );"))
sage: libgap.eval("x:= i[1]"); libgap.eval("f:= x;")
x_1
x_1
sage: libgap.eval("PowerMod( R, x, 20062006, x^3+7 );")
Z(97)^41*x_1
sage: print(gap.eval("PowerMod( R, x, 20062006, x^3+7 );"))
sage: libgap.eval("PowerMod( R, x, 20062006, x^3+7 );")
Z(97)^41*x_1
sage: print(gap.eval("PowerMod( R, x, 2006200620062006, x^3+7 );"))
sage: libgap.eval("PowerMod( R, x, 2006200620062006, x^3+7 );")
Z(97)^4*x_1^2
sage: a^2006200620062006
43*a^2
sage: print(gap.eval("PowerMod( R, x, 2006200620062006, x^3+7 );"))
sage: libgap.eval("PowerMod( R, x, 2006200620062006, x^3+7 );")
Z(97)^4*x_1^2
sage: print(gap.eval("Int(Z(97)^4)"))
sage: libgap.eval("Int(Z(97)^4)")
43

.. index::
Expand Down Expand Up @@ -136,11 +137,11 @@ interface.

::

sage: R = gap.PolynomialRing(gap.GF(2)); R
PolynomialRing( GF(2), ["x_1"] )
sage: R = libgap.PolynomialRing(GF(2)); R
GF(2)[x_1]
sage: i = R.IndeterminatesOfPolynomialRing(); i
[ x_1 ]
sage: x_1 = i[1]
sage: x_1 = i[0]
sage: f = (x_1^3 - x_1 + 1)*(x_1 + x_1^2); f
x_1^5+x_1^4+x_1^3+x_1
sage: g = (x_1^3 - x_1 + 1)*(x_1 + 1); g
Expand Down
72 changes: 36 additions & 36 deletions src/doc/en/constructions/rep_theory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Sage-GAP interface can be used to compute character tables.
You can construct the table of character values of a permutation
group :math:`G` as a Sage matrix, using the method
``character_table`` of the PermutationGroup class, or via the
pexpect interface to the GAP command ``CharacterTable``.
interface to the GAP command ``CharacterTable``.

::

Expand All @@ -29,8 +29,8 @@ pexpect interface to the GAP command ``CharacterTable``.
[ 1 -1 1 -1 1]
[ 1 1 -1 -1 1]
[ 2 0 0 0 -2]
sage: CT = gap(G).CharacterTable()
sage: print(gap.eval("Display(%s)"%CT.name()))
sage: CT = libgap(G).CharacterTable()
sage: CT.Display()
CT1
<BLANKLINE>
2 3 2 2 2 3
Expand All @@ -55,11 +55,10 @@ Here is another example:
[ 1 -zeta3 - 1 zeta3 1]
[ 1 zeta3 -zeta3 - 1 1]
[ 3 0 0 -1]
sage: gap.eval("G := Group((1,2)(3,4),(1,2,3))")
'Group([ (1,2)(3,4), (1,2,3) ])'
sage: gap.eval("T := CharacterTable(G)")
'CharacterTable( Alt( [ 1 .. 4 ] ) )'
sage: print(gap.eval("Display(T)"))
sage: G = libgap.eval("Group((1,2)(3,4),(1,2,3))"); G
Group([ (1,2)(3,4), (1,2,3) ])
sage: T = G.CharacterTable()
sage: T.Display()
CT2
<BLANKLINE>
2 2 . . 2
Expand All @@ -82,28 +81,30 @@ denotes a square root of :math:`-3`, say :math:`i\sqrt{3}`, and
:math:`b3 = \frac{1}{2}(-1+i \sqrt{3})`. Note the added ``print``
Python command. This makes the output look much nicer.

.. link

::

sage: print(gap.eval("irr := Irr(G)"))
sage: irr = G.Irr(); irr
[ Character( CharacterTable( Alt( [ 1 .. 4 ] ) ), [ 1, 1, 1, 1 ] ),
Character( CharacterTable( Alt( [ 1 .. 4 ] ) ), [ 1, E(3)^2, E(3), 1 ] ),
Character( CharacterTable( Alt( [ 1 .. 4 ] ) ), [ 1, E(3), E(3)^2, 1 ] ),
Character( CharacterTable( Alt( [ 1 .. 4 ] ) ), [ 3, 0, 0, -1 ] ) ]
sage: print(gap.eval("Display(irr)"))
sage: irr.Display()
[ [ 1, 1, 1, 1 ],
[ 1, E(3)^2, E(3), 1 ],
[ 1, E(3), E(3)^2, 1 ],
[ 3, 0, 0, -1 ] ]
sage: gap.eval("CG := ConjugacyClasses(G)")
'[ ()^G, (2,3,4)^G, (2,4,3)^G, (1,2)(3,4)^G ]'
sage: gap.eval("gamma := CG[3]")
'(2,4,3)^G'
sage: gap.eval("g := Representative(gamma)")
'(2,4,3)'
sage: gap.eval("chi := irr[2]")
'Character( CharacterTable( Alt( [ 1 .. 4 ] ) ), [ 1, E(3)^2, E(3), 1 ] )'
sage: gap.eval("g^chi")
'E(3)'
sage: CG = G.ConjugacyClasses(); CG
[ ()^G, (2,3,4)^G, (2,4,3)^G, (1,2)(3,4)^G ]
sage: gamma = CG[2]; gamma
(2,4,3)^G
sage: g = gamma.Representative(); g
(2,4,3)
sage: chi = irr[1]; chi
Character( CharacterTable( Alt( [ 1 .. 4 ] ) ), [ 1, E(3)^2, E(3), 1 ] )
sage: g^chi
E(3)

This last quantity is the value of the character ``chi`` at the group
element ``g``.
Expand All @@ -117,11 +118,11 @@ table prints nicely.

sage: %Pprint
Pretty printing has been turned OFF
sage: gap.eval("G := Group((1,2)(3,4),(1,2,3))")
'Group([ (1,2)(3,4), (1,2,3) ])'
sage: gap.eval("T := CharacterTable(G)")
'CharacterTable( Alt( [ 1 .. 4 ] ) )'
sage: gap.eval("Display(T)")
sage: G = libgap.eval("Group((1,2)(3,4),(1,2,3))"); G
Group([ (1,2)(3,4), (1,2,3) ])
sage: T = G.CharacterTable(); T
CharacterTable( Alt( [ 1 .. 4 ] ) )
sage: T.Display()
CT3
<BLANKLINE>
2 2 2 . .
Expand All @@ -138,12 +139,12 @@ table prints nicely.
<BLANKLINE>
A = E(3)^2
= (-1-Sqrt(-3))/2 = -1-b3
sage: gap.eval("irr := Irr(G)")
sage: irr = G.Irr(); irr
[ Character( CharacterTable( Alt( [ 1 .. 4 ] ) ), [ 1, 1, 1, 1 ] ),
Character( CharacterTable( Alt( [ 1 .. 4 ] ) ), [ 1, 1, E(3)^2, E(3) ] ),
Character( CharacterTable( Alt( [ 1 .. 4 ] ) ), [ 1, 1, E(3), E(3)^2 ] ),
Character( CharacterTable( Alt( [ 1 .. 4 ] ) ), [ 3, -1, 0, 0 ] ) ]
sage: gap.eval("Display(irr)")
sage: irr.Display()
[ [ 1, 1, 1, 1 ],
[ 1, 1, E(3)^2, E(3) ],
[ 1, 1, E(3), E(3)^2 ],
Expand All @@ -162,15 +163,15 @@ Brauer characters

The Brauer character tables in GAP do not yet have a "native"
interface. To access them you can directly interface with GAP using
pexpect and the ``gap.eval`` command.
the ``libgap.eval`` command.

The example below using the GAP interface illustrates the syntax.

::

sage: print(gap.eval("G := Group((1,2)(3,4),(1,2,3))"))
sage: G = libgap.eval("Group((1,2)(3,4),(1,2,3))"); G
Group([ (1,2)(3,4), (1,2,3) ])
sage: print(gap.eval("irr := IrreducibleRepresentations(G,GF(7))")) # random arch. dependent output
sage: irr = G.IrreducibleRepresentations(GF(7)); irr # random arch. dependent output
[ [ (1,2)(3,4), (1,2,3) ] -> [ [ [ Z(7)^0 ] ], [ [ Z(7)^4 ] ] ],
[ (1,2)(3,4), (1,2,3) ] -> [ [ [ Z(7)^0 ] ], [ [ Z(7)^2 ] ] ],
[ (1,2)(3,4), (1,2,3) ] -> [ [ [ Z(7)^0 ] ], [ [ Z(7)^0 ] ] ],
Expand All @@ -179,16 +180,15 @@ The example below using the GAP interface illustrates the syntax.
[ Z(7), Z(7)^5, Z(7)^2 ] ],
[ [ 0*Z(7), Z(7)^0, 0*Z(7) ], [ 0*Z(7), 0*Z(7), Z(7)^0 ],
[ Z(7)^0, 0*Z(7), 0*Z(7) ] ] ] ]
sage: gap.eval("brvals := List(irr,chi->List(ConjugacyClasses(G),c->BrauerCharacterValue(Image(chi,Representative(c)))))")
''
sage: print(gap.eval("Display(brvals)")) # random architecture dependent output
sage: brvals = [[chi.Image(c.Representative()).BrauerCharacterValue()
....: for c in G.ConjugacyClasses()] for chi in irr]
sage: brvals # random architecture dependent output
[ [ 1, 1, E(3)^2, E(3) ],
[ 1, 1, E(3), E(3)^2 ],
[ 1, 1, 1, 1 ],
[ 3, -1, 0, 0 ] ]
sage: print(gap.eval("T := CharacterTable(G)"))
CharacterTable( Alt( [ 1 .. 4 ] ) )
sage: print(gap.eval("Display(T)"))
sage: T = G.CharacterTable()
sage: T.Display()
CT3
<BLANKLINE>
2 2 . . 2
Expand Down
13 changes: 5 additions & 8 deletions src/doc/en/constructions/rings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,13 @@ Here is another approach using GAP:

::

sage: R = gap.new("PolynomialRing(GF(97), 4)"); R
PolynomialRing( GF(97), ["x_1", "x_2", "x_3", "x_4"] )
sage: R = libgap.PolynomialRing(GF(97), 4); R
GF(97)[x_1,x_2,x_3,x_4]
sage: I = R.IndeterminatesOfPolynomialRing(); I
[ x_1, x_2, x_3, x_4 ]
sage: vars = (I.name(), I.name(), I.name(), I.name())
sage: _ = gap.eval(
....: "x_0 := %s[1];; x_1 := %s[2];; x_2 := %s[3];;x_3 := %s[4];;"
....: % vars)
sage: f = gap.new("x_1*x_2+x_3"); f
x_2*x_3+x_4
sage: x1, x2, x3, x4 = I
sage: f = x1*x2 + x3; f
x_1*x_2+x_3
sage: f.Value(I,[1,1,1,1])
Z(97)^34

Expand Down
Loading
Loading