\documentstyle[11pt,reduce]{article}
\title{A \REDUCE{} package for the computation of several matrix 
normal forms}
\author{Matt Rebbeck \\ 
Konrad-Zuse-Zentrum f\"ur Informationstechnik Berlin}
Takustra\"se 7  \\
D--14195 Berlin -- Dahlem \\
Federal Republic of Germany \\[0.05in]
E--mail: neun@zib.de \\[0.05in]
}
\date{February 1994}
\begin{document}
\maketitle
\index{NORMFORM package}


\section{Introduction}
When are two given matrices similar? Similar matrices have the same
trace, determinant, \hspace{0in} characteristic polynomial, 
\hspace{0in} and eigenvalues, \hspace{0in} but the matrices 
\begin{displaymath}
\begin{array}{ccc} {\cal U} = \left( \begin{array}{cc} 0 & 1 \\ 0 & 
0 \end{array} \right) & $and$ & {\cal V} = \left( \begin{array}{cc} 
0 & 0 \\ 0 & 0 \end{array} \right) \end{array} 
\end{displaymath}
are the same in all four of the above but are not similar. Otherwise 
there could exist a nonsingular ${\cal N} {\in} M_{2}$ (the set of 
all $2 \times 2$ matrices) such that ${\cal U} = {\cal N} \, {\cal V}
\, {\cal N}^{-1} = {\cal N} \, {\it 0} \, {\cal N}^{-1} = {\it 0}$, 
which is a contradiction since ${\cal U} \neq {\it 0}$.

Two matrices can look very different but still be similar. One 
approach to determining whether two given matrices are similar is to 
compute the normal form of them. If both matrices reduce to the same 
normal form they must be similar.

{\small NORMFORM} is a package for computing the following normal 
forms of matrices:

\begin{itemize}
\begin{verbatim}
 - smithex
 - smithex_int
 - frobenius
 - ratjordan
 - jordansymbolic
 - jordan
\end{verbatim}
\end{itemize}
 
The package is loaded by {\tt load\_package normform;}

By default all calculations are carried out in {\cal Q} (the rational 
numbers). For {\tt smithex}, {\tt frobenius}, {\tt ratjordan}, 
{\tt jordansymbolic}, and {\tt jordan}, this field can be extended. 
Details are given in the respective sections.

The {\tt frobenius}, {\tt ratjordan}, and {\tt jordansymbolic} normal 
forms can also be computed in a modular base. Again, details are given 
in the respective sections.

The algorithms for each routine are contained in the source code.

{\small NORMFORM} has been converted from the normform and Normform 
packages written by T.M.L. Mulders and A.H.M. Levelt. These have been 
implemented in Maple [4].


\section{smithex}

\subsection{function}

{\tt smithex}(${\cal A},\, x$) computes the Smith normal form ${\cal S}$
of the matrix ${\cal A}$.

It returns \{${\cal S}, {\cal P}, {\cal P}^{-1}$\} where ${\cal S}, 
{\cal P}$, and ${\cal P}^{-1}$ are such that ${\cal P S P}^{-1} = 
{\cal A}$.

${\cal A}$ is a rectangular matrix of univariate polynomials in $x$.

$x$ is the variable name.

\subsection{field extensions}

Calculations are performed in ${\cal Q}$. To extend this field the 
{\small ARNUM} package can be used. For details see {\it section} 8.

\subsection{synopsis}

\begin{itemize}
\item The Smith normal form ${\cal S}$ of an n by m matrix ${\cal A}$ 
with univariate polynomial entries in $x$ over a field {\it F} is 
computed. That is, the polynomials are then regarded as elements of the
{\it E}uclidean domain {\it F}($x$).

\item The Smith normal form is a diagonal matrix ${\cal S}$ where:

  \begin{itemize}
  \item rank(${\cal A}$) = number of nonzero rows (columns) of 
        ${\cal S}$.
  \item ${\cal S}(i,\, i)$ is a monic polynomial for 0 $< i \leq $
        rank(${\cal A}$).
  \item ${\cal S}(i,\, i)$ divides ${\cal S}(i+1,\, i+1)$ for 0 $< i
        <$ rank(${\cal A}$).
  \item ${\cal S}(i,\,i)$ is the greatest common divisor of all $i$ by 
        $i$ minors of ${\cal A}$.
  \end{itemize}

      Hence, if we have the case that $n = m$, as well as 
      rank(${\cal A}$) $= n$, then product (${\cal S}(i,\,i), 
      i=1\ldots n$) = det(${\cal A}$) / lcoeff(det$({\cal A}), \, x$).

