% generated by GAPDoc2LaTeX from XML source (Frank Luebeck)
\documentclass[a4paper,11pt]{report}
\usepackage{a4wide}
\sloppy
\pagestyle{myheadings}
\usepackage{amssymb}
\usepackage[latin1]{inputenc}
\usepackage{makeidx}
\makeindex
\usepackage{color}
\definecolor{DarkOlive}{rgb}{0.1047,0.2412,0.0064}
\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{FuncColor}{rgb}{1.0,0.0,0.0}
%% strange name because of pdflatex bug:
\definecolor{Chapter }{rgb}{0.0,0.0,1.0}

\usepackage{fancyvrb}

\usepackage{pslatex}

\usepackage[pdftex=true,
        a4paper=true,bookmarks=false,pdftitle={Written with GAPDoc},
        pdfcreator={LaTeX with hyperref package / GAPDoc},
        colorlinks=true,backref=page,breaklinks=true,linkcolor=RoyalBlue,
        citecolor=RoyalGreen,filecolor=RoyalRed,
        urlcolor=RoyalRed,pagecolor=RoyalBlue]{hyperref}

% 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}}

\begin{document}

\logpage{[ 0, 0, 0 ]}
\begin{titlepage}
\begin{center}{\Huge \textbf{GAP 4 Package \textsf{Forms}\mbox{}}}\\[1cm]
\hypersetup{pdftitle=GAP 4 Package \textsf{Forms}}
\markright{\scriptsize \mbox{}\hfill GAP 4 Package \textsf{Forms} \hfill\mbox{}}
{\Large \textbf{Sesquilinear and Quadratic\mbox{}}}\\[1cm]
{ 1.2 \mbox{}}\\[1cm]
{March 2009\mbox{}}\\[1cm]
\mbox{}\\[2cm]
{\large \textbf{John Bamberg    \mbox{}}}\\
{\large \textbf{Jan De Beule    \mbox{}}}\\
\hypersetup{pdfauthor=John Bamberg    ; Jan De Beule    }
\end{center}\vfill

\mbox{}\\
{\mbox{}\\
\small \noindent \textbf{John Bamberg    } --- Email: \href{mailto://bamberg@cage.ugent.be} {\texttt{bamberg@cage.ugent.be}}\\
 --- Homepage: \href{http://cage.ugent.be/~bamberg} {\texttt{http://cage.ugent.be/\texttt{\symbol{126}}bamberg}}\\
 --- Address: \begin{minipage}[t]{8cm}\noindent
 Department of Pure Mathematics and Computer Algebra, Ghent University,
Krijgslaan 281 -- S22, 9000 Ghent, Belgium \end{minipage}
}\\
{\mbox{}\\
\small \noindent \textbf{Jan De Beule    } --- Email: \href{mailto://jdebeule@cage.ugent.be} {\texttt{jdebeule@cage.ugent.be}}\\
 --- Homepage: \href{http://cage.ugent.be/~jdebeule} {\texttt{http://cage.ugent.be/\texttt{\symbol{126}}jdebeule}}\\
 --- Address: \begin{minipage}[t]{8cm}\noindent
 Department of Pure Mathematics and Computer Algebra, Ghent University,
Krijgslaan 281 -- S22, 9000 Ghent, Belgium \end{minipage}
}\\
\end{titlepage}

\newpage\setcounter{page}{2}
{\small 
\section*{Copyright}
\logpage{[ 0, 0, 1 ]}
 {\copyright} 2009 by the authors

 This package may be distributed under the terms and conditions of the GNU
Public License Version 2 or higher. \mbox{}}\\[1cm]
\newpage

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

\tableofcontents
\newpage

  
\chapter{\textcolor{Chapter }{Introduction}}\label{intro}
\logpage{[ 1, 0, 0 ]}
\hyperdef{L}{X7DFB63A97E67C0A1}{}
{
  
\section{\textcolor{Chapter }{Philosophy}}\label{philosophy}
\logpage{[ 1, 1, 0 ]}
\hyperdef{L}{X873C99678745ABAF}{}
{
  \textsf{Forms} is a package for computing with sesquilinear and quadratic forms on finite
vector spaces. It provides users with the basic algebraic tools to work with
classical groups and polar geometries, and enables one to specify a form and
its corresponding geometry. The functionality of the package includes: 
\begin{itemize}
\item the construction of sesquilinear and quadratic forms;
\item operations which allow a user to change coordinates, that is, to ``change
form'' and work in an isometric (or similar) formed vector space; and
\item a way to determine the form(s) left invariant by a matrix group (up to a
scalar).
\end{itemize}
 }

 
\section{\textcolor{Chapter }{Overview over this manual}}\label{overview}
\logpage{[ 1, 2, 0 ]}
\hyperdef{L}{X786BACDB82918A65}{}
{
  The next chapter (\ref{examples}) gives some basic examples of the use of this package. In "Background Theory
of Forms" (Chapter \ref{theory}) we revise the basic notions of the theory of sesquilinear and quadratic
forms, where we also set the notation and conventions adopted by this package.
In "Constructing forms and basic functionality" (Chapter \ref{functionality}), we describe all operations to construct sesquilinear and quadratic forms
and basic attributes and properties that do not require morphisms. In
"Morphims of forms" (Chapter \ref{morphisms}) we revise the basic notions of morphisms of forms, and the classification of
sesquilinear and quadratic forms on vector spaces over finite fields.
Operations, attributes and properties that are related to the computation of
morphisms of forms, are also described in this chapter. }

 
\section{\textcolor{Chapter }{How to read this manual}}\label{howto}
\logpage{[ 1, 3, 0 ]}
\hyperdef{L}{X8416D2657E7831A1}{}
{
  We have tried to make this manual pleasant to read for the general reader. So
it is inevitable that we will use Greek symbols and simple mathematical
formulas. To make these visible in the HTML version of this documentation, you
may have to change the default character set of your browser to UTF-8. }

  }

  
\chapter{\textcolor{Chapter }{Examples}}\label{examples}
\logpage{[ 2, 0, 0 ]}
\hyperdef{L}{X7A489A5D79DA9E5C}{}
{
  Here we give some simple examples that display some of the functionality of \textsf{Forms}. 
\section{\textcolor{Chapter }{A conic of PG(2,8)}}\logpage{[ 2, 1, 0 ]}
\hyperdef{L}{X83510E647FBB2475}{}
{
  Consider the three-dimensional vector space $V := V(3,GF(8)) = GF(8)^3$, and consider the following quadratic polynomial in 3 variables: 
\[x_1^2+x_2x_3.\]
  Then this polynomial defines a quadratic form on $V$ and the zeros form a \emph{conic} of the associated projective plane. So in particular, our quadratic form
defines a degenerate parabolic quadric of Witt Index 1. We will see now how we
can use \textsf{Forms} to view this example. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> gf := GF(8);
  GF(2^3)
  gap> vec := gf^3;
  ( GF(2^3)^3 )
  gap> r := PolynomialRing( gf, 3);
  PolynomialRing(..., [ x_1, x_2, x_3 ])
  gap> poly := r.1^2 + r.2 * r.3;
  x_1^2+x_2*x_3
  gap> form := QuadraticFormByPolynomial( poly, r );
  < quadratic form >
  gap> Display( form );
  Quadratic form
  Gram Matrix:
   1 . .
   . . 1
   . . .
  Polynomial: x_1^2+x_2*x_3
  gap> IsDegenerateForm( form );
  #I  Testing degeneracy of the *associated bilinear form*
  true
  gap> IsSingularForm( form );
  false
  gap> WittIndex( form );
  1
  gap> IsParabolicForm( form );
  true
  gap> RadicalOfForm( form );
  <vector space over GF(2^3), with 0 generators>
\end{Verbatim}
 Now our conic is stabilised by a group isomorphic to $GO(3,8)$, but not identical to the group returned by the GAP command \texttt{GO(3,8)}. However, our conic is the canonical conic given in \textsf{Forms}. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> canonical := IsometricCanonicalForm( form );
  < parabolic quadratic form >
  gap> form = canonical;
  true
\end{Verbatim}
 So we ``change forms''... 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> go := GO(3,8);
  GO(0,3,8)
  gap> mat := InvariantQuadraticForm( go )!.matrix;
  [ [ Z(2)^0, 0*Z(2), 0*Z(2) ], [ 0*Z(2), 0*Z(2), 0*Z(2) ], 
    [ 0*Z(2), Z(2)^0, 0*Z(2) ] ]
  gap> gapform := QuadraticFormByMatrix( mat, GF(8) );
  < quadratic form >
  gap> b := BaseChangeToCanonical( gapform );
  [ [ Z(2)^0, 0*Z(2), 0*Z(2) ], [ 0*Z(2), Z(2)^0, 0*Z(2) ], 
    [ 0*Z(2), 0*Z(2), Z(2)^0 ] ]
  gap> hom := BaseChangeHomomorphism( b, GF(8) );
  ^[ [ Z(2)^0, 0*Z(2), 0*Z(2) ], [ 0*Z(2), Z(2)^0, 0*Z(2) ], 
    [ 0*Z(2), 0*Z(2), Z(2)^0 ] ]
  gap> newgo := Image(hom, go);
  Group(
  [ [ [ Z(2)^0, 0*Z(2), 0*Z(2) ], [ 0*Z(2), Z(2^3), 0*Z(2) ], [ 0*Z(2), 0*Z(2),
             Z(2^3)^6 ] ], 
    [ [ Z(2)^0, 0*Z(2), 0*Z(2) ], [ Z(2)^0, Z(2)^0, Z(2)^0 ], 
        [ 0*Z(2), Z(2)^0, 0*Z(2) ] ] ])
\end{Verbatim}
 Now we look at the action of our new $GO(3,8)$ on the conic. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> conic := Filtered(vec, x -> IsZero( x^form ));;
  gap> Size(conic);
  64
  gap> orbs := Orbits(newgo, conic, OnRight);;
  gap> List(orbs,Size);
  [ 1, 63 ]
\end{Verbatim}
 So we see that there is a fixed point, which is actually the \emph{nucleus} of the conic, or in other words, the radical of the form. }

 
\section{\textcolor{Chapter }{A form for W(5,3)}}\logpage{[ 2, 2, 0 ]}
\hyperdef{L}{X781F69578636E8C5}{}
{
  The symplectic polar space $W(5,q)$ is defined by an alternating reflexive bilinear form on the six-dimensional
vector space $GF(q)^6$. Any invertible $6 \times 6$ matrix $A$ which satisfies $A+A^T=0$ is a candidate for the Gram matrix of a symplectic polarity. The canonical
form we adopt in \textsf{Forms} for an alternating form is 
\[f(x,y)=x_1y_2-x_2y_1+x_3y_4-x_4y_3\cdots+x_{2n-1}y_{2n}-x_{2n}y_{2n-1}.\]
  
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> f := GF(3);
  GF(3)
  gap> gram := [
  > [0,0,0,1,0,0], 
  > [0,0,0,0,1,0],
  > [0,0,0,0,0,1],
  > [-1,0,0,0,0,0],
  > [0,-1,0,0,0,0],
  > [0,0,-1,0,0,0]] * One(f);;
  gap> form := BilinearFormByMatrix( gram, f );
  < bilinear form >
  gap> IsSymplecticForm( form );
  true
  gap> Display( form );
  Symplectic form
  Gram Matrix:
   . . . 1 . .
   . . . . 1 .
   . . . . . 1
   2 . . . . .
   . 2 . . . .
   . . 2 . . .
  gap> b := BaseChangeToCanonical( form );
  [ [ Z(3)^0, 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3) ], 
    [ 0*Z(3), 0*Z(3), 0*Z(3), Z(3)^0, 0*Z(3), 0*Z(3) ], 
    [ 0*Z(3), Z(3)^0, 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3) ], 
    [ 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3), Z(3)^0, 0*Z(3) ], 
    [ 0*Z(3), 0*Z(3), Z(3)^0, 0*Z(3), 0*Z(3), 0*Z(3) ], 
    [ 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3), Z(3)^0 ] ]
  gap> Display( b );
   1 . . . . .
   . . . 1 . .
   . 1 . . . .
   . . . . 1 .
   . . 1 . . .
   . . . . . 1
  gap> Display( b * gram * TransposedMat(b) );
   . 1 . . . .
   2 . . . . .
   . . . 1 . .
   . . 2 . . .
   . . . . . 1
   . . . . 2 .
   
\end{Verbatim}
 }

 
\section{\textcolor{Chapter }{What is the form preserved by this group?}}\logpage{[ 2, 3, 0 ]}
\hyperdef{L}{X78638D21797AC9A0}{}
{
  Here we start with a matrix group which is available in GAP, namely $GO(5,5)$. We then conjugate this group by an element of $GL(5,5)$, and then we find the forms left invariant by this copy of $GO(5,5)$ (which we expect to be a symmetric bilinear form). 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> go := GO(5, 5);
  GO(0,5,5)
  gap> x := 
  > [ [ Z(5)^0, Z(5)^3, 0*Z(5), Z(5)^3, Z(5)^3 ], 
  >   [ Z(5)^2, Z(5)^3, 0*Z(5), Z(5)^2, Z(5) ], 
  >   [ Z(5)^2, Z(5)^2, Z(5)^0, Z(5), Z(5)^3 ],
  >   [ Z(5)^0, Z(5)^3, Z(5), Z(5)^0, Z(5)^3 ], 
  >   [ Z(5)^3, 0*Z(5), Z(5)^0, 0*Z(5), Z(5) ] 
  >  ];;
  gap> go2 := go^x;
  <matrix group of size 18720000 with 2 generators>
  gap> forms := PreservedSesquilinearForms( go2 );
  [ < bilinear form > ]
  gap> Display( forms[1] );
  Bilinear form
  Gram Matrix:
   4 2 4 3 3
   2 2 2 3 3
   4 2 3 1 4
   3 3 1 2 4
   3 3 4 4 3
   
\end{Verbatim}
 }

 }

  
