Dear Gap-Forum,
Okada Sou asked:
I encountered one strange behavior of GAP4 4r2 fix4. That is gap>W:=[[1,1,1],[1, E(3), E(3)^2],[1,E(3)^2,E(3)]];; gap>Sum([[1,2]],i-> W{[i]}); [[1,1,1],[1,E(3),E(3)^2]]
In this form as you give it, the input produces an error on my machine.
However I believe you might have gotten distracted by the number of
different brackets and ways of indexing:
gap> Sum([1,2],i-> W[i]); [ 2, -E(3)^2, -E(3) ] produces the sum of the first two rows of W: W[1]+W[2]. I suppose this is what you want. gap> Sum([1,2],i-> W{[i]}); [ [ 2, -E(3)^2, -E(3) ] ]
returns the sum W{[1]}+W{[2]}, the sum of the matrices obtained by cutting out
the first row and cutting out the second row.
gap> Sum([[1,2]],i-> W{i}); [ [ 1, 1, 1 ], [ 1, E(3), E(3)^2 ] ]
(the result you got) is a sum over only one entry (namly the index set
[1,2]). It is the matrix obtained by cutting out the first two rows of W.
As far as I can see, this behaviour is sensible and according to the
description in the manual.
Best regards,
Alexander Hulpke