\item The Smith normal form is obtained by doing elementary row and 
      column operations. This includes interchanging rows (columns),
      multiplying through a row (column) by $-1$, and adding integral 
      multiples of one row (column) to another.

\item Although the rank and determinant can be easily obtained from 
      ${\cal S}$, this is not an efficient method for computing these 
      quantities except that this may yield a partial factorization of 
      det(${\cal A}$) without doing any explicit factorizations.

\end{itemize}

\subsection{example}

{\tt load\_package normform;}

\begin{displaymath}
{\cal A} = \left( \begin{array}{cc} x & x+1 \\ 0 & 3*x^2 \end{array} 
\right)
\end{displaymath}

\begin{displaymath}
\hspace{-0.5in}
\begin{array}{ccc}
{\tt smithex}({\cal A},\, x) & = & 
\left\{ \left( \begin{array}{cc} 1 & 0 \\ 
0 & x^3 \end{array} \right), \left( \begin{array}{cc} 1 & 0 \\ 3*x^2 
& 1 \end{array} \right), \left( \begin{array}{cc} x & x+1 \\ -3 & -3 
\end{array} \right) \right\} \end{array}
\end{displaymath}


\section{smithex\_int}

\subsection{function}

Given an $n$ by $m$ rectangular matrix ${\cal A}$ that contains 
{\it only} integer entries, {\tt smithex\_int}(${\cal A}$) computes the
Smith normal form ${\cal S}$ of ${\cal A}$.

It returns \{${\cal S}, {\cal P}, {\cal P}^{-1}$\} where ${\cal S}, 
{\cal P}$, and ${\cal P}^{-1}$ are such that ${\cal P S P}^{-1} = 
{\cal A}$.


\subsection{synopsis}

\begin{itemize}
\item The Smith normal form ${\cal S}$ of an $n$ by $m$ matrix 
${\cal A}$ with integer entries is computed.

\item The Smith normal form is a diagonal matrix ${\cal S}$ where:

  \begin{itemize}
  \item rank(${\cal A}$) = number of nonzero rows (columns) of 
        ${\cal S}$.
  \item sign(${\cal S}(i,\, i)$) = 1 for 0 $< i \leq $ rank(${\cal A}$).
  \item ${\cal S}(i,\, i)$ divides ${\cal S}(i+1,\, i+1)$ for 0 $< i
        <$ rank(${\cal A}$).
  \item ${\cal S}(i,\,i)$ is the greatest common divisor of all $i$ by 
        $i$ minors of ${\cal A}$.
  \end{itemize}

      Hence, if we have the case that $n = m$, as well as 
      rank(${\cal A}$) $= n$, then abs(det(${\cal A}$)) = 
      product(${\cal S}(i,\,i),i=1\ldots n$).
      
\item The Smith normal form is obtained by doing elementary row and 
      column operations. This includes interchanging rows (columns),
      multiplying through a row (column) by $-1$, and adding integral 
      multiples of one row (column) to another. 
\end{itemize}

\subsection{example}

{\tt load\_package normform;}

\begin{displaymath}
{\cal A} = \left( \begin{array}{ccc} 9 & -36 & 30 \\ -36 & 192 & -180 \\
30 & -180 & 180  \end{array} 
\right)
\end{displaymath}

{\tt smithex\_int}(${\cal A}$) = 
\begin{center}
\begin{displaymath}
\left\{ \left( \begin{array}{ccc} 3 & 0 & 0 \\ 0 & 12 & 0 \\ 0 & 0 & 60 
\end{array} \right), \left( \begin{array}{ccc} -17 & -5 & -4 \\ 64 & 19 
& 15 \\ -50 & -15 & -12 \end{array} \right), \left( \begin{array}{ccc} 
1 & -24 & 30 \\ -1 & 25 & -30 \\ 0 & -1 & 1 \end{array} \right) \right\}
\end{displaymath}
\end{center}


\section{frobenius}

\subsection{function}

{\tt frobenius}(${\cal A}$) computes the Frobenius normal form 
${\cal F}$ of the matrix ${\cal A}$.

It returns \{${\cal F}, {\cal P}, {\cal P}^{-1}$\} where ${\cal F}, 
{\cal P}$, and ${\cal P}^{-1}$ are such that ${\cal P F P}^{-1} = 
{\cal A}$.

${\cal A}$ is a square matrix.

\subsection{field extensions}

Calculations are performed in ${\cal Q}$. To extend this field the 
{\small ARNUM} package can be used. For details see {\it section} 8.

\subsection{modular arithmetic}

{\tt frobenius} can be calculated in a modular base. For details see 
{\it section} 9.

\subsection{synopsis}

\begin{itemize}
\item ${\cal F}$ has the following structure:
      \begin{displaymath}
      {\cal F} = \left( \begin{array}{cccc} {\cal C}{\it p_{1}} &  &  & 
      \\  & {\cal C}{\it p_{2}} &  &  \\  &  & \ddots &  \\  &  &  & 
      {\cal C}{\it p_{k}} \end{array} \right) 
      \end{displaymath}
      where the ${\cal C}({\it p_{i}})$'s are companion matrices 
      associated with polynomials ${\it p_{1}, p_{2}},\ldots, 
      {\it p_{k}}$, with the property that ${\it p_{i}}$ divides 
      ${\it p_{i+1}}$ for $i =1\ldots k-1$. All unmarked entries are 
      zero.

\item The Frobenius normal form defined in this way is unique (ie: if 
      we require that ${\it p_{i}}$ divides ${\it p_{i+1}}$ as above).
\end{itemize}
 
\subsection{example}

{\tt load\_package normform;}

\begin{displaymath}
{\cal A} = \left( \begin{array}{cc} \frac{-x^2+y^2+y}{y} & 
\frac{-x^2+x+y^2-y}{y} \\ \frac{-x^2-x+y^2+y}{y} & \frac{-x^2+x+y^2-y}
{y} \end{array} \right)
\end{displaymath}

{\tt frobenius}(${\cal A}$) = 
\begin{center}
\begin{displaymath}
\left\{ \left( \begin{array}{cc} 0 & \frac{x*(x^2-x-y^2+y)}{y} \\ 1 & 
\frac{-2*x^2+x+2*y^2}{y} \end{array} \right), \left( \begin{array}{cc}
1 & \frac{-x^2+y^2+y}{y} \\ 0 & \frac{-x^2-x+y^2+y}{y} \end{array} 
\right), \left( \begin{array}{cc} 1 & \frac{-x^2+y^2+y}{x^2+x-y^2-y} \\
0 & \frac{-y}{x^2+x-y^2-y} \end{array} \right) \right\}
\end{displaymath}
\end{center}


\section{ratjordan}

\subsection{function}

{\tt ratjordan}(${\cal A}$) computes the rational Jordan normal form 
${\cal R}$ of the matrix ${\cal A}$.

It returns \{${\cal R}, {\cal P}, {\cal P}^{-1}$\} where ${\cal R}, 
{\cal P}$, and ${\cal P}^{-1}$ are such that ${\cal P R P}^{-1} = 
{\cal A}$.

${\cal A}$ is a square matrix.

\subsection{field extensions}

Calculations are performed in ${\cal Q}$. To extend this field the 
{\small ARNUM} package can be used. For details see {\it section} 8.

\subsection{modular arithmetic}

{\tt ratjordan} can be calculated in a modular base. For details see 
{\it section} 9.

\subsection{synopsis}

\begin{itemize}
\item ${\cal R}$ has the following structure:
      \begin{displaymath}
      {\cal R} = \left( \begin{array}{cccccc} {\it r_{11}} \\  & 
      {\it r_{12}} \\  &  & \ddots \\  &  &  & {\it r_{21}}  \\ &  &  
      &  & {\it r_{22}} \\ &  &  &  &  & \ddots \end{array} \right) 
      \end{displaymath}

      The ${\it r_{ij}}$'s have the following shape:  
      \begin{displaymath}
      {\it r_{ij}} = \left( \begin{array}{ccccc} {\cal C}({\it p}) & 
      {\cal I}  &  &  & \\  &  {\cal C}({\it p}) & {\cal I}  & & \\ & 
      & \ddots & \ddots & \\ &  &  &  {\cal C}({\it p}) & {\cal I} \\ &
      &  &  & {\cal C}({\it p}) \end{array} \right) 
      \end{displaymath}

      where there are e${\it ij}$ times ${\cal C}({\it p})$ blocks 
      along the diagonal and ${\cal C}({\it p})$ is the companion 
      matrix  associated with the irreducible polynomial ${\it p}$. All 
      unmarked entries are zero.