\chapter{\textcolor{Chapter }{Background Theory on Forms}}\label{theory}
\logpage{[ 3, 0, 0 ]}
\hyperdef{L}{X79424B627CE11FCA}{}
{
  In this chapter we give a very brief overview of the theory of sesquilinear
and quadratic forms. The reader can find more in the texts: Cameron \cite{Cameron}, Taylor \cite{Taylor}, Aschbacher \cite{Aschbacher}, or Kleidman and Liebeck \cite{KleidmanLiebeck}. 
\section{\textcolor{Chapter }{Sesquilinear forms}}\label{theory:sesquilinearforms}
\logpage{[ 3, 1, 0 ]}
\hyperdef{L}{X874CD5E0802FEB50}{}
{
  A \emph{sesquilinear form}\index{Form@Form!sesquilinear} on an $n$-dimensional vector space $V$ over a field $F$, is a map $f$ from $V\times V$ to $F$ which is linear in the first coordinate, but semilinear\index{Semilinear} in the second coordinate; that is, there is a field automorphism $\alpha$ (the \emph{companion automorphism}\index{Companion Automorphism} of $f$) such that $f(v,\lambda w)=\lambda^\alpha f(v,w)$ for all $v,w \in V$ and $\lambda \in F$. If $\alpha$ is the identity, then $f$ is \emph{bilinear}\index{Form@Form!bilinear}. 

 A bilinear form is \emph{reflexive}\index{Form@Form!reflexive} if $f(v,w)=0 \Rightarrow f(w,v)=0$ for all $v,w \in V$. A bilinear form is \emph{symmetric}\index{Form@Form!symmetric} if $f(v,w)=f(w,v)$ for all $v,w \in V$. It is clear that a symmetric bilinear form is reflexive. A bilinear form is \emph{alternating}\index{Form@Form!alternating} if $f(v,v)=0$ for all $v \in V$. Using the linearity to compute $f(v+w,v+w)$, we see that an alternating form is also reflexive. When the characteristic
of the field differs from 2, an alternating form $f$ can also be characterised as $f(v,w) = -f(w,v)$ for all $v,w \in V$. It can be proved (see Chapter 7 of \cite{Taylor}) that symmetric and alternating bilinear forms are the only reflexive
bilinear forms. 

 For a given sesquilinear form $f$, the choice of the basis determines uniquely an $n\times n$ matrix $M$ such that 
\[f(v, w) = v M w^{\alpha}^T.\]
 This matrix is also called the \emph{Gram matrix} of $f$. Given a sesquilinear form $f$, we will denote its Gram matrix by $M_f$ . In \textsf{Forms}, sesquilinear forms can be constructed using matrices or polynomials, where
we always suppose that the basis of the vector space is the standard basis
(i.e., the rows of the identity matrix). 

 One proves easily that a bilinear form $f$ is symmetric if and only if $M_f$ is a symmetric matrix, i.e., $M_f^T=M_f$ , and that a bilinear form $f$ is alternating if and only if $M_f$ is a skew symmetric matrix, i.e., $M_f^T=-M_f$ . When the characteristic of the field is two, the condition that $f(v,v)=0$ for all $v \in V$ implies $M_f^T=M_f$  \textsc{and} $(M_{ii})=0$ (denoting the matrix $M_f = (M_{ij}))$. Since any skew symmetric odd dimensional matrix is singular, it follows that
an alternating form of an odd dimensional vector space is degenerate. 

 A sesquilinear form $f$ is \emph{hermitian}\index{Form@Form!hermitian} (n.b., \emph{conjugate-symmetric} in \cite{Atlas}) if $f(v,w)=f(w,v)^\alpha$  holds for all vectors $v,w$  and $\alpha$ has order 2. Again, it can be easily proved that a sesquilinear form $f$ is hermitian if and only if $m_f^T = m_f^{\alpha}$  (i.e., a hermitian matix). It is proved (see Chapter 7 of \cite{Taylor}) that hermitian forms are the only reflexive sesquilinear forms that are not
bilinear. Hence, in general, all reflexive sesquilinear forms are known, they
are either hermitian or bilinear, and in the latter case, they are either
symmetric or alternating (again, see Chapter 7 of \cite{Taylor}). 

 In \textsf{Forms}, only the construction of \textsc{reflexive} sesquilinear forms is allowed. An error message will be displayed if any
attempt to construct a non-reflexive sesquilinear form is made. As a
consequence, the Gram Matrix of a sesquilinear form is always a symmetric, a
skew symmetric or a hermitian matrix. From now on, the notion of a
``sesquilinear form'' will always refer to a ``reflexive sesquilinear form''. 

 Given a sesquilinear form $f$, two vectors $v$ and $w$ are \emph{orthogonal}\index{Orthogonal} with respect to $f$ if $f(v,w) = 0$. Note that the reflexivity makes orthogonality between two vectors a
symmetric relation. A vector $v$ is called \emph{isotropic}\index{isotropic} if $f(v,v)=0$. The \emph{radical}\index{Radical} of $f$ (n.b., \emph{kernel} in \cite{Atlas}) is the subspace consisting of vectors which are orthogonal to every vector.
That is, 
\[Rad(f) = \{v \in V | f(v,w) = 0,\, \forall w \in V\},\]
 and we say that $f$ is \emph{non-degenerate}\index{Form@Non-degenerate!sesquilinear} if its radical is trivial (and \emph{degenerate} otherwise). 

Given a subspace $W$, we denote the set of vectors of $V$ orthogonal with all vectors of $W$ by $W^\perp$. We call a subspace $W$ \emph{totally isotropic}\index{Form@Totally Isotropic!sesquilinear} with respect to $f$ if $W$ is contained in $W^\perp$, i.e. 
\[f(v,w) = 0,\, \forall v,w \in W.\]
 

Suppose that $f$ is a non-degenerate sesquilinear form. The \emph{Witt index}\index{Form@Witt Index!sesquilinear} of $f$ is the maximum dimension of a totally isotropic subspace with respect to $f$. Notice that all totally isotropic subspaces of maximal dimension of a
degenerate form $f$ contain the radical of $f$. 

 We end this section with a short description of the conventions used in \textsf{Forms} for the notions orthogonal, symplectic, pseudo, hyperbolic, elliptic and
parabolic. We call a form $f$ \emph{symplectic}\index{Form@Form!symplectic} if and only if $f$ is alternating. When the characteristic of the field is odd, we call a form $f$ \emph{orthogonal}\index{Form@Form!orthogonal} if and only $f$ is symmetric, and when the characteristic of the field is even, we call a form $f$ \emph{pseudo}\index{Form@Form!pseudo} if and only if $f$ is symmetric but not alternating. This terminology is related to the theory of
polar spaces, and in the case of orthogonal forms, we adopt the terms \emph{hyperbolic}\index{Form@Form!hyperbolic}, \emph{elliptic}\index{Form@Form!elliptic} and \emph{parabolic}\index{Form@Form!parabolic} for the three different isometry types of orthogonal forms. From the point of
view of matrix groups, these three types correspond as follows: \begin{center}
\begin{tabular}{l|l|l}\hline
Hyperbolic&
Orthogonal of + type&
Even dimension, maximal Witt index\\
Elliptic&
Orthogonal of - type&
Even dimension, non-maximal Witt index\\
Parabolic&
Orthogonal of o type&
Odd dimension\\
\hline
\end{tabular}\\[2mm]
\textbf{Table: }Summary of Orthogonal Forms\end{center}

 
\subsection{\textcolor{Chapter }{Examples}}\logpage{[ 3, 1, 1 ]}
\hyperdef{L}{X7A489A5D79DA9E5C}{}
{
  The examples we present in this section do not demonstrate the entire suite of
operations entailed in \textsf{Forms}. They are intended to allow the user to become familiar with particular
aspects of this package. All the functionality for sesquilinear forms will be
listed in detail in the next chapter. 

 We try to construct a bilinear form... 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> mat := [[1,0,0],[0,1,4],[1,2,1]]*Z(5)^0;
  [ [ Z(5)^0, 0*Z(5), 0*Z(5) ], [ 0*Z(5), Z(5)^0, Z(5)^2 ], 
    [ Z(5)^0, Z(5), Z(5)^0 ] ]
  gap> form := BilinearFormByMatrix(mat,GF(5));
  Error, Invalid Gram matrix
   called from
  BilinearFormByMatrixOp( m, f ) called from
  <function>( <arguments> ) called from read-eval-loop
  Entering break read-eval-print loop ...
  you can 'quit;' to quit to outer loop, or
  you can 'return;' to continue
  brk> quit;
   
\end{Verbatim}
 It is clear that the matrix used is not defining a reflexive bilinear form,
which causes the system to generate the error message. 

 We construct now a reflexive bilinear form. We investigate also the radical of
the form. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> mat := [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,-1]]*Z(9)^0;
  [ [ Z(3)^0, 0*Z(3), 0*Z(3), 0*Z(3) ], [ 0*Z(3), Z(3)^0, 0*Z(3), 0*Z(3) ], 
    [ 0*Z(3), 0*Z(3), Z(3)^0, 0*Z(3) ], [ 0*Z(3), 0*Z(3), 0*Z(3), Z(3) ] ]
  gap> form := BilinearFormByMatrix(mat,GF(9));
  < bilinear form >
  gap> Display(form);
  Bilinear form
  Gram Matrix:
   1 . . .
   . 1 . .
   . . 1 .
   . . . 2
  gap> IsReflexiveForm(form);
  true
  gap> IsSymmetricForm(form);
  true
  gap> IsAlternatingForm(form);
  false
  gap> r := RadicalOfForm(form);
  <vector space over GF(3^2), with 0 generators>
  gap> Dimension(r);
  0
   
\end{Verbatim}
 

 Degenerate forms are allowed. As an example we construct an alternating
bilinear form on an odd dimensional vector space. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> mat := [[0,0,-2],[0,0,1],[2,-1,0]]*Z(7)^0;
  [ [ 0*Z(7), 0*Z(7), Z(7)^5 ], [ 0*Z(7), 0*Z(7), Z(7)^0 ], 
    [ Z(7)^2, Z(7)^3, 0*Z(7) ] ]
  gap> form := BilinearFormByMatrix(mat,GF(7));
  < bilinear form >
  gap> Display(form);
  Bilinear form
  Gram Matrix:
   . . 5
   . . 1
   2 6 .
  gap> IsSymmetricForm(form);
  false
  gap> IsAlternatingForm(form);
  true
  gap> r := RadicalOfForm(form);
  <vector space over GF(7), with 1 generators>
  gap> Dimension(r);
  1
   
\end{Verbatim}
 When the characteristic of the field equals two, alternating forms are also
symmetric. We construct an example. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> mat := [[0,1,0,0,0,0],[1,0,0,0,0,0],[0,0,0,0,0,1],
  >         [0,0,0,0,1,0],[0,0,0,1,0,0],[0,0,1,0,0,0]]*Z(16)^0;
  [ [ 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ], 
    [ Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ], 
    [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0 ], 
    [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0, 0*Z(2) ], 
    [ 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2) ], 
    [ 0*Z(2), 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2) ] ]
  gap> form := BilinearFormByMatrix(mat,GF(16));
  < bilinear form >
  gap> Display(form);
  Bilinear form
  Gram Matrix:
   . 1 . . . .
   1 . . . . .
   . . . . . 1
   . . . . 1 .
   . . . 1 . .
   . . 1 . . .
  gap> IsSymmetricForm(form);
  true
  gap> IsAlternatingForm(form);
  true
  gap> IsDegenerateForm(form);
  false
  gap> WittIndex(form);
  3
   
\end{Verbatim}
 To define a hermitian form, we need a matrix and the companion automorphism.
Since this automorphism has order 2, it exists and is unique if the ground
field has square order. In the next example, the chosen matrix is somewhat
special. Together with the companion automorphism, it determines a hermitian
sesquilinear form. Without the companion automorphism, it determines an
alternating bilinear form. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> mat := [[0*Z(5),0*Z(5),0*Z(25),Z(25)^3],[0*Z(5),0*Z(5),Z(25)^3,0*Z(25)],
  >         [0*Z(5),-Z(25)^3,0*Z(5),0*Z(5)],[-Z(25)^3,0*Z(5),0*Z(25),0*Z(25)]];
  [ [ 0*Z(5), 0*Z(5), 0*Z(5), Z(5^2)^3 ], [ 0*Z(5), 0*Z(5), Z(5^2)^3, 0*Z(5) ], 
    [ 0*Z(5), Z(5^2)^15, 0*Z(5), 0*Z(5) ], 
    [ Z(5^2)^15, 0*Z(5), 0*Z(5), 0*Z(5) ] ]
  gap> form := HermitianFormByMatrix(mat,GF(25));
  < hermitian form >
  gap> Display(form);
  Hermitian form
  Gram Matrix:
  z = Z(25)
      .    .    .  z^3
      .    .  z^3    .
      . z^15    .    .
   z^15    .    .    .
  gap> WittIndex(form);
  2
  gap> form2 := BilinearFormByMatrix(mat,GF(25));
  < bilinear form >
  gap> Display(form2);
  Bilinear form
  Gram Matrix:
  z = Z(25)
      .    .    .  z^3
      .    .  z^3    .
      . z^15    .    .
   z^15    .    .    .
  gap> IsAlternatingForm(form2);
  true
  gap> Display(IsometricCanonicalForm(form));
  Hermitian form
  Gram Matrix:
   1 . . .
   . 1 . .
   . . 1 .
   . . . 1
  Witt Index: 2
  gap> Display(IsometricCanonicalForm(form2));
  Bilinear form
  Gram Matrix:
   . 1 . .
   4 . . .
   . . . 1
   . . 4 .
  Witt Index: 2
\end{Verbatim}
 We continue the previous example by exploring a little bit the sesquilinear
form \mbox{\texttt{\slshape form}}, and hence demonstrate some of the functionality of the \textsf{Forms} package. Eventually, we find a 2-dimensional totally isotropic subspace, which
lets us conclude that the Witt index of $form$ is at least 2, which is confirmed afterwards by calling the appropriate
function. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> V := GF(25)^4;
  ( GF(5^2)^4 )
  gap> u := [Z(5)^0,Z(5^2)^11,Z(5)^3,Z(5^2)^13 ];
  [ Z(5)^0, Z(5^2)^11, Z(5)^3, Z(5^2)^13 ]
  gap> [u,u]^form;
  0*Z(5)
  gap> v := [Z(5)^0,Z(5^2)^5,Z(5^2),Z(5^2)^13 ];
  [ Z(5)^0, Z(5^2)^5, Z(5^2), Z(5^2)^13 ]
  gap> [v,v]^form;                                     
  0*Z(5)
  gap> [u,v]^form;
  Z(5^2)^7
  gap> ([v,u]^form)^5;
  Z(5^2)^7
  gap> w := [Z(5^2)^21,Z(5^2)^19,Z(5^2)^4,Z(5)^3 ];
  [ Z(5^2)^21, Z(5^2)^19, Z(5^2)^4, Z(5)^3 ]
  gap> [w,w]^form;
  Z(5)
  gap> v := [Z(5)^0,Z(5^2)^10,Z(5^2)^15,Z(5^2)^3 ];
  [ Z(5)^0, Z(5^2)^10, Z(5^2)^15, Z(5^2)^3 ]
  gap> u := [Z(5)^3,Z(5^2)^9,Z(5^2)^4,Z(5^2)^16 ];
  [ Z(5)^3, Z(5^2)^9, Z(5^2)^4, Z(5^2)^16 ]
  gap> w := [Z(5)^2,Z(5^2)^9,Z(5^2)^23,Z(5^2)^11 ];
  [ Z(5)^2, Z(5^2)^9, Z(5^2)^23, Z(5^2)^11 ]
  gap> [u,v]^form;
  0*Z(5)
  gap> [u,w]^form;
  0*Z(5)
  gap> [v,w]^form;
  0*Z(5)
  gap> s := Subspace(V,[v,u,w]);
  <vector space over GF(5^2), with 3 generators>
  gap> Dimension(s);
  2
  gap> WittIndex(form);
  2
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Quadratic forms}}\label{quadforms}
\logpage{[ 3, 2, 0 ]}
\hyperdef{L}{X864CAF8881067D8A}{}
{
  A \emph{quadratic form}\index{Form@Quadratic Form!quadratic} on an $n$-dimensional vector space $V$ over a field $F$, is a map $Q$ from $V$ to $F$ satisfying the following two conditions: 
\[Q(\lambda v) = \lambda^2 Q(v),\, \forall \lambda \in F, \forall v \in V,\]
 and, the map $f$ defined from $V\times V$ to $F$ as follows, 
\[f(v,w) := Q(v+w) - Q(v) - Q(w),\]
 is a bilinear form on $V$. From this definition it follows that $f(v,v) = Q(2v) - 2Q(v) = 2Q(v)$. 

 The associated bilinear form $f$ (which is called the \emph{polar form} of $Q$ in \cite{Atlas}) is clearly reflexive. When the characteristic of the field is odd, it is
clear that $f$ is a symmetric bilinear form. The equation $f(v,v) = 2Q(v)$ allows us to reconstruct the quadratic form from the bilinear form, and hence
there is a one-to-one correspondence between quadratic forms and symmetric
bilinear forms. When the characteristic of the field equals 2, the bilinear
form $f$ is alternating (from the fact that $f(v,v) = 2Q(v) = 0$). Note, however, that different quadratic forms can determine the same
alternating form. 

 As in the case of sesquilinear forms, we will associate a matrix to a
quadratic form. Chosing a basis of the vector space $V$, it is clear that an $n \times n$ matrix determines the quadratic form completely. In \textsf{Forms}, the \emph{Gram matrix} of a quadratic form is always an upper triangle matrix $M$, such that 
\[Q(v) = vMv^T,\]
 where the basis of $V$ is the standard basis. Although the Gram matrix stored with the quadratic form
is always an upper triangle matrix, the user is allowed to use any matrix to
define the quadratic form, since any matrix $M$ defines a quadratic form $Q(v) := vMv^T$. During the construction, an appopriate upper triangle matrix is computed and
stored as the Gram matrix. So the Gram matrix of the associated bilinear form
is $M+M^T$. 

 The associated bilinear form could be used to define the notions
``isotropic'', ``totally isotropic'' and ``non-degenerate'', however, under
these restrictions the geometry of quadratic forms in even characteristic is
lost. In most of the literature, these notions refer indeed to the associated
bilinear form, and the notion of ``singularity'' is added to regain the
geometrical structure. 

In \textsf{Forms}, we use the above described approach. This means that a vector is isotropic
if and only if it is isotropic with respect to the associated bilinear form. A
subspace is totally isotropic if and only if it is totally isotropic with
respect to the associated bilinear form, and we call the quadratic form
degenerate if and only if the associated bilinear form is degenerate. 

 A vector $v$ is called \emph{singular} with relation to the quadratic form $Q$ if and only if $Q(v)=0$. two vectors $v$ and $w$ are \emph{orthogonal}\index{Form@Form!orthogonal} with respect to $Q$ if and only if they are orthogonal with respect to the associated bilinear
form $f$. The \emph{radical} of the quadratic form $Q$, is the intersection of the set of all singular vectors with relation to $Q$ and the radical of the associated bilinear form $f$, i.e. 
\[Rad(Q) = \{v \in V | Q(v) = 0\,\, \mathrm{and}\,\, v \in Rad(f)\}.\]
  We call a quadratic form $Q$ \emph{non-singular} if and only if the radical contains only the zero vector, and \emph{singular} otherwise. 

 A subspace $W$ of the vector space is called \emph{totally singular} if and only if all vectors of $W$ are singular, i.e., $Q$ vanishes totally on $W$. Necessarily, a totally singular subspace is also totally isotropic with
relation to the associated bilinear form $f$, but the converse is only true when the characteristic of the field is odd. 

Suppose now that $Q$ is a non-singular quadratic form. The \emph{Witt index} of $Q$ is the maximum dimension of a totally singular subspace with respect to $Q$. Notice that all totally singular subspaces of maximal dimension of a
singular quadratic form $Q$ contain the radical of $Q$. 

 From the above definitions, it follows that, when the characteristic of the
field differs from 2, a quadratic form $Q$ is non-degenerate if and only if its associated bilinear form $f$ is non-degenerate. When the characteristic of the field is 2, one can easily
construct non-degenerate quadratic forms, with a degenerate associated
bilinear form. We will give an example of this situation in the next section. 
\subsection{\textcolor{Chapter }{Examples}}\logpage{[ 3, 2, 1 ]}
\hyperdef{L}{X7A489A5D79DA9E5C}{}
{
  We construct some quadratic forms to demonstrate some funcionality of \textsf{Forms}. As in the previous example section, they are intended to allow the user to
gain some familiarity. All the functionality for quadratic forms will be
listed in detail in the next chapter. 

 The user can construct quadratic forms using any matrix (provided it has the
right dimension). The Gram matrix is always stored as an upper triangle
matrix, as explained above. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> V := GF(4)^3;                           
  ( GF(2^2)^3 )
  gap> mat := [[Z(2^2)^2,Z(2^2),Z(2^2)^2],[Z(2^2)^2,Z(2)^0,Z(2)^0],
  >         [0*Z(2),Z(2)^0,0*Z(2)]];
  [ [ Z(2^2)^2, Z(2^2), Z(2^2)^2 ], [ Z(2^2)^2, Z(2)^0, Z(2)^0 ], 
    [ 0*Z(2), Z(2)^0, 0*Z(2) ] ]
  gap> qform := QuadraticFormByMatrix(mat, GF(4));
  < quadratic form >
  gap> Display( qform );
  Quadratic form
  Gram Matrix:
  z = Z(4)
   z^2   1 z^2
     .   1   .
     .   .   .
  gap> PolynomialOfForm( qform );
  Z(2^2)^2*x_1^2+x_1*x_2+Z(2^2)^2*x_1*x_3+x_2^2
   
\end{Verbatim}
 In the previous example, we saw how we used a polynomial to display a
quadratic form. Conversely, \textsf{Forms} allows the user to construct (quadratic) forms using a polynomial. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> r := PolynomialRing(GF(8),4);
  GF(2^3)[x_1,x_2,x_3,x_4]
  gap> poly := r.1*r.2+r.3*r.4;
  x_1*x_2+x_3*x_4
  gap> qform := QuadraticFormByPolynomial(poly, r);
  < quadratic form >
  gap> Display(qform);
  Quadratic form
  Gram Matrix:
   . 1 . .
   . . . .
   . . . 1
   . . . .
  Polynomial: x_1*x_2+x_3*x_4
  gap> RadicalOfForm(qform);
  <vector space over GF(2^3), with 0 generators>
   
\end{Verbatim}
 We construct now two different quadratic forms with the same associated
bilinear form. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> mat := [[Z(16)^3,1,0,0],[0,Z(16)^5,0,0],
  >              [0,0,Z(16)^3,1],[0,0,0,Z(16)^12]]*Z(16)^0;
  [ [ Z(2^4)^3, Z(2)^0, 0*Z(2), 0*Z(2) ], [ 0*Z(2), Z(2^2), 0*Z(2), 0*Z(2) ], 
    [ 0*Z(2), 0*Z(2), Z(2^4)^3, Z(2)^0 ], [ 0*Z(2), 0*Z(2), 0*Z(2), Z(2^4)^12 ] 
   ]
  gap> qform := QuadraticFormByMatrix(mat,GF(16));
  < quadratic form >
  gap> Display( qform );
  Quadratic form
  Gram Matrix:
  z = Z(16)
    z^3    1    .    .
      .  z^5    .    .
      .    .  z^3    1
      .    .    . z^12
  gap> mat2 := [[Z(16)^7,1,0,0],[0,0,0,0],
  >              [0,0,Z(16)^2,1],[0,0,0,Z(16)^9]]*Z(16)^0;
  [ [ Z(2^4)^7, Z(2)^0, 0*Z(2), 0*Z(2) ], [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ], 
    [ 0*Z(2), 0*Z(2), Z(2^4)^2, Z(2)^0 ], [ 0*Z(2), 0*Z(2), 0*Z(2), Z(2^4)^9 ] ]
  gap> qform2 := QuadraticFormByMatrix(mat2, GF(16));
  < quadratic form >
  gap> Display( qform2 );
  Quadratic form
  Gram Matrix:
  z = Z(16)
    z^7    1    .    .
      .    .    .    .
      .    .  z^2    1
      .    .    .  z^9
  gap> biform := AssociatedBilinearForm( qform2 );
  < bilinear form >
  gap> Display( biform );
  Bilinear form
  Gram Matrix:
   . 1 . .
   1 . . .
   . . . 1
   . . 1 .
   
\end{Verbatim}
 We end with an example of a non-degenerate quadratic form with a degenerate
associated bilinear form. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> mat := [ [ Z(2^2), Z(2^2), Z(2^2), Z(2^2), Z(2^2) ], 
  >    [ 0*Z(2), Z(2^2), Z(2^2)^2, 0*Z(2), Z(2)^0 ], 
  >    [ 0*Z(2), 0*Z(2), Z(2)^0, Z(2)^0, Z(2)^0 ], 
  >    [ 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0, Z(2)^0 ], 
  >    [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0 ] ];;
  gap> qform := QuadraticFormByMatrix(mat,GF(4));
  < quadratic form >
  gap> IsDegenerateForm(qform);
  #I  Testing degeneracy of the *associated bilinear form*
  true
  gap> biform := AssociatedBilinearForm(qform);
  < bilinear form >
  gap> Display(biform);
  Bilinear form
  Gram Matrix:
  z = Z(4)
     . z^1 z^1 z^1 z^1
   z^1   . z^2   .   1
   z^1 z^2   .   1   1
   z^1   .   1   .   1
   z^1   1   1   1   .
  gap> IsDegenerateForm(biform);
  true
   
\end{Verbatim}
 }

 }

 }

  
\chapter{\textcolor{Chapter }{Constructing forms and basic functionality}}\label{functionality}
\logpage{[ 4, 0, 0 ]}
\hyperdef{L}{X8166C704848D128E}{}
{
  In this chapter, all operations to construct sesquilinear and quadratic forms
are listed, along with their basic attributes and properties. 
\section{\textcolor{Chapter }{Important filters}}\label{sec:filters}
\logpage{[ 4, 1, 0 ]}
\hyperdef{L}{X83494A76866B06A5}{}
{
  
\subsection{\textcolor{Chapter }{Categories for forms}}\logpage{[ 4, 1, 1 ]}
\hyperdef{L}{X7FA162E5874E8330}{}
{
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsBilinearForm\index{IsBilinearForm@\texttt{IsBilinearForm}}
\label{IsBilinearForm}
}\hfill{\scriptsize (Category)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsHermitianForm\index{IsHermitianForm@\texttt{IsHermitianForm}}
\label{IsHermitianForm}
}\hfill{\scriptsize (Category)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsSesquilinearForm\index{IsSesquilinearForm@\texttt{IsSesquilinearForm}}
\label{IsSesquilinearForm}
}\hfill{\scriptsize (Category)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsQuadraticForm\index{IsQuadraticForm@\texttt{IsQuadraticForm}}
\label{IsQuadraticForm}
}\hfill{\scriptsize (Category)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsForm\index{IsForm@\texttt{IsForm}}
\label{IsForm}
}\hfill{\scriptsize (Category)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsForm\index{IsForm@\texttt{IsForm}}
\label{IsForm}
}\hfill{\scriptsize (Category)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsTrivialForm\index{IsTrivialForm@\texttt{IsTrivialForm}}
\label{IsTrivialForm}
}\hfill{\scriptsize (Category)}}\\


The categories \texttt{IsBilinearForm} and \texttt{IsHermitianForm} are categories for bilinear and hermitian forms, respectively. They are
disjoint and are both contained in the category \texttt{IsSesquilinearForm}. 

 Quadratic forms are contained in the category \texttt{IsQuadraticForm}. The categories \texttt{IsSesquilinearForm} and \texttt{IsQuadraticForm} are disjoint and are both contained in the category \texttt{IsForm}. 

 The user is allowed to construct the trivial form (mapping all vectors to the
zero element of the field). The trivial form is an object in the category \texttt{IsTrivialForm}. This category is contained in \texttt{IsForm} and disjoint from \texttt{IsSesquilinearForm} and \texttt{IsQuadraticForm}. }

 
\subsection{\textcolor{Chapter }{Representation for forms}}\logpage{[ 4, 1, 2 ]}
\hyperdef{L}{X7999E38082474342}{}
{
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsFormRep\index{IsFormRep@\texttt{IsFormRep}}
\label{IsFormRep}
}\hfill{\scriptsize (Representation)}}\\


Every form is represented by a matrix, the base field and a string describing
the ``type'' of the form.}

 }

 
\section{\textcolor{Chapter }{Constructing forms using a matrix}}\label{sec:formsbymatrix}
\logpage{[ 4, 2, 0 ]}
\hyperdef{L}{X78D981A67DBFCD6D}{}
{
  

\subsection{\textcolor{Chapter }{BilinearFormByMatrix}}
\logpage{[ 4, 2, 1 ]}\nobreak
\hyperdef{L}{X7C9D7E517A73F02F}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{BilinearFormByMatrix({\slshape matrix, field})\index{BilinearFormByMatrix@\texttt{BilinearFormByMatrix}}
\label{BilinearFormByMatrix}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{BilinearFormByMatrix({\slshape matrix})\index{BilinearFormByMatrix@\texttt{BilinearFormByMatrix}}
\label{BilinearFormByMatrix}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:\ }
a bilinear form



 The argument \mbox{\texttt{\slshape matrix}} must be a symmetric, or skew-symmetric, square matrix over the finite field \mbox{\texttt{\slshape field}}. The argument \mbox{\texttt{\slshape field}} is an optional argument, and if it is not given, then we assume that the \emph{defining field} of the bilinear form is the smallest field containing the entries of matrix.
Below we give an example where the defining field can make a difference in
some applications. As it is only possible to construct reflexive bilinear
forms, it is checked whether the matrix \mbox{\texttt{\slshape matrix}} is symmetric or skew symmetric. If matrix \mbox{\texttt{\slshape matrix}} is not symmetric nor skew symmetric, then an error message is returned. The
output is a bilinear form (i.e., an object in \texttt{IsBilinearForm}) with Gram matrix \mbox{\texttt{\slshape matrix}} and defining field \mbox{\texttt{\slshape field}}. (See \ref{theory:sesquilinearforms} for more on bilinear forms). 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> mat := IdentityMat(4, GF(9));
  [ [ Z(3)^0, 0*Z(3), 0*Z(3), 0*Z(3) ], [ 0*Z(3), Z(3)^0, 0*Z(3), 0*Z(3) ], 
    [ 0*Z(3), 0*Z(3), Z(3)^0, 0*Z(3) ], [ 0*Z(3), 0*Z(3), 0*Z(3), Z(3)^0 ] ]
  gap> form := BilinearFormByMatrix(mat,GF(9));
  < bilinear form >
  gap> Display(form);
  Bilinear form
  Gram Matrix:
   1 . . .
   . 1 . .
   . . 1 .
   . . . 1
  gap> mat := [[0*Z(2),Z(16)^12,0*Z(2),Z(4)^2,Z(16)^13],
  >    [Z(16)^12,0*Z(2),0*Z(2),Z(16)^11,Z(16)],
  >    [0*Z(2),0*Z(2),0*Z(2),Z(4)^2,Z(16)^3],
  >    [Z(4)^2,Z(16)^11,Z(4)^2,0*Z(2),Z(16)^3],
  >    [Z(16)^13,Z(16),Z(16)^3,Z(16)^3,0*Z(2) ]];
  [ [ 0*Z(2), Z(2^4)^12, 0*Z(2), Z(2^2)^2, Z(2^4)^13 ], 
    [ Z(2^4)^12, 0*Z(2), 0*Z(2), Z(2^4)^11, Z(2^4) ], 
    [ 0*Z(2), 0*Z(2), 0*Z(2), Z(2^2)^2, Z(2^4)^3 ], 
    [ Z(2^2)^2, Z(2^4)^11, Z(2^2)^2, 0*Z(2), Z(2^4)^3 ], 
    [ Z(2^4)^13, Z(2^4), Z(2^4)^3, Z(2^4)^3, 0*Z(2) ] ]
  gap> form := BilinearFormByMatrix(mat,GF(16));
  < bilinear form >
  gap> Display(form);
  Bilinear form
  Gram Matrix:
  z = Z(16)
      . z^12    . z^10 z^13
   z^12    .    . z^11  z^1
      .    .    . z^10  z^3
   z^10 z^11 z^10    .  z^3
   z^13  z^1  z^3  z^3    .
  gap> mat := [[1,0,0,0],[0,1,0,0],[0,0,0,1],[0,0,1,0]]*Z(7)^0;
  [ [ Z(7)^0, 0*Z(7), 0*Z(7), 0*Z(7) ], [ 0*Z(7), Z(7)^0, 0*Z(7), 0*Z(7) ], 
    [ 0*Z(7), 0*Z(7), 0*Z(7), Z(7)^0 ], [ 0*Z(7), 0*Z(7), Z(7)^0, 0*Z(7) ] ]
  gap> form := BilinearFormByMatrix(mat);
  < bilinear form >
  gap> WittIndex(form);
  1
  gap> form := BilinearFormByMatrix(mat,GF(49));
  < bilinear form >
  gap> WittIndex(form);
  2
   
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{QuadraticFormByMatrix}}
\logpage{[ 4, 2, 2 ]}\nobreak
\hyperdef{L}{X86B8694F782A4EE7}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{QuadraticFormByMatrix({\slshape matrix, field})\index{QuadraticFormByMatrix@\texttt{QuadraticFormByMatrix}}
\label{QuadraticFormByMatrix}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{QuadraticFormByMatrix({\slshape matrix})\index{QuadraticFormByMatrix@\texttt{QuadraticFormByMatrix}}
\label{QuadraticFormByMatrix}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:\ }
a quadratic form



 The argument \mbox{\texttt{\slshape matrix}} must be a square matrix over the finite field \mbox{\texttt{\slshape field}}. The argument \mbox{\texttt{\slshape field}} is an optional argument, and if it is not given, then we assume that the \emph{defining field} of the bilinear form is the smallest field containing the entries of matrix.
Below we give an example where the defining field can make a difference in
some applications. Any square matrix determines a quadratic form, but the Gram
matrix is recomputed so that it is an upper triangle matrix. The output is a
quadratic form (i.e., an object in \texttt{IsQuadraticForm}) with defining field \mbox{\texttt{\slshape field}}. (See \ref{quadforms} for more on bilinear forms). 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> mat := [[1,0,0,0],[0,3,0,0],[0,0,0,6],[0,0,6,0]]*Z(7)^0;
  [ [ Z(7)^0, 0*Z(7), 0*Z(7), 0*Z(7) ], [ 0*Z(7), Z(7), 0*Z(7), 0*Z(7) ], 
    [ 0*Z(7), 0*Z(7), 0*Z(7), Z(7)^3 ], [ 0*Z(7), 0*Z(7), Z(7)^3, 0*Z(7) ] ]
  gap> form := QuadraticFormByMatrix(mat,GF(7));
  < quadratic form >
  gap> Display(form);
  Quadratic form
  Gram Matrix:
   1 . . .
   . 3 . .
   . . . 5
   . . . .
  gap> gf := GF(2^2);
  GF(2^2)
  gap> mat := InvariantQuadraticForm( SO(-1, 4, 4) )!.matrix;
  [ [ 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2) ], [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ], 
    [ 0*Z(2), 0*Z(2), Z(2^2)^2, Z(2)^0 ], [ 0*Z(2), 0*Z(2), 0*Z(2), Z(2^2)^2 ] ]
  gap> form := QuadraticFormByMatrix( mat, gf );
  < quadratic form >
  gap> Display(form);
  Quadratic form
  Gram Matrix:
  z = Z(4)
     .   1   .   .
     .   .   .   .
     .   . z^2   1
     .   .   . z^2
   
\end{Verbatim}
 The following example shows how using the argument \mbox{\texttt{\slshape field}} has influence on the properties of the constructed form. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> mat := 
  > [[Z(2)^0,Z(2)^0,0*Z(2),0*Z(2)],[0*Z(2),Z(2)^0,0*Z(2),0*Z(2)], 
  >  [0*Z(2),0*Z(2),0*Z(2),Z(2)^0],[0*Z(2),0*Z(2),0*Z(2),0*Z(2)]];
  [ [ Z(2)^0, Z(2)^0, 0*Z(2), 0*Z(2) ], [ 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2) ], 
    [ 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0 ], [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ] ]
  gap> form := QuadraticFormByMatrix(mat);
  < quadratic form >
  gap> WittIndex(form);
  1
  gap> form := QuadraticFormByMatrix(mat,GF(4));
  < quadratic form >
  gap> WittIndex(form);
  2
   
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{HermitianFormByMatrix}}
\logpage{[ 4, 2, 3 ]}\nobreak
\hyperdef{L}{X7C027FF77AFED321}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{HermitianFormByMatrix({\slshape matrix, field})\index{HermitianFormByMatrix@\texttt{HermitianFormByMatrix}}
\label{HermitianFormByMatrix}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:\ }
a quadratic form



 The argument \mbox{\texttt{\slshape matrix}} must be a hermitian square matrix over the finite field \mbox{\texttt{\slshape field}}, and \mbox{\texttt{\slshape field}} has square order. The field must be specified, since we can only determine the
smallest field containing the entries of \mbox{\texttt{\slshape matrix}}. As it is only possible to construct reflexive sesquilinear forms, it is
checked whether the matrix is a hermitian matrix, and if not, an error message
is returned. The output is a hermitian sesquilinear form (i.e., an object in \texttt{IsHermitianForm}) with Gram matrix \mbox{\texttt{\slshape matrix}} and defining field \mbox{\texttt{\slshape field}}. (See \ref{theory:sesquilinearforms} for more on hermitian forms). 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> gf := GF(3^2);
  GF(3^2)
  gap> mat := IdentityMat(4, gf);
  [ [ Z(3)^0, 0*Z(3), 0*Z(3), 0*Z(3) ], [ 0*Z(3), Z(3)^0, 0*Z(3), 0*Z(3) ], 
    [ 0*Z(3), 0*Z(3), Z(3)^0, 0*Z(3) ], [ 0*Z(3), 0*Z(3), 0*Z(3), Z(3)^0 ] ]
  gap> form := HermitianFormByMatrix( mat, gf );
  < hermitian form >
  gap> Display(form);
  Hermitian form
  Gram Matrix:
   1 . . .
   . 1 . .
   . . 1 .
   . . . 1
  gap> mat := [[Z(11)^0,0*Z(11),0*Z(11)],[0*Z(11),0*Z(11),Z(11)],
  >     [0*Z(11),Z(11),0*Z(11)]];
  [ [ Z(11)^0, 0*Z(11), 0*Z(11) ], [ 0*Z(11), 0*Z(11), Z(11) ], 
    [ 0*Z(11), Z(11), 0*Z(11) ] ]
  gap> form := HermitianFormByMatrix(mat,GF(121));
  < hermitian form >
  gap> Display(form);
  Hermitian form
  Gram Matrix:
    1  .  .
    .  .  2
    .  2  .
   
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Constructing forms using a polynomial}}\label{sec:formsbypolynomial}
\logpage{[ 4, 3, 0 ]}
\hyperdef{L}{X78476EDF7B9498D7}{}
{
  Suppose that $f$ is a sesquilinear form on an $n$-dimensional vectorspace. Consider a vector $x$ with coordinates $x_1,\ldots,x_{n}$ with $x_i$ indeterminates over the field. Then $f(x,x)$ is a polynomial in $n$ indeterminates. When $f$ is alternating, $f(x,x)$ is identically zero, but in all other cases, $f(x,x)$ determines $f$ completely. 

 Conversely, suppose that $Q$ is a quadratic form on an $n$-dimensional vectorspace. Consider a vector $x$ with coordinates $x_1,\ldots,x_{n}$ with $x_i$ indeterminates over the field. Then $Q(x)$ is a polynomial in $n$ indeterminates, and $Q(x)$ determines $Q$ completely. 

 \textsf{Forms} provides functionality to construct bilinear, hermitian and quadratic forms
using an appropriate polynomial. 

\subsection{\textcolor{Chapter }{BilinearFormByPolynomial}}
\logpage{[ 4, 3, 1 ]}\nobreak
\hyperdef{L}{X81D571077C4BCEFF}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{BilinearFormByPolynomial({\slshape poly, r, n})\index{BilinearFormByPolynomial@\texttt{BilinearFormByPolynomial}}
\label{BilinearFormByPolynomial}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{BilinearFormByPolynomial({\slshape poly, r})\index{BilinearFormByPolynomial@\texttt{BilinearFormByPolynomial}}
\label{BilinearFormByPolynomial}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:\ }
a bilinear form



 The argument \mbox{\texttt{\slshape poly}} must be a polynomial in the polynomial ring \mbox{\texttt{\slshape r}}. The (optional) last argument is the dimension for the underlying vector
space of the resulting form, which by default is the number of indeterminates
specified by \mbox{\texttt{\slshape poly}}. It is checked whether the polynomial is a homogeneous polynomial of degree
two over the given field, and if not, an error message is returned. It is not
possible to construct a nontrivial bilinear form from a polynomial in even
characteristic. The output is a bilinear (orthogonal) form in the category \texttt{IsBilinearForm}. (See \ref{theory:sesquilinearforms} for more on bilinear forms). 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> r := PolynomialRing( GF(11), 4);
  GF(11)[x_1,x_2,x_3,x_4]
  gap> vars := IndeterminatesOfPolynomialRing( r );
  [ x_1, x_2, x_3, x_4 ]
  gap> pol := vars[1]*vars[2]+vars[3]*vars[4];
  x_1*x_2+x_3*x_4
  gap> form := BilinearFormByPolynomial(pol, r, 4);
  < bilinear form >
  gap> Display(form);
  Bilinear form
  Gram Matrix:
    .  6  .  .
    6  .  .  .
    .  .  .  6
    .  .  6  .
  Polynomial: x_1*x_2+x_3*x_4
  gap> r := PolynomialRing(GF(4),2);
  GF(2^2)[x_1,x_2]
  gap> pol := r.1*r.2;
  x_1*x_2
  gap> form := BilinearFormByPolynomial(pol,r);
  Error, No orthogonal form can be associated with a quadratic polynomial in eve
  n characteristic
   called from
  BilinearFormByPolynomial( pol, pring, n ) called from
  <function>( <arguments> ) called from read-eval-loop
  Entering break read-eval-print loop ...
  you can 'quit;' to quit to outer loop, or
  you can 'return;' to continue
  brk> quit;
   
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{QuadraticFormByPolynomial}}
\logpage{[ 4, 3, 2 ]}\nobreak
\hyperdef{L}{X86ADE1D986CC90CB}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{QuadraticFormByPolynomial({\slshape poly, r, n})\index{QuadraticFormByPolynomial@\texttt{QuadraticFormByPolynomial}}
\label{QuadraticFormByPolynomial}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{QuadraticFormByPolynomial({\slshape poly, r})\index{QuadraticFormByPolynomial@\texttt{QuadraticFormByPolynomial}}
\label{QuadraticFormByPolynomial}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:\ }
a quadratic form



 The argument \mbox{\texttt{\slshape poly}} must be a polynomial in the polynomial ring \mbox{\texttt{\slshape r}}. The (optional) last argument is the dimension for the underlying vector
space of the resulting form, which by default is the number of indeterminates
specified by \mbox{\texttt{\slshape poly}}. It is checked whether the polynomial is a homogeneous polynomial of degree
two over the given field, and if not, an error message is returned. The output
is a quadratic form in the category \texttt{IsQuadraticForm}. (See \ref{quadforms} for more on quadratic forms). 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> r := PolynomialRing( GF(8), 3);
  GF(2^3)[x_1,x_2,x_3]
  gap> poly := r.1^2 + r.2^2 + r.3^2;
  x_1^2+x_2^2+x_3^2
  gap> form := QuadraticFormByPolynomial(poly, r);
  < quadratic form >
  gap> RadicalOfForm(form);
  <vector space over GF(2^3), with 63 generators>
  gap> r := PolynomialRing(GF(9),4);
  GF(3^2)[x_1,x_2,x_3,x_4]
  gap> poly := Z(3)^2*r.1^2+r.2^2+r.3*r.4;
  x_1^2+x_2^2+x_3*x_4
  gap> qform := QuadraticFormByPolynomial(poly,r);
  < quadratic form >
  gap> Display(qform);
  Quadratic form
  Gram Matrix:
   1 . . .
   . 1 . .
   . . . 1
   . . . .
  Polynomial: x_1^2+x_2^2+x_3*x_4
   
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{HermitianFormByPolynomial}}
\logpage{[ 4, 3, 3 ]}\nobreak
\hyperdef{L}{X7E21CFFA84180D0D}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{HermitianFormByPolynomial({\slshape poly, r, n})\index{HermitianFormByPolynomial@\texttt{HermitianFormByPolynomial}}
\label{HermitianFormByPolynomial}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{HermitianFormByPolynomial({\slshape poly, r})\index{HermitianFormByPolynomial@\texttt{HermitianFormByPolynomial}}
\label{HermitianFormByPolynomial}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:\ }
an hermitian form



 The argument \mbox{\texttt{\slshape poly}} must be a polynomial in the polynomial ring \mbox{\texttt{\slshape r}} defined over a finite field of square order $q^2$ The (optional) last argument is the dimension for the underlying vector space
of the resulting form, which by default is the number of indeterminates
specified by \mbox{\texttt{\slshape poly}}. It is checked whether the polynomial is a homogeneous polynomial of degree $q+1$, and if not, an error message is returned. The output is a hermitian form in
the category \texttt{IsHermitianForm}. (See \ref{theory:sesquilinearforms} for more on hermitian forms). 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> r := PolynomialRing( GF(9), 4);
  GF(3^2)[x_1,x_2,x_3,x_4]
  gap> vars := IndeterminatesOfPolynomialRing( r );
  [ x_1, x_2, x_3, x_4 ]
  gap> poly := vars[1]*vars[2]^3+vars[1]^3*vars[2]+
  >              vars[3]*vars[4]^3+vars[3]^3*vars[4];
  x_1^3*x_2+x_1*x_2^3+x_3^3*x_4+x_3*x_4^3
  gap> form := HermitianFormByPolynomial(poly,r);
  < hermitian form >
  gap> Display(form);
  Hermitian form
  Gram Matrix:
   . 1 . .
   1 . . .
   . . . 1
   . . 1 .
  Polynomial: x_1^3*x_2+x_1*x_2^3+x_3^3*x_4+x_3*x_4^3
   
\end{Verbatim}
 }

 }

  
\section{\textcolor{Chapter }{Switching between bilinear and quadratic forms}}\label{switch}
\logpage{[ 4, 4, 0 ]}
\hyperdef{L}{X843B68558283CE5F}{}
{
  When the characteristic of the field is odd, a homogeneous quadratic
polynomial determines a bilinear form, and a quadratic form. In some
situations, when a quadratic form $Q$ is given, it is useful to consider the bilinear form $f$ such that $f(v,v)=Q(v)$, i.e., the bilinear form which is determined by exactly the same polynomial
determining the quadratic form $Q$. \textsf{Forms} provides functionality to construct a bilinear form $f$ from a given quadratic form $Q$ such that $f(v,v)=Q(v)$. Conversely, we can extract a quadratic form from a given bilinear form. 

\subsection{\textcolor{Chapter }{QuadraticFormByBilinearForm}}
\logpage{[ 4, 4, 1 ]}\nobreak
\hyperdef{L}{X7F13EAC17BDE228D}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{QuadraticFormByBilinearForm({\slshape form})\index{QuadraticFormByBilinearForm@\texttt{QuadraticFormByBilinearForm}}
\label{QuadraticFormByBilinearForm}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:\ }
a quadratic form



The argument $form$ is an orthogonal bilinear form (and thus it belongs to \texttt{IsBilinearForm}), otherwise a ``No method found'' error is returned. The output is the
quadratic form $Q$ (an object in \texttt{IsQuadraticForm}), such that $Q(v) = form(v,v)$ for all vectors $v$ in a vector space equipped with $form$. An error is returned when the characteristic of the field is even, or when $form$ is not orthogonal. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> mat := [ [ Z(3^2)^7, Z(3)^0, Z(3^2)^2, 0*Z(3), Z(3^2)^5 ], 
  >    [ Z(3)^0, Z(3^2)^7, Z(3^2)^6, Z(3^2)^5, Z(3^2)^2 ], 
  >    [ Z(3^2)^2, Z(3^2)^6, Z(3^2)^7, Z(3^2)^2, Z(3^2)^2 ], 
  >    [ 0*Z(3), Z(3^2)^5, Z(3^2)^2, Z(3^2)^6, Z(3^2)^7 ], 
  >    [ Z(3^2)^5, Z(3^2)^2, Z(3^2)^2, Z(3^2)^7, Z(3) ] ];
  [ [ Z(3^2)^7, Z(3)^0, Z(3^2)^2, 0*Z(3), Z(3^2)^5 ], 
    [ Z(3)^0, Z(3^2)^7, Z(3^2)^6, Z(3^2)^5, Z(3^2)^2 ], 
    [ Z(3^2)^2, Z(3^2)^6, Z(3^2)^7, Z(3^2)^2, Z(3^2)^2 ], 
    [ 0*Z(3), Z(3^2)^5, Z(3^2)^2, Z(3^2)^6, Z(3^2)^7 ], 
    [ Z(3^2)^5, Z(3^2)^2, Z(3^2)^2, Z(3^2)^7, Z(3) ] ]
  gap> form := BilinearFormByMatrix(mat,GF(9));
  < bilinear form >
  gap> Q := QuadraticFormByBilinearForm(form);
  < quadratic form >
  gap> Display(form);
  Bilinear form
  Gram Matrix:
  z = Z(9)
   z^7   1 z^2   . z^5
     1 z^7 z^6 z^5 z^2
   z^2 z^6 z^7 z^2 z^2
     . z^5 z^2 z^6 z^7
   z^5 z^2 z^2 z^7   2
  gap> Display(Q);
  Quadratic form
  Gram Matrix:
  z = Z(9)
   z^7   2 z^6   . z^1
     . z^7 z^2 z^1 z^6
     .   . z^7 z^6 z^6
     .   .   . z^6 z^3
     .   .   .   .   2
  gap> Set(List(GF(9)^5),x->[x,x]^form=x^Q);
  [ true ]
  gap> PolynomialOfForm(form);
  Z(3^2)^7*x_1^2-x_1*x_2+Z(3^2)^6*x_1*x_3+Z(3^2)*x_1*x_5+Z(3^2)^7*x_2^2+Z(3^2)^2
  *x_2*x_3+Z(3^2)*x_2*x_4+Z(3^2)^6*x_2*x_5+Z(3^2)^7*x_3^2+Z(3^2)^6*x_3*x_4+Z(3^2
  )^6*x_3*x_5+Z(3^2)^6*x_4^2+Z(3^2)^3*x_4*x_5-x_5^2
  gap> PolynomialOfForm(Q);
  Z(3^2)^7*x_1^2-x_1*x_2+Z(3^2)^6*x_1*x_3+Z(3^2)*x_1*x_5+Z(3^2)^7*x_2^2+Z(3^2)^2
  *x_2*x_3+Z(3^2)*x_2*x_4+Z(3^2)^6*x_2*x_5+Z(3^2)^7*x_3^2+Z(3^2)^6*x_3*x_4+Z(3^2
  )^6*x_3*x_5+Z(3^2)^6*x_4^2+Z(3^2)^3*x_4*x_5-x_5^2
   
\end{Verbatim}
 Note that the given bilinear form \mbox{\texttt{\slshape form}} is \textsc{not} the associated bilinear form of the constructed quadratic form $Q$, according to the definition in Section \ref{quadforms}. We can construct the associated bilinear forms by using \texttt{AssociatedBilinearForm} (\ref{AssociatedBilinearForm}). (See \ref{quadforms} for more on quadratic forms). }

 

\subsection{\textcolor{Chapter }{BilinearFormByQuadraticForm}}
\logpage{[ 4, 4, 2 ]}\nobreak
\hyperdef{L}{X812963777BBF97E3}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{BilinearFormByQuadraticForm({\slshape Q})\index{BilinearFormByQuadraticForm@\texttt{BilinearFormByQuadraticForm}}
\label{BilinearFormByQuadraticForm}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:\ }
a bilinear form



The argument $Q$ must be a quadratic form (and thus it belongs to \texttt{IsQuadraticForm}). The output is the orthogonal bilinear form $f$ (an object in \texttt{IsBilinearForm}), such that $f(v,v) = Q(v)$ for all vectors $v$ in a vector space equipped with $Q$. An error is returned when the characteristic of the field is even. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> r := PolynomialRing(GF(9),4);
  GF(3^2)[x_1,x_2,x_3,x_4]
  gap> poly := -r.1*r.2+Z(3^2)*r.3^2+r.4^2;
  -x_1*x_2+Z(3^2)*x_3^2+x_4^2
  gap> qform := QuadraticFormByPolynomial(poly,r);
  < quadratic form >
  gap> Display( qform );
  Quadratic form
  Gram Matrix:
  z = Z(9)
     .   2   .   .
     .   .   .   .
     .   . z^1   .
     .   .   .   1
  Polynomial: -x_1*x_2+Z(3^2)*x_3^2+x_4^2
  gap> form := BilinearFormByQuadraticForm( qform );
  < bilinear form >
  gap> Display(form);
  Bilinear form
  Gram Matrix:
  z = Z(9)
     .   1   .   .
     1   .   .   .
     .   . z^1   .
     .   .   .   1
  gap> Set(GF(9)^4, x -> [x,x]^form = x^qform);
  [ true ]
   
\end{Verbatim}
 Note that the constructed bilinear form $f$ is \textsc{not} the associated bilinear form of the given quadratic form $Q$, according to the definition in Section \ref{quadforms}. We can construct the associated bilinear forms by using \texttt{AssociatedBilinearForm} (\ref{AssociatedBilinearForm}). (See \ref{quadforms} for more on quadratic forms). }

 

\subsection{\textcolor{Chapter }{AssociatedBilinearForm}}
\logpage{[ 4, 4, 3 ]}\nobreak
\hyperdef{L}{X7BF7FBCA7FF91052}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{AssociatedBilinearForm({\slshape Q})\index{AssociatedBilinearForm@\texttt{AssociatedBilinearForm}}
\label{AssociatedBilinearForm}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:\ }
a bilinear form



The argument $Q$ must be a quadratic form (and thus it belongs to \texttt{IsQuadraticForm}). The output is the associated bilinear form $f$ (an object in \texttt{IsBilinearForm}), as defined in Section \ref{quadforms}, i.e. the bilinear form $f$ such that $f(v,w) = Q(v+w)-Q(v)-Q(w)$ for all vectors $v,w$ in a vector space equipped with $Q$. (See \ref{quadforms} for more on quadratic forms). 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> r:= PolynomialRing(GF(121),6);
  GF(11^2)[x_1,x_2,x_3,x_4,x_5,x_6]
  gap> poly := r.1*r.5-r.2*r.6+r.3*r.4;
  x_1*x_5-x_2*x_6+x_3*x_4
  gap> form := QuadraticFormByPolynomial(poly,r);
  < quadratic form >
  gap> aform := AssociatedBilinearForm(form);
  < bilinear form >
  gap> Display(aform);
  Bilinear form
  Gram Matrix:
    .  .  .  .  1  .
    .  .  .  .  . 10
    .  .  .  1  .  .
    .  .  1  .  .  .
    1  .  .  .  .  .
    . 10  .  .  .  .
   
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Evaluating forms}}\label{evaluate}
\logpage{[ 4, 5, 0 ]}
\hyperdef{L}{X8110213A7B303D1C}{}
{
  

\subsection{\textcolor{Chapter }{EvaluateForm}}
\logpage{[ 4, 5, 1 ]}\nobreak
\hyperdef{L}{X808AB7B9840ABC27}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{EvaluateForm({\slshape f, u, v})\index{EvaluateForm@\texttt{EvaluateForm}}
\label{EvaluateForm}
}\hfill{\scriptsize (operation)}}\\
\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{EvaluateForm({\slshape f, u})\index{EvaluateForm@\texttt{EvaluateForm}}
\label{EvaluateForm}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:\ }
a finite field element



 The argument \mbox{\texttt{\slshape f}} is either a sesquilinear or quadratic form defined over a finite field $GF(q)$. The other argument is a pair of vectors or matrices, or a single vector or
matrix, which represent the bases of given subspaces of $GF(q)^d$. This operation evaluates the form on the given vector or pair of vectors and
returns an element in $GF(q)$. There is also an overloading of the operation \mbox{\texttt{\slshape \texttt{\symbol{92}}\texttt{\symbol{94}}}} where $(u,v)^f$ represents $f(u,v)$ in the case that \mbox{\texttt{\slshape f}} is sesquilinear, and $u^f$ stands for $f(u)$ in the quadratic case. So for convenience, the user may use this compressed
version of this operation, which we show in the following example: 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> mat := [[Z(8),0,0,0],[0,0,Z(8)^4,0],[0,0,0,1],[0,0,0,0]]*Z(8)^0;;
  gap> form := QuadraticFormByMatrix(mat,GF(8));
  < quadratic form >
  gap> u := [ Z(2^3)^4, Z(2^3)^4, Z(2)^0, Z(2^3)^3 ];
  [ Z(2^3)^4, Z(2^3)^4, Z(2)^0, Z(2^3)^3 ]
  gap> EvaluateForm( form, u );
  Z(2^3)^6
  gap> u^form;
  Z(2^3)^6
  gap> gram := [[0,0,0,0,0,2],[0,0,0,0,2,0],[0,0,0,1,0,0],
  >               [0,0,1,0,0,0],[0,2,0,0,0,0],[2,0,0,0,0,0]]*Z(3)^0;;
  gap> form := BilinearFormByMatrix(gram,GF(3));
  < bilinear form >
  gap> u := [ [ Z(3)^0, 0*Z(3), 0*Z(3), Z(3)^0, 0*Z(3), Z(3)^0 ], 
  >   [ 0*Z(3), 0*Z(3), Z(3)^0, Z(3)^0, Z(3), 0*Z(3) ] ];;
  gap> v := [ [ Z(3)^0, 0*Z(3), Z(3)^0, Z(3), 0*Z(3), Z(3) ], 
  >   [ 0*Z(3), Z(3)^0, 0*Z(3), Z(3), Z(3), Z(3) ] ];;
  gap> EvaluateForm( form, u, v);
  [ [ Z(3)^0, Z(3)^0 ], [ 0*Z(3), 0*Z(3) ] ]
  gap> [u,v]^form;
  [ [ Z(3)^0, Z(3)^0 ], [ 0*Z(3), 0*Z(3) ] ]
   
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Orthogonality, totally isotropic subspaces, and totally singular subspaces}}\label{ortho}
\logpage{[ 4, 6, 0 ]}
\hyperdef{L}{X7A0825A987C88978}{}
{
  

\subsection{\textcolor{Chapter }{OrthogonalSubspaceMat}}
\logpage{[ 4, 6, 1 ]}\nobreak
\hyperdef{L}{X78F2409184D192D3}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{OrthogonalSubspaceMat({\slshape form, v})\index{OrthogonalSubspaceMat@\texttt{OrthogonalSubspaceMat}}
\label{OrthogonalSubspaceMat}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:\ }
a base of the subspace orthogonal to the given vector with relation to the
given form



 The argument \mbox{\texttt{\slshape form}} is a sesquilinear or quadratic form. The operation returns a base of the
subspace orthogonal to the given vector \mbox{\texttt{\slshape v}} with relation to the sesquilinear \mbox{\texttt{\slshape form}} or with relation to the associated bilinear form of the quadratic form \mbox{\texttt{\slshape form}} 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> mat := [[0,0,0,-2],[0,0,-3,0],[0,3,0,0],[2,0,0,0]]*Z(7)^0;
  [ [ 0*Z(7), 0*Z(7), 0*Z(7), Z(7)^5 ], [ 0*Z(7), 0*Z(7), Z(7)^4, 0*Z(7) ], 
    [ 0*Z(7), Z(7), 0*Z(7), 0*Z(7) ], [ Z(7)^2, 0*Z(7), 0*Z(7), 0*Z(7) ] ]
  gap> form := BilinearFormByMatrix(mat);
  < bilinear form >
  gap> v := Random(GF(7)^4);
  [ Z(7)^3, Z(7)^2, Z(7)^4, Z(7) ]
  gap> vperp := OrthogonalSubspaceMat(form,v);
  [ [ Z(7)^5, Z(7)^0, 0*Z(7), 0*Z(7) ], [ Z(7)^0, 0*Z(7), Z(7)^0, 0*Z(7) ], 
    [ Z(7)^2, 0*Z(7), 0*Z(7), Z(7)^0 ] ]
  gap> sub := [[1,1,0,0],[0,0,1,2]]*Z(7)^0;
  [ [ Z(7)^0, Z(7)^0, 0*Z(7), 0*Z(7) ], [ 0*Z(7), 0*Z(7), Z(7)^0, Z(7)^2 ] ]
  gap> subperp := OrthogonalSubspaceMat(form,sub);
  [ [ Z(7)^0, Z(7)^0, 0*Z(7), 0*Z(7) ], [ 0*Z(7), 0*Z(7), Z(7)^4, Z(7)^0 ] ]
  gap> mat := [[1,0,0],[0,0,1],[0,0,0]]*Z(2)^0;
  [ [ Z(2)^0, 0*Z(2), 0*Z(2) ], [ 0*Z(2), 0*Z(2), Z(2)^0 ], 
    [ 0*Z(2), 0*Z(2), 0*Z(2) ] ]
  gap> form := QuadraticFormByMatrix(mat);
  < quadratic form >
  gap> v := Random(GF(2)^3);
  <a GF2 vector of length 3>
  gap> vperp := OrthogonalSubspaceMat(form,v);
  [ <an immutable GF2 vector of length 3>, <an immutable GF2 vector of length 
      3> ]
  gap> sub := [[1,0,1],[1,0,0]]*Z(2)^0;
  [ [ Z(2)^0, 0*Z(2), Z(2)^0 ], [ Z(2)^0, 0*Z(2), 0*Z(2) ] ]
  gap> subperp := OrthogonalSubspaceMat(form,sub);
  [ <an immutable GF2 vector of length 3>, <an immutable GF2 vector of length 
      3> ]
   
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{IsIsotropicVector}}
\logpage{[ 4, 6, 2 ]}\nobreak
\hyperdef{L}{X8394CCAD798053C6}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsIsotropicVector({\slshape form, v})\index{IsIsotropicVector@\texttt{IsIsotropicVector}}
\label{IsIsotropicVector}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:\ }
true or false



 The operation return \mbox{\texttt{\slshape true}} if and only if \mbox{\texttt{\slshape v}} is isotropic with relation to the sesquilinear or quadratic form \mbox{\texttt{\slshape form}}. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> mat := [[1,0,0,0],[0,-1,0,0],[0,0,0,1],[0,0,1,0]]*Z(41)^0;
  [ [ Z(41)^0, 0*Z(41), 0*Z(41), 0*Z(41) ], 
    [ 0*Z(41), Z(41)^20, 0*Z(41), 0*Z(41) ], 
    [ 0*Z(41), 0*Z(41), 0*Z(41), Z(41)^0 ], 
    [ 0*Z(41), 0*Z(41), Z(41)^0, 0*Z(41) ] ]
  gap> form := BilinearFormByMatrix(mat);
  < bilinear form >
  gap> v := [1,1,0,0]*Z(41)^0;
  [ Z(41)^0, Z(41)^0, 0*Z(41), 0*Z(41) ]
  gap> IsIsotropicVector(form,v);
  true
  gap> mat := [[1,0,0,0,0],[0,0,0,0,1],[0,0,0,0,0],[0,0,1,0,0],[0,0,0,0,0]]*Z(8)^0;
  [ [ Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ], 
    [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0 ], 
    [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ], 
    [ 0*Z(2), 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2) ], 
    [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ] ]
  gap> form := QuadraticFormByMatrix(mat);
  < quadratic form >
  gap> v1 := [1,0,0,0,0]*Z(8)^0;
  [ Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ]
  gap> v2 := [0,1,0,0,0]*Z(8)^0;
  [ 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2) ]
  gap> IsIsotropicVector(form,v1);
  true
  gap> IsIsotropicVector(form,v2);
  true
   
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{IsSingularVector}}
\logpage{[ 4, 6, 3 ]}\nobreak
\hyperdef{L}{X855E539185D7D3C7}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsSingularVector({\slshape form, v})\index{IsSingularVector@\texttt{IsSingularVector}}
\label{IsSingularVector}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:\ }
true or false



 The operation return \mbox{\texttt{\slshape true}} if and only if \mbox{\texttt{\slshape v}} is singular with relation to the quadratic form \mbox{\texttt{\slshape form}}. Note that only when the characteristic of the field is odd, the singular
vectors with relation to a quadratic form are the isotropic vectors with
relation to its associated form. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> mat := [[1,0,0,0,0],[0,0,0,0,1],[0,0,0,0,0],[0,0,1,0,0],[0,0,0,0,0]]*Z(8)^0;
  [ [ Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ], 
    [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0 ], 
    [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ], 
    [ 0*Z(2), 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2) ], 
    [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ] ]
  gap> form := QuadraticFormByMatrix(mat);
  < quadratic form >
  gap> v1 := [1,0,0,0,0]*Z(8)^0;
  [ Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ]
  gap> v2 := [0,1,0,0,0]*Z(8)^0;
  [ 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2) ]
  gap> IsSingularVector(form,v1);
  false
  gap> IsSingularVector(form,v2);
  true
  gap> IsIsotropicVector(form,v1);
  true
  gap> IsIsotropicVector(form,v2);
  true
   
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{IsTotallyIsotropicSubspace}}
\logpage{[ 4, 6, 4 ]}\nobreak
\hyperdef{L}{X8141325085AAC0CD}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsTotallyIsotropicSubspace({\slshape form, sub})\index{IsTotallyIsotropicSubspace@\texttt{IsTotallyIsotropicSubspace}}
\label{IsTotallyIsotropicSubspace}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:\ }
true or false



 The operation return \mbox{\texttt{\slshape true}} if and only if the subspace spanned by the vectors in the list \mbox{\texttt{\slshape sub}} is totally isotropic with relation to the sesquilinear or quadratic form \mbox{\texttt{\slshape form}}. Note that when \mbox{\texttt{\slshape form}} is a quadratic form, it is checked whether \mbox{\texttt{\slshape sub}} generates a subspace that is totally isotropic with relation to the associated
bilinear form of \mbox{\texttt{\slshape form}}. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> mat := [[1,0,0,0],[0,-1,0,0],[0,0,0,1],[0,0,1,0]]*Z(7)^0;
  [ [ Z(7)^0, 0*Z(7), 0*Z(7), 0*Z(7) ], [ 0*Z(7), Z(7)^3, 0*Z(7), 0*Z(7) ], 
    [ 0*Z(7), 0*Z(7), 0*Z(7), Z(7)^0 ], [ 0*Z(7), 0*Z(7), Z(7)^0, 0*Z(7) ] ]
  gap> form := BilinearFormByMatrix(mat);
  < bilinear form >
  gap> sub:= [[Z(7)^0,0*Z(7),Z(7)^0,Z(7)],[0*Z(7),Z(7)^0,Z(7)^0,Z(7)^4]];
  [ [ Z(7)^0, 0*Z(7), Z(7)^0, Z(7) ], [ 0*Z(7), Z(7)^0, Z(7)^0, Z(7)^4 ] ]
  gap> IsTotallyIsotropicSubspace(form,sub);
  true
  gap> mat := IdentityMat(6,GF(2));
  [ <a GF2 vector of length 6>, <a GF2 vector of length 6>, 
    <a GF2 vector of length 6>, <a GF2 vector of length 6>, 
    <a GF2 vector of length 6>, <a GF2 vector of length 6> ]
  gap> form := HermitianFormByMatrix(mat,GF(4));
  < hermitian form >
  gap> sub := [[Z(2)^0,0*Z(2),0*Z(2),Z(2)^0,Z(2)^0,Z(2)^0], 
  >   [0*Z(2),Z(2)^0,0*Z(2),Z(2^2)^2,Z(2^2),Z(2)^0], 
  >   [0*Z(2),0*Z(2),Z(2)^0,Z(2)^0,Z(2^2),Z(2^2)^2]];
  [ [ Z(2)^0, 0*Z(2), 0*Z(2), Z(2)^0, Z(2)^0, Z(2)^0 ], 
    [ 0*Z(2), Z(2)^0, 0*Z(2), Z(2^2)^2, Z(2^2), Z(2)^0 ], 
    [ 0*Z(2), 0*Z(2), Z(2)^0, Z(2)^0, Z(2^2), Z(2^2)^2 ] ]
  gap> IsTotallyIsotropicSubspace(form,sub);
  true
  
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{IsTotallySingularSubspace}}
\logpage{[ 4, 6, 5 ]}\nobreak
\hyperdef{L}{X834FD9117F1DA8D0}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsTotallySingularSubspace({\slshape form, sub})\index{IsTotallySingularSubspace@\texttt{IsTotallySingularSubspace}}
\label{IsTotallySingularSubspace}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:\ }
true or false



 The operation return \mbox{\texttt{\slshape true}} if and only if the subspace spanned by the vectors in the list \mbox{\texttt{\slshape sub}} is totally singular with relation to quadratic form \mbox{\texttt{\slshape form}}. Note that only when the characteristic of the field is odd, the totally
singular subspaces of given dimension $n$ with relation to a quadratic form are exactly the totally isotropic subspaces
of dimension $n$ with relation to its associated form. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> mat := [[1,0,0,0,0],[0,0,0,0,1],[0,0,0,0,0],[0,0,1,0,0],[0,0,0,0,0]]*Z(8)^0;
  [ [ Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ], 
    [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0 ], 
    [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ], 
    [ 0*Z(2), 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2) ], 
    [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ] ]
  gap> form := QuadraticFormByMatrix(mat);
  < quadratic form >
  gap> sub := [[Z(2)^0,0*Z(2),Z(2^3)^6,Z(2^3),Z(2^3)^3],
  >        [0*Z(2),Z(2)^0,Z(2^3)^6,Z(2^3)^2,Z(2^3)]];
  [ [ Z(2)^0, 0*Z(2), Z(2^3)^6, Z(2^3), Z(2^3)^3 ], 
    [ 0*Z(2), Z(2)^0, Z(2^3)^6, Z(2^3)^2, Z(2^3) ] ]
  gap> IsTotallySingularSubspace(form,sub);
  true
  
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Attributes and properties of forms}}\label{properties}
\logpage{[ 4, 7, 0 ]}
\hyperdef{L}{X813A02878352E9E5}{}
{
  

\subsection{\textcolor{Chapter }{IsReflexiveForm}}
\logpage{[ 4, 7, 1 ]}\nobreak
\hyperdef{L}{X80254BFD7E4B8F06}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsReflexiveForm({\slshape f})\index{IsReflexiveForm@\texttt{IsReflexiveForm}}
\label{IsReflexiveForm}
}\hfill{\scriptsize (property)}}\\
\textbf{\indent Returns:\ }
true or false.



 A sesquilinear form $f$ on a vector space $V$ is \emph{reflexive}\index{Form@Form!Reflexive} if $f(v,w)=0 \Rightarrow f(w,v)=0$ for all $v,w \in V$. The argument $f$ must be a sesquilinear form (and thus it belongs to \texttt{IsSesquilinearForm}). A sesquilinear form $f$ is \emph{reflexive} if whenever we have $f(u,v)=0$, for two vectors $u,v$ in the associated vector space, then we also have $f(v,u)=0$. This attribute simply returns \mbox{\texttt{\slshape true}} or \mbox{\texttt{\slshape false}} according to whether \mbox{\texttt{\slshape f}} is reflexive or not, and is stored as a property of \mbox{\texttt{\slshape f}}. It is not possible in this version of \textsf{Forms} to construct non-reflexive forms. (See \ref{theory:sesquilinearforms} for more on reflexive sesquilinear forms). }

 

\subsection{\textcolor{Chapter }{IsAlternatingForm}}
\logpage{[ 4, 7, 2 ]}\nobreak
\hyperdef{L}{X7D5AB7E484CFBF63}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsAlternatingForm({\slshape f})\index{IsAlternatingForm@\texttt{IsAlternatingForm}}
\label{IsAlternatingForm}
}\hfill{\scriptsize (property)}}\\
\textbf{\indent Returns:\ }
true or false.



 A sesquilinear form $f$ on a vector space $V$ is \emph{alternating}\index{Form@Form!Alternating} if $f(v,v)=0$ for all $v \in V$. The argument $f$ must be a sesquilinear form (and thus it belongs to \texttt{IsSesquilinearForm}). A bilinear form $f$ is \emph{alternating} if $f(v,v)=0$ for all $v$. This method simply returns \mbox{\texttt{\slshape true}} or \mbox{\texttt{\slshape false}} according to whether \mbox{\texttt{\slshape f}} is alternating or not, and is stored as a property of \mbox{\texttt{\slshape f}}. (See \ref{theory:sesquilinearforms} for more on alternating sesquilinear forms). }

 

\subsection{\textcolor{Chapter }{IsSymmetricForm}}
\logpage{[ 4, 7, 3 ]}\nobreak
\hyperdef{L}{X85585B2C80413490}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsSymmetricForm({\slshape f})\index{IsSymmetricForm@\texttt{IsSymmetricForm}}
\label{IsSymmetricForm}
}\hfill{\scriptsize (property)}}\\
\textbf{\indent Returns:\ }
true or false.



 A sesquilinear form $f$ on a vector space $V$ is \emph{symmetric}\index{Form@Form!Symmetric} if $f(v,w)=f(w,v)$ for all $v,w \in V$. The argument $f$ must be a sesquilinear form (and thus it belongs to \texttt{IsSesquilinearForm}). A bilinear form $f$ is \emph{symmetric} if $f(u,v)=f(v,u)$ for all pairs of vectors $u$ and $v$. This attribute simply returns \mbox{\texttt{\slshape true}} or \mbox{\texttt{\slshape false}} according to whether \mbox{\texttt{\slshape f}} is symmetric or not, and is stored as a property of \mbox{\texttt{\slshape f}}. (See \ref{theory:sesquilinearforms} for more on symmetric sesquilinear forms). }

 

\subsection{\textcolor{Chapter }{IsOrthogonalForm}}
\logpage{[ 4, 7, 4 ]}\nobreak
\hyperdef{L}{X87E9C9A1781AB058}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsOrthogonalForm({\slshape f})\index{IsOrthogonalForm@\texttt{IsOrthogonalForm}}
\label{IsOrthogonalForm}
}\hfill{\scriptsize (property)}}\\
\textbf{\indent Returns:\ }
true or false.



 The argument $f$ must be a sesquilinear form (and thus it belongs to \texttt{IsSesquilinearForm}). A bilinear form $f$ is called \emph{orthogonal}\index{Form@Form!orthogonal} if the characteristic of the underlying field is odd, and $f$ is a symmetric form. (See \ref{theory:sesquilinearforms} for more on bilinear forms). This operation simply returns \mbox{\texttt{\slshape true}} or \mbox{\texttt{\slshape false}} according to whether \mbox{\texttt{\slshape f}} is an orthogonal bilinear form or not, and is stored as a property of \mbox{\texttt{\slshape f}}. }

 

\subsection{\textcolor{Chapter }{IsPseudoForm}}
\logpage{[ 4, 7, 5 ]}\nobreak
\hyperdef{L}{X861AF6EE82F4DA39}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsPseudoForm({\slshape f})\index{IsPseudoForm@\texttt{IsPseudoForm}}
\label{IsPseudoForm}
}\hfill{\scriptsize (property)}}\\
\textbf{\indent Returns:\ }
true or false.



 When the characteristic of the field is odd, we call a form $f$ \emph{orthogonal} if and only $f$ is symmetric, and when the characteristic of the field is even, we call a form $f$ \emph{pseudo}\index{Form@Form!pseudo} if and only if $f$ is symmetric but not alternating. The argument $f$ must be a sesquilinear form (and thus it belongs to \texttt{IsSesquilinearForm}). (See \ref{theory:sesquilinearforms} for more on pseudo forms). This method simply returns \mbox{\texttt{\slshape true}} or \mbox{\texttt{\slshape false}} according to whether \mbox{\texttt{\slshape f}} is a pseudo form or not, and is stored as a property of \mbox{\texttt{\slshape f}}. }

 

\subsection{\textcolor{Chapter }{IsSymplecticForm}}
\logpage{[ 4, 7, 6 ]}\nobreak
\hyperdef{L}{X86F552AE7ACC12C7}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsSymplecticForm({\slshape f})\index{IsSymplecticForm@\texttt{IsSymplecticForm}}
\label{IsSymplecticForm}
}\hfill{\scriptsize (property)}}\\
\textbf{\indent Returns:\ }
true or false.



 We call a bilinear form $f$ \emph{symplectic}\index{Form@Form!symplectic} if and only if $f$ is alternating. The argument $f$ must be a sesquilinear form (and thus it belongs to \texttt{IsSesquilinearForm}). (See \ref{theory:sesquilinearforms} for more on symplectic forms). This method simply returns \mbox{\texttt{\slshape true}} or \mbox{\texttt{\slshape false}} according to whether \mbox{\texttt{\slshape f}} is symplectic or not, and is stored as a property of \mbox{\texttt{\slshape f}}. }

 

\subsection{\textcolor{Chapter }{IsDegenerateForm}}
\logpage{[ 4, 7, 7 ]}\nobreak
\hyperdef{L}{X7C60B9587D130DBB}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsDegenerateForm({\slshape f})\index{IsDegenerateForm@\texttt{IsDegenerateForm}}
\label{IsDegenerateForm}
}\hfill{\scriptsize (property)}}\\
\textbf{\indent Returns:\ }
true or false.



 The argument $f$ must be a form (and thus it belongs to \texttt{IsForm}). A sesquilinear form $f$ is \emph{degenerate} if its radical is non-trivial. A quadratic form is degenerate if and only if
the radical of the associated bilinear form is non-trivial. Note that
degeneracy for quadratic forms is too restrictive if the characteristic is
even. See also \texttt{IsSingularForm} (\ref{IsSingularForm}). This attribute simply returns \mbox{\texttt{\slshape true}} or \mbox{\texttt{\slshape false}} according to whether \mbox{\texttt{\slshape f}} is degenerate or not, and is stored as a property of \mbox{\texttt{\slshape f}}. }

 

\subsection{\textcolor{Chapter }{IsSingularForm}}
\logpage{[ 4, 7, 8 ]}\nobreak
\hyperdef{L}{X7A0E882F801624DA}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsSingularForm({\slshape f})\index{IsSingularForm@\texttt{IsSingularForm}}
\label{IsSingularForm}
}\hfill{\scriptsize (property)}}\\
\textbf{\indent Returns:\ }
true or false.



 The argument $f$ must be a quadratic form (and thus it belongs to \texttt{IsQuadraticForm}). A quadratic form $f$ is \emph{singular} if its radical is non-trivial. When the characteristic of the field is odd, a
quadratic form is singular if and only if it is degenerate. This is not the
case when the characteristic of the field is even. This method simply returns \mbox{\texttt{\slshape true}} or \mbox{\texttt{\slshape false}} according to whether \mbox{\texttt{\slshape f}} is singular or not, and is stored as a property of \mbox{\texttt{\slshape f}}. }

 

\subsection{\textcolor{Chapter }{BaseField}}
\logpage{[ 4, 7, 9 ]}\nobreak
\hyperdef{L}{X7BCBA564829D9E89}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{BaseField({\slshape f})\index{BaseField@\texttt{BaseField}}
\label{BaseField}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:\ }
the underlying field of \mbox{\texttt{\slshape f}}.



 The argument $f$ must be a form (and thus it belongs to \texttt{IsForm}). The method returns the field which is stored as the \emph{defining field} of $f$. We sometimes stipulate in \textsf{Forms} that a form have a defining field, for mathematical reasons. Clearly, to
define a hermitian form one needs to specify the field of scalars for the
vector space that you wish your hermitian form to act on. The default, if the
user has not specified a field on creation of a form, is the smallest field
containing the entries or coefficients of the input (a matrix or polynomial).
Having a particular defining field for a form can be very useful, for example,
when one wants to find a change of basis from one form to another (isometric)
form. In this case, one needs to know in which $GL(d,q)$ the base-transition matrix should be taken. }

 

\subsection{\textcolor{Chapter }{GramMatrix}}
\logpage{[ 4, 7, 10 ]}\nobreak
\hyperdef{L}{X847AFB4C81A90B3F}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{GramMatrix({\slshape f})\index{GramMatrix@\texttt{GramMatrix}}
\label{GramMatrix}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:\ }
the Gram matrix of \mbox{\texttt{\slshape f}}.



 The argument $f$ must be a form (and thus it belongs to \texttt{IsForm}). This method returns the Gram matrix of $f$ (see \ref{theory:sesquilinearforms} and \ref{quadforms}). }

 

\subsection{\textcolor{Chapter }{RadicalOfForm}}
\logpage{[ 4, 7, 11 ]}\nobreak
\hyperdef{L}{X7855C3C07AAA1A68}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{RadicalOfForm({\slshape f})\index{RadicalOfForm@\texttt{RadicalOfForm}}
\label{RadicalOfForm}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:\ }
The radical of the form \mbox{\texttt{\slshape f}} 



 The argument $f$ must be a form (and thus it belongs to \texttt{IsForm}) on some vector space $V$. The radical of a form $f$ is the subspace consisting of vectors which are orthogonal to every vector,
i.e., 
\[Rad(f) = \{v \in V | f(v,w) = 0,\, \forall w \in V\}.\]
 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> r := PolynomialRing( GF(8), 3 );
  GF(2^3)[x_1,x_2,x_3]
  gap> poly := r.1^2 + r.2 * r.3;
  x_1^2+x_2*x_3
  gap> form := QuadraticFormByPolynomial( poly, r );
  < quadratic form >
  gap> r := RadicalOfForm( form );
  <vector space over GF(2^3), with 0 generators>
  gap> Dimension(r);
  0
   
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{PolynomialOfForm}}
\logpage{[ 4, 7, 12 ]}\nobreak
\hyperdef{L}{X82E7367F817C6BD0}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{PolynomialOfForm({\slshape f})\index{PolynomialOfForm@\texttt{PolynomialOfForm}}
\label{PolynomialOfForm}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:\ }
the polynomial associated with \mbox{\texttt{\slshape f}}.



 The argument \mbox{\texttt{\slshape f}} must be a form (and thus it belongs to \texttt{IsForm}). All forms, except for bilinear forms in even characteristic, have an
associated polynomial defining a quadratic or hermitian form (see \ref{theory:sesquilinearforms} and \ref{quadforms}). This method returns the polynomial associated with \mbox{\texttt{\slshape f}}, and if not already bound, stores it as a property of \mbox{\texttt{\slshape f}}. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> mat := [ [ Z(8) , 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ], 
  >  [ 0*Z(2), Z(2)^0, Z(2^3)^5, 0*Z(2), 0*Z(2) ], 
  >  [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ], 
  >  [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0 ], 
  >  [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ] ];;
  gap> form := QuadraticFormByMatrix(mat,GF(8));
  < quadratic form >
  gap> PolynomialOfForm(form);
  Z(2^3)*x_1^2+x_2^2+Z(2^3)^5*x_2*x_3+x_4*x_5
   
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{DiscriminantOfForm}}
\logpage{[ 4, 7, 13 ]}\nobreak
\hyperdef{L}{X87B652A28534E0D2}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{DiscriminantOfForm({\slshape f})\index{DiscriminantOfForm@\texttt{DiscriminantOfForm}}
\label{DiscriminantOfForm}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:\ }
a string



 The argument $f$ must be a form (and thus it belongs to \texttt{IsForm}). Given a quadratic or bilinear form \mbox{\texttt{\slshape f}} of even dimension, this operation returns a string: ``square'' or
``nonsquare''. More specifically, let $f$ be a from over $GF(q)$, and let $M$ be the Gram matrix of $f$. Define the \emph{discriminant} of $Q$ (n.b., \emph{quasideterminant} in \cite{Atlas}) as `square' if $det(M)$ is a square of $GF(q)$, and `non-square' otherwise. The discriminant is an invariant of
nondegenerate orthogonal spaces over finite fields of odd order, up to
isometry. Thus, discriminants can be used to delineate the isometry type of an
orthogonal form in even (algebraic) dimension. The discriminant of a hermitian
form is not defined, and applying this operation on a hermitian form, will
result in an error message. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> gram := InvariantQuadraticForm(GO(-1,4,5))!.matrix;;
  gap> qform := QuadraticFormByMatrix(gram, GF(5));
  < quadratic form >
  gap> DiscriminantOfForm( qform );
  "nonsquare"
   
\end{Verbatim}
 }

 }

 
\section{\textcolor{Chapter }{Recognition of sesquilinear forms preserved by a classical group}}\label{recognition}
\logpage{[ 4, 8, 0 ]}
\hyperdef{L}{X79E3749C7A023189}{}
{
  In this section, we describe a function that was initially developed by Frank
Celler (and which has now been adapted to \textsf{Forms}) for the recognition of sesquilinear forms left invariant by a matrix group.
More importantly, we should stress that this routine differs to that already
offered by the \textsf{MeatAxe} in that it finds sesquilinear forms preserved up to \textsc{scalars}. Eventually, the procedure used for finding preserved sesquilinear forms does
use the \textsf{MeatAxe} but in some cases it can rule out the existence of preserved forms without
calling the \textsf{MeatAxe}. For more information on the algorithm, please see \cite{CLGNNPP}. 

\subsection{\textcolor{Chapter }{PreservedSesquilinearForms}}
\logpage{[ 4, 8, 1 ]}\nobreak
\hyperdef{L}{X84056A357E5447AF}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{PreservedSesquilinearForms({\slshape group})\index{PreservedSesquilinearForms@\texttt{PreservedSesquilinearForms}}
\label{PreservedSesquilinearForms}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:\ }
a list of forms 



 The argument \mbox{\texttt{\slshape group}} is a matrix group. The function uses random methods to find all of the
bilinear or unitary forms preserved by \mbox{\texttt{\slshape group}} (the trivial form is also a possibility) up to a scalar. Since the procedure
relies on a pseudo-random generator, the user may need to execute the
operation more than once to find all invariant sesquilinear forms. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> g := SU(4,3);
  SU(4,3)
  gap> forms := PreservedSesquilinearForms(g);
  [ < hermitian form > ]
  gap> Display( forms[1] );
  Hermitian form
  Gram Matrix:
   . . . 2
   . . 2 .
   . 2 . .
   2 . . .
   
\end{Verbatim}
 Here is another example which shows that this procedure is suitable in some
cases where using the \textsf{MeatAxe} is not applicable. Here, our matrix group is the group of similarities
preserving a (hyperbolic) bilinear form on $GF(3)^6$. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> a := [ [ -1, 0, 0, -1, 0, 1 ], [ 0, -1, -1, 0, 0, 1 ], 
  >        [ -1, 0, 0, 1, 0, 0 ],  [ 0, -1, 1, 0, 0, -1 ], 
  >        [ 0, 0, 0, 0, 0, -1 ], [ 0, -1, -1, 1, 1, 1 ] ] * One(GF(3));;
  gap> b := [ [ 1, -1, 1, -1, 1, -1 ], [ 1, 1, -1, 1, 1, 0 ], 
  >        [ -1, 0, 1, 0, 0, 0 ], [ 0, -1, 0, 0, 0, 1 ], 
  >        [ 1, 1, 1, 1, 1, 1 ], [ -1, 1, 1, 1, -1, 0 ] ] * One(GF(3));;
  gap> g := Group( a, b );
  <matrix group with 2 generators>
  gap> forms := PreservedSesquilinearForms( g );
  [ < bilinear form > ]
  gap> Display( forms[1] );
  Bilinear form
  Gram Matrix:
   . 1 . . . .
   1 . . . . .
   . . . 1 . .
   . . 1 . . .
   . . . . . 1
   . . . . 1 .
  gap> m := GModuleByMats( [a,b], GF(3) );;
  gap> usemeataxe := MTX.InvariantBilinearForm(m);
  fail
   
\end{Verbatim}
 }

 }

 }

  
