Hi,
I'm having a problem in GAP when I attempt to assign entries
to lists. Apparently my problem is due to the way GAP makes
assignments. I've read the section on Lists in the GAP manual, but I
am still struggling to understand this. (I apologize in advance for
asking a question apparently covered in the manual!)
Explicitly -- I don't understand why the following loops give
different answers. The first example creates the array
[[1,2,3,4][5,6,7,8]] while the second does not.
Why?
(I am running GAP 4.1 on a Macintosh G3 laptop -- if that matters.)
---- GAP program ------------ #Filling in an array -- example 1 mat := [[0,0,0,0], [0,0,0,0]]; Print( mat, "\n" ); entry := 0; for i1 in [1..2] do for i2 in [1..4] do entry := entry + 1; mat[i1][i2] := entry; mat2 := mat; Print( mat, "\n" ); od; od; Print("\n"); #Filling in an array -- example 2 zero_1 := ListWithIdenticalEntries( 4, 0 ); mat := ListWithIdenticalEntries( 2, zero_1 ); Print( mat, "\n" ); entry := 0; for i1 in [1..2] do for i2 in [1..4] do entry := entry + 1; mat[i1][i2] := entry; mat2 := mat; Print( mat, "\n" ); od; od; ------
The real problem I am working on attempts to create
3-dimensional t x r x c arrays for various abelian groups of rank 3,
so the programming is more complicated than this simple example.
However, I think an explanation of this small example would be very
helpful.
Thanks, Ken -- Ken W. Smith, Professor of Mathematics, Central Michigan University Phone: 517-774-6521; Fax: 517-774-2414; home phone: 772-5042.