[GAP Forum] simple programming problem

meinpaidmailaccount at gmx.de meinpaidmailaccount at gmx.de
Fri Aug 18 19:17:37 BST 2006


I apologize I have to use this list for a rather simple problem, but I can't seem to understand my mistake.

I would like to generate certain square matrices, say in dimension 4, whose 1st and 2nd vectors are already known and, and they have to obey to certain rules. I try to go through vectors in a list called "lstvecs" in order to fill in the 3rd and 4th vector of the matrix x, and, once checked if the rules are fulfilled, would like to append x to a list "listx".
Now here is where comes trouble... For some reason, the generated list will have always the SAME matrix as its enries, whereas while still in the loop, the entries are -obviously- equal to the matrices x.

I would be glad for any hint on what's going wrong here!!

Sincerely, Eva



Here is the fragment I'm talking about:




listx := [];


x := [];
x[1] := [1,0,0,0];
x[2] := [0,1,0,0] * (Z(char)^0);

i := 1;
for a in lstvecs do
   
  if (a <> x[1] and a <> x[2] * (Z(char)^0) and a <> [0,0,0,0] *
    (Z(char)^0) ) then 
     
     x[3] := a;

     for b in lstvecs do
       if (b <> x[1] and b <> [0,0,0,0] * (Z(char)^0) and b <> x[1] and 
         b <> x[3]) then
 
          if Determinant([x[1], x[2], x[3], b]) <> 0 * (Z(char)^0) then
           
            x[4] := b;
            Add(listx,x);

          fi;
       fi;
     od;

  fi;
od;



-- 


Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer



More information about the Forum mailing list