Dear GAP Forum,
Alessandro Logar asked:
(I have to add that I am definitely not a gap expert...)
My problem is (or can redeuced to) the following:
I want to define a function, say F(n), such that, for a given n, F(n)
returns the free group generated by x1,...,xn.
The funcion FreeGroup, as far as I can understand, do not allows to
have as an argument, a sequence of element as x1, ..., xn for a
generic n.
I would greately appreciate any suggestion.
I'm not completely sure whether this is your question, but I'll try to
explain a bit better how one can use 'FreeGroup'.
You have 4 possibilities to create free groups. They all give different
names (for printing) to the generators, from a mathematical or algorithmic
point of view they are all equivalent:
gap> f:=FreeGroup(3); Group( f.1, f.2, f.3 ) gap> f:=FreeGroup(3,"x"); Group( x.1, x.2, x.3 ) gap> f:=FreeGroup(["a","b","c"]); Group( a, b, c )
You can access the generators via their record components f.1,f.2 and f.3
(or f.generators[nr]). So with the last example one would get
gap> f.2^2; b^2
(It is important to distinguish between variables and their names,
i.e. the way they are printed).
The fourth version will not be supported any longer in GAP 4.x as it might
lead to confusion. It's just mentioned for sake of completeness:
gap> x1:=AbstractGenerator("a");
a
gap> x2:=AbstractGenerator("b");
bThe names are completely independent of the generators. As you see we can
even give the same name to different generators:gap> x3:=AbstractGenerator("a");
a
gap> Group(x1,x2,x3);
Group( a, b, a )
gap> AbelianInvariants(CommutatorFactorGroup(last));
[ 0, 0, 0 ]So x1,x2 and x3 are all distinct, though x1 and x3 are called the same.
Alexander Hulpke