\documentclass[dvips]{article} \usepackage[centering,width=10in,height=7.5in]{geometry}% geometry v3; for v2, use: [width=10in,height=7.5in,nohead] \geometry{landscape} \usepackage{amsfonts, amsmath, amssymb, graphicx} \usepackage{multicol,color,shortvrb,fancyvrb} \setlength{\columnsep}{4em} \let\epsilon\varepsilon \let\phi\varphi \parindent 0in \parskip .5ex % COMMANDS: %---------- % \| a ShortVerb % \opt#1 for optional parameters % code fancyvrb environment allowing \commands % \columnbreak for breaking columns \def\GAP{\textsf{\textbf{GAP}}} \def\ZZZ{\relax{\sf Z\kern-.4em Z}} \def\sl#1{{\textrm{\textsl{#1}}}} \def\opt#1{\textcolor[gray]{.5}{#1}} \MakeShortVerb{\|} \DefineVerbatimEnvironment{code}{Verbatim} {gobble=2,baselinestretch=.8,commandchars=\\\{\}} \def\subsection#1{ \vspace{1ex}{\large{\textbf{#1}}}\\[-4ex] } \def\section#1{ \vspace{1ex}{\large{\textbf{#1}}} } \pagestyle{empty} \begin{document}\small \begin{multicols*}3 \begin{center} {\GAP} 4.4 Reference Guide\\ Version 0.61, Dec 2004 --- Dean Serenevy \end{center} |LogTo( "|\textsl{filename}|" );|\hfill Log a session\\ |Read( "|\textsl{filename}|" );|\hfill Run commands in file |?|\textsl{command}\hfill Look up help for \textsl{command}\\ \fbox{Tab}\hfill Command completion\\ Input line uses some |emacs| style keybindings \section{Operators and Keywords} |#|\hfill Comment Delimiter\\ |:=|\hfill Assignment\\ |=|, |<>|, |>|, |<|, |<=|, |>=|\hfill Comparison\\ |+|, |-|, |*|, |/|, |mod|, |^|\hfill Arithmetic\\ |and|, |or|, |not|\hfill Logical \section{Basic Data Types} |Foo_Bar1;|\hfill Variable (long names ok)\\ |x:= [ 1, 2, 3 ];|\hfill List\\ \mbox{ }\ \ \ access: |x[1];| or |x{[1,2]};|\\ |x:= Set([ 1, 2, 3 ]);|\hfill Set\\ |x:= ( 1, 2, 3 );|\hfill Permutation\\ |x:= rec( Foo := 1, bar := 2 );|\hfill Record\\ \mbox{ }\ \ \ access: |x.Foo| or |x.("bar");|\\ |true|, |false|\hfill Boolean |Unbind( |\textsl{var}| );|\hfill Clear \textsl{var} from memory \section{Display and Output} |View( |\textsl{objects}| );|\hfill Short form\\ |Print( |\textsl{objects}| );|\hfill {\GAP} readable form\\ |Display( |\textsl{objects}| );|\hfill Long human-readable form |PrintArray( |\textsl{matrix}| );|\hfill Pretty print \textsl{matrix} \subsection{Functions} \begin{code} \sl{MyFunc} := function(\sl{x}, \sl{y}) local \sl{A}, \sl{b}; ... return \sl{result}; end; # \textrm{use \texttt{arg} for functions of many arguments} \sl{MySum} := function( arg ) local sum, x; sum := 0; for x in arg do sum := sum + x; od; return sum; end; \sl{MySquare} := \sl{x} -> \sl{x}^2; \end{code} \vspace{-1.5ex} %%%%%%%%%%%%%%%%%%%%% \columnbreak %%%%%%%%%%%%%%%%%%%%% \section{Loops and Conditionals} |break|\hfill Exit any loop\\ |continue|\hfill Move to next loop iteration\\[-4ex] \begin{code} if \sl{cond} then ... elif \sl{cond} then ... else ... fi; for \sl{var} in \sl{list} do ... od; for \sl{var} in \sl{object} do ... od; while \sl{cond} do ... od; repeat ... until \sl{cond}; \end{code} \vspace{-1.5ex} |L:= List( |\textsl{list}|, |\textsl{func}| );|\hfill New list of \textsl{func} values\\ |Apply( |\textsl{list}|, |\textsl{func}| );|\hfill Change values of \textsl{list} \section{Lists} |x:= [ 1, 2, 3 ];|\hfill List\\ |x:= [ 1..2000 ];|\hfill List\\ \mbox{ }\ \ \ access: |x[1];| or |x{[1..5]};| |Add( |\textsl{L}|, |\textsl{x}| );|\hfill Add \textsl{x} to end of \textsl{L}\\ |L:= Concatentaion( |\textsl{L$_1$}|, |\textsl{L$_2$}|, |\dots| );|\hfill Join lists\\ |Append( |\textsl{L}|, |\textsl{L$_1$}|, |\dots| );|\hfill Changes \textsl{L}\\ |L:= Flat( |\textsl{list}| );|\hfill Flatten nested lists\\ |L:= Reversed( |\textsl{list}| );| |n:= Length( |\textsl{L}| );|\\ |b:= IsEmpty( |\textsl{L}| );| |L:= List( |\textsl{list}|, |\textsl{func}| );|\hfill New list of \textsl{func} values\\ |Apply( |\textsl{list}|, |\textsl{func}| );|\hfill Alter values of \textsl{list}\\ |L:= Filtered( |\textsl{list}|, |\textsl{func}| );|\hfill Elems satisfying \textsl{func} \section{Sets} |x:= Set([ 1, 2, 3 ]);|\hfill Set\\ \textsl{object}| in |\textsl{set}|;|\hfill Test membership |UniteSet( |\textsl{A}|, |\textsl{B}| );|\hfill Changes $A$\\ |IntersectSet( |\textsl{A}|, |\textsl{B}| );|\hfill Changes $A$\\ |SubtractSet( |\textsl{A}|, |\textsl{B}| );|\hfill Changes $A$ These next four also work for objects such as lists and groups. The objects of $C$ will be identical to the objects of $A$ and $B$.\\ |b:= IsSubset( |\textsl{A}|, |\textsl{B}| );|\hfill $B\subseteq A$?\\ |C:= Union( |\textsl{A}|, |\textsl{B}|, |\dots| );|\\ |C:= Intersection( |\textsl{A}|, |\textsl{B}|, |\dots| );|\\ |C:= Difference( |\textsl{A}|, |\textsl{B}| );|\hfill $\textsl{A}-\textsl{B}$ \hrulefill\\ {\footnotesize% The {\GAP} program and full manual can be found at:\\ |http://www.gap-system.org/|\\ |http://www-gap.dcs.st-and.ac.uk/~gap/| } %%%%%%%%%%%%%%%%%%%%% \columnbreak %%%%%%%%%%%%%%%%%%%%% \section{Matrices} |M:= [ [1,2], [0,1] ];|\hfill Matrix\\ Matrices typically have their own functions,\\ |RankMat(M)|, |DeterminantMat(M)|, |DimensionsMat(M)|, |TransposedMat(M)|, |NullspaceMat(M)|, |Inverse(M)|, Also ``Destructive'' forms: |RankMatDestructive|, \dots |PrintArray( |\textsl{matrix}| );|\hfill Pretty print \textsl{matrix} |M:= IdentityMat( |\textsl{n}| );|\hfill $n\times n$ identity matrix\\ |M:= RandomMat( |\textsl{n}|, |\textsl{m}\opt{, \textsl{Ring}}| );|\\ |M:= RandomInvertibleMat( |\textsl{n}\opt{, \textsl{Ring}}| );|\\ |M:= DiagonalMat( |\textsl{vec}| );|\hfill $V$ a vector\\ |M:= PermutationMat( |\textsl{perm}|, |\textsl{dim}| );|\\ |x:= SolutionMat( |\textsl{mat}|, |\textsl{b}| );|\hfill $xM=b$\\ |M:= TriangulizeMat( |\textsl{mat}| );|\\ |M:= BaseMat( |\textsl{mat}| );|\hfill row space\\ |D:= JordanDecomposition( |\textsl{mat}| );| {\footnotesize New in GAP 4.4: |NullspaceIntMat|, |SolutionIntMat|, % |BaseIntMat|, |TriangulizedIntegerMat|, |ComplementIntMat|, |DiagonalizeIntMat|, \dots } % |GeneralisedEigenvalues( |\textsl{field}|, |\textsl{mat}| );|\\ % |GeneralisedEigenspaces( |\textsl{field}|, |\textsl{mat}| );|\\ % |Eigenvalues( |\textsl{field}|, |\textsl{mat}| );|\\ % |Eigenspaces( |\textsl{field}|, |\textsl{mat}| );|\\ % |Eigenvectors( |\textsl{field}|, |\textsl{mat}| );| \section{Permutations} |x:= ( 1, 2, 3 );|\hfill Permutation\\ |a:= 3^x;|\hfill Action on a point\\ |L:= OnTuples( |\textsl{list}|, |\textsl{perm}| );|\hfill Action on a list |L:= ListPerm( |\textsl{perm}| );|\hfill Permutation $\to$ list\\ |p:= PermList( |\textsl{list}| );|\hfill List $\to$ permutation |a:= SignPerm( |\textsl{perm}| );|\hfill $\pm1$\\ |L:= MovedPoints( |\textsl{perm}| );| \section{Numerical} |IsInt|, |isRat|, |IsCyc| Are the filters which test for integers, rationals, and finite cyclotomic numbers. |infinity;|\hfill $\infty$\\ |a:= E( |\textsl{n}| );|\hfill Primitive \textsl{n}-th root of unity |a:= AbsoluteValue( |\textsl{num}| );|\\ |a:= SignInt( |\textsl{num}| );|\hfill $\pm1$ (rationals allowed)\\ |a:= GcdInt( |\textsl{int}|, |\textsl{int}| );|\\ |a:= Sqrt( |\textsl{num}| );|\hfill Given as a sum of |E(i)|'s \section{Number Theory} |IsEvenInt|, |IsPrimeInt|, \dots\hfill Filters\\ \textsl{int}| mod |\textsl{int}\\ |list:= FactorsInt( |\textsl{int}| );|\\ % |n:= Phi( |\textsl{int}| );|\hfill Euler $\phi$ function\\ |o:= OrderMod( |\textsl{n}|, |\textsl{m}| );|\hfill Order of \textsl{n} mod \textsl{m}\\ |n:= Legendre( |\textsl{int}|, |\textsl{int}| );|\\ |n:= MoebiusMu( |\textsl{int}| );| %%%%%%%%%%%%%%%%%%%%% \columnbreak %%%%%%%%%%%%%%%%%%%%% \section{Combinatorics} |Binomial( |\textsl{n}|, |\textsl{k}| );|\hfill ${\textsl{n}\choose\textsl{k}}$\\ |Factorial( |\textsl{int}| );| The following with second parameter \textsl{k} restricts to length \textsl{k} results. Use |Nr|\underline{\phantom{com}} for simple count.\\ |list:= Combinations( |\textsl{list}| );|\hfill Subsets\\ |list:= Arrangements( |\textsl{list}| );|\\ \mbox{ }\hfill Subset permutations\\ |list:= PartitionsSet( |\textsl{list} |);|\hfill Partitions\\ |list:= Tuples( |\textsl{list}|, |\textsl{k}| );|\hfill Elements of \textsl{list}$^{\textsl{k}}$ % |list:= UnorderedTuples( |\textsl{list}|, |\textsl{k}| );|\\ % \mbox{ }\hfill Elements of \textsl{list}$^{\textsl{k}}$ up to permutations \section{Built-in Groups} Type: |?AbelianGroup| for more info and types |G:= AbelianGroup( |\textsl{list}| );|\hfill $\bigoplus_{n\in\mbox{\textsl{list}}}\ZZZ_n$\\ |G:= FreeGroup( |\textsl{int}| );|\hfill\\ |G:= SymmetricGroup( |\textsl{int}| );|\hfill \\ |G:= AlternatingGroup( |\textsl{int}| );|\hfill \\ |G:= DihedralGroup( |\textsl{int}| );|\hfill \section{Elements} \textsl{elem}| in |\textsl{object}|;|\hfill Test membership |n:= Order( |\textsl{elem}| );|\hfill |One(|\textsl{elem}|)|$=\textsl{elem}^n$\\ |i:= Inverse( |\textsl{elem}| );| |x:= Comm( |\textsl{elem}|, |\textsl{elem} |);|\hfill Commutator {\small $a^{-1}b^{-1}ab$}\\ |matrix:= MultiplicationTable( |\textsl{elems}| );|\\ |x:= Factorization( |\textsl{gens}|, |\textsl{elem}| );| |M:= Maximum( |\textsl{list} or \textsl{elems}| );|\\ |m:= Minimum( |\textsl{list} or \textsl{elems}| );|\\ |p:= Product( |\textsl{list} or \textsl{elems}| );|\\ |s:= Sum( |\textsl{list} or \textsl{elems}| );| |SetName( |\textsl{object}|, |\textsl{name}| );|\hfill Set display string \section{Words} |b:= IsWord( |\textsl{object}| );|\hfill Word in a free object? |w:= UnderlyingElement( |\textsl{elem}| );|\hfill \textsl{elem}$\to$word\\ |a:= ElementOfFpGroup( FamilyObj(|\textsl{elem}|),|\textsl{word}| );|\\ \mbox{ }\hfill Make \textsl{word} an element in same group as \textsl{elem}\\ \mbox{ }\hfill See Also: |MappedWord|\\[.75ex] |list:= LetterRepAssocWord( |\textsl{word}| );|\\ \mbox{ }\hfill \textsl{word} $\to$ list of indices\\[.75ex] |a:= AssocWordByLetterRep(FamilyObj(|\textsl{elem}|),|\textsl{list}|);|\\ \mbox{ }\hfill List of indices $\to$ word of same type as \textsl{elem} %%%%%%%%%%%%%%%%%%%%% \columnbreak %%%%%%%%%%%%%%%%%%%%% \section{Groups} \textsl{object}| in |\textsl{grp}|;|\hfill Test membership\\ |G.1|, |G.2|, \dots\hfill Generators of group |G| |G:= Group( |\textsl{elems}| );|\hfill Construct by generators\\ |H:= Subgroup( |\textsl{grp}|, |\textsl{elems}| );|\\ |n:= Index( |\textsl{grp}|, |\textsl{subgrp}| );|\\ |list:= ConjugateSubgroups( |\textsl{grp}|, |\textsl{subgrp}| );| |F:= FreeGroup(2);|\hfill Free group for next line\\ |G:= F/[F.1^4, F.1^-2*F.2^3];|\hfill Quotient group\\ |G:= DirectProduct( |$G_1$|, |$G_2$|, |\dots| );| |n:= Size( |\textsl{grp}| );|\\ |list:= Elements( |\textsl{grp}| );|\\ |list:= GeneratorsOfGroup( |\textsl{grp}| );|\\ |e:= One( |\textsl{grp} or \textsl{element}| );|\hfill Get identity |b:= IsAbelian( |\textsl{grp}| );|\hfill Testing a filter\\ |list:= AbelianInvariants( |\textsl{grp}| );|\hfill Sig. of $G^{ab}$ |list:= LowIndexSubgroupsFpGroup(|\textsl{grp}|, |\textsl{index}|);|\\ |matrix:= CosetTable( |\textsl{grp}|, |\textsl{subgrp}| );|\\ |C:= ConjugacyClass( |\textsl{grp}|, |\textsl{element}| );|\\ |list:= ConjugacyClasses( |\textsl{grp}| );| |list:= ChiefSeries( |\textsl{grp}| );|\\ |list:= CompositionSeries( |\textsl{grp}| );|\\ |list:= LowerCentralSeriesOfGroup( |\textsl{grp}| );| \section{Group Homomorphisms} Assume each line begins with ``|f:= |''. |GroupHomomorphismByImages(|\textsl{G}|, |\textsl{H}|, |\textsl{gens}|, |\textsl{imgs}|);|\\ % |GroupHomomorphismByImagesNC(|\textsl{F}|,|\textsl{G}|,GeneratorsOfGroup(|\textsl{F}|),GeneratorsOfGroup(|\textsl{G}|));| if G = F/[rels]; |GroupHomomorphismByFunction( |\textsl{G}|, |\textsl{H}|, |\textsl{func}| );| |NaturalHomomorphism( |\textsl{G}|, |\textsl{N}| );|\hfill {\small $f:G\to G/N$}\\ |MaximalAbelianQuotient( |\textsl{G}| );|\hfill {\small $f:G\to G^{ab}$}\\ |ConjugatorIsomorphism( |\textsl{G}|, |\textsl{g}| );|\hfill $f(h)=ghg^{-1}$ |IsomorphismGroups( |\textsl{G}|, |\textsl{H}| );|\hfill Find iso$:\textsl{G}\to\textsl{H}$ |H:= Kernel( |\textsl{f}| );|\\ |H:= Image( |\textsl{f}| );|\\ |H:= Image( |\textsl{f}|, |\textsl{subgroup} or \textsl{element}| );|\\ |H:= PreImage( |\textsl{f}|, |\textsl{subgroup} or \textsl{element}| );|\\ |H:= CoKernel( |\textsl{f}| );|\hfill Nonstandard! $h=f(1)$ |G:= AutomorphismGroup( |\textsl{object}| );|\\ |H:= AutomorphismDomain( |\textsl{aut grp}| );| \section{Group Conversions} \vspace{-.75ex}Each gives $\textsl{iso}:\textsl{grp}\,{\buildrel\cong\over\longrightarrow}\,H$ with $H$ of shown type\\ |iso:= IsomorphismFpGroup( |\textsl{grp}| );|\hfill \\ |iso:= IsomorphismPcGroup( |\textsl{grp}| );|\hfill \\ |iso:= IsomorphismPermGroup( |\textsl{grp}| );|\hfill \\ |H:= SimplifiedFpGroup( |\textsl{grp}| );|\hfill Do Tietze moves %%%%%%%%%%%%%%%%%%%%% \columnbreak %%%%%%%%%%%%%%%%%%%%% \section{Identifying/Canonicalizing Groups} A ``small'' group generally has less than 2000 elements, though there are exceptions both ways. |id:= IdGroup( |\textsl{group}| );|\hfill Identify a group\\ |G:= SmallGroup( |\textsl{id}| );|\hfill Retrieve group by id\\ |L:= AllSmallGroups( |\textsl{order} or \textsl{properties}| );|\\ |n:= NumberSmallGroups( |\textsl{order}| );|\\ |SmallGroupsInformation( |\textsl{order}| );| \section{Filters} |L:= KnownPropertiesOfObject(| \textsl{object}| );|\\ \mbox{ }\hfill Filters whose value is known on \textsl{object}\\[.75ex] |L:= KnownTruePropertiesOfObject( |\textsl{object}| );|\\ \mbox{ }\hfill Filters the \textsl{object} will satisfy\\[.75ex] |b:= |\textsl{filter}|( |\textsl{object}| );|\hfill |true| if \textsl{object} has \textsl{filter} Some example filters: |IsCommutative|, |IsFinite|,\\ |IsFpGroup|, |IsFreeAbelian|, |IsFreeGroup|,\\ |IsInt|, |IsMatrix|, |IsMutable|, |IsNormal|, |IsOne|,\\ |IsPrime|, |IsSolvableGroup|, |IsSortedList|,\\ |IsSurjective|, |IsTrivial| % \section{Polynomials} % |x:= Indeterminate( |\textsl{Ring}|, "|\textsl{x}|" );| % NumeratorOfRationalFunction( % DenominatorOfRationalFunction( % CoefficientsOfUnivariateRationalFunction( % DegreeIndeterminate( % Derivative( % Discriminant( pol, ind ) % Resultant( pol1, pol2, ind ) % Value( upol, value[, one] ) % Factors([R,]upoly[,opt]) % l:=[x^2+y^2+z^2-1,x^2+z^2-y,x-y];; % gap> GroebnerBasis(l,MonomialLexOrdering()); \end{multicols*} \end{document} %%% Local Variables: %%% mode: latex %%% TeX-master: t %%% End: