Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  utils.tex   Sprache: Latech

 
% generated by GAPDoc2LaTeX from XML source (Frank Luebeck)
\documentclass[a4paper,11pt]{report}

\usepackage[top=37mm,bottom=37mm,left=27mm,right=27mm]{geometry}
\sloppy
\pagestyle{myheadings}
\usepackage{amssymb}
\usepackage[utf8]{inputenc}
\usepackage{makeidx}
\makeindex
\usepackage{color}
\definecolor{FireBrick}{rgb}{0.5812,0.0074,0.0083}
\definecolor{RoyalBlue}{rgb}{0.0236,0.0894,0.6179}
\definecolor{RoyalGreen}{rgb}{0.0236,0.6179,0.0894}
\definecolor{RoyalRed}{rgb}{0.6179,0.0236,0.0894}
\definecolor{LightBlue}{rgb}{0.8544,0.9511,1.0000}
\definecolor{Black}{rgb}{0.0,0.0,0.0}

\definecolor{linkColor}{rgb}{0.0,0.0,0.554}
\definecolor{citeColor}{rgb}{0.0,0.0,0.554}
\definecolor{fileColor}{rgb}{0.0,0.0,0.554}
\definecolor{urlColor}{rgb}{0.0,0.0,0.554}
\definecolor{promptColor}{rgb}{0.0,0.0,0.589}
\definecolor{brkpromptColor}{rgb}{0.589,0.0,0.0}
\definecolor{gapinputColor}{rgb}{0.589,0.0,0.0}
\definecolor{gapoutputColor}{rgb}{0.0,0.0,0.0}

%%  for a long time these were red and blue by default,
%%  now black, but keep variables to overwrite
\definecolor{FuncColor}{rgb}{0.0,0.0,0.0}
%% strange name because of pdflatex bug:
\definecolor{Chapter }{rgb}{0.0,0.0,0.0}
\definecolor{DarkOlive}{rgb}{0.1047,0.2412,0.0064}


\usepackage{fancyvrb}

\usepackage{mathptmx,helvet}
\usepackage[T1]{fontenc}
\usepackage{textcomp}


\usepackage[
            pdftex=true,
            bookmarks=true,        
            a4paper=true,
            pdftitle={Written with GAPDoc},
            pdfcreator={LaTeX with hyperref package / GAPDoc},
            colorlinks=true,
            backref=page,
            breaklinks=true,
            linkcolor=linkColor,
            citecolor=citeColor,
            filecolor=fileColor,
            urlcolor=urlColor,
            pdfpagemode={UseNone}, 
           ]{hyperref}

\newcommand{\maintitlesize}{\fontsize{50}{55}\selectfont}

% write page numbers to a .pnr log file for online help
\newwrite\pagenrlog
\immediate\openout\pagenrlog =\jobname.pnr
\immediate\write\pagenrlog{PAGENRS := [}
\newcommand{\logpage}[1]{\protect\write\pagenrlog{#1, \thepage,}}
%% were never documented, give conflicts with some additional packages

\newcommand{\GAP}{\textsf{GAP}}

%% nicer description environments, allows long labels
\usepackage{enumitem}
\setdescription{style=nextline}

%% depth of toc
\setcounter{tocdepth}{1}





%% command for ColorPrompt style examples
\newcommand{\gapprompt}[1]{\color{promptColor}{\bfseries #1}}
\newcommand{\gapbrkprompt}[1]{\color{brkpromptColor}{\bfseries #1}}
\newcommand{\gapinput}[1]{\color{gapinputColor}{#1}}


\begin{document}

\logpage{[ 0, 0, 0 ]}
\begin{titlepage}
\mbox{}\vfill

\begin{center}{\maintitlesize \textbf{ utils \mbox{}}}\\
\vfill

\hypersetup{pdftitle= utils }
\markright{\scriptsize \mbox{}\hfill  utils  \hfill\mbox{}}
{\Huge \textbf{ Utility functions in \textsf{GAP} \mbox{}}}\\
\vfill

{\Huge  0.92 \mbox{}}\\[1cm]
{ 11 September 2025 \mbox{}}\\[1cm]
\mbox{}\\[2cm]
{\Large \textbf{ Thomas Breuer\\
   \mbox{}}}\\
{\Large \textbf{ Sebastian Gutsche\\
   \mbox{}}}\\
{\Large \textbf{ Max Horn\\
   \mbox{}}}\\
{\Large \textbf{ Alexander Hulpke\\
   \mbox{}}}\\
{\Large \textbf{ Pedro Garc{\a'\i}a\texttt{\symbol{45}}S{\a'a}nchez\\
   \mbox{}}}\\
{\Large \textbf{ Christopher Jefferson\\
   \mbox{}}}\\
{\Large \textbf{ Stefan Kohl\\
   \mbox{}}}\\
{\Large \textbf{ Frank L{\"u}beck\\
   \mbox{}}}\\
{\Large \textbf{ Chris Wensley\\
   \mbox{}}}\\
\hypersetup{pdfauthor= Thomas Breuer\\
   ;  Sebastian Gutsche\\
   ;  Max Horn\\
   ;  Alexander Hulpke\\
   ;  Pedro Garc{\a'\i}a\texttt{\symbol{45}}S{\a'a}nchez\\
   ;  Christopher Jefferson\\
   ;  Stefan Kohl\\
   ;  Frank L{\"u}beck\\
   ;  Chris Wensley\\
   }
\end{center}\vfill

\mbox{}\\
{\mbox{}\\
\small \noindent \textbf{ Thomas Breuer\\
   }  Email: \href{mailto://sam@math.rwth-aachen.de} {\texttt{sam@math.rwth\texttt{\symbol{45}}aachen.de}}\\
  Homepage: \href{https://www.math.rwth-aachen.de/~Thomas.Breuer} {\texttt{https://www.math.rwth\texttt{\symbol{45}}aachen.de/\texttt{\symbol{126}}Thomas.Breuer}}}\\
{\mbox{}\\
\small \noindent \textbf{ Sebastian Gutsche\\
   }  Email: \href{mailto://gutsche@mathematik.uni-siegen.de} {\texttt{gutsche@mathematik.uni\texttt{\symbol{45}}siegen.de}}\\
  Homepage: \href{https://sebasguts.github.io/} {\texttt{https://sebasguts.github.io/}}}\\
{\mbox{}\\
\small \noindent \textbf{ Max Horn\\
   }  Email: \href{mailto://mhorn@rptu.de} {\texttt{mhorn@rptu.de}}\\
  Homepage: \href{https://github.com/mhorn} {\texttt{https://github.com/mhorn}}}\\
{\mbox{}\\
\small \noindent \textbf{ Alexander Hulpke\\
   }  Email: \href{mailto://hulpke@math.colostate.edu} {\texttt{hulpke@math.colostate.edu}}\\
  Homepage: \href{https://www.math.colostate.edu/~hulpke} {\texttt{https://www.math.colostate.edu/\texttt{\symbol{126}}hulpke}}}\\
{\mbox{}\\
\small \noindent \textbf{ Pedro Garc{\a'\i}a\texttt{\symbol{45}}S{\a'a}nchez\\
   }  Email: \href{mailto://pedro@ugr.es} {\texttt{pedro@ugr.es}}\\
  Homepage: \href{http://www.ugr.es/local/pedro} {\texttt{http://www.ugr.es/local/pedro}}}\\
{\mbox{}\\
\small \noindent \textbf{ Christopher Jefferson\\
   }  Email: \href{mailto://caj21@st-andrews.ac.uk} {\texttt{caj21@st\texttt{\symbol{45}}andrews.ac.uk}}\\
  Homepage: \href{https://caj.host.cs.st-andrews.ac.uk/} {\texttt{https://caj.host.cs.st\texttt{\symbol{45}}andrews.ac.uk/}}}\\
{\mbox{}\\
\small \noindent \textbf{ Stefan Kohl\\
   }  Email: \href{mailto://stefan@mcs.st-and.ac.uk} {\texttt{stefan@mcs.st\texttt{\symbol{45}}and.ac.uk}}\\
  Homepage: \href{https://www.gap-system.org/DevelopersPages/StefanKohl/} {\texttt{https://www.gap\texttt{\symbol{45}}system.org/DevelopersPages/StefanKohl/}}}\\
{\mbox{}\\
\small \noindent \textbf{ Frank L{\"u}beck\\
   }  Email: \href{mailto://Frank.Luebeck@Math.RWTH-Aachen.De} {\texttt{Frank.Luebeck@Math.RWTH\texttt{\symbol{45}}Aachen.De}}\\
  Homepage: \href{https://www.math.rwth-aachen.de/~Frank.Luebeck} {\texttt{https://www.math.rwth\texttt{\symbol{45}}aachen.de/\texttt{\symbol{126}}Frank.Luebeck}}}\\
{\mbox{}\\
\small \noindent \textbf{ Chris Wensley\\
   }  Email: \href{mailto://cdwensley.maths@btinternet.com} {\texttt{cdwensley.maths@btinternet.com}}\\
  Homepage: \href{https://github.com/cdwensley} {\texttt{https://github.com/cdwensley}}}\\
\end{titlepage}

\newpage\setcounter{page}{2}
{\small 
\section*{Abstract}
\logpage{[ 0, 0, 1 ]}
 The \textsf{Utils} package provides a space for utility functions in a variety of \textsf{GAP} packages to be collected together into a single package. In this way it is
hoped that they will become more visible to package authors. 

 Any package author who transfers a function to \textsf{Utils} will become an author of \textsf{Utils}. 

 If deemed appropriate, functions may also be transferred from the main
library. 

 Bug reports, suggestions and comments are, of course, welcome. Please contact
the last author at \href{mailto://cdwensley.maths@btinternet.com} {\texttt{cdwensley.maths@btinternet.com}} or submit an issue at the GitHub repository \href{https://github.com/gap-packages/utils/issues/} {\texttt{https://github.com/gap\texttt{\symbol{45}}packages/utils/issues/}}. \mbox{}}\\[1cm]
{\small 
\section*{Copyright}
\logpage{[ 0, 0, 2 ]}
 {\copyright} 2015\texttt{\symbol{45}}2025, The GAP Group. 

 The \textsf{Utils} package is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 2 of the License, or (at your option) any later
version. \mbox{}}\\[1cm]
{\small 
\section*{Acknowledgements}
\logpage{[ 0, 0, 3 ]}
 This documentation was prepared using the \textsf{GAPDoc} \cite{GAPDoc} and \textsf{AutoDoc} \cite{AutoDoc} packages.

 The procedure used to produce new releases uses the package \textsf{GitHubPagesForGAP} \cite{GitHubPagesForGAP} and the package \textsf{ReleaseTools}.

 \mbox{}}\\[1cm]
\newpage

\def\contentsname{Contents\logpage{[ 0, 0, 4 ]}}

\tableofcontents
\newpage

         
\chapter{\textcolor{Chapter }{Introduction}}\label{chap-intro}
\logpage{[ 1, 0, 0 ]}
\hyperdef{L}{X7DFB63A97E67C0A1}{}
{
  The \textsf{Utils} package provides a space for utility functions from a variety of \textsf{GAP} packages to be collected together into a single package. In this way it is
hoped that they will become more visible to other package authors. This
package was first distributed as part of the \textsf{GAP} 4.8.2 distribution. 

 The package is loaded with the command 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@LoadPackage( "utils" ); |
  
\end{Verbatim}
 

 Functions have been transferred from the following packages: 
\begin{itemize}
\item  Conversion of a \textsf{GAP} group to a ${\sf Magma}$ output string, taken from various sources including \texttt{other.gi} in the main library. 
\end{itemize}
 

 Transfer is complete (for now) for functions from the following packages: 
\begin{itemize}
\item  \textsf{AutoDoc} \cite{AutoDoc} (with function names changed); 
\item  \textsf{ResClasses} \cite{ResClasses}; 
\item  \textsf{RCWA} \cite{RCWA}; 
\item  \textsf{XMod} \cite{XMod}. 
\end{itemize}
 

 The package may be obtained either as a compressed \texttt{.tar} file or as a \texttt{.zip} file, \texttt{utils\texttt{\symbol{45}}version{\textunderscore}number.tar.gz}, by ftp from one of the following sites: 
\begin{itemize}
\item  the \textsf{Utils} GitHub release site: \href{https://gap-packages.github.io/utils/} {\texttt{https://gap\texttt{\symbol{45}}packages.github.io/utils/}}. 
\item  any \textsf{GAP} archive, e.g. \href{https://www.gap-system.org/Packages/packages.html} {\texttt{https://www.gap\texttt{\symbol{45}}system.org/Packages/packages.html}}; 
\end{itemize}
 \index{GitHub repository} The package also has a GitHub repository at: \href{https://github.com/gap-packages/utils} {\texttt{https://github.com/gap\texttt{\symbol{45}}packages/utils}}. 

 Once the package is loaded, the manual \texttt{doc/manual.pdf} can be found in the documentation folder. The \texttt{html} versions, with or without ${\sf MathJax}$, may be rebuilt as follows: 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@ReadPackage( "utils""makedoc.g" ); |
  
\end{Verbatim}
 

 It is possible to check that the package has been installed correctly by
running the test files (which terminates the \textsf{GAP} session): 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@ReadPackage( "utils""tst/testall.g" );|
  Architecture: . . . . . 
  testing: . . . . . 
  . . . 
  #I  No errors detected while testing
  
\end{Verbatim}
 

 Note that functions listed in this manual that are currently in the process of
being transferred are only read from the source package \textsf{Home} (say), and so can only be used if \textsf{Home} has already been loaded. There are no such functions in transition at present. 
\section{\textcolor{Chapter }{Information for package authors}}\label{sect-author-info}
\logpage{[ 1, 1, 0 ]}
\hyperdef{L}{X8508AD637B79CEE8}{}
{
  A function (or collection of functions) is suitable for transfer from a
package \textsf{Home} to \textsf{Utils} if the following conditions are satisfied. 
\begin{itemize}
\item  The function is sufficiently non\texttt{\symbol{45}}specialised so that it
might be of use to other authors. 
\item  The function does not depend on the remaining functions in \textsf{Home} 
\item  The function does not do what can already be done with a \textsf{GAP} library function. 
\item  Documentation of the function and test examples are available. 
\item  When there is more than one active author of \textsf{Home}, they should all be aware (and content) that the transfer is taking place. 
\end{itemize}
 

 Authors of packages may be reluctant to let go of their utility functions. The
following principles may help to reassure them. (Suggestions for more items
here are welcome.) 
\begin{itemize}
\item  A function that has been transferred to \textsf{Utils} will not be changed without the approval of the original author
\item  The current package maintainer has every intention of continuing to maintain \textsf{Utils}. In the event that this proves impossible, the \textsf{GAP} development team will surely find someone to take over. 
\item  Function names will not be changed unless specifically requested by \textsf{Home}'s author(s) or unless they have the form \texttt{HOME{\textunderscore}FunctionName}.
\item  In order to speed up the transfer process, only functions from one package
will be in transition at any given time. Hopefully a week or two will suffice
for most packages. 
\item  Any package author who transfers a function to \textsf{Utils} will become an author of \textsf{Utils}. (In truth, \textsf{Utils} does not have \emph{authors}, just a large number of \emph{contributors}.) 
\end{itemize}
 

 The process for transferring utility functions from \textsf{Home} to \textsf{Utils} is described in Chapter \ref{chap-transfer}. }

 }

         
\chapter{\textcolor{Chapter }{Printing Lists and Iterators}}\label{chap-print}
\logpage{[ 2, 0, 0 ]}
\hyperdef{L}{X83686EE47E4D4F66}{}
{
  
\section{\textcolor{Chapter }{Printing selected items}}\label{sec-print-select}
\logpage{[ 2, 1, 0 ]}
\hyperdef{L}{X7F6817927F86240F}{}
{
  The functions described here print lists or objects with an iterator with one
item per line, either the whole list/iterator or certain subsets: 
\begin{itemize}
\item  by giving a list of positions of items to be printed, or 
\item  by specifying a first item and then a regular step. 
\end{itemize}
 

\subsection{\textcolor{Chapter }{PrintSelection (for a list of positions)}}
\logpage{[ 2, 1, 1 ]}\nobreak
\hyperdef{L}{X784638AC84D49870}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{PrintSelection({\mdseries\slshape obj, list})\index{PrintSelection@\texttt{PrintSelection}!for a list of positions}
\label{PrintSelection:for a list of positions}
}\hfill{\scriptsize (function)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{PrintSelection({\mdseries\slshape obj, first, step[, last]})\index{PrintSelection@\texttt{PrintSelection}!for a first item and a step}
\label{PrintSelection:for a first item and a step}
}\hfill{\scriptsize (function)}}\\


 This function, given three (or four) parameters, calls operations \texttt{PrintSelectionFromList} or \texttt{PrintSelectionFromIterator} which prints the \emph{first} item specified, and then the item at every \emph{step}. The fourth parameter is essential when the object being printed is infinite. 

 Alternatively, given two parameters, with the second parameter a list \texttt{L} of positive integers, only the items at positions in \texttt{L} are printed. 

 }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@L := List( [1..20], n -> n^5 );;|
  !gapprompt@gap>| !gapinput@PrintSelection( L, [18..20] );|
  18 : 1889568
  19 : 2476099
  20 : 3200000
  !gapprompt@gap>| !gapinput@PrintSelection( L, 2, 9 );       |
  2 : 32
  11 : 161051
  20 : 3200000
  !gapprompt@gap>| !gapinput@PrintSelection( L, 2, 3, 11 );|
  2 : 32
  5 : 3125
  8 : 32768
  11 : 161051
  !gapprompt@gap>| !gapinput@s5 := SymmetricGroup( 5 );;|
  !gapprompt@gap>| !gapinput@PrintSelection( s5, [30,31,100,101] );|
  30 : (1,5)(3,4)
  31 : (1,5,2)
  100 : (1,4,3)
  101 : (1,4)(3,5)
  !gapprompt@gap>| !gapinput@PrintSelection( s5, 1, 30 );|
  1 : ()
  31 : (1,5,2)
  61 : (1,2,3)
  91 : (1,3,5,2,4)
  !gapprompt@gap>| !gapinput@PrintSelection( s5, 9, 11, 43 );|
  9 : (2,5,3)
  20 : (2,4)
  31 : (1,5,2)
  42 : (1,5,2,3,4)
  
\end{Verbatim}
 }

 }

         
\chapter{\textcolor{Chapter }{Lists, Sets and Strings}}\label{chap-lists}
\logpage{[ 3, 0, 0 ]}
\hyperdef{L}{X7AE6EFC086C0EB3C}{}
{
  
\section{\textcolor{Chapter }{Functions for lists}}\label{sec-lists}
\logpage{[ 3, 1, 0 ]}
\hyperdef{L}{X7C3F1E7D878AAA65}{}
{
  

\subsection{\textcolor{Chapter }{DifferencesList}}
\logpage{[ 3, 1, 1 ]}\nobreak
\hyperdef{L}{X78B7C92681D2F13C}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DifferencesList({\mdseries\slshape L})\index{DifferencesList@\texttt{DifferencesList}}
\label{DifferencesList}
}\hfill{\scriptsize (function)}}\\


 This function has been transferred from package \textsf{ResClasses}. 

 It takes a list $L$ of length $n$ and outputs the list of length $n-1$ containing all the differences $L[i]-L[i-1]$. 

 }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@List( [1..12], n->n^3 );|
  [ 1, 8, 27, 64, 125, 216, 343, 512, 729, 1000, 1331, 1728 ]
  !gapprompt@gap>| !gapinput@DifferencesList( last );|
  [ 7, 19, 37, 61, 91, 127, 169, 217, 271, 331, 397 ]
  !gapprompt@gap>| !gapinput@DifferencesList( last );|
  [ 12, 18, 24, 30, 36, 42, 48, 54, 60, 66 ]
  !gapprompt@gap>| !gapinput@DifferencesList( last );|
  [ 6, 6, 6, 6, 6, 6, 6, 6, 6 ]
  
\end{Verbatim}
 

\subsection{\textcolor{Chapter }{QuotientsList}}
\logpage{[ 3, 1, 2 ]}\nobreak
\hyperdef{L}{X7975371E865B89BC}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{QuotientsList({\mdseries\slshape L})\index{QuotientsList@\texttt{QuotientsList}}
\label{QuotientsList}
}\hfill{\scriptsize (function)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{FloatQuotientsList({\mdseries\slshape L})\index{FloatQuotientsList@\texttt{FloatQuotientsList}}
\label{FloatQuotientsList}
}\hfill{\scriptsize (function)}}\\


 These functions have been transferred from package \textsf{ResClasses}. 

 They take a list $L$ of length $n$ and output the quotients $L[i]/L[i-1]$ of consecutive entries in $L$. An error is returned if an entry is zero. 

 }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@List( [0..10], n -> Factorial(n) );|
  [ 1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800 ]
  !gapprompt@gap>| !gapinput@QuotientsList( last );|
  [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
  !gapprompt@gap>| !gapinput@L := [ 1, 3, 5, -1, -3, -5 ];;|
  !gapprompt@gap>| !gapinput@QuotientsList( L );|
  [ 3, 5/3, -1/5, 3, 5/3 ]
  !gapprompt@gap>| !gapinput@FloatQuotientsList( L );|
  [ 3., 1.66667, -0.2, 3., 1.66667 ]
  !gapprompt@gap>| !gapinput@QuotientsList( [ 2, 1, 0, -1, -2 ] );|
  [ 1/2, 0, fail, 2 ]
  !gapprompt@gap>| !gapinput@FloatQuotientsList( [1..10] );|
  [ 2., 1.5, 1.33333, 1.25, 1.2, 1.16667, 1.14286, 1.125, 1.11111 ]
  !gapprompt@gap>| !gapinput@Product( last );|
  10. 
  
\end{Verbatim}
 

\subsection{\textcolor{Chapter }{SearchCycle}}
\logpage{[ 3, 1, 3 ]}\nobreak
\hyperdef{L}{X86096E73858CFABD}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{SearchCycle({\mdseries\slshape L})\index{SearchCycle@\texttt{SearchCycle}}
\label{SearchCycle}
}\hfill{\scriptsize (operation)}}\\


 This function has been transferred from package \textsf{RCWA}. 

 \texttt{SearchCycle} is a tool to find likely cycles in lists. What, precisely, a \emph{cycle} is, is deliberately fuzzy here, and may possibly even change. The idea is that
the beginning of the list may be anything, following that the same pattern
needs to be repeated several times in order to be recognized as a cycle. 

 }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@L := [1..20];;  L[1]:=13;;                                              |
  !gapprompt@gap>| !gapinput@for i in [1..19] do                                                     |
  !gapprompt@>| !gapinput@       if IsOddInt(L[i]) then L[i+1]:=3*L[i]+1; else L[i+1]:=L[i]/2; fi;|
  !gapprompt@>| !gapinput@   od;                                                                  |
  !gapprompt@gap>| !gapinput@L;                                                                      |
  [ 13, 40, 20, 10, 5, 16, 8, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4, 2, 1, 4 ]
  !gapprompt@gap>| !gapinput@SearchCycle( L );                                                       |
  [ 1, 4, 2 ]
  !gapprompt@gap>| !gapinput@n := 1;;  L := [n];;|
  !gapprompt@gap>| !gapinput@for i in [1..100] do  n:=(n^2+1) mod 1093;  Add(L,n);  od;|
  !gapprompt@gap>| !gapinput@L; |
  [ 1, 2, 5, 26, 677, 363, 610, 481, 739, 715, 795, 272, 754, 157, 604, 848, 
    1004, 271, 211, 802, 521, 378, 795, 272, 754, 157, 604, 848, 1004, 271, 
    211, 802, 521, 378, 795, 272, 754, 157, 604, 848, 1004, 271, 211, 802, 521, 
    378, 795, 272, 754, 157, 604, 848, 1004, 271, 211, 802, 521, 378, 795, 272, 
    754, 157, 604, 848, 1004, 271, 211, 802, 521, 378, 795, 272, 754, 157, 604, 
    848, 1004, 271, 211, 802, 521, 378, 795, 272, 754, 157, 604, 848, 1004, 
    271, 211, 802, 521, 378, 795, 272, 754, 157, 604, 848, 1004 ]
  !gapprompt@gap>| !gapinput@C := SearchCycle( L );|
  [ 157, 604, 848, 1004, 271, 211, 802, 521, 378, 795, 272, 754 ]
  !gapprompt@gap>| !gapinput@P := Positions( L, 157 );|
  [ 14, 26, 38, 50, 62, 74, 86, 98 ]
  !gapprompt@gap>| !gapinput@Length( C );  DifferencesList( P );|
  12
  [ 12, 12, 12, 12, 12, 12, 12 ]
  
\end{Verbatim}
 

\subsection{\textcolor{Chapter }{RandomCombination}}
\logpage{[ 3, 1, 4 ]}\nobreak
\hyperdef{L}{X7EF06CAD7F35245D}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{RandomCombination({\mdseries\slshape S, k})\index{RandomCombination@\texttt{RandomCombination}}
\label{RandomCombination}
}\hfill{\scriptsize (operation)}}\\


 This function has been transferred from package \textsf{ResClasses}. 

 It returns a random unordered $k$\texttt{\symbol{45}}tuple of distinct elements of a set{\nobreakspace}$S$. 

 }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@## "6 aus 49" is a common lottery in Germany|
  !gapprompt@gap>| !gapinput@RandomCombination( [1..49], 6 ); |
  [ 2, 16, 24, 26, 37, 47 ]
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Distinct and Common Representatives}}\logpage{[ 3, 2, 0 ]}
\hyperdef{L}{X82F443FF84B8FCE3}{}
{
 \index{distinct and common representatives} 

\subsection{\textcolor{Chapter }{DistinctRepresentatives}}
\logpage{[ 3, 2, 1 ]}\nobreak
\hyperdef{L}{X78105CAA847A888C}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DistinctRepresentatives({\mdseries\slshape list})\index{DistinctRepresentatives@\texttt{DistinctRepresentatives}}
\label{DistinctRepresentatives}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{CommonRepresentatives({\mdseries\slshape list})\index{CommonRepresentatives@\texttt{CommonRepresentatives}}
\label{CommonRepresentatives}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{CommonTransversal({\mdseries\slshape grp, subgrp})\index{CommonTransversal@\texttt{CommonTransversal}}
\label{CommonTransversal}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IsCommonTransversal({\mdseries\slshape grp, subgrp, list})\index{IsCommonTransversal@\texttt{IsCommonTransversal}}
\label{IsCommonTransversal}
}\hfill{\scriptsize (operation)}}\\


 These operations have been transferred from package \textsf{XMod}. 

 They deal with lists of subsets of $[1 \ldots n]$ and construct systems of distinct and common representatives using simple,
non\texttt{\symbol{45}}recursive, combinatorial algorithms. 

 When $L$ is a set of $n$ subsets of $[1 \ldots n]$ and the Hall condition is satisfied (the union of any $k$ subsets has at least $k$ elements), a set of \texttt{DistinctRepresentatives} exists. 

 When $J,K$ are both lists of $n$ sets, the operation \texttt{CommonRepresentatives} returns two lists: the set of representatives, and a permutation of the
subsets of the second list. 

 The operation \texttt{CommonTransversal} may be used to provide a common transversal for the sets of left and right
cosets of a subgroup $H$ of a group $G$, although a greedy algorithm is usually quicker. }

 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@J := [ [1,2,3], [3,4], [3,4], [1,2,4] ];;|
  !gapprompt@gap>| !gapinput@DistinctRepresentatives( J );|
  [ 1, 3, 4, 2 ]
  !gapprompt@gap>| !gapinput@K := [ [3,4], [1,2], [2,3], [2,3,4] ];;|
  !gapprompt@gap>| !gapinput@CommonRepresentatives( J, K );|
  [ [ 3, 3, 3, 1 ], [ 1, 3, 4, 2 ] ]
  !gapprompt@gap>| !gapinput@d16 := DihedralGroup( IsPermGroup, 16 ); |
  Group([ (1,2,3,4,5,6,7,8), (2,8)(3,7)(4,6) ])
  !gapprompt@gap>| !gapinput@SetName( d16, "d16" );|
  !gapprompt@gap>| !gapinput@c4 := Subgroup( d16, [ d16.1^2 ] ); |
  Group([ (1,3,5,7)(2,4,6,8) ])
  !gapprompt@gap>| !gapinput@SetName( c4, "c4" );|
  !gapprompt@gap>| !gapinput@RightCosets( d16, c4 );|
  [ RightCoset(c4,()), RightCoset(c4,(2,8)(3,7)(4,6)), RightCoset(c4,(1,8,7,6,5,
     4,3,2)), RightCoset(c4,(1,8)(2,7)(3,6)(4,5)) ]
  !gapprompt@gap>| !gapinput@trans := CommonTransversal( d16, c4 );|
  [ (), (2,8)(3,7)(4,6), (1,2,3,4,5,6,7,8), (1,2)(3,8)(4,7)(5,6) ]
  !gapprompt@gap>| !gapinput@IsCommonTransversal( d16, c4, trans );|
  true
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Functions for strings}}\label{sec-strings}
\logpage{[ 3, 3, 0 ]}
\hyperdef{L}{X8033A2FE80FC2F2A}{}
{
  

\subsection{\textcolor{Chapter }{BlankFreeString}}
\logpage{[ 3, 3, 1 ]}\nobreak
\hyperdef{L}{X870C964E7804B266}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{BlankFreeString({\mdseries\slshape obj})\index{BlankFreeString@\texttt{BlankFreeString}}
\label{BlankFreeString}
}\hfill{\scriptsize (function)}}\\


 This function has been transferred from package \textsf{ResClasses}. 

 The result of \texttt{BlankFreeString( obj );} is a composite of the functions \texttt{String( obj )} and \texttt{RemoveCharacters( obj, " " );}. 

 }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@gens := GeneratorsOfGroup( DihedralGroup(12) );|
  [ f1, f2, f3 ]
  !gapprompt@gap>| !gapinput@String( gens );                                |
  "[ f1, f2, f3 ]"
  !gapprompt@gap>| !gapinput@BlankFreeString( gens );                       |
  "[f1,f2,f3]"
  
\end{Verbatim}
 }

 }

         
\chapter{\textcolor{Chapter }{Number\texttt{\symbol{45}}theoretic functions}}\label{chap-number}
\logpage{[ 4, 0, 0 ]}
\hyperdef{L}{X86E71C1687F2D0AD}{}
{
  
\section{\textcolor{Chapter }{Functions for integers}}\label{sec-integers}
\logpage{[ 4, 1, 0 ]}
\hyperdef{L}{X7D33B5B17BF785CA}{}
{
  

\subsection{\textcolor{Chapter }{AllSmoothIntegers (for two integers)}}
\logpage{[ 4, 1, 1 ]}\nobreak
\hyperdef{L}{X8191A031788AC7C0}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{AllSmoothIntegers({\mdseries\slshape maxp, maxn})\index{AllSmoothIntegers@\texttt{AllSmoothIntegers}!for two integers}
\label{AllSmoothIntegers:for two integers}
}\hfill{\scriptsize (function)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{AllSmoothIntegers({\mdseries\slshape L, maxp})\index{AllSmoothIntegers@\texttt{AllSmoothIntegers}!for a list and an integer}
\label{AllSmoothIntegers:for a list and an integer}
}\hfill{\scriptsize (function)}}\\


 This function has been transferred from package \textsf{RCWA}. 

 \index{smooth integer} The function \texttt{AllSmoothIntegers(\mbox{\texttt{\mdseries\slshape maxp}},\mbox{\texttt{\mdseries\slshape maxn}})} returns the list of all positive integers less than or equal to \mbox{\texttt{\mdseries\slshape maxn}} whose prime factors are all in the list $L = \{p ~|~ p \leqslant maxp, p~\mbox{prime} \}$. 

 In the alternative form, when $L$ is a list of primes, the function returns the list of all positive integers
whose prime factors lie in $L$. 

 }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@AllSmoothIntegers( 3, 1000 );|
  [ 1, 2, 3, 4, 6, 8, 9, 12, 16, 18, 24, 27, 32, 36, 48, 54, 64, 72, 81, 96, 
    108, 128, 144, 162, 192, 216, 243, 256, 288, 324, 384, 432, 486, 512, 576, 
    648, 729, 768, 864, 972 ]
  !gapprompt@gap>| !gapinput@AllSmoothIntegers( [5,11,17], 1000 );|
  [ 1, 5, 11, 17, 25, 55, 85, 121, 125, 187, 275, 289, 425, 605, 625, 935 ]
  !gapprompt@gap>| !gapinput@Length( last );|
  16
  !gapprompt@gap>| !gapinput@List( [3..20], n -> Length( AllSmoothIntegers( [5,11,17], 10^n ) ) );|
  [ 16, 29, 50, 78, 114, 155, 212, 282, 359, 452, 565, 691, 831, 992, 1173, 
    1374, 1595, 1843 ]
  
\end{Verbatim}
 

\subsection{\textcolor{Chapter }{AllProducts}}
\logpage{[ 4, 1, 2 ]}\nobreak
\hyperdef{L}{X78BE6B8B878D250D}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{AllProducts({\mdseries\slshape L, k})\index{AllProducts@\texttt{AllProducts}}
\label{AllProducts}
}\hfill{\scriptsize (function)}}\\


 This function has been transferred from package \textsf{RCWA}. 

 The command \texttt{AllProducts(\mbox{\texttt{\mdseries\slshape L}},\mbox{\texttt{\mdseries\slshape k}})} returns the list of all products of \mbox{\texttt{\mdseries\slshape k}} entries of the list{\nobreakspace}\mbox{\texttt{\mdseries\slshape L}}. Note that every ordering of the entries is used so that, in the commuting
case, there are bound to be repetitions. 

 }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@AllProducts([1..4],3); |
  [ 1, 2, 3, 4, 2, 4, 6, 8, 3, 6, 9, 12, 4, 8, 12, 16, 2, 4, 6, 8, 4, 8, 12, 
    16, 6, 12, 18, 24, 8, 16, 24, 32, 3, 6, 9, 12, 6, 12, 18, 24, 9, 18, 27, 
    36, 12, 24, 36, 48, 4, 8, 12, 16, 8, 16, 24, 32, 12, 24, 36, 48, 16, 32, 
    48, 64 ]
  !gapprompt@gap>| !gapinput@Set(last);            |
  [ 1, 2, 3, 4, 6, 8, 9, 12, 16, 18, 24, 27, 32, 36, 48, 64 ]
  !gapprompt@gap>| !gapinput@AllProducts( [(1,2,3),(2,3,4)], 2 );|
  [ (2,4,3), (1,2)(3,4), (1,3)(2,4), (1,3,2) ]
  
\end{Verbatim}
 

\subsection{\textcolor{Chapter }{RestrictedPartitionsWithoutRepetitions}}
\logpage{[ 4, 1, 3 ]}\nobreak
\hyperdef{L}{X845F46E579CEA43F}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{RestrictedPartitionsWithoutRepetitions({\mdseries\slshape n, S})\index{RestrictedPartitionsWithoutRepetitions@\texttt{Restricted}\-\texttt{Partitions}\-\texttt{Without}\-\texttt{Repetitions}}
\label{RestrictedPartitionsWithoutRepetitions}
}\hfill{\scriptsize (function)}}\\


 This function has been transferred from package \textsf{RCWA}. 

 For a positive integer \mbox{\texttt{\mdseries\slshape n}} and a set of positive integers \mbox{\texttt{\mdseries\slshape S}}, this function returns the list of partitions of \mbox{\texttt{\mdseries\slshape n}} into distinct elements of \mbox{\texttt{\mdseries\slshape S}}. Unlike \texttt{RestrictedPartitions}, no repetitions are allowed. 

 }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@RestrictedPartitions( 20, [4..10] );|
  [ [ 4, 4, 4, 4, 4 ], [ 5, 5, 5, 5 ], [ 6, 5, 5, 4 ], [ 6, 6, 4, 4 ], 
    [ 7, 5, 4, 4 ], [ 7, 7, 6 ], [ 8, 4, 4, 4 ], [ 8, 6, 6 ], [ 8, 7, 5 ], 
    [ 8, 8, 4 ], [ 9, 6, 5 ], [ 9, 7, 4 ], [ 10, 5, 5 ], [ 10, 6, 4 ], 
    [ 10, 10 ] ]
  !gapprompt@gap>| !gapinput@RestrictedPartitionsWithoutRepetitions( 20, [4..10] );|
  [ [ 10, 6, 4 ], [ 9, 7, 4 ], [ 9, 6, 5 ], [ 8, 7, 5 ] ]
  !gapprompt@gap>| !gapinput@RestrictedPartitionsWithoutRepetitions( 10^2, List([1..10], n->n^2 ) );|
  [ [ 100 ], [ 64, 36 ], [ 49, 25, 16, 9, 1 ] ]
  
\end{Verbatim}
 

\subsection{\textcolor{Chapter }{NextProbablyPrimeInt}}
\logpage{[ 4, 1, 4 ]}\nobreak
\hyperdef{L}{X81708BF4858505E8}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{NextProbablyPrimeInt({\mdseries\slshape n})\index{NextProbablyPrimeInt@\texttt{NextProbablyPrimeInt}}
\label{NextProbablyPrimeInt}
}\hfill{\scriptsize (function)}}\\


 This function has been transferred from package \textsf{RCWA}. 

 The function \texttt{NextProbablyPrimeInt(\mbox{\texttt{\mdseries\slshape n}})} does the same as \texttt{NextPrimeInt(\mbox{\texttt{\mdseries\slshape n}})} except that for reasons of performance it tests numbers only for \texttt{IsProbablyPrimeInt(\mbox{\texttt{\mdseries\slshape n}})} instead of \texttt{IsPrimeInt(\mbox{\texttt{\mdseries\slshape n}})}. For large \mbox{\texttt{\mdseries\slshape n}}, this function is much faster than \texttt{NextPrimeInt(\mbox{\texttt{\mdseries\slshape n}})} 

 }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@n := 2^251;|
  3618502788666131106986593281521497120414687020801267626233049500247285301248
  !gapprompt@gap>| !gapinput@NextProbablyPrimeInt( n );|
  3618502788666131106986593281521497120414687020801267626233049500247285301313
  !gapprompt@gap>| !gapinput@time;                     |
  1
  !gapprompt@gap>| !gapinput@NextPrimeInt( n );        |
  3618502788666131106986593281521497120414687020801267626233049500247285301313
  !gapprompt@gap>| !gapinput@time;             |
  213
  
\end{Verbatim}
 

\subsection{\textcolor{Chapter }{PrimeNumbersIterator}}
\logpage{[ 4, 1, 5 ]}\nobreak
\hyperdef{L}{X8021EEE5787FCA37}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{PrimeNumbersIterator({\mdseries\slshape [chunksize]})\index{PrimeNumbersIterator@\texttt{PrimeNumbersIterator}}
\label{PrimeNumbersIterator}
}\hfill{\scriptsize (function)}}\\


 This function has been transferred from package \textsf{RCWA}. 

 This function returns an iterator which runs over the prime numbers n
ascending order; it takes an optional argument \texttt{chunksize} which specifies the length of the interval which is sieved in one go (the
default is $10^7$), and which can be used to balance runtime vs. memory consumption. It is
assumed that \texttt{chunksize} is larger than any gap between two consecutive primes within the range one
intends to run the iterator over. 

 }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@iter := PrimeNumbersIterator();;|
  !gapprompt@gap>| !gapinput@for i in [1..100] do  p := NextIterator(iter);  od;|
  !gapprompt@gap>| !gapinput@p;|
  541
  !gapprompt@gap>| !gapinput@sum := 0;;|
  !gapprompt@gap>| !gapinput@## "prime number race" 1 vs. 3 mod 4|
  !gapprompt@gap>| !gapinput@for p in PrimeNumbersIterator() do |
  !gapprompt@>| !gapinput@      if p <> 2 then sum := sum + E(4)^(p-1); fi;|
  !gapprompt@>| !gapinput@      if sum > 0 then break; fi;|
  !gapprompt@>| !gapinput@   od;|
  !gapprompt@gap>| !gapinput@p;|
  26861
  
\end{Verbatim}
 }

 }

         
\chapter{\textcolor{Chapter }{Groups and homomorphisms}}\label{chap-groups}
\logpage{[ 5, 0, 0 ]}
\hyperdef{L}{X8171DAF2833FF728}{}
{
  
\section{\textcolor{Chapter }{Functions for groups}}\label{sec-groups}
\logpage{[ 5, 1, 0 ]}
\hyperdef{L}{X7E21E6D285E6B12C}{}
{
  

\subsection{\textcolor{Chapter }{Comm}}
\logpage{[ 5, 1, 1 ]}\nobreak
\hyperdef{L}{X80761843831B468E}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{Comm({\mdseries\slshape L})\index{Comm@\texttt{Comm}}
\label{Comm}
}\hfill{\scriptsize (operation)}}\\


 This method has been transferred from package \textsf{ResClasses}. 

 It provides a method for \texttt{Comm} when the argument is a list (enclosed in square brackets), and calls the
function \texttt{LeftNormedComm}. 

 }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@Comm( [ (1,2), (2,3) ] );|
  (1,2,3)
  !gapprompt@gap>| !gapinput@Comm( [(1,2),(2,3),(3,4),(4,5),(5,6)] );|
  (1,5,6)
  !gapprompt@gap>| !gapinput@Comm(Comm(Comm(Comm((1,2),(2,3)),(3,4)),(4,5)),(5,6));  ## the same|
  (1,5,6)
  
\end{Verbatim}
 

\subsection{\textcolor{Chapter }{IsCommuting}}
\logpage{[ 5, 1, 2 ]}\nobreak
\hyperdef{L}{X803A050C7A183CCC}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IsCommuting({\mdseries\slshape a, b})\index{IsCommuting@\texttt{IsCommuting}}
\label{IsCommuting}
}\hfill{\scriptsize (operation)}}\\


 This function has been transferred from package \textsf{ResClasses}. 

 It tests whether two elements in a group commute. 

 }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@D12 := DihedralGroup( 12 );|
  <pc group of size 12 with 3 generators>
  !gapprompt@gap>| !gapinput@SetName( D12, "D12" ); |
  !gapprompt@gap>| !gapinput@a := D12.1;;  b := D12.2;;  |
  !gapprompt@gap>| !gapinput@IsCommuting( a, b );|
  false
  
\end{Verbatim}
 

\subsection{\textcolor{Chapter }{ListOfPowers}}
\logpage{[ 5, 1, 3 ]}\nobreak
\hyperdef{L}{X87A8F01286548037}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{ListOfPowers({\mdseries\slshape g, exp})\index{ListOfPowers@\texttt{ListOfPowers}}
\label{ListOfPowers}
}\hfill{\scriptsize (operation)}}\\


 This function has been transferred from package \textsf{RCWA}. 

 The operation \texttt{ListOfPowers(g,exp)} returns the list $[g,g^2,...,g^{exp}]$ of powers of the element $g$. 

 }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@ListOfPowers( 2, 20 );|
  [ 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384,
   32768, 65536, 131072, 262144, 524288, 1048576 ]
  !gapprompt@gap>| !gapinput@ListOfPowers( (1,2,3)(4,5), 12 );|
  [ (1,2,3)(4,5), (1,3,2), (4,5), (1,2,3), (1,3,2)(4,5), (),
   (1,2,3)(4,5), (1,3,2), (4,5), (1,2,3), (1,3,2)(4,5), () ]
  !gapprompt@gap>| !gapinput@ListOfPowers( D12.2, 6 );|
  [ f2, f3, f2*f3, f3^2, f2*f3^2, <identity> of ... ]
  
\end{Verbatim}
 

\subsection{\textcolor{Chapter }{GeneratorsAndInverses}}
\logpage{[ 5, 1, 4 ]}\nobreak
\hyperdef{L}{X820B71307E41BEE5}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{GeneratorsAndInverses({\mdseries\slshape G})\index{GeneratorsAndInverses@\texttt{GeneratorsAndInverses}}
\label{GeneratorsAndInverses}
}\hfill{\scriptsize (operation)}}\\


 This function has been transferred from package \textsf{RCWA}. 

 This operation returns a list containing the generators of $G$ followed by the inverses of these generators. 

 }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@GeneratorsAndInverses( D12 );|
  [ f1, f2, f3, f1, f2*f3^2, f3^2 ]
  !gapprompt@gap>| !gapinput@GeneratorsAndInverses( SymmetricGroup(5) );     |
  [ (1,2,3,4,5), (1,2), (1,5,4,3,2), (1,2) ]
  
\end{Verbatim}
 

\subsection{\textcolor{Chapter }{UpperFittingSeries}}
\logpage{[ 5, 1, 5 ]}\nobreak
\hyperdef{L}{X84CF95227F9D562F}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{UpperFittingSeries({\mdseries\slshape G})\index{UpperFittingSeries@\texttt{UpperFittingSeries}}
\label{UpperFittingSeries}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{LowerFittingSeries({\mdseries\slshape G})\index{LowerFittingSeries@\texttt{LowerFittingSeries}}
\label{LowerFittingSeries}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{FittingLength({\mdseries\slshape G})\index{FittingLength@\texttt{FittingLength}}
\label{FittingLength}
}\hfill{\scriptsize (attribute)}}\\


 These three functions have been transferred from package \textsf{ResClasses}. 

 \index{Fitting series} The upper and lower Fitting series and the Fitting length of a solvable group
are described here: \href{https://en.wikipedia.org/wiki/Fitting_length} {\texttt{https://en.wikipedia.org/wiki/Fitting{\textunderscore}length}}. 

 }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@UpperFittingSeries( D12 );  LowerFittingSeries( D12 );|
  [ Group([  ]), Group([ f3, f2*f3 ]), Group([ f1, f3, f2*f3 ]) ]
  [ D12, Group([ f3 ]), Group([  ]) ]
  !gapprompt@gap>| !gapinput@FittingLength( D12 );|
  2
  !gapprompt@gap>| !gapinput@S4 := SymmetricGroup( 4 );;|
  !gapprompt@gap>| !gapinput@UpperFittingSeries( S4 );|
  [ Group(()), Group([ (1,2)(3,4), (1,4)(2,3) ]), Group([ (1,2)(3,4), (1,4)
    (2,3), (2,4,3) ]), Group([ (3,4), (2,3,4), (1,2)(3,4) ]) ]
  !gapprompt@gap>| !gapinput@List( last, StructureDescription );|
  [ "1""C2 x C2""A4""S4" ]
  !gapprompt@gap>| !gapinput@LowerFittingSeries( S4 );|
  [ Sym( [ 1 .. 4 ] ), Alt( [ 1 .. 4 ] ), Group([ (1,4)(2,3), (1,3)
   (2,4) ]), Group(()) ]
  !gapprompt@gap>| !gapinput@List( last, StructureDescription );|
  [ "S4""A4""C2 x C2""1" ]
  !gapprompt@gap>| !gapinput@FittingLength( S4);|
  3
  
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{Left Cosets for Groups}}\label{sec-leftcosets}
\logpage{[ 5, 2, 0 ]}
\hyperdef{L}{X7FE4848B7DE6B3FD}{}
{
  

\subsection{\textcolor{Chapter }{LeftCoset}}
\logpage{[ 5, 2, 1 ]}\nobreak
\hyperdef{L}{X8340B4537F17DCD3}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{LeftCoset({\mdseries\slshape g, U})\index{LeftCoset@\texttt{LeftCoset}}
\label{LeftCoset}
}\hfill{\scriptsize (operation)}}\\


 Since \textsf{GAP} uses right actions by default, the library contains the operation \texttt{RightCoset(U,g)} for constructing the right coset $Ug$ of a subgroup $U \leq G$ and an element $\in G$. It has been noted in the reference manual that, by inverting all the
elements in $Ug$, the left coset $g^{-1}U$ is obtained. 

 Just for the sake of completeness, from August 2022 this package provides the
operation \texttt{LeftCoset(g,U)} for constructing the left coset $gU$. Users are strongly recommended to continue to use \texttt{RightCoset} for all serious calculations, since left cosets have a much simpler
implementation and do not behave exactly like right cosets. 

 The methods for left cosets which are provided generally work by converting $gU$ to $Ug^{-1}$; applying the equivalent method for right cosets; and, if necessary,
converting back again to left cosets. 

 $G$ acts on left cosets by \texttt{OnLeftInverse}: $(gU)^{g_0} = g_0^{-1}*(gU) = (g_0^{-1}g)U$. 

 }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@a4 := Group( (1,2,3), (2,3,4) );; SetName( a4, "a4" );|
  !gapprompt@gap>| !gapinput@k4 := Group( (1,2)(3,4), (1,3)(2,4) );; SetName( k4, "k4" );|
  !gapprompt@gap>| !gapinput@rc := RightCosets( a4, k4 );|
  [ RightCoset(k4,()), RightCoset(k4,(2,3,4)), RightCoset(k4,(2,4,3)) ]
  !gapprompt@gap>| !gapinput@lc := LeftCosets( a4, k4 );|
  [ LeftCoset((),k4), LeftCoset((2,4,3),k4), LeftCoset((2,3,4),k4) ]
  !gapprompt@gap>| !gapinput@AsSet( lc[2] );|
  [ (2,4,3), (1,2,3), (1,3,4), (1,4,2) ]
  !gapprompt@gap>| !gapinput@LeftCoset( (1,4,2), k4 ) = lc[2];|
  true
  !gapprompt@gap>| !gapinput@Representative( lc[2] );|
  (2,4,3)
  !gapprompt@gap>| !gapinput@ActingDomain( lc[2] );|
  k4
  !gapprompt@gap>| !gapinput@(1,4,3) in lc[3];|
  true
  !gapprompt@gap>| !gapinput@(1,2,3)*lc[2] = lc[3];|
  true
  !gapprompt@gap>| !gapinput@lc[2]^(1,3,2) = lc[3];|
  true
  
\end{Verbatim}
 
\subsection{\textcolor{Chapter }{Inverse}}\label{subsec-inverse}
\logpage{[ 5, 2, 2 ]}
\hyperdef{L}{X793E48267EF5FD77}{}
{
  The inverse of the left coset $gU$ is the right coset $Ug^{-1}$, and conversely. This is an abuse of the attribute \texttt{Inverse}, since the standard requirement, that $x*x^{-1}$ is an identity, does not hold. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@Inverse( rc[3] ) = lc[3];|
  true
  !gapprompt@gap>| !gapinput@Inverse( lc[2] ) = rc[2];|
  true
  
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Functions for group homomorphisms}}\label{sec-homomorphisms}
\logpage{[ 5, 3, 0 ]}
\hyperdef{L}{X80A512877F515DE7}{}
{
  

\subsection{\textcolor{Chapter }{EpimorphismByGenerators}}
\logpage{[ 5, 3, 1 ]}\nobreak
\hyperdef{L}{X80C9A0B583FEA7B9}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{EpimorphismByGenerators({\mdseries\slshape G, H})\index{EpimorphismByGenerators@\texttt{EpimorphismByGenerators}}
\label{EpimorphismByGenerators}
}\hfill{\scriptsize (operation)}}\\


 This function has been transferred from package \textsf{RCWA}. 

 It constructs a group homomorphism which maps the generators of $G$ to those of $H$. Its intended use is when $G$ is a free group, and a warning is printed when this is not the case. Note that
anything may happen if the resulting map is not a homomorphism! 

 }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@G := Group( (1,2,3), (3,4,5), (5,6,7), (7,8,9) );;|
  !gapprompt@gap>| !gapinput@phi := EpimorphismByGenerators( FreeGroup("a","b","c","d"), G );|
  [ a, b, c, d ] -> [ (1,2,3), (3,4,5), (5,6,7), (7,8,9) ]
  !gapprompt@gap>| !gapinput@PreImagesRepresentativeNC( phi, (1,2,3,4,5,6,7,8,9) );|
  d*c*b*a
  !gapprompt@gap>| !gapinput@a := G.1;; b := G.2;; c := G.3;; d := G.4;;|
  !gapprompt@gap>| !gapinput@d*c*b*a;|
  (1,2,3,4,5,6,7,8,9)
  !gapprompt@gap>| !gapinput@## note that it is easy to produce nonsense: |
  !gapprompt@gap>| !gapinput@epi := EpimorphismByGenerators( Group((1,2,3)), Group((8,9)) );|
  Warning: calling GroupHomomorphismByImagesNC without checks
  [ (1,2,3) ] -> [ (8,9) ]
  !gapprompt@gap>| !gapinput@IsGroupHomomorphism( epi );|
  true
  !gapprompt@gap>| !gapinput@Image( epi, (1,2,3) );                                            |
  ()
  !gapprompt@gap>| !gapinput@Image( epi, (1,3,2) );|
  (8,9)
  
\end{Verbatim}
 

\subsection{\textcolor{Chapter }{Pullback}}
\logpage{[ 5, 3, 2 ]}\nobreak
\hyperdef{L}{X7C705F2A79F8E43C}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{Pullback({\mdseries\slshape hom1, hom2})\index{Pullback@\texttt{Pullback}}
\label{Pullback}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{PullbackInfo({\mdseries\slshape G})\index{PullbackInfo@\texttt{PullbackInfo}}
\label{PullbackInfo}
}\hfill{\scriptsize (attribute)}}\\


 If $\phi_1 : G_1 \to H$ and $\phi_2 : G_2 \to H$ are two group homomorphisms with the same range, then their \emph{pullback} is the subgroup of $G_1 \times G_2$ consisting of those elements $(g_1,g_2)$ such that $\phi_1 g_1 = \phi_2 g_2$. 

 The attribute \texttt{PullbackInfo} of a pullback group \texttt{P} is similar to \texttt{DirectProductInfo} for a direct product of groups. Its value is a record with the following
components: 

 
\begin{description}
\item[{\texttt{directProduct}}]  the direct product $G_1 \times G_2$, and 
\item[{\texttt{projections}}]  a list with the two projections onto $G_1$ and $G_2$. 
\end{description}
 There are no embeddings in this record, but it is possible to use the
embeddings into the direct product, see \texttt{Embedding} (\textbf{Reference: Embedding}). 

 }

 
\begin{Verbatim}[commandchars=@|C,fontsize=\small,frame=single,label=Example]
  
  @gapprompt|gap>C @gapinput|s4 := Group( (1,2),(2,3),(3,4) );;C
  @gapprompt|gap>C @gapinput|s3 := Group( (5,6),(6,7) );;C
  @gapprompt|gap>C @gapinput|c3 := Subgroup( s3, [ (5,6,7) ] );;C
  @gapprompt|gap>C @gapinput|f := GroupHomomorphismByImages( s4, s3, C
  @gapprompt|>C @gapinput|            [(1,2),(2,3),(3,4)], [(5,6),(6,7),(5,6)] );; C
  @gapprompt|gap>C @gapinput|i := GroupHomomorphismByImages( c3, s3, [(5,6,7)], [(5,6,7)] );; C
  @gapprompt|gap>C @gapinput|Pfi := Pullback( f, i );C
  Group([ (2,3,4)(5,7,6), (1,2)(3,4) ])
  @gapprompt|gap>C @gapinput|StructureDescription( Pfi );C
  "A4"
  @gapprompt|gap>C @gapinput|info := PullbackInfo( Pfi );C
  rec( directProduct := Group([ (1,2), (2,3), (3,4), (5,6,7) ]), 
    projections := [ [ (2,3,4)(5,7,6), (1,2)(3,4) ] -> [ (2,3,4), (1,2)(3,4) ], 
        [ (2,3,4)(5,7,6), (1,2)(3,4) ] -> [ (5,7,6), () ] ] )
  @gapprompt|gap>C @gapinput|g := (1,2,3)(5,6,7);; C
  @gapprompt|gap>C @gapinput|ImageElm( info!.projections[1], g );C
  (1,2,3)
  @gapprompt|gap>C @gapinput|ImageElm( info!.projections[2], g );C
  (5,6,7) 
  @gapprompt|gap>C @gapinput|dp := info!.directProduct;; C
  @gapprompt|gap>C @gapinput|a := ImageElm( Embedding( dp, 1 ), (1,4,3) );; C
  @gapprompt|gap>C @gapinput|b := ImageElm( Embedding( dp, 2 ), (5,7,6) );; C
  @gapprompt|gap>C @gapinput|a*b in Pfi;C
  true
  
\end{Verbatim}
 

\subsection{\textcolor{Chapter }{CentralProduct}}
\logpage{[ 5, 3, 3 ]}\nobreak
\hyperdef{L}{X78DD2C617B992BE2}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{CentralProduct({\mdseries\slshape G1, G2, Z1, Phi})\index{CentralProduct@\texttt{CentralProduct}}
\label{CentralProduct}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{CentralProductInfo({\mdseries\slshape G})\index{CentralProductInfo@\texttt{CentralProductInfo}}
\label{CentralProductInfo}
}\hfill{\scriptsize (attribute)}}\\


 This function was added by Thomas Breuer, following discussions with Hongyi
Zhao (see \href{https://github.com/gap-packages/hap/issues/73} {\texttt{https://github.com/gap\texttt{\symbol{45}}packages/hap/issues/73}}). 

 Let \mbox{\texttt{\mdseries\slshape G1}} and \mbox{\texttt{\mdseries\slshape G2}} be two groups, \mbox{\texttt{\mdseries\slshape Z1}} be a central subgroup of \mbox{\texttt{\mdseries\slshape G1}}, and \mbox{\texttt{\mdseries\slshape Phi}} be an isomorphism from \mbox{\texttt{\mdseries\slshape Z1}} to a central subgroup of \mbox{\texttt{\mdseries\slshape G2}}. The \emph{central product} defined by these arguments is the factor group of the direct product of \mbox{\texttt{\mdseries\slshape G1}} and \mbox{\texttt{\mdseries\slshape G2}} by the central subgroup $\{ (z, (\mbox{\texttt{\mdseries\slshape Phi}}(z))^{-1}) : z \in \mbox{\texttt{\mdseries\slshape Z1}} \}$. 

 The attribute \texttt{CentralProductInfo} of a group $G$ that has been created by \texttt{CentralProduct} is similar to \texttt{PullbackInfo} (\ref{PullbackInfo}) for pullback groups. Its value is a record with the following components. 

 
\begin{description}
\item[{\texttt{projection}}]  the epimorphism from the direct product of \mbox{\texttt{\mdseries\slshape G1}} and \mbox{\texttt{\mdseries\slshape G2}} to $G$, and 
\item[{\texttt{phi}}]  the map \mbox{\texttt{\mdseries\slshape Phi}}. 
\end{description}
 Note that one can access the direct product as the \texttt{Source} (\textbf{Reference: Source}) value of the \texttt{projection} map, and one can access \mbox{\texttt{\mdseries\slshape G1}} and \mbox{\texttt{\mdseries\slshape G2}} as the two embeddings of this direct product, see \texttt{Embedding} (\textbf{Reference: Embedding}). 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  !gapprompt@gap>| !gapinput@g1 := DihedralGroup( 8 );|
  <pc group of size 8 with 3 generators>
  !gapprompt@gap>| !gapinput@c1 := Centre( g1 );|
  Group([ f3 ])
  !gapprompt@gap>| !gapinput@cp1 := CentralProduct( g1, g1, c1, IdentityMapping( c1 ) );|
  Group([ f1, f2, f5, f3, f4, f5 ])
  !gapprompt@gap>| !gapinput@IdGroup( cp1 ) = IdGroup( ExtraspecialGroup( 2^5, "+" ) );|
  true
  !gapprompt@gap>| !gapinput@g2 := QuaternionGroup( 8 );|
  <pc group of size 8 with 3 generators>
  !gapprompt@gap>| !gapinput@c2 := Centre( g2 );|
  Group([ y2 ])
  !gapprompt@gap>| !gapinput@cp2 := CentralProduct( g2, g2, c2, IdentityMapping( c2 ) );|
  Group([ f1, f2, f5, f3, f4, f5 ])
  !gapprompt@gap>| !gapinput@IdGroup( cp2 ) = IdGroup( ExtraspecialGroup( 2^5, "+" ) );|
  true
  !gapprompt@gap>| !gapinput@info2 := CentralProductInfo( cp2 );|
  rec( phi := IdentityMapping( Group([ y2 ]) ), 
    projection := [ f1, f2, f3, f4, f5, f6 ] -> [ f1, f2, f5, f3, f4, f5 ] )
  !gapprompt@gap>| !gapinput@Source( Embedding( Source( info2.projection ), 1 ) ) = g2;|
  true
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{IdempotentEndomorphisms}}
\logpage{[ 5, 3, 4 ]}\nobreak
\hyperdef{L}{X801038CB808FC956}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IdempotentEndomorphisms({\mdseries\slshape G})\index{IdempotentEndomorphisms@\texttt{IdempotentEndomorphisms}}
\label{IdempotentEndomorphisms}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IdempotentEndomorphismsData({\mdseries\slshape G})\index{IdempotentEndomorphismsData@\texttt{IdempotentEndomorphismsData}}
\label{IdempotentEndomorphismsData}
}\hfill{\scriptsize (attribute)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{IdempotentEndomorphismsWithImage({\mdseries\slshape genG, R})\index{IdempotentEndomorphismsWithImage@\texttt{IdempotentEndomorphismsWithImage}}
\label{IdempotentEndomorphismsWithImage}
}\hfill{\scriptsize (operation)}}\\


 An endomorphism $f : G \to G$ is idempotent if $f^2=f$. It has an image $R \leqslant G$; is the identity map when restricted to $R$; and has a kernel $N$ which has trivial intersection with $R$ and has size $|G|/|R|$. 

 The operation \texttt{IdempotentEndomorphismsWithImage(genG,R)} returns a list of the images of the generating set \texttt{genG} of a group $G$ under the idempotent endomorphisms with image $R$. 

 The attribute \texttt{IdempotentEndomorphismsData(G)} returns a record \texttt{data} with fields \texttt{data.gens}, a fixed generating set for $G$, and \texttt{data.images} a list of the non\texttt{\symbol{45}}empty outputs of \texttt{IdempotentEndomorphismsWithImage(genG,R)} obtained by iterating over all subgroups of $G$. 

 The operation \texttt{IdempotentEndomorphisms(G)} returns the list of these mappings obtained using \texttt{IdempotentEndomorphismsData(G)}. The first of these is the zero map, the second is the identity. 

 }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@gens := [ (1,2,3,4), (1,2)(3,4) ];; |
  !gapprompt@gap>| !gapinput@d8 := Group( gens );;|
  !gapprompt@gap>| !gapinput@SetName( d8, "d8" );|
  !gapprompt@gap>| !gapinput@c2 := Subgroup( d8, [ (2,4) ] );;|
  !gapprompt@gap>| !gapinput@IdempotentEndomorphismsWithImage( gens, c2 );|
  [ [ (), (2,4) ], [ (2,4), () ] ]
  !gapprompt@gap>| !gapinput@IdempotentEndomorphismsData( d8 );|
  rec( gens := [ (1,2,3,4), (1,2)(3,4) ], 
    images := [ [ [ (), () ] ], [ [ (), (2,4) ], [ (2,4), () ] ], 
        [ [ (), (1,3) ], [ (1,3), () ] ], 
        [ [ (), (1,2)(3,4) ], [ (1,2)(3,4), (1,2)(3,4) ] ], 
        [ [ (), (1,4)(2,3) ], [ (1,4)(2,3), (1,4)(2,3) ] ], 
        [ [ (1,2,3,4), (1,2)(3,4) ] ] ] )
  !gapprompt@gap>| !gapinput@List( last.images, L -> Length(L) );|
  [ 1, 2, 2, 2, 2, 1 ]
  !gapprompt@gap>| !gapinput@IdempotentEndomorphisms( d8 );               |
  [ [ (1,2,3,4), (1,2)(3,4) ] -> [ (), () ], 
    [ (1,2,3,4), (1,2)(3,4) ] -> [ (), (2,4) ], 
    [ (1,2,3,4), (1,2)(3,4) ] -> [ (2,4), () ], 
    [ (1,2,3,4), (1,2)(3,4) ] -> [ (), (1,3) ], 
    [ (1,2,3,4), (1,2)(3,4) ] -> [ (1,3), () ], 
    [ (1,2,3,4), (1,2)(3,4) ] -> [ (), (1,2)(3,4) ], 
    [ (1,2,3,4), (1,2)(3,4) ] -> [ (1,2)(3,4), (1,2)(3,4) ], 
    [ (1,2,3,4), (1,2)(3,4) ] -> [ (), (1,4)(2,3) ], 
    [ (1,2,3,4), (1,2)(3,4) ] -> [ (1,4)(2,3), (1,4)(2,3) ], 
    [ (1,2,3,4), (1,2)(3,4) ] -> [ (1,2,3,4), (1,2)(3,4) ] ]
  
\end{Verbatim}
 The quaternion group \texttt{q8} is an example of a group with a tail: there is only one subgroup in the
lattice which covers the identity subgroup. The only idempotent isomorphisms
of such groups are the identity mapping and the zero mapping because the only
pairs $N,R$ are the whole group and the identity subgroup. 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@q8 := QuaternionGroup( 8 );;|
  !gapprompt@gap>| !gapinput@IdempotentEndomorphisms( q8 );|
  [ [ x, y ] -> [ <identity> of ..., <identity> of ... ], [ x, y ] -> [ x, y ] ]
  
\end{Verbatim}
 

\subsection{\textcolor{Chapter }{DirectProductOfFunctions}}
\logpage{[ 5, 3, 5 ]}\nobreak
\hyperdef{L}{X81FA9E6C7F3B9238}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DirectProductOfFunctions({\mdseries\slshape G, H, f1, f2})\index{DirectProductOfFunctions@\texttt{DirectProductOfFunctions}}
\label{DirectProductOfFunctions}
}\hfill{\scriptsize (operation)}}\\


 Given group homomorphisms $f_1 : G_1 \to G_2$ and $f_2 : H_1 \to H_2$, this operation return the product homomorphism $f_1 \times f_2 : G_1 \times G_2 \to H_1 \times H_2$. 

 }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@c4 := Group( (1,2,3,4) );; |
  !gapprompt@gap>| !gapinput@c2 := Group( (5,6) );; |
  !gapprompt@gap>| !gapinput@f1 := GroupHomomorphismByImages( c4, c2, [(1,2,3,4)], [(5,6)] );;|
  !gapprompt@gap>| !gapinput@c3 := Group( (1,2,3) );; |
  !gapprompt@gap>| !gapinput@c6 := Group( (1,2,3,4,5,6) );; |
  !gapprompt@gap>| !gapinput@f2 := GroupHomomorphismByImages( c3, c6, [(1,2,3)], [(1,3,5)(2,4,6)] );; |
  !gapprompt@gap>| !gapinput@c4c3 := DirectProduct( c4, c3 ); |
  Group([ (1,2,3,4), (5,6,7) ])
  !gapprompt@gap>| !gapinput@c2c6 := DirectProduct( c2, c6 ); |
  Group([ (1,2), (3,4,5,6,7,8) ])
  !gapprompt@gap>| !gapinput@f := DirectProductOfFunctions( c4c3, c2c6, f1, f2 ); |
  [ (1,2,3,4), (5,6,7) ] -> [ (1,2), (3,5,7)(4,6,8) ]
  !gapprompt@gap>| !gapinput@ImageElm( f, (1,4,3,2)(5,7,6) ); |
  (1,2)(3,7,5)(4,8,6)
  
\end{Verbatim}
 

\subsection{\textcolor{Chapter }{DirectProductOfAutomorphismGroups}}
\logpage{[ 5, 3, 6 ]}\nobreak
\hyperdef{L}{X7CB2D5F27F4182AF}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DirectProductOfAutomorphismGroups({\mdseries\slshape A1, A2})\index{DirectProductOfAutomorphismGroups@\texttt{DirectProductOfAutomorphismGroups}}
\label{DirectProductOfAutomorphismGroups}
}\hfill{\scriptsize (operation)}}\\


 Let $A_1,A_2$ be groups of automorphism of groups $G_1,G_2$ respectively. The output of this function is a group $A_1 \times A_2$ of automorphisms of $G_1 \times G_2$. 

 }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@c9 := Group( (1,2,3,4,5,6,7,8,9) );; |
  !gapprompt@gap>| !gapinput@ac9 := AutomorphismGroup( c9 );; |
  !gapprompt@gap>| !gapinput@q8 := QuaternionGroup( IsPermGroup, 8 );;|
  !gapprompt@gap>| !gapinput@aq8 := AutomorphismGroup( q8 );;|
  !gapprompt@gap>| !gapinput@A := DirectProductOfAutomorphismGroups( ac9, aq8 );|
  <group with 5 generators>
  !gapprompt@gap>| !gapinput@genA := GeneratorsOfGroup( A );;|
  !gapprompt@gap>| !gapinput@G := Source( genA[1] );|
  Group([ (1,2,3,4,5,6,7,8,9), (10,14,12,16)(11,17,13,15), (10,11,12,13)
  (14,15,16,17) ])
  !gapprompt@gap>| !gapinput@a := genA[1]*genA[5];  |
  [ (1,2,3,4,5,6,7,8,9), (10,14,12,16)(11,17,13,15), (10,11,12,13)(14,15,16,17) 
   ] -> [ (1,3,5,7,9,2,4,6,8), (10,16,12,14)(11,15,13,17), 
    (10,11,12,13)(14,15,16,17) ]
  !gapprompt@gap>| !gapinput@ImageElm( a, (1,9,8,7,6,5,4,3,2)(10,14,12,16)(11,17,13,15) );|
  (1,8,6,4,2,9,7,5,3)(10,16,12,14)(11,15,13,17)
  
\end{Verbatim}
 }

 }

         
\chapter{\textcolor{Chapter }{Matrices}}\label{chap-matrix}
\logpage{[ 6, 0, 0 ]}
\hyperdef{L}{X812CCAB278643A59}{}
{
  
\section{\textcolor{Chapter }{Some operations for matrices}}\label{sec-matrix-ops}
\logpage{[ 6, 1, 0 ]}
\hyperdef{L}{X802118FB7C94D6BA}{}
{
  

\subsection{\textcolor{Chapter }{DirectSumDecompositionMatrices}}
\logpage{[ 6, 1, 1 ]}\nobreak
\hyperdef{L}{X787B89237E1398B6}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{DirectSumDecompositionMatrices({\mdseries\slshape M})\index{DirectSumDecompositionMatrices@\texttt{DirectSumDecompositionMatrices}}
\label{DirectSumDecompositionMatrices}
}\hfill{\scriptsize (operation)}}\\


 In June 2023 Hongyi Zhao asked in the Forum for a function to implement matrix
decomposition into blocks. Such a function was then provided by Pedro
Garc{\a'\i}a\texttt{\symbol{45}}S{\a'a}nchez. Hongyi Zhao then requested that
the function be added to \textsf{Utils}. What is provided here is a revised version of the original solution,
returning a list of decompositions. 

 This function is a partial inverse to the undocumented library operation \texttt{DirectSumMat}. So if $L$ is the list of diagonal decompositions of a matrix $M$ then each entry in $L$ is a list of matrices, and the direct sum of each of these lists is equal to
the original $M$. 

 In the following examples, $M_6$ is an obvious direct sum with $3$ blocks. $M_4$ is an example with three decompositions, while $M_8 = M_4 \oplus M_4$ has $16$ decompositions (not listed). 

 }

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@M6 := [ [1,2,0,0,0,0], [3,4,0,0,0,0], [5,6,0,0,0,0],                       |
  !gapprompt@>| !gapinput@           [0,0,9,0,0,0], [0,0,0,1,2,3], [0,0,0,4,5,6] ];;|
  !gapprompt@gap>| !gapinput@Display( M6 );|
  [ [  1,  2,  0,  0,  0,  0 ],
    [  3,  4,  0,  0,  0,  0 ],
    [  5,  6,  0,  0,  0,  0 ],
    [  0,  0,  9,  0,  0,  0 ],
    [  0,  0,  0,  1,  2,  3 ],
    [  0,  0,  0,  4,  5,  6 ] ]
  !gapprompt@gap>| !gapinput@L6 := DirectSumDecompositionMatrices( M6 );|
  [ [ [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ], [ [ 9 ] ], [ [ 1, 2, 3 ], [ 4, 5, 6 ] ] 
       ] ]
  
  !gapprompt@gap>| !gapinput@M4 := [ [0,3,0,0], [0,0,0,0], [0,0,0,0], [0,0,4,0] ];;|
  !gapprompt@gap>| !gapinput@Display( M4 );|
  [ [  0,  3,  0,  0 ],
    [  0,  0,  0,  0 ],
    [  0,  0,  0,  0 ],
    [  0,  0,  4,  0 ] ]
  !gapprompt@gap>| !gapinput@L4 := DirectSumDecompositionMatrices( M4 );|
  [ [ [ [ 0, 3 ] ], [ [ 0, 0 ], [ 0, 0 ], [ 4, 0 ] ] ], 
    [ [ [ 0, 3 ], [ 0, 0 ] ], [ [ 0, 0 ], [ 4, 0 ] ] ], 
    [ [ [ 0, 3 ], [ 0, 0 ], [ 0, 0 ] ], [ [ 4, 0 ] ] ] ]
  !gapprompt@gap>| !gapinput@for L in L4 do |
  !gapprompt@>| !gapinput@       A := DirectSumMat( L );; |
  !gapprompt@>| !gapinput@       if ( A = M4 ) then Print( "yes, A = M4\n" ); fi; |
  !gapprompt@>| !gapinput@   od;|
  yes, A = M4
  yes, A = M4
  yes, A = M4
  
  !gapprompt@gap>| !gapinput@M8 := DirectSumMat( M4, M4 );; |
  !gapprompt@gap>| !gapinput@Display( M8 );|
  [ [  0,  3,  0,  0,  0,  0,  0,  0 ],
    [  0,  0,  0,  0,  0,  0,  0,  0 ],
    [  0,  0,  0,  0,  0,  0,  0,  0 ],
    [  0,  0,  4,  0,  0,  0,  0,  0 ],
    [  0,  0,  0,  0,  0,  3,  0,  0 ],
    [  0,  0,  0,  0,  0,  0,  0,  0 ],
    [  0,  0,  0,  0,  0,  0,  0,  0 ],
    [  0,  0,  0,  0,  0,  0,  4,  0 ] ]
  !gapprompt@gap>| !gapinput@L8 := DirectSumDecompositionMatrices( M8 );;|
  !gapprompt@gap>| !gapinput@Length( L8 ); |
  16
  
\end{Verbatim}
 

 The current method does not, however, catch all possible decompositions. In
the following example the matrix $M_5$ has its third row and third column extirely zero, and the only decomposition
found has a $[0]$ factor. There are clearly two $2$\texttt{\symbol{45}}factor decompositions with a $2$\texttt{\symbol{45}}by\texttt{\symbol{45}}$3$ and a $3$\texttt{\symbol{45}}by\texttt{\symbol{45}}$2$ factor, but these are not found at present. 

 
\begin{Verbatim}[commandchars=!@|,fontsize=\small,frame=single,label=Example]
  
  !gapprompt@gap>| !gapinput@M5 := [ [1,2,0,0,0], [3,4,0,0,0], [0,0,0,0,0],|
  !gapprompt@>| !gapinput@           [0,0,0,6,7], [0,0,0,8,9] ];;|
  !gapprompt@gap>| !gapinput@Display(M5);|
  [ [  1,  2,  0,  0,  0 ],
    [  3,  4,  0,  0,  0 ],
    [  0,  0,  0,  0,  0 ],
    [  0,  0,  0,  6,  7 ],
    [  0,  0,  0,  8,  9 ] ]
  !gapprompt@gap>| !gapinput@L5 := DirectSumDecompositionMatrices( M5 ); |
  [ [ [ [ 1, 2 ], [ 3, 4 ] ], [ [ 0 ] ], [ [ 6, 7 ], [ 8, 9 ] ] ] ]
  
\end{Verbatim}
 }

 }

         
