Ask Your Question
1

Error in the sage online cell related to GAP

asked 2022-04-18 21:35:06 +0200

klaaa gravatar image

updated 2022-04-18 21:35:44 +0200

Typing this into the online sage cell (https://sagecell.sagemath.org/) gives an error (using the GAP language):

LoadPackage("qpa");
Q:=Quiver(3,[[1,2,"a"],[2,3,"b"]]);KQ:=PathAlgebra(GF(3),Q);AssignGeneratorVariables(KQ);rel:=[a*b];A:=KQ/rel;

But this error doesnt occur when opening GAP in a terminal and entering the code. So my question is whether there is a problem in the sage online cell related to GAP or how I can fix this.

(Is there by the way another site offering to use GAP online?)

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2022-04-25 13:17:39 +0200

nothing to do with sagecell, it can be reproduced in Sage:

gap.eval('LoadPackage("qpa");Q:=Quiver(3,[[1,2,"a"],[2,3,"b"]]);KQ:=PathAlgebra(GF(3),Q);AssignGeneratorVariables(KQ);rel:=[a*b];A:=KQ/rel;')

(enter the above as one line). So that's a bug in Sage's GAP pexpect interface. More specifically, it's in a feature that switches to using temp files for interaction as soon as lines are "too long"

sage: gap._eval_using_file_cutoff
100
sage: gap._eval_using_file_cutoff=2000
sage: gap._eval_using_file_cutoff
2000
sage: gap.eval('LoadPackage("qpa");;Q:=Quiver(3,[[1,2,"a"], 
         [2,3,"b"]]);;KQ:=PathAlgebra(GF(3),Q);;AssignGeneratorVariables(KQ);;rel:=[a*b];;A:=KQ/rel;')
 '<GF(3)[<quiver with 3 vertices and 2 arrows>]/\n<two-sided ideal in <GF(3)[<quiver with 3 vertices and 2 arrows>]>, \n  (1 generators)>>'

```

edit flag offensive delete link more
0

answered 2022-04-18 23:00:57 +0200

Emmanuel Charpentier gravatar image

updated 2022-04-25 17:41:35 +0200

Sage's gap_console() running ina terminal (in fact, emacs's sage-mode...), youtr code works ; it fails in Sagecell.

According to what I understand from the error message insagecell output, sagecell pastes the lines together and adds continuation backslashes "when it feels it".

This behaviour is probably a bug, and a ticket should be filed as such. The "right place" may be sagecell's issues page or Sage's Trac. Yelping on sage-support may get you a better direction.

EDIT : According to a sage-develthread, this problem is inherent to the pexpect Gap interface. The author of this remark says :

I won't want to touch GAP's pexpect interface...

and wraps code in a Gap function that he defines and calls once.

An analogous possible workaround :

foo = """
LoadPackage("qpa");
Q:=Quiver(3,[[1,2,"a"],[2,3,"b"]]);
KQ:=PathAlgebra(GF(3),Q);
AssignGeneratorVariables(KQ);
rel:=[a*b];
A:=KQ/rel;
"""
Res=[]
for u in foo.splitlines() : Res.append(gap.eval(u))
Res

prints :

['',
 'true',
 '<quiver with 3 vertices and 2 arrows>',
 '<GF(3)[<quiver with 3 vertices and 2 arrows>]>',
 '',
 '[ (Z(3)^0)*a*b ]',
 '<GF(3)[<quiver with 3 vertices and 2 arrows>]/\n<two-sided ideal in <GF(3)[<quiver with 3 vertices and 2 arrows>]>, \n  (1 generators)>>']

HTH,

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2022-04-18 21:35:06 +0200

Seen: 180 times

Last updated: Apr 25 '22