> < ^ Date: Mon, 25 Oct 1999 10:39:39 +0100
> < ^ From: Steve Linton <sal@dcs.st-and.ac.uk >
> < ^ Subject: Re: matrices

Dear GAP Forum,

Kurt Ewald asks:

I have
gap> x:=GL(3,3);
GL(3,3)
gap> Random(x);
[ [ Z(3)^0, Z(3)^0, Z(3)^0 ], [ Z(3)^0, Z(3), Z(3) ],
  [ 0*Z(3), Z(3)^0, Z(3) ] ]
Is there a command to get the matrix in a quadratic form as:
[ Z(3)^0, Z(3)^0, Z(3)^0 ]
[ Z(3)^0, Z(3), Z(3) ]
[ 0*Z(3), Z(3)^0, Z(3) ] 

I assume that by "quadratic form" you are simply seeking a more pleasing
layout.

There are two possible solutions.

Firstly as Dmitrii Pasechnik has already suggested, you can use the PrintArray
function, to get a tabular layout of a list of lists.

Secondly, you can use the general GAP4 procedure Display() which is intended
to display any object in a formatted way for a human reader (which is
typically not parseable by GAP). We are still adding methods for Display'ing
different sorts of objects as we think of them, and have the time.

For example:

gap> x:=GL(3,3);
GL(3,3)
gap> Random(x);
[ [ Z(3), Z(3), Z(3)^0 ], [ Z(3), Z(3)^0, Z(3)^0 ], 
  [ Z(3)^0, Z(3)^0, 0*Z(3) ] ]
gap> Display(last);
 2 2 1
 2 1 1
 1 1 .
gap> PrintArray(last);
[ [    Z(3),    Z(3),  Z(3)^0 ],
  [    Z(3),  Z(3)^0,  Z(3)^0 ],
  [  Z(3)^0,  Z(3)^0,  0*Z(3) ] ]

Steve


> < [top]