\chapter{\textcolor{Chapter }{Iterators}}\label{chap-iterator}
\logpage{[ 7, 0, 0 ]}
\hyperdef{L}{X85A3F00985453F95}{}
{
  
\section{\textcolor{Chapter }{Some iterators for groups and their isomorphisms}}\label{sec-group-iters}
\logpage{[ 7, 1, 0 ]}
\hyperdef{L}{X7BB5350081B27D17}{}
{
  \index{Iterators} The motivation for adding these operations is partly to give a simple example
of an iterator for a list that does not yet exist, and need not be created. 

 

\subsection{\textcolor{Chapter }{AllIsomorphismsIterator}}
\logpage{[ 7, 1, 1 ]}\nobreak
\hyperdef{L}{X7F8B54D1806C762D}{}
{\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{AllIsomorphismsIterator({\mdseries\slshape G, H})\index{AllIsomorphismsIterator@\texttt{AllIsomorphismsIterator}}
\label{AllIsomorphismsIterator}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{AllIsomorphismsNumber({\mdseries\slshape G, H})\index{AllIsomorphismsNumber@\texttt{AllIsomorphismsNumber}}
\label{AllIsomorphismsNumber}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\triangleright$\enspace\texttt{AllIsomorphisms({\mdseries\slshape G, H})\index{AllIsomorphisms@\texttt{AllIsomorphisms}}
\label{AllIsomorphisms}
}\hfill{\scriptsize (operation)}}\\


 The main \textsf{GAP} library contains functions producing complete lists of group homomorphisms
such as \texttt{AllHomomorphisms}; \texttt{AllEndomorphisms} and \texttt{AllAutomorphisms}. Here we add the missing \texttt{AllIsomorphisms(G,H)} for a list of isomorphisms from $G$ to $H$. The method is simple \texttt{\symbol{45}}\texttt{\symbol{45}} find one
isomorphism $G \to H$ and compose this with all the automorphisms of $G$. In all these cases it may not be desirable to construct a list of
homomorphisms, but just implement an iterator, and that is what is done here.
--> --------------------

--> maximum size reached

--> --------------------

100%


¤ Dauer der Verarbeitung: 0.30 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge
 




Quellcodebibliothek  | Gedichte  | Musik  | Bilder  | Normaldarstellung  | © 2026 JDD |