\end{itemize}

\subsection{example}

{\tt load\_package normform;}

\begin{displaymath}
{\cal A} = \left( \begin{array}{cc} x+y & 5 \\ y & x^2  \end{array} 
\right)
\end{displaymath}

{\tt ratjordan}(${\cal A}$) = 
\begin{center}
\begin{displaymath}
\left\{ \left( \begin{array}{cc} 0 & -x^3-x^2*y+5*y \\ 1 & 
x^2+x+y \end{array} \right), \left( \begin{array}{cc}
1 & x+y \\ 0 & y \end{array} \right), \left( \begin{array}{cc} 1 & 
\frac{-(x+y)}{y} \\ 0 & \hspace{0.2in} \frac{1}{y} \end{array} \right) 
\right\}
\end{displaymath}
\end{center}


\section{jordansymbolic}

\subsection{function}

{\tt jordansymbolic}(${\cal A}$) \hspace{0in} computes the Jordan 
normal form ${\cal J}$of the matrix ${\cal A}$.

It returns \{${\cal J}, {\cal L}, {\cal P}, {\cal P}^{-1}$\}, where 
${\cal J}, {\cal P}$, and ${\cal P}^{-1}$ are such that ${\cal P J P}^
{-1} = {\cal A}$. ${\cal L}$ = \{ {\it ll} , $\xi$ \}, where $\xi$ is 
a name and {\it ll} is a list of irreducible factors of ${\it p}(\xi)$.

${\cal A}$ is a square matrix.

\subsection{field extensions}

Calculations are performed in ${\cal Q}$. To extend this field the 
{\small ARNUM} package can be used. For details see {\it section} 8.

\subsection{modular arithmetic}

{\tt jordansymbolic} can be calculated in a modular base. For details 
see {\it section} 9.

\subsection{extras}

If using {\tt xr}, the X interface for \REDUCE, the appearance of the 
output can be improved by switching {\tt on looking\_good;}. This 
converts all lambda to $\xi$ and improves the indexing, eg: lambda12 
$\Rightarrow \xi_{12}$. The example ({\it section} 6.6) shows the 
output when this switch is on.

\subsection{synopsis}

\begin{itemize}
\item A {\it Jordan block} ${\jmath}_{k}(\lambda)$ is a $k$ by $k$ 
      upper triangular matrix of the form:

      \begin{displaymath}
      {\jmath}_{k}(\lambda) = \left( \begin{array}{ccccc} \lambda & 1 
      &  &  & \\  &  \lambda & 1  & & \\ & 
      & \ddots & \ddots & \\ &  &  &  \lambda & 1 \\ &
      &  &  & \lambda \end{array} \right) 
      \end{displaymath}
      
      There are $k-1$ terms ``$+1$'' in the superdiagonal; the scalar 
      $\lambda$ appears $k$ times on the main diagonal. All other 
      matrix entries are zero, and ${\jmath}_{1}(\lambda) = (\lambda)$.

\item A Jordan matrix ${\cal J} \in M_{n}$ (the set of all $n$ by $n$ 
      matrices) is a direct sum of {\it jordan blocks}.

      \begin{displaymath}
      {\cal J} = \left( \begin{array}{cccc} \jmath_{n_1}(\lambda_{1}) 
      \\  & \jmath_{n_2}(\lambda_{2}) \\ & & \ddots \\ & & & 
      \jmath_{n_k}(\lambda_{k}) \end{array} \right),
      {\it n}_{1}+{\it n}_{2}+\cdots +{\it n}_{k} = n
      \end{displaymath}

      in which the orders ${\it n}_{i}$ may not be distinct and the 
      values ${\lambda_{i}}$ need not be distinct.

