> < ^ Date: Sun, 24 Oct 1999 16:54:54 +0100
> < ^ From: Steve Linton <sal@dcs.st-and.ac.uk >
< ^ Subject: Re: Matrices with arbitrary elements

Dear GAP Forum,

Some time ago Sergei Haller reported problems with matrices containing

a:=Indeterminate(r, "a", vars);Add(vars, last);
b:=Indeterminate(r, "b", vars);Add(vars, last);
c:=Indeterminate(r, "c", vars);Add(vars, last);

m:=[[1,a],[0,1]]; # for example

The multiplication of such matreces with scalars, vectors and other
matreces, addition/subtraction with scalars and other matrices works very

But Inverse(m) or m^-1 (and all operations like m/m, which require m^-1)
don't work (but a^-1 does).
And [[1,a],[0,1]]*[[1,-a],[0,1]] returns [[1,0],[0,1]]

The problem here is that your data structures have entries which are a mixture
of integers and Laurent polynomials. In GAP we maintain a distinction between
elements of a coefficient ring and constant polynomials over that ring (this
allows, for instance, iterated polynomial ring constructions).

As you discovered, if after your setup you do:
gap>  m:=[[a^0,a],[0*a,a^0]];
[ [ 1, a ], [ 0, 1 ] ]

creating a matrix all of whose entries are polynomials (some of them constant)
then you get:

gap> m^-1;
[ [ 1, -a ], [ 0, 1 ] ]
gap> m/m;
[ [ 1, 0 ], [ 0, 1 ] ]
gap> last[1][1] = 1;
gap> IsMatrix(m);

You comment:

sergei.haller@math.uni-giessen.de said:
> But this seems to be too complicate to do this. As said befroe,
> multiplication, addition and subtraction work with m:=[[1,a],[0,1]]
> also.

Now is my Question: Is this the common way to define such matrices?
Is there any other way?

The answer is basically that this IS the way to define such matrices. Of
you can simplify the programming a little by adding lines like

o := One(a);
z := Zero(a);

m := [[o, a], [z, o]];;

or you can do

m := [[1, a], [0, 1]] * One(a);

Sorry about the slow reply,


Miles-Receive-Header: reply

> < [top]