Hello!
During my recent work with GAP I have been using polynomials and
Laurent polynomials a lot, and I often found the output of GAP
somewhat difficult to read. This is particularly true if finite fields
are involved.
Since no single way of printing things can be correct for all
applications, I suggest that different ways of printing objects be
implemented in GAP. This could for instance be done by means of a
global variable PrintLevel that controls the "exactness" of the
output.
For example, consider how gap outputs various polynomials:
gap> x := Indeterminate(Integers); X(Integers) gap> x.name := "x"; "x" gap> v := [0*x, x^0, x, x^2 + x + 1]; [ 0*x^0, x^0, x, x^2 + x + 1 ]
Let's call this PrintLevel=2.
At PrintLevel=1, I could imagine the following output:
gap> v; [ 0, 1, x, x^2 + x + 1 ]
This would be more readable than the output above but would of course
not clearly show the fact that "0" and "1" are not integers but
polynomials over integers. I'd nevertheless much prefer this output
when dealing with matrices of polynomials, since the zeros and ones
would be a lot easier to see.
On the other hand, at PrintLevel=3, I'd like to see the following
output:
gap> v;
[Polynomial(Integers,[]), Polynomial(Integers,[1]),
Polynomial(Integers,[0,1]), Polynomial(Integers,[1,1,1])]
This could be useful for saving things in files and reading them back
into GAP. I have found that reading polynomials represented this way
is much more efficient than reading the current output of
GAP. Furthermore, this representation is independent from the name of
the indeterminate.
I can think of similar examples for elements of finite fields. At
PrintLevel=1, elements of prime fields could simply be output as
integers in the range 0..p-1. Instead of GAP's current (a little
inconsistent) output:
gap> x := Indeterminate(GF(17)); X(GF(17)) gap> x.name := "x"; "x" gap> x+x; Z(17)^14*x gap> x+x+x^2; Z(17)^0*(x^2 + 2*x)
I would like to see this at PrintLevel=2:
gap> x+x; Z(17)^14*x gap> x+x+x^2; x^2 + Z(17)^14*x gap> 20*x; Z(17)*x
and this at PrintLevel=1:
gap> x+x; 2*x gap> x+x+x^2; x^2 + 2*x gap> 20*x; 3*x
Maybe the designers of GAP can think of a more elegant way for
selecting the desired type of output (instead of a global variable).
Thanks for taking the time to read this longish suggestion.
hwb
-- Harald Boegeholz | hwb@mathematik.uni-stuttgart.de | os2a@ftp.uni-stuttgart.de