\item Here ${\lambda}$ is a zero of the characteristic polynomial 
      ${\it p}$ of ${\cal A}$. If ${\it p}$ does not split completely, 
      symbolic names are chosen for the missing zeroes of ${\it p}$.
      If, by some means, one knows such missing zeroes, they can be 
      substituted for the symbolic names. For this, 
      {\tt jordansymbolic} actually returns $\{ {\cal J,L,P,P}^{-1} \}$.
      ${\cal J}$ is the Jordan normal form of ${\cal A}$ (using 
      symbolic names if necessary). ${\cal L} = \{ {\it ll}, \xi \}$, 
      where $\xi$ is a name and ${\it ll}$ is a list of irreducible 
      factors of ${\it p}(\xi)$. If symbolic names are used then 
      ${\xi}_{ij}$ is a zero of ${\it ll}_{i}$. ${\cal P}$ and 
      ${\cal P}^{-1}$ are as above.
\end{itemize}      

\subsection{example}

{\tt load\_package normform;}\\
{\tt on looking\_good;} 

\begin{displaymath}
{\cal A} = \left( \begin{array}{cc} 1 & y \\ y^2 & 3  \end{array} 
\right)
\end{displaymath}

{\tt jordansymbolic}(${\cal A}$) = 
\begin{eqnarray}
 & & \left\{ \left( \begin{array}{cc} \xi_{11} & 0 \\ 0 & \xi_{12}
\end{array} \right) ,
\left\{ \left\{ -y^3+\xi^2-4*\xi+3 \right\}, \xi \right\}, \right. 
\nonumber \\ & & \hspace{0.1in} \left. \left( \begin{array}{cc} 
\xi_{11} -3 & \xi_{12} -3 \\ y^2 & y^2 
\end{array} \right), \left( \begin{array}{cc} \frac{\xi_{11} -2}
{2*(y^3-1)} & \frac{\xi_{11} + y^3 -1}{2*y^2*(y^3+1)} \\ 
\frac{\xi_{12} -2}{2*(y^3-1)} & \frac{\xi_{12}+y^3-1}{2*y^2*(y^3+1)}
\end{array} \right) \right\} \nonumber
\end{eqnarray}

\vspace{0.2in}
\begin{flushleft}
\begin{math}
{\tt solve(-y^3+xi^2-4*xi+3,xi)}${\tt ;}$
\end{math}
\end{flushleft}

\vspace{0.1in}
\begin{center}
\begin{math}
\{ \xi = \sqrt{y^3+1} + 2,\, \xi = -\sqrt{y^3+1}+2 \}
\end{math}
\end{center}

\vspace{0.1in}
\begin{math}
{\tt {\cal J}  = sub}{\tt (}{\tt \{ xi(1,1)=sqrt(y^3+1)+2,\, xi(1,2) = 
-sqrt(y^3+1)+2\},} 
\end{math}
\\ \hspace*{0.29in} {\tt first  jordansymbolic (${\cal A}$));} 
 
\vspace{0.2in}
\begin{displaymath}
{\cal J} = \left( \begin{array}{cc} \sqrt{y^3+1} + 2 & 0 \\ 0 & 
-\sqrt{y^3+1} + 2 \end{array} \right)
\end{displaymath}

\vspace{0.2in}
For a similar example ot this in standard {\REDUCE} (ie: not using 
{\tt xr}), see the {\it normform.log} file.

\vspace{0.5in}

\section{jordan}

\subsection{function}

{\tt jordan}(${\cal A}$) computes the Jordan normal form 
${\cal J}$ of the matrix ${\cal A}$.

It returns \{${\cal J}, {\cal P}, {\cal P}^{-1}$\}, where 
${\cal J}, {\cal P}$, and ${\cal P}^{-1}$ are such that ${\cal P J P}^
{-1} = {\cal A}$. 

${\cal A}$ is a square matrix.

\subsection{field extensions}

Calculations are performed in ${\cal Q}$. To extend this field the 
{\small ARNUM} package can be used. For details see {\it section} 8.

\subsection{note}
In certain polynomial cases {\tt fullroots} is turned on to compute the 
zeroes. This can lead to the calculation taking a long time, as well as 
the output being very large. In this case a message {\tt ***** WARNING: 
fullroots turned on. May take a while.} will be printed. It may be 
better to kill the calculation and compute {\tt jordansymbolic} instead.

\subsection{synopsis}

\begin{itemize}
\item The Jordan normal form ${\cal J}$ with entries in an algebraic 
      extension of ${\cal Q}$ is computed.

\item A {\it Jordan block} ${\jmath}_{k}(\lambda)$ is a $k$ by $k$ 
      upper triangular matrix of the form:

      \begin{displaymath}
      {\jmath}_{k}(\lambda) = \left( \begin{array}{ccccc} \lambda & 1 
      &  &  & \\  &  \lambda & 1  & & \\ & 
      & \ddots & \ddots & \\ &  &  &  \lambda & 1 \\ &
      &  &  & \lambda \end{array} \right) 
      \end{displaymath}
      
      There are $k-1$ terms ``$+1$'' in the superdiagonal; the scalar 
      $\lambda$ appears $k$ times on the main diagonal. All other 
      matrix entries are zero, and ${\jmath}_{1}(\lambda) = (\lambda)$.

\item A Jordan matrix ${\cal J} \in M_{n}$ (the set of all $n$ by $n$ 
      matrices) is a direct sum of {\it jordan blocks}.

      \begin{displaymath}
      {\cal J} = \left( \begin{array}{cccc} \jmath_{n_1}(\lambda_{1}) 
      \\  & \jmath_{n_2}(\lambda_{2}) \\ & & \ddots \\ & & & 
      \jmath_{n_k}(\lambda_{k}) \end{array} \right),
      {\it n}_{1}+{\it n}_{2}+\cdots +{\it n}_{k} = n
      \end{displaymath}

      in which the orders ${\it n}_{i}$ may not be distinct and the 
      values ${\lambda_{i}}$ need not be distinct.

\item Here ${\lambda}$ is a zero of the characteristic polynomial 
      ${\it p}$ of ${\cal A}$. The zeroes of the characteristic 
      polynomial are computed exactly, if possible. Otherwise they are 
      approximated by floating point numbers.
\end{itemize}      

\subsection{example}

{\tt load\_package normform;}

\begin{displaymath}
{\cal A} = \left( \begin{array}{cccccc} -9 & -21 & -15 & 4 & 2 & 0 \\
-10 & 21 & -14 & 4 & 2 & 0 \\ -8 & 16 & -11 & 4 & 2 & 0 \\ -6 & 12 & -9 
& 3 & 3 & 0 \\ -4 & 8 & -6 & 0 & 5 & 0 \\ -2 & 4 & -3 & 0 & 1 & 3 
\end{array} \right)
\end{displaymath}

\begin{flushleft}
{\tt ${\cal J}$ = first jordan$({\cal A})$;}
\end{flushleft}
  
\begin{displaymath}
{\cal J} = \left( \begin{array}{cccccc} 3 & 0 & 0 & 0 & 0 & 0 \\ 0 & 3 
& 0 & 0 & 0 & 0 \\ 0 & 0 & 1 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 \\
 0 & 0 & 0 & 0 & i+2 & 0 \\ 0 & 0 & 0 & 0 & 0 & -i+2 
\end{array} \right)
\end{displaymath}

\newpage


\section{arnum}

The package is loaded by {\tt load\_package arnum;}. The algebraic 
field ${\cal Q}$ can now be extended. For example, {\tt defpoly 
sqrt2**2-2;} will extend it to include ${\sqrt{2}}$ (defined here by 
{\tt sqrt2}). The {\small ARNUM} package was written by Eberhard 
Schr\"ufer and is described in the {\it arnum.tex} file.

\subsection{example}

{\tt load\_package normform;} \\
{\tt load\_package arnum;} \\
{\tt defpoly sqrt2**2-2;} \\
(sqrt2 now changed to ${\sqrt{2}}$ for looks!) 
\vspace{0.2in}

\begin{displaymath}
{\cal A} = \left( \begin{array}{ccc} 4*{\sqrt{2}}-6 & -4*{\sqrt{2}}+7 &
-3*{\sqrt{2}}+6 \\ 3*{\sqrt{2}}-6 & -3*{\sqrt{2}}+7 & -3*{\sqrt{2}}+6 
\\ 3*{\sqrt{2}} & 1-3*{\sqrt{2}} & -2*{\sqrt{2}}   \end{array} \right)
\end{displaymath} 
\vspace{0.2in}

\begin{eqnarray}
{\tt ratjordan}({\cal A}) & = & 
\left\{ \left( \begin{array}{ccc} {\sqrt{2}} & 0 & 0 \\ 0 & {\sqrt{2}} 
& 0 \\ 0 & 0 & -3*{\sqrt{2}}+1 \end{array} \right), \right. \nonumber 
\\ & & \hspace{0.1in} \left. \left( \begin{array}{ccc} 7*{\sqrt{2}}-6 
& \frac{2*{\sqrt{2}}-49}{31} & \frac{-21*{\sqrt{2}}+18}{31} \\ 
3*{\sqrt{2}}-6 & \frac{21*{\sqrt{2}}-18}{31} & \frac{-21*{\sqrt{2}}+18}
{31} \\ 3*{\sqrt{2}}+1 & \frac{-3*{\sqrt{2}}+24}{31} & 
\frac{3*{\sqrt{2}}-24}{31} \end{array} \right), \right. \nonumber \\ & 
& \hspace{0.1in} \left. \left( \begin{array}{ccc} 0 & {\sqrt{2}}+1 & 
1 \\ -1 & 4*{\sqrt{2}}+9 & 4*{\sqrt{2}} \\ -1 & -\frac{1}{6}*{\sqrt{2}}
+1 & 1 \end{array} \right) \right\} \nonumber 
\end{eqnarray}

\newpage


\section{modular}

Calculations can be performed in a modular base by switching {\tt on 
modular;}. The base can then be set by {\tt setmod p;} (p a prime). The 
normal form will then have entries in ${\cal Z}/$p${\cal Z}$. 

By also switching {\tt on balanced\_mod;} the output will be shown using
a symmetric modular representation. 

Information on this modular manipulation can be found in {\it chapter} 
9 (Polynomials and Rationals) of the {\REDUCE}  User's Manual [5].

\subsection{example}

{\tt load\_package normform;} \\
{\tt on modular;} \\
{\tt setmod 23;} 
\vspace{0.1in}

\begin{displaymath}
{\cal A} = \left( \begin{array}{cc} 10 & 18 \\ 17 & 20 \end{array} 
\right)
\end{displaymath}

{\tt jordansymbolic}(${\cal A}$) = 
\begin{center}
\begin{displaymath}
\left\{ \left( \begin{array}{cc} 18 & 0 \\ 0 & 12 \end{array} \right),
\left\{ \left\{ \lambda + 5, \lambda + 11  \right\}, \lambda \right\}, 
\left( \begin{array}{cc} 15 & 9 \\ 22 & 1 \end{array} \right), \left( 
\begin{array}{cc} 1 & 14 \\ 1 & 15 \end{array} \right) \right\}
\end{displaymath}
\end{center}
\vspace{0.2in}

{\tt on balanced\_mod;}
\vspace{0.2in}

{\tt jordansymbolic}(${\cal A}$) = 
\begin{center}
\begin{displaymath}
\left\{ \left( \begin{array}{cc} -5 & 0 \\ 0 & -11 \end{array} \right),
\left\{ \left\{ \lambda + 5, \lambda + 11  \right\}, \lambda \right\}, 
\left( \begin{array}{cc} -8 & 9 \\ -1 & 1 \end{array} \right), \left( 
\begin{array}{cc} 1 & -9 \\ 1 & -8 \end{array} \right) \right\}
\end{displaymath}
\end{center}

\newpage
\begin{thebibliography}{6}
\bibitem{MulLev} T.M.L.Mulders and A.H.M. Levelt: {\it The Maple 
        normform and Normform packages.} (1993)
\bibitem{Mulders} T.M.L.Mulders: {\it Algoritmen in De Algebra, A 
        Seminar on Algebraic Algorithms, Nigmegen.} (1993)
\bibitem{HoJo} Roger A. Horn and Charles A. Johnson: {\it Matrix 
        Analysis.} Cambridge University Press (1990)
\bibitem{Maple} Bruce W. Chat\ldots [et al.]: {\it Maple (Computer 
        Program)}. Springer-Verlag (1991)
\bibitem{Reduce} Anthony C. Hearn: {\REDUCE} {\it User's Manual 3.6.}
	RAND (1995)
\end{thebibliography}

\end{document}

