\chapter{ARNUM: An algebraic number package}
\label{ARNUM}
\typeout{{ARNUM: An algebraic number package}}

{\footnotesize
\begin{center}
Eberhard Schr\"{u}fer \\
Institute SCAI.Alg   \\
German National Research Center for Information Technology (GMD) \\
Schloss Birlinghoven \\
D-53754 Sankt Augustin, Germany       \\[0.05in]
e--mail: schruefer@gmd.de
\end{center}
}

Algebraic numbers are the solutions of an irreducible polynomial over
some ground domain. \index{i} The algebraic number $i$ (imaginary
unit),\index{imaginary unit} for example, would be defined by the
polynomial $i^2 + 1$.  The arithmetic of algebraic number $s$ can be
viewed as a polynomial arithmetic modulo the defining polynomial.

The {\tt ARNUM}\ttindex{ARNUM}  package provides a mechanism to
define other algebraic numbers, and compute with them.

\section{DEFPOLY}\ttindex{DEFPOLY}

{\tt DEFPOLY} takes as its argument the defining polynomial for an
algebraic number, or a number of defining polynomials for different
algebraic numbers, and arranges that arithmetic with the new symbol(s) is
performed relative to these polynomials.

\begin{verbatim}
     load_package arnum;

     defpoly sqrt2**2-2;

     1/(sqrt2+1);

     SQRT2 - 1

     (x**2+2*sqrt2*x+2)/(x+sqrt2);

     X + SQRT2

     on gcd;

     (x**3+(sqrt2-2)*x**2-(2*sqrt2+3)*x-3*sqrt2)/(x**2-2);

       2
      X  - 2*X - 3
     --------------
       X - SQRT2

     off gcd;

     sqrt(x**2-2*sqrt2*x*y+2*y**2);

     ABS(X - SQRT2*Y)
\end{verbatim}

The following example introduces both $\sqrt 2$ and $5^{1 \over 3}$:

\begin{verbatim}
   defpoly sqrt2**2-2,cbrt5**3-5;

   *** defining polynomial for primitive element:

     6       4        3        2
   A1  - 6*A1  - 10*A1  + 12*A1  - 60*A1 + 17

   sqrt2;

             5             4              3              2
   48/1187*A1  + 45/1187*A1  - 320/1187*A1  - 780/1187*A1  +


   735/1187*A1 - 1820/1187

   sqrt2**2;

   2
\end{verbatim}

\section{SPLIT\_FIELD}\ttindex{SPLIT\_FIELD}

The function {\tt SPLIT\_FIELD} calculates a primitive element of
minimal degree for which a given polynomial splits into linear
factors.

\begin{verbatim}
   split_field(x**3-3*x+7);

   *** Splitting field is generated by:

     6        4        2
   A5  - 18*A5  + 81*A5  + 1215



            4          2
   {1/126*A5  - 5/42*A5  - 1/2*A5 + 2/7,


              4          2
    - (1/63*A5  - 5/21*A5  + 4/7),


           4          2
   1/126*A5  - 5/42*A5  + 1/2*A5 + 2/7}


   for each j in ws product (x-j);

    3
   X  - 3*X + 7
\end{verbatim}

