GAP4 I. Introduction Getting started Objects

advertisement
Getting started
GAP4
I. Introduction
Alexander Hulpke
June 1, 1998
You can start GAP on the PCs (brora, chrystal, cochran,
deanston, muir, shades ) using the command gap-4. You can
The things GAP deals with are Objects. There are:
leave GAP using the command
Kernel objects like
quit;
http://www-gap.dcs.st-and.ac.uk/~ahulpke/course.html
GAP runs in a “Read”, “Eval”, “Print” (or rather “View”, see later)
loop. There is EMACS-like (or tcsh-like) command-line editing.
gap> ?group
Creating groups _______ ...
The language is essentially unchanged from GAP3, it is Pascal-like.
Alexander Hulpke, May 1, 1998
fi
1
Objects can simulate to be lists or records (more later).
Standard loop programming can be easy using list functions:
gap> l:=[-50..100];
[ -50 .. 100 ]
gap> l{[17..25]};
[ -34 .. -26 ]
gap>
[ 1,
gap>
8
gap>
[ 6,
List([1..10],i->i^2);
4, 9, 16, 25, 36, 49, 64, 81, 100 ]
Number([1..20],IsPrime);
The manual section “Operations for collections” contains more.
Alexander Hulpke, May 1, 1998
Alexander Hulpke, May 1, 1998
4
2
There are commands to get an isomorphic group in different
representation
Results of Attributes (many Operations with one argument) are
stored in the object.
Alexander Hulpke, May 1, 1998
3
Groups can be generated by all types of elements that can
be multiplied and inverted, good methods are available for
permutations, pc presentations, matrices, fi nite presentations,
automorphisms.
gap> g:=AlternatingGroup(5);;
5
Alexander Hulpke, May 1, 1998
gap> s:=SylowSubgroup(g,2);
Group([ (1,2)(3,4), (1,3)(2,4) ])
gap> Index(g,s);
15
gap> c:=ConjugacyClassesSubgroups(g);
[Group(())^G,Group([(2,3)(4,5)])^G,Group([(3,4,5)])^G,
Group([(2,3)(4,5),(2,4)(3,5)])^G,Group([(1,2,3,4,5)])^G,
Group([(3,4,5),(1,2)(4,5)])^G, Group([(1,2,3,4,5),
(2,5)(3,4)])^G,Group([(2,3)(4,5),(2,4)(3,5),(3,4,5)])^G,
AlternatingGroup([1..5])^G]
The Operations like Centralizer are independent of the
representation. GAP takes care that a suitable (and good) method
will be used.
Filtered([1..10000],i->Sum(DivisorsInt(i))=2*i);
28, 496, 8128 ]
(Iterated sublist operators will cut out a “rectangle”, see the manual
section on ”List elements”.)
Alexander Hulpke, May 1, 1998
gap> g:=Group((1,2,3),(2,3,4));
Group([ (1,2,3), (2,3,4) ])
gap> Size(g);
12
gap> (1,2) in g;
false
gap> Centralizer(g,(1,2,3));
Group([ (1,2,3) ])
gap> ConjugacyClasses(g);
[()^G,(2,3,4)^G,(2,4,3)^G,(1,2)(3,4)^G]
gap> Representative(last[4]);
(1,2)(3,4)
gap> AsList(last2[3]);
[ (2,4,3), (1,2,3), (1,3,4), (1,4,2) ]
GAP generally uses row vectors.
Sublists can be formed by using pointy brackets to indicate a range;
Every object has a Type which consists of a Family and Filters (more
later).
Some computations with groups
gap> Reversed("Drab as a fool, aloof as a bard");
"drab a sa foola ,loof a sa barD"
gap> v:=[1,2,3];;
gap> m:=[[1,2,3],[4,5,6],[7,8,9]];;
gap> v*m;
[ 30, 36, 42 ]
gap> m*v;
[ 14, 32, 50 ]
gap> v*v;
14
gap> l:=[1,2,3];
[ 1, 2, 3 ]
gap> l[2];
2
gap> l[4]:=5;;
gap> l;
[ 1, 2, 3, 5 ]
gap> Unbind(l[2]);
gap> l;
[ 1,, 3, 5 ]
gap> IsBound(l[3]);
true
Composite objects (list and records) can be made immutable (that
is you cannot change components any longer).
gap> a:=[1];
[ 1 ]
gap> b:=[1];
[ 1 ]
gap> a=b;
Lists are also used to represent sets, strings, vectors, matrices:
List access is via square brackets to an index:
integers, cyclotomics (5+E(8)+3*E(7)),
fi nite fi eld elements (Z(5)^3),
permutations ((1,3,5,7,2)(4,8)),
booleans (true, false, fail),
words (x1*x2*x3^-1),
It is important to distinguish between equal and identical objects
Alexander Hulpke, May 1, 1998
Lists
–
–
–
–
–
Lists ([1,2,[2,(1,2)]], "ABC"),
Records (rec(a:=1,b:=2)),
Other Objects (Group((1,2,3)))
The help function can be called by “?topic”
for var in list do ...od
while condition do ...od
repeat ...until condition
if condition then ... elif condition then ... else ...
function( variables ) local variables; ...end;
true
gap> IsIdenticalObj(a,b);
false
gap> c:=[a,b];
[ [ 1 ], [ 1 ] ]
gap> a[1]:=2;
2
gap> c;
[ [ 2 ], [ 1 ] ]
Objects
6
gap> hom:=IsomorphismPcGroup(g);
Pcgs([(2,4,3),(1,3)(2,4),(1,2)(3,4)])->[f1,f2,f3]
gap> Image(hom);
<pc group with 3 generators>
gap> Image(hom,(1,2,3));
f1*f3
gap> IsomorphismFpGroup(g);
[(2,4,3),(1,3)(2,4),(1,2)(3,4)]->[F1,F2,F3]
Alexander Hulpke, May 1, 1998
7
Finitely presented groups
GAP distinguishes between free groups and fi nitely presented
groups:
gap> f:=FreeGroup("a","b");
<free group on the generators [ a, b ]>
gap> f:=FreeGroup("a","b","c");
<free group on the generators [ a, b, c ]>
gap> g:=f/[f.1*f.2/f.3,f.2*f.3/f.1,f.3*f.1/f.2];
<fp group on the generators [ a, b, c ]>
gap> Size(g);
8
gap> g.1;
a
gap> f.1;
a
gap> g.1=f.1;
false
gap> g.1^8=One(g);
true
gap> f.1^8=One(f);
false
Alexander Hulpke, May 1, 1998
8
Download