This interface is extremely flexible, since it's exactly like typing into the GAP interpreter, and anything that works there should work here. Unfortunately, it's sometimes much slower than using C-library calls.
pexpect
module must be installed, which is not standard
with Python (but is included with SAGE), and the gap
command
must be in your path.
AUTHORS: David Joyner and William Stein
sage: import sage.interfaces.gap as gap sage: Gap = gap.GAP() sage: i = "G:=Group((1,2),(1,2,3));" sage: Gap(i) 'Group([ (1,2), (1,2,3) ])' sage: i = "Size(G);" sage: Gap(i) '6'
Next we give a Groebner basis example via GAP. This will not work unless the GAP singular package is installed and correctly configured.
sage: i = 'LoadPackage("singular");' sage: o = Gap(i) sage: i = 'R:= PolynomialRing( Rationals, ["x","y","z"] );;' sage: o = Gap(i) sage: i = 'i:= IndeterminatesOfPolynomialRing(R);;' sage: o = Gap(i) sage: i = "x:= i[1];; y:= i[2];; z:= i[3];;" sage: o = Gap(i) sage: i = "r:= [ x*y*z -x^2*z, x^2*y*z-x*y^2*z-x*y*z^2, x*y-x*z-y*z];;" sage: o = Gap(i) sage: i = "I:= Ideal( R, r );;" sage: o = Gap(i) sage: i = "GroebnerBasis( I );" sage: o = Gap(i) sage: print o
The module sage.interfaces.gap defines the following classes: