0
DeclareOperation("helpfunction", [IsList]);
InstallMethod(helpfunction, "for a representation of a quiver",[IsList],0,function(L)
local list, n, i, j, f, temp, temp2, temp3, u;

  n:=L[1];
  s:=L[2];
  l:=L[3];

  A:=GroupRing(GF(3),SymmetricGroup(n));
  temp:=[];
  r:=Identity(A);

  for i in [1..l-1] do
    r:=r+s^i;
  od;
  return(r);
end);

This works:

gap> helpfunction([3,(1,2),4]);
(Z(3))*()+(Z(3))*(1,2)

But now I use it:

DeclareOperation("helpfunction2", [IsList]);
InstallMethod(helpfunction2, "for a representation of a quiver",[IsList],0,function(L)
local list, n, i, j, f, temp, temp2, temp3, u;

  x:=L[1];
  n:=L[2];
  A:=SymmetricGroup(n);
  U:=Size(Elements(A));
  temp:=[];
  for i in [1..U] do
    Append(temp,[helpfunction([n,x,i])]);
  od;
  return(temp);
end);

This works as well alone:

gap> helpfunction2([(1,3),3]);
[ (Z(3)^0)*(), (Z(3)^0)*()+(Z(3)^0)*(1,3), (Z(3))*()+(Z(3)^0)*(1,3), 
  (Z(3))*()+(Z(3))*(1,3), (Z(3))*(1,3), <zero> of ... ]

Now the next things do not work:

gap> B:=SymmetricGroup(3);
Sym( [ 1 .. 3 ] )
gap> A:=GroupRing(GF(3),B);
<algebra-with-one over GF(3), with 2 generators>
gap> W:=Subspace(A,helpfunction2([(1,3),3]));

Error, first argument must be a left module, second a collection
 called from <function "Submodule">( <arguments> )

called from read-eval loop at line 1823 of stdin

So what did I do wrong? Somehow it seems the list is not regocnized as a subset of A.

ahulpke
  • 18,416
  • 1
  • 21
  • 38
Mare
  • 2,332
  • OK. I've had questions and answers here that I could not understand any part of, but a program? Give me a break! – marty cohen Jan 23 '17 at 23:11
  • well this site has a gap tag – Mare Jan 23 '17 at 23:17
  • 2
    As far as I can surmise from the atrocious formatting, the issue is that your helpfunction creates a new group ring $A$ every time. GAP will not consider them as compatible objects. You need to create this ring once at the start and then always use the identity of this same ring to create elements. – ahulpke Jan 24 '17 at 01:10
  • thanks, that was the mistake. – Mare Jan 24 '17 at 09:17
  • @ahulpke Please consider converting your comment into an answer, so that this question gets removed from the unanswered queue. – Olexandr Konovalov Sep 29 '18 at 22:56

1 Answers1

3

The issue is that your helpfunction creates a new group ring $A$ every time it is called. GAP will not consider these rings as different, incompatible objects. You need to create this ring once at the start of your calculation and then always use the identity of this same ring to create elements.

ahulpke
  • 18,416
  • 1
  • 21
  • 38