GAP Lesson 1


Start up GAP.

gap> LogTo("GAPlesson1");

Arithmetic Operations

You learn: + - * / ^, terminating input with ;, some data types that GAP knows last. Factors, mod, Int, Gcd, Lcm, Factorial.

Try the following. Press the return key at the end of each line.

gap> 5+7;
gap> 12/17;
gap> 2/7+3/5;
gap> 2^3*3^3;
gap> 3.1415^2;
gap> 5/4 in Rationals;
gap> 3.1415 in Rationals;
gap> 3.1415 in Reals;

Discuss. Do you know another computer system that will respond the way GAP does to 2/7+3/5;? Does the nature of the responses to 3.1415 in Rationals; and 3.1415 in Reals; suprise you?

gap> Factors(1111111);
gap> Factors(11111111111);
gap> IsPrime(513239);
gap> Factors(2^32 + 1);
gap> Factors(216);
gap> last;
gap> Collected(last);

There are also variables last2 and last3. Guess what their values are. Fermat conjectured that the numbers 2^2^n+1 might all be prime. It was eventually Euler who managed to factorize 2^2^5+1, which was an impressive calculation at the time. We can now do this factorization instantaneously with this software.

Exercise: Find the first number of the form 111..1 bigger than 11 that is prime. Note that such a number must have a prime number of digits.

gap> Int(18/7);
gap> Gcd(216,930);
gap> Lcm(216,930);
gap> Factorial(6);
gap> -5 mod 11;
gap> 6 mod -5;
gap> 6 mod 0;

Did anything go wrong? This is the first time we have encountered brk>, and not the last. What would you expect Int(-1/2) to be? Try it? Are you surprised? Does this make you think of consequences if we start programming with these functions?

Permutations
You learn: permutations are written in cycle notation and are enclosed in (). Some operations have the same form as for integers. Conjugation is built in.

gap> (1,2,3)*(1,2);
gap> (1,2,3)^-1;
gap> (1,2,3)^(2,5);
gap> 1^(1,2,3);

What do (1,2,3)^(2,5); and 1^(1,2,3); mean?
When we come to them, other kinds of elements such as matrices, and elements of finite fields can be manipulated with the same syntax.

Help
You learn: lines are not terminated with ; How to call up and browse sections of the manual. You will need to follow some of the on screen instructions to get through the next commands.

gap> ?
gap> ?Help
gap> ?Factor
gap> ?A f s
gap> ?>

Exercise: What is the name of the section in the GAP manual immediately preceding section 56.5-9 Factors?
On a scale of 0-10, rate the manual section 'A first session with GAP' in terms of helpfulness.


True and False; Assignment of Variables
You learn: The difference between = and :=, how to store things in memory.

gap> 8=2^3;
gap> 8=3^3;
gap> g:=17;
gap> g;
gap> g=17;
gap> g=21;
gap> g^2;
gap> 3<=2;
gap> 3>=2;

Exercise: What response do you expect from
gap> true and false;
gap> true or false;
?

Permutation groups; groups from the library; operations on groups
You learn: how to input a group generated by permutations. The operations Size, Center, DerivedSubgroup, in, SylowSubgroup, Elements, SymmetricGroup, AlternatingGroup, DihedralGroup.

gap> a:=Group((2,3,5)(6,7,8),(1,2,4,7)(3,6,8,5));
gap> Size(a);
gap> Center(a);
gap> Size(last);
gap> p:=SylowSubgroup(a,2);
gap> Size(p);
gap> Elements(p);
gap> Center(p);
gap> Size(last);
gap> IsNormal(a,p);

Exercise: Identify the Sylow 2-subgroups of the group a. What structure does a have? Is it a semidirect product?

gap> g:=SymmetricGroup(6);
gap> Size(g);
gap> h:=DerivedSubgroup(g);
gap> Size(h);
gap> (1,2) in h;
gap> (1,2,3) in h;
gap> d:=DihedralGroup(8);
gap> Size(d);

Exercise: Identify the Sylow 2-subgroups of
gap> c:=Group((1,2,3,4,5,6,7),(2,3)(4,7));