\chapter{\textcolor{Chapter }{Morphisms of forms}}\label{morphisms}
\logpage{[ 5, 0, 0 ]}
\hyperdef{L}{X7B9AF2E784EB8481}{}
{
  In this chapter we give a very brief overview on morphisms of sesquilinear and
quadratic forms. The reader can find more in the texts: Cameron \cite{Cameron}, Taylor \cite{Taylor}, Aschbacher \cite{Aschbacher}, or Kleidman and Liebeck \cite{KleidmanLiebeck}. 

 In this chapter we consider an $n$-dimensional vector space $V$ over a finite field. Suppose that $f$ is a sesquilinear form or a quadratic form on $V$, then we call the pair $(V,f)$ a \emph{formed vector space}. 
\section{\textcolor{Chapter }{Morphisms of sesquilinear forms}}\label{morphisms:sesquilinear}
\logpage{[ 5, 1, 0 ]}
\hyperdef{L}{X784D3B338055EC9D}{}
{
  Consider two formed vector spaces $(V,f)$ and $(W,g)$ over the same field $F$, where both $f$ and $g$ are sesquilinear forms. Suppose that $\phi$ is a linear map from $V$ to $W$. The map $\phi$ is an \emph{isometry}\index{Isometry} from the formed space $(V,f)$ to the formed space $(W,g)$ if for all $v,w$ in $V$ we have 
\[ f(v,w) = f'(\phi(v), \phi(w)). \]
 The map $\phi$ is a \emph{similarity}\index{Similarity} from the formed space $(V,f)$ to the formed space $(W,g)$ if for all $v,w$ in $V$ we have 
\[ f(v,w) = \lambda f'(\phi(v), \phi(w)).  \]
 for some non-zero $\lambda \in F$. Finally, the map $\phi$. is a \emph{semi-similarity}\index{Semi-similarity} from the formed space $(V,f)$ to the formed space $(W,g)$ if for all $v,w$ in $V$ we have 
\[f(v,w) = \lambda f'(\phi(v), \phi(w))^\alpha\]
  for some non-zero $\lambda \in F$ and a field automorphism $\alpha$ of $F$. 

 One of the objectives of studying maps between formed vector spaces is the
classification of sesquilinear forms on a vector space $V$, where it is sufficient to classify non-degenerate forms. The following
results are well known. 

 It can be proved that (see for example Section 6.3 of \cite{Cameron}): 
\begin{itemize}
\item all non-degenerate alternating forms of a given vector space over a given
finite field are similar,
\item all non-degenerate hermitian forms of a given vector space over a given finite
field are similar, and,
\item the non-degenerate symmetric bilinear forms on a vector space over a field
with odd characteristic come in three flavours, two of which occur when the
dimension of the vector space is even, one of which occurs when the dimension
of the vector space is odd.
\end{itemize}
 In principle, within each similarity class, different isometry classes can
occur, but we will see that in most cases, each similarity class contains
exactly one isometry class. 

 Given a sesquilinear form $f$ over a vector space $V$, \textsf{Forms} provides functionality to compute the linear map $\phi$ from $V$ to itself (or, equivalently, a matrix describing a change of basis), such that $f$ is mapped to its canonical representative in its isometry class. In the next
sections, we describe the representative(s) of the similarity class(es) used
in \textsf{Forms}, and, when necessary, the different isometry classes, for each of the three
reflexive sesquilinear forms. The easiest cases are the hermitian and
alternating cases. 
\subsection{\textcolor{Chapter }{Hermitian forms}}\label{morphisms:hermitian}
\logpage{[ 5, 1, 1 ]}
\hyperdef{L}{X807E16A383D2E04C}{}
{
  We suppose that $f$ is a non-degenerate hermitian form on a vector space $V$ over the finite field $F$, with involutory field automorphism $\alpha$. It can be proved (see \cite{KleidmanLiebeck}) that any vector space equipped with a non-degenerate hermitian form $f$ contains an orthogonal basis such that $f(e_i,e_i)=1$ for each basisvector $e_i$. Hence $(V,f)$ is isometric with $(V,f')$ with $f'$ the non-degenerate hermitian form with the identity matrix over $F$. The Witt index of $f$ equals $n/2$ when $n$ is even and $(n-1)/2$ when $n$ is odd. }

 
\subsection{\textcolor{Chapter }{Alternating forms}}\label{morphisms:alternating}
\logpage{[ 5, 1, 2 ]}
\hyperdef{L}{X8042784984331FF4}{}
{
  We suppose that $f$ is a non-degenerate alternating bilinear form on a vector space $V$ over a finite field $F$. As already mentioned in Section \ref{theory:sesquilinearforms}, non-degenerate alternating forms only exist on even dimensional vector
spaces. Restricting to a two dimensional vector space, it is clear immediately
that the Gram matrix of $f$ must be  $\left( \begin{array}{cc}0 & r \\ -r & 0 \end{arry} \right)$ for some non-zero $r \in F$. If we rescale one of the basisvectors, which induces an isometry, then we
see that there always exists a basis such that $r=1$. We call a two dimensional vector space equipped with a non-degenerate
alternating form a \emph{symplectic hyperbolic line}, and it is proved (see Theorem 6.7 of \cite{Cameron}) that the formed space $(V,f)$ can be written as an orthogonal direct sum of symplectic hyperbolic planes.
Hence, up to isometry, there is only one non-degenerate alternating form of an
even dimensional vector space, and we choose as canonical representative the
alternating form with Gram matrix 
\[\left( \begin{array}{ccccccc} 0 & 1 & 0 & 0 & \ldots & 0 & 0 \\ -1 & 0 & 0 & 0
& \ldots & 0 & 0 \\ 0 & 0 & 0 & 1 & \ldots & 0 & 0 \\ 0 & 0 & -1 & 0 & \ldots
& 0 & 0 \\ \vdots & \vdots & \vdots & \vdots & \ddots & \vdots & \vdots \\ 0 &
0 & 0 & 0 & \ldots & 0 & 1 \\ 0 & 0 & 0 & 0 & \ldots & -1 & 0 \\ \end{array}
\right).\]
   The Witt index of $f$ equals $n/2$. }

 
\subsection{\textcolor{Chapter }{Bilinear forms}}\label{morphisms:bilinear}
\logpage{[ 5, 1, 3 ]}
\hyperdef{L}{X7F1255F77B6874E3}{}
{
  We suppose that $f$ is a non-degenerate symmetric bilinear form on a vector space $V$ over a finite field $F$ with odd characteristic. We call a two dimensional vector space a \emph{hyperbolic line} if it contains a non-zero vector such that $f(v,v) = 0$. It is proved (see Proposition 6.9 of \cite{Cameron}) that any two hyperbolic lines are isometric, and we choose as canonical
representative the orthogonal form with Gram matrix  
\[\left( \begin{array}{cc}0 & 1 \\ 1 & 0 \end{arry} \right).\]
 

 It can be proved (see Theorem 6.10 of \cite{Cameron}) that the formed space $(V,f)$ can be written as the orthogonal direct sum of hyperbolic lines and one
subspace $U$ of dimension at most two. The behaviour of $f$ on the subspace $U$ determines the similarity class of $f$. We describe the three occurring cases, to describe the chosen canonical
form, we use the polynomial rather than the Gram matrix. 

 
\begin{itemize}
\item If the dimension of $U$ is zero, then $(V,f)$ is the orthogonal direct sum of hyperbolic lines, and hence $(V,f)$ is isometric to the formed space $(V,f')$, where the Gram matrix of $f'$ consists of blocks as described above. The chosen canonical form has
polynomial 
\[ x_1 x_2 + \ldots + x_{n-1}x_n \]
 Note that the dimension of the vector space $V$ is necessarily even. We call $f$ \emph{hyperbolic} (see also Section \ref{theory:sesquilinearforms}). It follows also that in this similarity class, there is only one isometry
class. The Witt index of $f$ equals $n/2$. 
\item If the dimension of $U$ is one, then necessarily the polynomial of $f$ equals 
\[ \mu x_1^2 + x_2 x_3 + \ldots + x_{n-1}x_n \]
 for some $\mu \in F$, and the dimension of the vector space $V$ is odd. We call $f$ \emph{parabolic} (see also Section \ref{theory:sesquilinearforms}). It is clear that if $\mu$ is a square in $F$, then rescaling the first basis vector yields a polynomial 
\[ x_1^2 + x_2 x_3 + \ldots + x_{n-1}x_n \]
 which we choose as the canonical form for this similarity class. If $\mu$ is a non-square, a rescaling of $x_2,x_4,\ldots,x_{n-1}$ yields a polynomial 
\[ \mu (x_1^2 + x_2 x_3 + \ldots + x_{n-1}x_n) \]
 which represents now a bilinear form that is \textsc{similar but not isometric} to the given one. Hence, the parabolic similarity class contains two isometry
classes. The Witt index of $f$ equals $(n-1)/2$. 
\item  Suppose at last that the dimension of $U$ is two. We may suppose that $U$ is not a hyperbolic line. It is not too difficult to see that a suitable base
change yields the polynomial 
\[ \mu x_1^2 + x_2^2 + x_3 x_4 + \ldots + x_{n-1}x_n \]
 for a non-square $\mu \in F$, and the dimension of the vector space $V$ is even. We call $f$ \emph{elliptic}. The Witt index of $f$ equals $(n-2)/2$. 
\end{itemize}
 }

 
\subsection{\textcolor{Chapter }{Degenerate forms}}\label{morphisms:degenerate}
\logpage{[ 5, 1, 4 ]}
\hyperdef{L}{X79453E2B7DDE1412}{}
{
  Suppose that $f$ is a degenerate sesquilinear form on the vector space $V$, then $Rad(f)$ is a non-trivial subspace of the vector space $V$. The vector space $V$ can be written as the orthogonal direct sum of a subspace $W$ and $Rad(f)$, and the restriction of $f$ to $W$ is a non-degenerate sesquilinear form on $W$. Hence, $f$ is isometric with a sesquilinear form having Gram matrix   
\[\left( \begin{array}{cc} M & A \\ B & C \end{arry} \right)\]
  where $M$ is the Gram matrix of a non-degenerate sesquilinear form and $A,B$ and $C$ are appropriate zero matrices. The dimension of the maximal isotropic
subspaces is the sum of the Witt index and the dimension of the radical. }

 }

 
\section{\textcolor{Chapter }{Morphisms of quadratic forms}}\label{morphisms:quadratic}
\logpage{[ 5, 2, 0 ]}
\hyperdef{L}{X87C0B98C8669A34A}{}
{
  Consider two formed vector spaces $(V,f)$ and $(W,g)$ over the same field $F$, where both $f$ and $g$ are quadratic forms. Suppose that $\phi$ is a linear map from $V$ to $W$. The map $\phi$ is an \emph{isometry}\index{Isometry} from the formed space $(V,f)$ to the formed space $(W,g)$ if for all $v,w$ in $V$ we have 
\[ f(v) = f'(\phi(v)). \]
 The map $\phi$ is a \emph{similarity}\index{Similarity} from the formed space $(V,f)$ to a formed space $(W,g)$ if for all $v,w$ in $V$ we have 
\[ f(v) = \lambda f'(\phi(v)).  \]
 for some non-zero $\lambda \in F$. Finally, the map $\phi$. is a \emph{semi-similarity}\index{Semi-similarity} from the formed space $(V,f)$ to the formed space $(W,g)$ if for all $v,w$ in $V$ we have 
\[ f(v)=\lambda f'(\phi(v))^\alpha  \]
 for some non-zero $\lambda \in F$ and a field automorphism $\alpha$ of $F$. 

 Also in this case, one of the objectives of studying maps between formed
vector spaces is the classification of quadratic forms of the same vector
space $V$, where it is sufficient to classify non-degenerate forms. 

Since there is a one-to-one relationship between quadratic forms in odd
characteristic and orthogonal bilinear forms in odd characteristic, we suppose
in this section that $f$ is a quadratic form in even characteristic. We call a two dimensional vector
space a \emph{hyperbolic line} if it contains a non-zero vector such that $f(v) = 0$. It is proved (see Proposition 6.9 of \cite{Cameron}) that any two hyperbolic lines are isometric, and we choose as canonical
representative the quadratic form with polynomial $ x_1 x_2$. As in the case of the orthogonal bilinear forms, it can be proved (see
Theorem 6.10 of \cite{Cameron}) that $(V,f)$ can be written as the orthogonal direct sum of hyperbolic lines and one
subspace $U$ of dimension at most two. The behaviour of $f$ on the subspace $U$ determines the similarity class of $f$. The classification of quadratic forms in even characteristic is analogous to
the one in odd characteristic. 
\begin{itemize}
\item If the dimension of $U$ is zero, then $(V,f)$ is the orthogonal direct sum of hyperbolic lines, and hence $(V,f)$ is isometric to the formed space $(V,f')$, with polynomial 
\[ x_1 x_2 + \ldots + x_{n-1}x_n, \]
 which is chosen as the canonical form. Note that the dimension of the vector
space $V$ is necessarily even. We call $f$ \emph{hyperbolic} (see also Section \ref{theory:sesquilinearforms}). It follows also that in this similarity class, there is only one isometry
class. The Witt index of $f$ equals $n/2$. 
\item If the dimension of $U$ is one, then necessarily the polynomial of $f$ equals 
\[ \mu x_1^2 + x_2 x_3 + \ldots + x_{n-1}x_n \]
 for some $\mu \in F$, and the dimension of the vector space $V$ is odd. We call $f$ \emph{parabolic} (see also Section \ref{theory:sesquilinearforms}). Since every element is a square in even characteristic, rescaling the first
basis vector yields $\mu=1$. The Witt index of $f$ equals $(n-1)/2$. 
\item  Suppose at last that the dimension of $U$ is two. We may suppose that $U$ is not a hyperbolic line. It is not difficult to see that a suitable base
change yields the polynomial 
\[ d x_1^2 + x_1x_2 + x_2^2 + x_3 x_4 + \ldots + x_{n-1}x_n \]
 for an element of category 1, this is, an element $d$ such that $T(d)=1$ with $T$ the trace map from $F$ to $GF(2)$. Furthermore, an easy argument shows that an appropriate base change allows
to choose any element of category 1 for $d$. It follows also that the dimension of the vector space $V$ is even. We call $f$ \emph{elliptic} (see also Section \ref{theory:sesquilinearforms}). The Witt index of $f$ equals $(n-2)/2$. 
\end{itemize}
 Hence, non-degenerate quadratic forms in even characteristic come in three
similarity classes, which is analogous to the odd characteristic case, and
each similarity class contains only one isometry class, which is different
than in the odd characteristic case 

 Suppose that $f$ is a degenerate quadratic form on the $n$-dimensional vector space $V$, then $Rad(f)$ is a non-trivial subspace of the vector space $V$. The vector space $V$ can be written as the orthogonal direct sum of a subspace $W$ and $Rad(f)$, and the restriction of $f$ to $W$ is a non-degenerate quadratic form on $W$. Hence, $f$ is isometric with a quadratic form with one of the three above polynomials.
The dimension of the maximal isotropic subspaces is the sum of the Witt index
and the dimension of the radical. }

 
\section{\textcolor{Chapter }{Operations based on morphisms of forms}}\label{morphisms_functions}
\logpage{[ 5, 3, 0 ]}
\hyperdef{L}{X790B24568376AACE}{}
{
  

\subsection{\textcolor{Chapter }{BaseChangeToCanonical}}
\logpage{[ 5, 3, 1 ]}\nobreak
\hyperdef{L}{X78CCFB957A6153F5}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{BaseChangeToCanonical({\slshape f})\index{BaseChangeToCanonical@\texttt{BaseChangeToCanonical}}
\label{BaseChangeToCanonical}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:\ }
a transition matrix \mbox{\texttt{\slshape b}} from one basis to another



 The argument \mbox{\texttt{\slshape f}} is a sesquilinear or quadratic form. For every isometry class of forms, there
is a canonical representative, as described in Section \ref{morphisms:sesquilinear}. If \mbox{\texttt{\slshape M}} is the Gram matrix of the form \mbox{\texttt{\slshape f}}, then this method returns an invertible matrix \mbox{\texttt{\slshape b}} such that \mbox{\texttt{\slshape b * M * TransposedMat(b)}} is the Gram matrix of the canonical representative. That is, \mbox{\texttt{\slshape b}} is the \emph{transition matrix} from a basis of the underlying vector space of \mbox{\texttt{\slshape f}} to another basis. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> gf := GF(3);
  GF(3)
  gap> gram := [
  > [0,0,0,1,0,0], 
  > [0,0,0,0,1,0],
  > [0,0,0,0,0,1],
  > [-1,0,0,0,0,0],
  > [0,-1,0,0,0,0],
  > [0,0,-1,0,0,0]] * One(gf);;
  gap> form := BilinearFormByMatrix( gram, gf );
  < bilinear form >
  gap> b := BaseChangeToCanonical( form );;
  gap> Display( b * gram * TransposedMat(b) );
   . 1 . . . .
   2 . . . . .
   . . . 1 . .
   . . 2 . . .
   . . . . . 1
   . . . . 2 .
   
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{BaseChangeHomomorphism}}
\logpage{[ 5, 3, 2 ]}\nobreak
\hyperdef{L}{X87A6F5C979551677}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{BaseChangeHomomorphism({\slshape b, gf})\index{BaseChangeHomomorphism@\texttt{BaseChangeHomomorphism}}
\label{BaseChangeHomomorphism}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:\ }
the inner automorphism of GL(d,q) associated to the transition matrix \mbox{\texttt{\slshape b}}.



 The argument \mbox{\texttt{\slshape b}} must be an invertible matrix of size $d$ over the finite field \mbox{\texttt{\slshape gf}} of order $q$. This method returns the inner automorphism of $GL(d,q)$ induces by conjugation by $b$. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> gl:=GL(3,3);
  GL(3,3)
  gap> go:=GO(3,3);
  GO(0,3,3)
  gap> form := PreservedSesquilinearForms(go)[1]; 
  < bilinear form >
  gap> gram := GramMatrix( form );  
  [ [ 0*Z(3), Z(3), 0*Z(3) ], [ Z(3), 0*Z(3), 0*Z(3) ], 
    [ 0*Z(3), 0*Z(3), Z(3)^0 ] ]
  gap> b := BaseChangeToCanonical(form);;
  gap> hom := BaseChangeHomomorphism(b, GF(3));
  ^[ [ 0*Z(3), Z(3)^0, 0*Z(3) ], [ Z(3), Z(3), Z(3)^0 ], 
    [ Z(3)^0, Z(3), 0*Z(3) ] ]
  gap> newgo := Image(hom, go); 
  Group(
  [ [ [ Z(3)^0, Z(3)^0, 0*Z(3) ], [ 0*Z(3), Z(3), 0*Z(3) ], [ Z(3), Z(3)^0,
             Z(3) ] ], 
    [ [ Z(3)^0, Z(3), 0*Z(3) ], [ Z(3), Z(3), Z(3)^0 ], [ 0*Z(3), Z(3)^0,
             0*Z(3) ] ] ])
  gap> gens := GeneratorsOfGroup(newgo);;
  gap> canonical := b * gram * TransposedMat(b);
  [ [ Z(3)^0, 0*Z(3), 0*Z(3) ], [ 0*Z(3), 0*Z(3), Z(3) ], 
    [ 0*Z(3), Z(3), 0*Z(3) ] ]
  gap> ForAll(gens, y -> y * canonical * TransposedMat(y) = canonical);
  true
   
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{IsometricCanonicalForm}}
\logpage{[ 5, 3, 3 ]}\nobreak
\hyperdef{L}{X7DFEFA2C7945A5AD}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsometricCanonicalForm({\slshape f})\index{IsometricCanonicalForm@\texttt{IsometricCanonicalForm}}
\label{IsometricCanonicalForm}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:\ }
the canonical form isometric to the sesquilinear or quadratic form \mbox{\texttt{\slshape f}}.



 The argument \mbox{\texttt{\slshape f}} is a sesquilinear or quadratic form. For every isometry class of forms, there
is a canonical representative, as described in Section \ref{morphisms:sesquilinear}, which is the returned form. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> mat := [ [ Z(8) , 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ], 
  > [ 0*Z(2), Z(2)^0, Z(2^3)^5, 0*Z(2), 0*Z(2) ], 
  > [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ], 
  > [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0 ], 
  > [ 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ] ];;
  gap> form := QuadraticFormByMatrix(mat,GF(8));
  < quadratic form >
  gap> iso := IsometricCanonicalForm(form);
  < parabolic quadratic form >
  gap> Display(form);
  Parabolic quadratic form
  Gram Matrix:
  z = Z(8)
   z^1   .   .   .   .
     .   1 z^5   .   .
     .   .   .   .   .
     .   .   .   .   1
     .   .   .   .   .
  Witt Index: 2
  gap> Display(iso);
  Parabolic quadratic form
  Gram Matrix:
   1 . . . .
   . . 1 . .
   . . . . .
   . . . . 1
   . . . . .
  Witt Index: 2
   
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{ScalarOfSimilarity}}
\logpage{[ 5, 3, 4 ]}\nobreak
\hyperdef{L}{X7C7D92267EFE71DB}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{ScalarOfSimilarity({\slshape M, form})\index{ScalarOfSimilarity@\texttt{ScalarOfSimilarity}}
\label{ScalarOfSimilarity}
}\hfill{\scriptsize (operation)}}\\
\textbf{\indent Returns:\ }
a finite field element 



 Recall that a similarity of a form $f$ on a vector space $V$, is a linear transformation $g$ of $V$ where there exists some nonzero scalar $c$ such that for all $v,w$ in $V$, $f(u^g,v^g) = c f(u,v).$ This operation finds for a particular matrix \mbox{\texttt{\slshape M}}, giving rise to a similarity of the sesquilinear form \mbox{\texttt{\slshape form}}, the said scalar $c$. 
\begin{Verbatim}[fontsize=\small,frame=single,label=Example]
  gap> gram := [ [ 0*Z(3), Z(3)^0, 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3) ], 
  >   [ Z(3)^0, 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3) ], 
  >   [ 0*Z(3), 0*Z(3), 0*Z(3), Z(3)^0, 0*Z(3), 0*Z(3) ], 
  >   [ 0*Z(3), 0*Z(3), Z(3)^0, 0*Z(3), 0*Z(3), 0*Z(3) ], 
  >   [ 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3), Z(3)^0 ], 
  >   [ 0*Z(3), 0*Z(3), 0*Z(3), 0*Z(3), Z(3)^0, 0*Z(3) ] ];;
  gap> form := BilinearFormByMatrix( gram, GF(3) );
  < bilinear form >
  gap> m := [ [ Z(3)^0, Z(3)^0, Z(3), 0*Z(3), Z(3)^0, Z(3) ], 
  >   [ Z(3), Z(3), Z(3)^0, 0*Z(3), Z(3)^0, Z(3) ], 
  >   [ 0*Z(3), Z(3), 0*Z(3), Z(3), 0*Z(3), 0*Z(3) ], 
  >   [ 0*Z(3), Z(3), Z(3)^0, Z(3), Z(3), Z(3) ], 
  >   [ Z(3)^0, Z(3)^0, Z(3), Z(3), Z(3)^0, Z(3)^0 ], 
  >   [ Z(3)^0, 0*Z(3), Z(3), Z(3)^0, Z(3), Z(3) ] ];;
  gap> ScalarOfSimilarity( m, form );
  Z(3)
   
\end{Verbatim}
 }

 

\subsection{\textcolor{Chapter }{WittIndex}}
\logpage{[ 5, 3, 5 ]}\nobreak
\hyperdef{L}{X85FA387280DAEA69}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{WittIndex({\slshape f})\index{WittIndex@\texttt{WittIndex}}
\label{WittIndex}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:\ }
the Witt index of the form \mbox{\texttt{\slshape f}}. 



 The argument \mbox{\texttt{\slshape f}} is a sesquilinear or quadratic form. When \mbox{\texttt{\slshape f}} is degenerate, its Witt index is defined as the Witt index of its
non-degenerate part, see Sections \ref{theory:sesquilinearforms} and \ref{quadforms}. }

 

\subsection{\textcolor{Chapter }{IsEllipticForm}}
\logpage{[ 5, 3, 6 ]}\nobreak
\hyperdef{L}{X853AF8D97E00F1DB}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsEllipticForm({\slshape f})\index{IsEllipticForm@\texttt{IsEllipticForm}}
\label{IsEllipticForm}
}\hfill{\scriptsize (property)}}\\
\textbf{\indent Returns:\ }
true or false. 



 The argument \mbox{\texttt{\slshape f}} is a sesquilinear or quadratic form. This operation returns \mbox{\texttt{\slshape true}} is and only if \mbox{\texttt{\slshape f}} is elliptic; that is, it is orthogonal of minus type, or in other words, has
even dimension and non-maximal Witt index (see Section \ref{morphisms:bilinear} for sesquilinear forms and Section \ref{morphisms:quadratic} for quadratic forms). }

 

\subsection{\textcolor{Chapter }{IsParabolicForm}}
\logpage{[ 5, 3, 7 ]}\nobreak
\hyperdef{L}{X7B73832A786FEC21}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsParabolicForm({\slshape f})\index{IsParabolicForm@\texttt{IsParabolicForm}}
\label{IsParabolicForm}
}\hfill{\scriptsize (property)}}\\
\textbf{\indent Returns:\ }
true or false. 



 The argument \mbox{\texttt{\slshape f}} is a sesquilinear or quadratic form. This operation returns \mbox{\texttt{\slshape true}} is and only if \mbox{\texttt{\slshape f}} is parabolic; that is, it is orthogonal of neutral type, or in other words, it
has odd dimension (see Section \ref{morphisms:bilinear} for sesquilinear forms and Section \ref{morphisms:quadratic} for quadratic forms). }

 

\subsection{\textcolor{Chapter }{IsHyperbolicForm}}
\logpage{[ 5, 3, 8 ]}\nobreak
\hyperdef{L}{X85551B28798B07C7}{}
{\noindent\textcolor{FuncColor}{$\Diamond$\ \texttt{IsHyperbolicForm({\slshape f})\index{IsHyperbolicForm@\texttt{IsHyperbolicForm}}
\label{IsHyperbolicForm}
}\hfill{\scriptsize (attribute)}}\\
\textbf{\indent Returns:\ }
true or false. 



 The argument \mbox{\texttt{\slshape f}} is a sesquilinear or quadratic form. This operation returns \mbox{\texttt{\slshape true}} is and only if \mbox{\texttt{\slshape f}} is hyperbolic; that is, it is orthogonal of plus type, or in other words, has
even dimension and maximal Witt index (see Section \ref{morphisms:bilinear} for sesquilinear forms and Section \ref{morphisms:quadratic} for quadratic forms). }

 }

 }

 \def\bibname{References\logpage{[ "Bib", 0, 0 ]}
\hyperdef{L}{X7A6F98FD85F02BFE}{}
}

\bibliographystyle{alpha}
\bibliography{forms}

\def\indexname{Index\logpage{[ "Ind", 0, 0 ]}
\hyperdef{L}{X83A0356F839C696F}{}
}


\printindex

\newpage
\immediate\write\pagenrlog{["End"], \arabic{page}];}
\immediate\closeout\pagenrlog
\end{document}
