# Summary and Setup

GAP is a system for discrete computational algebra, with particular emphasis on Computational Group Theory. GAP provides a programming language, a library of thousands of functions implementing algebraic algorithms written in the GAP language as well as large data libraries of algebraic objects, for example the Small Groups Library which contains, among others, all 423 164 062 groups of order at most 2000 except 1024.

This lesson gives an introduction to GAP. It is centred around a
common task of searching in the Small Groups Library for interesting
examples and counterexamples, and a particular research problem in which
we will be interested is to **find examples of non-trivial groups
such that the average order of their elements is an
integer**.

The lesson will lead the learner along the path from working in the GAP command line and exploring algebraic objects interactively to saving the GAP code into files, creating functions and regression tests, and further to performing comprehensive search and extending the system by adding new attributes.

On this path, the learner will become familiar with:

basic constructions of the GAP programming language,

ways to find necessary information in the GAP system, and

good design practices to organise GAP code into complex programs.

### Prerequisites

The lesson is oriented on learners possessing the minimal theoretical background (at least at the level of an undergraduate group theory course) and willing to learn how concepts from abstract algebra may be explored using computational tools. No previous experience of working with GAP is required.

Learners only need to understand the concepts of files and directories (including home and working directories) and know how to start GAP.

### Getting ready

- In your home directory, create a new directory called
`avgord`

. - Start GAP:

- on Linux and macOS, open the terminal and call
`path-to-your-gap-installation/gap-4.X.Y/gap`

(edit the path as necessary); - on Windows, start GAP using the Start menu or a desktop shortcut created after GAP installation.

- Set your current directory to
`avgord`

:

- on Linux and macOS, call
`ChangeDirectoryCurrent("/Users/username/avgord");`

(edit the path as necessary; remember to type the full path to your home directory instead of`~`

). - on Windows, call
`ChangeDirectoryCurrent("C:/Users/username/avgord");`

(edit the path as necessary; remember to use`/`

instead of`\`

);

- Verify that your current directory is set up properly: call
`DirectoryCurrent();`

and check that the path in the output points to the`avgord`

directory.

## Windows

From the GAP Downloads
page, download the `.exe`

installer and double click on
the file to run it. When you are asked for the installation path, note
that it should not contain spaces. For example, you may install GAP
4.X.Y in `C:\gap-4.X.Y`

(default), `D:\gap-4.X.Y`

or `C:\Math\GAP\gap-4.X.Y`

, but you must not install it in a
directory such as `C:\Program Files\gap-4.X.Y`

or
`C:\Users\alice\My Documents\gap-4.X.Y`

.

## macOS

On macOS, you need to install GAP from source as explained at the GAP Downloads page.
Download one of the archives provided there, unpack it and run
`./configure && make`

in the unpacked directory. Then
change to the `pkg`

subdirectory and call
`../bin/BuildPackages.sh`

to run the script which will build
most of the packages that require compilation (provided sufficiently
many libraries, headers and tools are available).

Alternatively, you may also install GAP using Homebrew. After installing Homebrew, follow the instructions for the GAP Homebrew tap.

## Linux

On Linux, you need to install GAP from source as explained at the GAP Downloads page.
Download one of the archives provided there, unpack it and run
`./configure && make`

in the unpacked directory. Then
change to the `pkg`

subdirectory and call
`../bin/BuildPackages.sh`

to run the script which will build
most of the packages that require compilation (provided sufficiently
many libraries, headers and tools are available).