% polynomial part 12.2.91 hk
% arbitrary domain system 18.3.92 hk

\newcommand{\synopsis}[1]{\par
    \framebox{\begin{minipage}{13cm} %15.2cm}
              #1\hfill 
              \end{minipage}}\par}
\def\AD{{\cal AD}}

\section{Arbitrary domain system} %---------------

The arbitrary domain system consists of two parts: 
\begin{enumerate} 
\item the distributive polynomial system algorithms 
      over arbitrary domain coefficients 
\item and the arbitrary domain algorithms themselves. 
\end{enumerate} 

Distributive polynomials with arbitrary domain coefficients are 
represented in the same way as distributive polynomials, except 
that the representation of the base coefficients is different. 
So all distributive polynomial algorithms which do not depend 
on the base coefficient ring can be applied to distributive 
polynomials with arbitrary domain coefficients. 

Let $\AD$ denote the set of arbitrary domain elements and let 
$\AD_d$ denote the set of arbitrary domain elements from domain $d$.
Then the representation of an arbitrary domain element 
$a \in \AD_d$ is the list 
$$
  ( n_d, a', \ldots ).
$$
Where $n_d \in \A$ is a unique atom which identifies 
the domain $d$, 
$a'$ is the representation of a domain element 
(e.g.\ a rational number or an integer)
and the rest of the list $( \ldots )$ represents 
internal information of the domain.
The value $n_d$ is uniquely assigned to a domain during 
programm initialization and may thus vary from one MAS run 
to another. 
The domain descriptor read functions associate the domain number 
with the external domain specification. 
The actually available domains depend on the 
totally available domains and the compiled version of MAS. 

The available domains are discussed later together with 
examples for each domain. We turn now to the description of the 
algorithms.
 

\subsection{Algorithms} %--------------------

\label{adip.alg}
We first summarize the programs of the most important 
distributive arbitrary domain polynomial algorithms 
and then we summarize the programs of the most important 
arbitrary domain algorithms.

\def\DI{{\cal D}}
\def\I{{\cal I}}
\def\IP{{\cal IP}}
\def\DII{{\cal DI}}
\def\DIAD{{\cal DAD}}
Let
$\A$ be the set of atoms,
$\L$ be the set of lists,
$\O = \A \cup \L$ be the set of objects,
$\AD = \{ x \in \O: \ x$ represents an element of an
         arbitrary domain base coefficient ring $\}$ 
be the set of arbitrary domain base coefficients, 
$\DIAD_r = \{ x \in \O: \ x$ represents a multivariate polynomial 
         in $r$ variables over arbitrary domain coefficients $\}$ 
be the set of distributive arbitrary domain polynomials. 
$\DI_r = \{ x \in \O: \ x$ represents a multivariate polynomial 
         in $r$ variables $\}$ 
be the set of distributive polynomials. 
\index{arbitrary domain! polynomial}\index{arbitrary domain}
\index{polynomial}\index{distributive polynomial}

We discuss now the polynomial algorithms which depend on the 
base coefficient field. The polynomial algorithms which do not 
depend on the base coefficient ring are the same as discussed 
in the section on distributive polynomials. 

\begin{deflist}{$C \gets DIPROD(A,B)$}
\item[$A' \gets DIPNEG(A)$] $A, A' \in \DIAD_r$. 
     $A' = - A$ is the negative of $A$.
     \index{DIPNEG}
\item[$C \gets DIPSUM(A,B)$] $A, B, C \in \DIAD_r$. 
     $C = A + B$ is the sum of $A$ and $B$.
     \index{DIPSUM}
\item[$C \gets DIPDIF(A,B)$] $A, B, C \in \DIAD_r$. 
     $C = A - B$ is the difference of $A$ and $B$.
     \index{DIPDIF}
\item[$C \gets DIPROD(A,B)$] $A, B, C \in \DIAD_r$. 
     $C = A * B$ is the product of $A$ and $B$.
     \index{DIPROD}

\item[$B \gets DIPNOR(P,A)$] $A, B \in \DIAD_r$, $P \in \L\DIAD_r$. 
     $B = {\rm normalform}_P(A) $ is the normal form
     or completely reduced form of $A$ with respect to $P$.
     $\AD$ must be a field. 
     \index{DIPNOR}
\item[$Q \gets DILIS(P)$] $P, Q \in \L\DIAD_r$. 
     $Q$ is the irreducible set of $P$, that is every 
     $p \in Q$ is irreducible with respect to 
     $Q \setminus \{ p \}$.
     $\AD$ must be a field. 
     \index{DILIS}
\item[$G \gets DIPGB(P,t)$] $P, G \in \L\DIAD_r$, 
     $t \in \{ 0, 1, 2 \}$. 
     $G$ is the Gr\"obner base of $P$.
     $t$ is the `trace flag', $t = 0$ if no intermediate 
     output is requred, $t = 1$ if the reduced S--polynomials 
     are to be listed and $t = 2$ for maximal information.
     $\AD$ must be a field. 
     \index{DIPGB}

\item[$B \gets DIIFNF(P,A',A)$] $A, A', B \in \DIAD_r$, $P \in \L\DIAD_r$. 
     $B = {\rm normalform}_P(A) $ is the normal form
     or completely reduced form of $A$ with respect to $P$.
     $A'$ is a polynomial which has already been reduced. 
     $\AD$ must be the ring of integers or integral functions and 
     the polynomial $A'$ and the polynomial $A$ are multiplied 
     by the head terms of the polynomials $p \in P$ which are used for 
     reduction. 
     \index{DIIFNF}
\item[$Q \gets DIIFLS(P)$] $P, Q \in \L\DIAD_r$. 
     $Q$ is the irreducible set of $P$, that is every 
     $p \in Q$ is irreducible with respect to 
     $Q \setminus \{ p \}$.
     $\AD$ must be the ring of integers or integral functions. 
     \index{DIIFLS}
\item[$G \gets DIIFGB(P,t)$] $P, G \in \L\DIAD_r$, 
     $t \in \{ 0, 1, 2 \}$. 
     $G$ is the Gr\"obner base of $P$.
     $t$ is the `trace flag', $t = 0$ if no intermediate 
     output is requred, $t = 1$ if the reduced S--polynomials 
     are to be listed and $t = 2$ for maximal information.
     $\AD$ must be the ring of integers or integral functions. 
     \index{DIIFGB}

\item[$B \gets DIFIP(A,d)$] $A \in \DII_r$, $B \in \DIAD_r$, 
     $d \in \AD_d$. 
     The distributive integral polynomial is converted to 
     a distributive arbitrary domain polynomial with 
     specified domain $d$. 
     \index{DIFIP}

\item[$P \gets DILRD(V,d)$] $P \in \L\DIAD_r$. 
     A list of distributive rational polynomials 
     with the variable list $V$, $d \in \AD_d$
     and term order as defined in \verb/EVORD/ are 
     read from the actual input stream.
     The accepted syntax (with start symbol \verb/polylist/) is:
     \begin{verbatim}
polylist = "(" poly { "," poly } ")"
poly     = "(" term { ("+"|"-") term } ")"
term     = power { [ "*" ] power }
power    = factor [ "**" atom ]
factor   = ( ident | "(" domain element ")" )
     \end{verbatim}
     With the context conditions:
     \begin{enumerate}
     \item the \verb/atoms/ must be nonnegative,
     \item \verb/ident/s appearing in \verb/poly/ must 
           be declared in \verb/varlist/, 
     \item the right most variable in the variable list 
           denotes the main variable, 
     \item \verb/domain element/ must be a valid element of 
           the domain as defined by $d$. 
     \end{enumerate}
     Examples will be discussed later.
     \index{DILRD}
\item[$DILWR(P,V)$] $P \in \L\DIAD_r$. 
     A list of distributive rational polynomials is 
     written to the actual output stream using the variable list $V$. 
     The output syntax of the polynomial list is similar 
     to the input syntax of $DILRD$.
     \index{DILWR}
\end{deflist}

This concludes the summary of the 
distributive arbitrary domain polynomial functions.

\label{adom.alg}
We turn now to the summary of the programs of the most important 
arbitrary domain algorithms. 
As before let 
$\AD = \{ x \in \O: \ x$ represents an element of an
         arbitrary domain base coefficient ring $\}$ 
be the set of arbitrary domain base coefficients. 

\begin{deflist}{$C \gets ADPROD(A,B)$}
\item[$s \gets ADONE(A)$] $A \in \AD$, $s \in \A$. 
     $s = 1$ if $A = 1_{\AD}$ otherwise $s \neq 1$.
     If the domain has no one-test function defined an 
     error occurs.
     \index{ADONE}
\item[$s \gets ADSIGN(A)$] $A \in \AD$, $s \in \A$. 
     $s = 1$ if $A >_{\AD} 0$, $s = 0$ if $A =_{\AD} 0$ 
     and $s = -1$ if $A <_{\AD} 0$. 
     If the domain has no sign function defined an 
     error occurs.
     \index{ADSIGN}
\item[$s \gets ADINVT(A)$] $A \in \AD$, $s \in \A$. 
     $s = 1$ if $A$ is invertible in $\AD$ otherwise $s = 0$.
     If the domain has no invertibility test function defined an 
     error occurs.
     \index{ADINVT}
\item[$s \gets ADCNST(A)$] $A \in \AD$, $s \in \A$. 
     $s = 1$ if $A$ is a constant in $\AD$ otherwise $s \neq 1$.
     If the domain has no constant test function defined an 
     error occurs. The meaning of a constant depends on the 
     domain. In polynomial like domains a constant is in general a 
     polynomial of degree zero. 
     \index{ADCNST}

\item[$A' \gets ADNEG(A)$] $A, A' \in \AD$. 
     $A' = - A$ is the negative of $A$.
     If the domain has no negation function defined an error occurs.
     \index{ADNEG}
\item[$A' \gets ADINV(A)$] $A, A' \in \AD$. 
     $A' = A^{-1}$ is the multiplicative inverse of $A$.
     If $A$ is not invertible in the domain $\AD$ or the domain
     has no inverse element function defined an error occurs.
     \index{ADINV}
\item[$C \gets ADDIF(A,B)$] $A, B, C \in \AD$. 
     $C = A - B$ is the difference of $A$ and $B$. 
     If $A$ and $B$ are not elements the same domain or the domain 
     has no difference function defined an error occurs.
     \index{ADDIF}
\item[$C \gets ADSUM(A,B)$] $A, B, C \in \AD$. 
     $C = A + B$ is the sum of $A$ and $B$. 
     If $A$ and $B$ are not elements the same domain or the domain 
     has no sum function defined an error occurs.
     \index{ADSUM}
\item[$C \gets ADPROD(A,B)$] $A, B, C \in \AD$. 
     $C = A * B$ is the product of $A$ and $B$. 
     If $A$ and $B$ are not elements the same domain or the domain 
     has no product function defined an error occurs.
     \index{ADPROD}
\item[$C \gets ADQUOT(A,B)$] $A, B, C \in \AD$. 
     $C = A / B$ is the quotient of $A$ and $B$. 
     If $A$ and $B$ are not elements the same domain or the domain 
     has no quotient function defined or if the quotient does not 
     exist an error occurs.
     \index{ADQUOT}
\item[$B \gets ADEXP(A,n)$] $A, B \in \AD$, $n \in \A^+$. 
     $B = A^n$ is the $n$-th power of $A$. 
     If the domain has no product function or no `one' function 
     defined (in case $n=0$) an error occurs.
     \index{ADEXP}

\item[$C \gets ADGCD(A,B)$] $A, B, C \in \AD$. 
     $C = {\rm gcd}(A, B)$ is the greatest common divisor of $A$ and $B$. 
     If the domain has no greatest common divisor function defined 
     an error occurs.
     \index{ADGCD}
\item[$ADGCDC(A,B; C, A', B')$] $A, B, C, A', B'  \in \AD$. 
     $C = {\rm gcd}(A, B)$ is the greatest common divisor of $A$ and $B$. 
     $A'$ and $B'$ are the cofactors of $A$ and $B$ respectively,
     i.e.\ $A * A' = C = B * B'$. If $C = 0$ then also $A' = B' = 0$.
     If the domain has no greatest common divisor function defined 
     an error occurs.
     \index{ADGCDC}
\item[$ADGCDE(A,B; C, A', B')$] $A, B, C, A', B'  \in \AD$. 
     $C = {\rm gcd}(A, B)$ is the greatest common divisor of $A$ and $B$. 
     $A'$ and $B'$ are elements of $\AD$ such that the gcd $C$ is a linear 
     combination of $A$ and $B$ with factors $A'$ and $B'$, 
     i.e.\  $C = A * A' + B * B'$. If $C = 0$ then also $A' = B' = 0$.
     If the domain has no extended greatest common divisor function 
     defined an error occurs.
     \index{ADGCDE}
\item[$C \gets ADLCM(A,B)$] $A, B, C \in \AD$. 
     $C = {\rm lcm}(A, B)$ is the least common multiple of $A$ and $B$. 
     If the domain has no least common multiple function defined 
     an error occurs.
     \index{ADLCM}
\item[$L \gets ADFACT(A)$] $A \in \AD$, $L \in \L\AD$. 
     $L$ is a list of prime respectively irreducible factors of $A$.
     If the domain has no factorization function defined an error occurs.
     \index{ADFACT}

\item[$B \gets ADCONV(A,d)$] $A \in \AD$, $d, B \in \AD_d$.
     $B = A_{d}$. $A$ is converted to an element of domain $\AD_d$. 
     If the conversion is not defined an error occurs.
     \index{ADCONV}
\item[$B \gets ADFI(d,A)$] $A \in \I$, $d, B \in \AD_d$. 
     $B = A_{d}$. An integer $A$ is converted to an element 
     of domain $\AD_d$. 
     If the conversion is not defined an error occurs.
     \index{ADFI}
\item[$B \gets ADFIP(d,A)$] $A \in \IP_r$, $d, B \in \AD_d$.
     $B = A_{d}$. An integral polynomial $A$ is converted to an element 
     of domain $\AD_d$. The number of variables of the domain 
     $\AD_d$ must be equal to $r$. 
     If the conversion is not defined an error occurs.
     \index{ADFIP}
\item[$B \gets ADTOIP(A; l)$] $B \in \IP_r$, $A \in \AD_d$, $l \in \IP_r$. 
     $l$ is the least common multiple of the coefficient-denominators. 
     An domain element $A$ is converted to an integral polynomial.
     If the conversion is not defined an error occurs.
     \index{ADTOIP}

\item[$A \gets ADREAD(d)$] $d, A \in \AD_d$, 
     A domain element $A$ is read from the actual input stream.
     If no input function is defined an error occurs.
     \index{ADREAD}
\item[$ADWRIT(A)$] $A \in \AD$.
     A domain element $A$ is written to the actual output stream.
     If no output function is defined an error occurs.
     \index{ADWRIT}

\item[$d \gets ADDDREAD()$] $d \in \AD_d$ is a domain element. 
     A domain descriptor is read from the actual input stream 
     and an element (in general $0$) of the domain $\AD_d$ is returned.
     If no input function is defined an error occurs.
     The accepted syntax (with start symbol \verb/spec/) is:
     \begin{verbatim}
spec     = dsymbol ddescription 
dsymbol  = ( "INT" | "RN" | "MI" | "MD" | "APF" | 
             "IP"  | "RP" | "RF" | "AF" | 
             "C"   | "Q"  | "O"  | "FF" )
     \end{verbatim}
     With the context conditions:
     \begin{enumerate}
     \item \verb/ddescription/ depends on the domain symbol
           and the syntax is discussed in the next subsection;
     \item not all \verb/dsymbol/s may always be available 
           and the available ones are discussed in the 
           next subsection. 
     \end{enumerate}
     \index{ADDDREAD}
\item[$ADDDWRIT(d)$] $d \in \AD_d$ is a domain element. 
     The domain descriptor of element $d$ is written to the 
     actual output stream.
     If no output function is defined an error occurs.
     \index{ADDDWRIT}
\item[$V \gets ADVLDD(d)$] $d \in \AD_d$ is a domain element. 
     $V$ gets the variable list from domain element $d$. 
     If the element has no variable list, or
     if no variable list function is defined an error occurs.
     \index{ADVLDD}
\end{deflist}

This concludes the summary of the arbitrary domain functions.


\subsection{Available Domains} %-----------------

\label{domain.sec} 
The general format of a domain specification is as 
defined in the syntax of \verb/ADDDREAD/: 

\synopsis{$<$domain symbol$>$ $<$domain description$>$}
  \index{$<$domain symbol$>$}\index{$<$domain description$>$}

Where $<$domain symbol$>$ is a unique short name of a domain 
and $<$domain description$>$ is a partly optional list 
of further specifications which are meaningful for the particular domain. 
The available domains are discussed in the this subsection. 
In the following subsections we discuss the 
various domains in more detail together with the specifications 
and with some examples. 
\index{domain! symbol}\index{domain! description}

Supported domains and domain symbols are:

\begin{center}
\begin{description}
\item[INT] Integral Numbers
         \index{Integral Numbers}
\item[RN] Rational Numbers
          \index{Rational Numbers}
\item[MI] Integral Numbers modulo an Integer 
          \index{Integral Numbers modulo Integer}
\item[MD] Integral Digits modulo a Digit
          \index{Integral Digit modulo Digit}
\item[APF] Arbitrary Precision Floating Point Numbers
          \index{Arbitrary Precision Floating Point Numbers}
\item[IP] Integral Polynomials 
          \index{Integral Polynomials}
\item[RP] Rational Polynomials 
          \index{Rational Polynomials}
\item[RF] Rational Functions 
         \index{Rational Functions}
\item[AF] Algebraic Numbers
          \index{Algebraic Numbers}
\item[FF] Finite Field Numbers 
          \index{Finite Field Numbers}
\item[C] Complex Numbers
          \index{Complex Numbers}
\item[Q] Quaternion Numbers
          \index{Quaternion Numbers}
\item[O] Octonion Numbers
          \index{Octonion Numbers}
\end{description}
\end{center}

The acutally available domains can be listed by the 
`\verb/DOMAINS/' command. 

{\footnotesize %-------------------------
\begin{verbatim} 
       DOMAINS. (*show available domains*)
\end{verbatim}
}

The output shows all defined domains 
(in the order in which they are defined to the system).
 
{\footnotesize %-------------------------
\begin{verbatim} 
   List of all defined domains
 
   AF Algebraic Number
   INT Integer
   IP Integral Polynomial
   MD Modular Digit
   MI Modular Integer
   FF Finite Field
   RF Rational Function
   RN Rational Number
   C Complex Number
   Q Quaternion Number
   O Octonion Number
   RP Rational Polynomial
   APF Arbitrary Precision Floating Point
 
   13 defined domains.
\end{verbatim}
}
 
The domain descriptions for some of the different domains are
discussed in the next subsections together with some examples.


\subsection{Integral Numbers} %---------------------

\synopsis{INT}\index{INT} 
For integral numbers there are no further options.
\index{Integral Numbers} 
If the computation requires to take
quotients of integral numbers and the remainder is non--zero, 
an error message is displayed and the user is asked for interaction.

In the following example we read a list of 
distributive polynomials over the integral number and 
compute the $3$-rd power of the first polyomial.
First we read the domain symbol `\verb/INT/' with the 
domain descriptor read function `\verb/ADDDREAD/' and 
also print the descriptor with `\verb/ADDDWRIT/'. 
Then we setup a variable list using the `\verb/LIST/' function 
on strings of variable names `\verb/V:=LIST("x","y","z")/'. 
A list of two polynomials 
`\verb/( 7 y x**4 z ... )/' and `\verb/( y + ... )/' 
is then read by `\verb/DILRD/', which 
requires as inputs a variable list `\verb/V/' and 
a domain descriptor `\verb/dp/'.
The polynomials are then printed by `\verb/DILWR/'. 
Next the $3$-rd power of the first polynomial is computed 
using the `\verb/DILEX/' function. 
Finally this polynomial is put into a list 
and printed on the output stream. 

{\footnotesize %-------------------------
\begin{verbatim} 
   (*Integer ----------------------------------- *)
   (*domain descriptor *)
   dp:=ADDDREAD().          INT 
 
   ADDDWRIT(dp).
 
   (*variable list *)
   V:=LIST("x","y","z").
 
   (*Polynomials *)
   P:=DILRD(V,dp).
 
   (
   ( 7 y x**4 z + 9 + 13 z**3 - x ),
   ( y + z**5 + 77 ) 
   )
 
   DILWR(P,V).
 
   (* computations *)
   p:=FIRST(P). q:=DIPEXP(p,3).
 
   Q:=LIST(q). DILWR(Q,V).
\end{verbatim}
}

Next we discuss the output as produced by the above example. 
`\verb/(2 0)/' is the internal representation of the 
interger domain descriptor. 
`\verb/INT (* Integer *)/' is the printed domain descriptor,
the comment gives a more verbose description of the domain.
`\verb/((56) (58) (60))/' is the internal representation of the
variable list. 
Then the input polynomials are printed. 
Finally the time for computing the $3$-rd power of the first polynomial is 
printed followed by the resulting polynomial itself. 

{\footnotesize %-------------------------
\begin{verbatim} 
   ANS: (2 0)
   MAS: INT (* Integer *) 
   ANS: ((56) (58) (60))
 
   ( 13 z**3 +7 x**4 y z - x +9 )
   (  z**5 + y +77 )
 
   Time: read = 16, eval = 34, print = 16, gc = 0.

( 2197 z**9 +3549 x**4 y z**7 -507 x z**6 +4563 z**6 +1911 x**8 y**2 z**5 -546 
x**5 y z**4 +4914 x**4 y z**4 +343 x**12 y**3 z**3 +39 x**2 z**3 -702 x z**3 +3
159 z**3 -147 x**9 y**2 z**2 +1323 x**8 y**2 z**2 +21 x**6 y z -378 x**5 y z +1
701 x**4 y z - x**3 +27 x**2 -243 x +729 )
\end{verbatim}
}


\subsection{Rational Numbers} %---------------------
 
\synopsis{RN $\lbrack s \rbrack$}\index{RN $\lbrack s \rbrack$}
For rational numbers there is one option, 
\index{Rational Numbers} 
the so called decimal flag `$s$'. It 
controls the printout of the rational numbers as follows:
 
If `$s= -1$' (this is the default) the rational numbers are printed
as fractions of integral numbers (e.g. 33/100).
If `$s \geq 0$' the rational numbers are approximated by
the nearest decimal fractions
with $s$ decimal digits following the decimal point
(e.g.\ if s=5, 2/3 is printed as 0.66667). 
More precisely the decimal fraction approximation
$d.d_1 d_2 \ldots d_{s-1} d_s$
were $d \in \Z$, $d_i \in \{0,1,\ldots,9 \}$
$(1 \leq i \leq s)$ for a rational number $a$ means:
\begin{displaymath}
\vert a - d.d_1 d_2 \ldots d_{s-1} d_s \vert 
   \leq \frac{1}{2 \cdot 10^s}. 
\end{displaymath}
 
In the following example we read a list of 
distributive polynomials over the rational numbers, 
to be printed with $10$ places after the decimal point,
and compute the $3$-rd power of the first polyomial.
First we read the domain symbol `\verb/RN/' and the 
decimal flag $s$ as $10$ with the 
domain descriptor read function `\verb/ADDDREAD/' and 
also print the descriptor with `\verb/ADDDWRIT/'. 
The rest of the example is as in the previous example 
with integer coefficients.

{\footnotesize %-------------------------
\begin{verbatim} 
   (*Rational Number  ---------------------------- *) 
   (*domain descriptor         <print precision> *) 
   dp:=ADDDREAD().          RN 10 
 
   ADDDWRIT(dp).
 
   (*variable list *)
   V:=LIST("x","y","z"). 
 
   (*Polynomials *)
   P:=DILRD(V,dp).
 
   (
   ( 7 y x**4 z + 9 + 13 z**3 - x ),
   ( y + z**5 + 77 ) 
   )
 
   DILWR(P,V).
 
   (* computations *)
   p:=FIRST(P). q:=DIPEXP(p,3).
 
   Q:=LIST(q). DILWR(Q,V). 
\end{verbatim}
}

Next we discuss the output as produced by the above example. 
`\verb/(7 0 10)/' is the internal representation of the 
rational number domain descriptor with decimal flag $10$. 
`\verb/RN 10  (* Rational Number *)/' is the printed domain descriptor,
the comment gives a more verbose description of the domain.
The rest of the example is as in the previous example 
with integer coefficients except that all numbers are 
printed with $10$ places after the decimal point. 
 
{\footnotesize %-------------------------
\begin{verbatim} 
   ANS: (7 0 10)
   MAS: RN 10  (* Rational Number *) 
   ANS: ((56) (58) (60))
 
   ( 13.0000000000 z**3 +7.0000000000 x**4 y z - x +9.0000000000 )
   (  z**5 + y +77.0000000000 )
 
   Time: read = 0, eval = 50, print = 17, gc = 0.

( 2197.0000000000 z**9 +3549.0000000000 x**4 y z**7 -507.0000000000 x z**6 +456
3.0000000000 z**6 +1911.0000000000 x**8 y**2 z**5 -546.0000000000 x**5 y z**4 +
4914.0000000000 x**4 y z**4 +343.0000000000 x**12 y**3 z**3 +39.0000000000 x**2
 z**3 -702.0000000000 x z**3 +3159.0000000000 z**3 -147.0000000000 x**9 y**2 z*
*2 +1323.0000000000 x**8 y**2 z**2 +21.0000000000 x**6 y z -378.0000000000 x**5
 y z +1701.0000000000 x**4 y z - x**3 +27.0000000000 x**2 -243.0000000000 x +72
9.0000000000 )
\end{verbatim}
}


\subsection{Modular Integers and Digits} %---------------------

\synopsis{MI m}\index{MI m}

\synopsis{MD m}\index{MD m} 
Integral numbers or digits modulo the integer `m'.
\index{Integral Numbers modulo Integer}
`MI' uses the long integer arithmetic and `MD' uses 
arithmetic of $\beta$-digits only. 
During input of the domain descriptor it is checked whether 
`m' is prime or not and the 
result of this check is printed in a comment. 
If the computation requires to take
inverses modulo `m' and they do not exist in the case
of `m' beeing not prime, an error message is displayed 
and user interaction is requested. 
 
In the following two examples we read a list of 
distributive polynomials over modular digits with modulus $7$ 
respectively over modular integers with modulus $19$
and compute the $3$-rd power of the first polyomial.
First we read the domain symbol 
`\verb/MD/' and the modulus $7$ respectively 
`\verb/MI/' and the modulus $19$ 
with the domain descriptor read function 
`\verb/ADDDREAD/' and 
also print the descriptor with `\verb/ADDDWRIT/'. 
The rest of the example is as in the previous examples 
with integer or rational number coefficients.

{\footnotesize %-------------------------
\begin{verbatim} 
   (*Modular Digit ----------------------------- *) 
   (*domain descriptor         <modulus> *) 
   dp:=ADDDREAD().          MD 7
 
   ADDDWRIT(dp).
 
   (*variable list *)
   V:=LIST("x","y","z"). 
 
   (*Polynomials *)
   P:=DILRD(V,dp).
 
   (
   ( 7 y x**4 z + 9 + 13 z**3 - x ),
   ( y + z**5 + 717 ) 
   )
 
   DILWR(P,V).
 
   (* computations *)
   p:=FIRST(P). q:=DIPEXP(p,3).
 
   Q:=LIST(q). DILWR(Q,V). 
\end{verbatim}
}
 
{\footnotesize %-------------------------
\begin{verbatim} 
   (*Modular Integer ----------------------------- *) 
   (*domain descriptor         <modulus> *) 
   dp:=ADDDREAD().          MI 19
 
   ADDDWRIT(dp).
 
   (*variable list *)
   V:=LIST("x","y","z"). 
 
   (*Polynomials *)
   P:=DILRD(V,dp).
 
   (
   ( 7 y x**4 z + 13 + 19 z**3 - x ),
   ( y + z**5 + 77 ) 
   )
 
   DILWR(P,V).
 
   (* computations *)
   p:=FIRST(P). q:=DIPEXP(p,3).
 
   Q:=LIST(q). DILWR(Q,V). 
\end{verbatim}
}

Next we discuss the output as produced by the above examples. 
`\verb/(4 0 7 1)/' is the internal representation of the 
modular digit domain descriptor with modulus $7$. 
($1$ indicates that $7$ is a prime number.)
`\verb/MD 7 (* prime. *) (* Modular Digit *)/' 
is the printed domain descriptor for modulus $7$.
The first comment `\verb/(* prime. *)/' indicates, that 
the modulus is a prime number and the
second comment gives a more verbose description of the domain.
The rest of the example is as in the previous examples 
with integer or rational number coefficients. 
The differences to the previous examples is that 
the coefficients of the input polynomials are 
reduced modulo $7$, respectively $19$ and thus some might 
have been become zero and the respective 
terms disappear. E.g. `\verb/7 y x**4 z/' reduces to zero, 
and `\verb/19 z**3/' reduces to `\verb/6 z**3/' modulo $7$. 

{\footnotesize %-------------------------
\begin{verbatim} 
   ANS: (4 0 7 1)
   MAS: MD 7 (* prime. *) (* Modular Digit *) 
   ANS: ((56) (58) (60))
 
   ( 6 z**3 +6 x +2 )
   (  z**5 + y +3 )
 
   Time: read = 0, eval = 17, print = 16, gc = 0.

( 6 z**9 +4 x z**6 +6 z**6 +4 x**2 z**3 +5 x z**3 +2 z**3 +6 x**3 +6 x**2 +2 x 
 +1 )
\end{verbatim}
}
 
{\footnotesize %-------------------------
\begin{verbatim} 
   ANS: (5 0 19 1)
   MAS: MI 19 (* prime. *) (* Modular Integer *) 
   ANS: ((56) (58) (60))
 
   ( 7 x**4 y z +18 x +13 )
   (  z**5 + y +1 )
 
   Time: read = 17, eval = 17, print = 16, gc = 0.

(  x**12 y**3 z**3 +5 x**9 y**2 z**2 +11 x**8 y**2 z**2 +2 x**6 y z +5 x**5 y z
 +15 x**4 y z +18 x**3 + x**2 +6 x +12 )
\end{verbatim}
}


\subsection{Arbitrary precision floating point numbers} %-----------------

\synopsis{APF $\lbrack s \rbrack$}\index{APF $\lbrack s \rbrack$}
Arbitrary precision floating point numbers.
\index{Arbitrary Precision Floating Point Numbers} 
The flag `$s$' defines the precision of the numbers, 
i.e.\ the minimal number of decimal digits 
in the internal representation. 

In the following example we read a list of 
distributive polynomials over 
arbitrary precision floating point numbers with precision $50$ 
and compute the $3$-rd power of the first polyomial.
First we read the domain symbol 
`\verb/APF/' and the precision $50$ 
with the domain descriptor read function 
`\verb/ADDDREAD/' and 
also print the descriptor with `\verb/ADDDWRIT/'. 
The rest of the example is as in the previous examples 
with integer or rational number coefficients.

{\footnotesize %-------------------------
\begin{verbatim} 
   (*Arbitrary precision floating point -------- *) 
   (*domain descriptor         <precision> *) 
   dp:=ADDDREAD().          APF 50 
 
   ADDDWRIT(dp).
 
   (*variable list *)
   V:=LIST("x","y","z"). 
 
   (*Polynomials *)
   P:=DILRD(V,dp).
 
   (
   ( 7 y x**4 z + 9 + 13 z**3 - x ),
   ( y + z**5 + 77 ) 
   )
 
   DILWR(P,V).
 
   (* computations *)
   p:=FIRST(P). q:=DIPEXP(p,3).
 
   Q:=LIST(q). DILWR(Q,V). 
\end{verbatim}
}

Next we discuss the output as produced by the above examples. 
The first line indicates that the precision is defined to be at least 
$50$ decimal digits and exactly $173$ binary digits. 
`\verb/(8 (0 0) 50)/' is the internal representation of the 
arbitrary precision floating point number domain descriptor 
with precision $50$. \\
`\verb/APF 50  (* Arbitrary Precision Floating Point *)/' 
is the printed domain descriptor for precision $50$.
The comment gives a more verbose description of the domain.
The rest of the example is as in the previous examples 
with integer or rational number coefficients. 
 
{\footnotesize %-------------------------
\begin{verbatim} 
   MAS: Floating point precision set to 50 digits = 173 bits. 
   ANS: (8 (0 0) 50)
   MAS: APF 50  (* Arbitrary Precision Floating Point *) 
   ANS: ((56) (58) (60))
 
( 0.130000000000000000000000000000000000000000000000000E2 z**3 +0.7000000000000
00000000000000000000000000000000000000E1 x**4 y z -0.10000000000000000000000000
0000000000000000000000000E1 x +0.9000000000000000000000000000000000000000000000
0000E1 )
 
( 0.100000000000000000000000000000000000000000000000000E1 z**5 +0.1000000000000
00000000000000000000000000000000000000E1 y +0.770000000000000000000000000000000
000000000000000000E2 )
 
   Time: read = 0, eval = 234, print = 50, gc = 0.

( 0.219700000000000000000000000000000000000000000000000E4 z**9 +0.3549000000000
00000000000000000000000000000000000000E4 x**4 y z**7 -0.50699999999999999999999
9999999999999999999999999999E3 x z**6 +0.45630000000000000000000000000000000000
0000000000000E4 z**6 +0.191100000000000000000000000000000000000000000000000E4 x
**8 y**2 z**5 -0.545999999999999999999999999999999999999999999999999E3 x**5 y z
**4 +0.491400000000000000000000000000000000000000000000000E4 x**4 y z**4 +0.343
000000000000000000000000000000000000000000000000E3 x**12 y**3 z**3 +0.389999999
999999999999999999999999999999999999999999E2 x**2 z**3 -0.701999999999999999999
999999999999999999999999999999E3 x z**3 +0.315900000000000000000000000000000000
000000000000000E4 z**3 -0.146999999999999999999999999999999999999999999999999E3
 x**9 y**2 z**2 +0.132300000000000000000000000000000000000000000000000E4 x**8 y
**2 z**2 +0.209999999999999999999999999999999999999999999999999E2 x**6 y z -0.3
77999999999999999999999999999999999999999999999999E3 x**5 y z +0.17010000000000
0000000000000000000000000000000000000E4 x**4 y z - x**3 +0.26999999999999999999
9999999999999999999999999999999E2 x**2 -0.2429999999999999999999999999999999999
99999999999999E3 x +0.729000000000000000000000000000000000000000000000000E3 )
\end{verbatim}
}


\subsection{Integral Polynomials} %---------------------
 
\synopsis{IP (x1,...,xr)}\index{IP (x1,...,xr)}
For the integral polynomial domain the variables need to be
\index{Integral Polynomial}
specified in the variable list `(x1,...,xr)'.
The `xi' denote variable names (starting with a letter, followed 
by letters and/or decimal digits).
The elements are represented as multivariate polynomials 
with integral coefficients. 
On input the coefficients should be enclosed in
parenthesis: `(p)' where p denotes a multivariate 
polynomial with {\em integer} coefficients.
If the computation requires to take quotients of integral numbers 
and the remainder is non--zero, an error message is displayed 
and user interaction is requested. 

In the following example we read a list of 
distributive polynomials over 
integral polynomials in the variables $a,b,c$ 
and compute the $3$-rd power of the first polyomial.
First we read the domain symbol 
`\verb/IP/' and the list of variables `\verb/(a,b,c)/'
with the domain descriptor read function 
`\verb/ADDDREAD/' and 
also print the descriptor with `\verb/ADDDWRIT/'. 
As usual the rightmost variable `\verb/c/' defines the 
main variable. 
The rest of the example is as in the previous examples 
with integer or rational number coefficients except 
that we use new polynomials. The coefficients 
`\verb/( a + b + c )/' and `\verb/( a )/' are enclosed in parenthesis 
to allow the distributive polynomial input routines to switch to 
integral polynomial input routines for the 
input of the coefficients.

{\footnotesize %-------------------------
\begin{verbatim} 
(*Integral Polynomial ----------------------- *) 
   (*domain descriptor        <var list> *) 
   dp:=ADDDREAD().          IP(a,b,c)
 
   ADDDWRIT(dp).

   (*variable list 2 *)
   V:=LIST("x","y","z"). 
 
   (*Polynomials *)
   P:=DILRD(V,dp).
 
   (
   ( ( a + b + c ) z**3 - x ),
   ( y + z**5 + ( a ) ) 
   )
 
   DILWR(P,V).

   (* computations *)
   q:=DIPEXP(FIRST(P),3).

   DILWR(LIST(q),V). 
\end{verbatim}
}

Next we discuss the output as produced by the above examples. \\ 
`\verb/(3 0 3 ((10) (12) (14)))/' is the internal representation of the 
integral polynomial domain descriptor.
`\verb/((10) (12) (14)))/' is the internal representation 
of the variable list `\verb/(a,b,c)/' and the 
second `\verb/3/' denotes, that the integral polynomials are 
in $3$ variables. 
The comment gives a more verbose description of the domain.
The rest of the example is as in the previous examples 
with integer or rational number coefficients. 
 
{\footnotesize %-------------------------
\begin{verbatim} 
   ANS: (3 0 3 ((10) (12) (14)))
   MAS: IP(a,b,c) (* Integral Polynomial *) 
   ANS: ((56) (58) (60))
 
   ( (  c + b + a ) z**3 - x )

   (  z**5 + y +  a  )
 
   Time: read = 16, eval = 34, print = 33, gc = 0.

( (  c**3 +3 b c**2 +3 a c**2 +3 b**2 c +6 a b c +3 a**2 c + b**3 +3 a b**2 +3 
a**2 b + a**3 ) z**9 -( 3 c**2 +6 b c +6 a c +3 b**2 +6 a b +3 a**2 ) x z**6 +(
 3 c +3 b +3 a ) x**2 z**3 - x**3 )
\end{verbatim}
}

\subsection{Rational Polynomials} %---------------------
 
\synopsis{RP (x1,...,xr)}\index{RP (x1,...,xr)}
For the rational polynomial domain the variables need to be
\index{Rational Polynomial}
specified in the variable list `(x1,...,xr)'.
The `xi' denote variable names (starting with a letter, followed 
by letters and/or decimal digits).
The elements are represented as multivariate polynomials 
with rational coefficients. 
On input the coefficients should be enclosed in
parenthesis: `(p)' where p denotes a multivariate 
polynomial with {\em rational} coefficients.
If the computation requires to take quotients 
and the remainder is non--zero, an error message is displayed 
and user interaction is requested. 

In the following example we read a list of 
distributive polynomials over 
rational polynomials in the variables $a,b,c$ 
and compute the $3$-rd power of the first polyomial.
First we read the domain symbol 
`\verb/RP/' and the list of variables `\verb/(a,b,c)/'
with the domain descriptor read function 
`\verb/ADDDREAD/' and 
also print the descriptor with `\verb/ADDDWRIT/'. 
As usual the leftmost variable `\verb/c/' defines the 
main variable. 
The rest of the example is as in the previous example over 
integral polynomials. The coefficients 
`\verb/( a + b + c )/' and `\verb/( a )/' are enclosed in parenthesis 
to allow the distributive polynomial input routines to switch to 
rational polynomial input routines for the 
input of the coefficients.

{\footnotesize %-------------------------
\begin{verbatim} 
(*Rational Polynomial ----------------------- *) 
   (*domain descriptor        <var list> *) 
   dp:=ADDDREAD().          RP(a,b,c)
 
   ADDDWRIT(dp).

   (*variable list 2 *)
   V:=LIST("x","y","z"). 
 
   (*Polynomials *)
   P:=DILRD(V,dp).
 
   (
   ( ( a + b + c ) z**3 - x ),
   ( y + z**5 + ( a ) ) 
   )
 
   DILWR(P,V).

   (* computations *)
   q:=DIPEXP(FIRST(P),3).

   DILWR(LIST(q),V). 
\end{verbatim}
}

Next we discuss the output as produced by the above examples. \\ 
`\verb/(8 0 3 ((10) (12) (14)))/' is the internal representation of the 
rational polynomial domain descriptor.
`\verb/((10) (12) (14)))/' is the internal representation 
of the variable list `\verb/(a,b,c)/' and the 
second `\verb/3/' denotes, that the rational polynomials are 
in $3$ variables. 
The comment gives a more verbose description of the domain.
The rest of the example is as in the previous example 
with integral polynomial coefficients. 
 
{\footnotesize %-------------------------
\begin{verbatim} 
   ANS: (8 0 3 ((10) (12) (14)))
   MAS: RP(a,b,c) (* Rational Polynomial *) 
   ANS: ((56) (58) (60))
 
   ( (  c + b + a ) z**3 - x )
 
   (  z**5 + y +  a  )
 
   Time: read = 16, eval = 34, print = 50, gc = 0.

( (  c**3 +3 b c**2 +3 a c**2 +3 b**2 c +6 a b c +3 a**2 c + b**3 +3 a b**2 +3 
a**2 b + a**3 ) z**9 -( 3 c**2 +6 b c +6 a c +3 b**2 +6 a b +3 a**2 ) x z**6 +(
 3 c +3 b +3 a ) x**2 z**3 - x**3 )
\end{verbatim}
}


\subsection{Rational Functions} %---------------------
 
\synopsis{RF (x1,...,xr)}\index{RF (x1,...,xr)}
For the rational function domain the variables need to be
\index{Rational Functions}
specified in the variable list `(x1,...,xr)'.
The `xi' denote variable names (starting with a letter, followed 
by letters and/or decimal digits).
The rational functions are fractions of multivariate
integral polynomials reduced to lowest terms. 
I.e.\ gcd(denominator,nominator) $=1$ and 
leading base coefficient (nominator) $> 0$. 
On input the denominators and nominators should be enclosed in
parenthesis: `(p)/(q)' where p and q denote multivariate 
polynomials with {\em integer} coefficients.

In the following example we read a list of 
distributive polynomials over 
rational functions in the variables $a,b,c$ 
and compute the $3$-rd power of the first polyomial.
First we read the domain symbol 
`\verb/IP/' and the list of variables `\verb/(a,b,c)/' 
with the domain descriptor read function 
`\verb/ADDDREAD/' and 
also print the descriptor with `\verb/ADDDWRIT/'. 
As usual the leftmost variable `\verb/c/' defines the 
main variable. 
The rest of the example is as in the previous examples 
with integer or rational number coefficients except 
that we use new polynomials. The coefficients 
`\verb/( a + b + c )/( a**2 - 4 )/' and `\verb/( a )/' are enclosed 
in parenthesis to allow the distributive polynomial input routines 
to switch to rational function input routines for the 
input of the coefficients.

{\footnotesize %-------------------------
\begin{verbatim} 
   (*Rational Function ----------------------- *) 
   (*domain descriptor        <var list> *) 
   dp:=ADDDREAD().          RF(a,b,c)
 
   ADDDWRIT(dp).

   (*variable list 2 *)
   V:=LIST("x","y","z"). 
 
   (*Polynomials *)
   P:=DILRD(V,dp).
 
   (
   ( ( a + b + c )/( a**2 - 4 ) z**3 - x ),
   ( y + z**5 + ( a ) ) 
   )

   DILWR(P,V). 
 
   (* computations *)
   q:=DIPEXP(FIRST(P),3).
 
   DILWR(LIST(q),V). 
\end{verbatim}
}

Next we discuss the output as produced by the above examples. \\
`\verb/(6 (3 0) ((10) (12) (14)))/' is the internal representation of 
the rational function domain descriptor.
`\verb/((10) (12) (14)))/' is the internal representation 
of the variable list `\verb/(a,b,c)/'.
The comment gives a more verbose description of the domain.
The rest of the example is as in the previous examples 
with integer or rational number coefficients. 
 
{\footnotesize %-------------------------
\begin{verbatim} 
   ANS: (6 (3 0) ((10) (12) (14)))
   MAS: RF(a,b,c) (* Rational Function *) 
   ANS: ((56) (58) (60))
 
   ( (  c + b + a )/(  a**2 -4 ) z**3 - x )
 
   (  z**5 + y +  a  )
 
   Time: read = 17, eval = 333, print = 33, gc = 0.

( (  c**3 +3 b c**2 +3 a c**2 +3 b**2 c +6 a b c +3 a**2 c + b**3 +3 a b**2 +3 
a**2 b + a**3 )/(  a**6 -12 a**4 +48 a**2 -64 ) z**9 -( 3 c**2 +6 b c +6 a c +3
 b**2 +6 a b +3 a**2 )/(  a**4 -8 a**2 +16 ) x z**6 +( 3 c +3 b +3 a )/(  a**2 
-4 ) x**2 z**3 - x**3 )
\end{verbatim}
}
 

\subsection{Algebraic Numbers} %---------------------
 
\synopsis{AF (x, p(x), $\lbrack$ (l,r) $\lbrack$, s$\rbrack$ $\rbrack$)}
\index{AF (x, p(x), $\lbrack$ (l,r) $\lbrack$, s$\rbrack$ $\rbrack$)}
Algebraic numbers, i.e.\ elements of $\Q\lbrack x \rbrack / ( p(x) )$,
are represented as univariate polynomials 
modulo an univariate polynomial $p \in \Q\lbrack x \rbrack$, 
together with an optional isolating intervall $(l,r)$ for the 
algebraic number $\alpha$ with $p(\alpha) = 0$ and $\alpha \in (l,r)$. 
\index{Algebraic Numbers}
If $p$ is irreducible, then 
$\Q\lbrack x \rbrack / ( p(x) ) = \Q(\alpha)$ is a field.
`x' denotes the variable name, in which the algebraic numbers 
are written.
`p(x)' denotes the polynomial modulo which
the computation is to be done.
`(l,r)' is an optional isolating intervall, $(l,r) \in \Q \times \Q$, 
for the real algebraic number $\alpha \in (l, r \rbrack \subseteq \R$.
`s' is the optional decimal flag. 
If `s $=-1$' the algebraic numbers are printed as polynomials in `x'.
If `s $\geq 0$' decimal approximations for the 
algebraic numbers are printed. As with the case of the 
decimal approximation of the rational numbers we have: 
\begin{displaymath}
\vert \beta - d.d_1 d_2 \ldots d_{s-1} d_s \vert 
   \leq \frac{1}{2 \cdot 10^s}. 
\end{displaymath}
for $\beta \in \Q(\alpha)$, 
and $d \in \Z$, $d_i \in \{0,1,\ldots,9 \}$ $(1 \leq i \leq s)$.
The isolating intervall 
is only required if the decimal flag `s' is non-negative. 

The polynomial `p' is checked whether it is (1) not squarefree,
(2) squarefree or (3) irreducible.
The result of this check is printed together 
with the domain descriptor in a comment.
It depends on the package if the computation can proceed correctly,
e.g.\ real root isolation requires `p' to be squarefree or
Gr\"obner bases computation requires inverses in $\Q(\alpha)$, so
`p' must be irreducible over \Q.
If the computation requires to take
inverses modulo `p' and they do not exist in the case
of `p' beeing not irreducible, an error message is displayed 
and user interaction is requested. 

In the following three examples we read a list of 
distributive polynomials over three different algebraic number fields
and compute the $3$-rd power of the first polyomial.
First we read the domain symbol 
`\verb/AF/' and the specification of the algebraic number ring 
with the domain descriptor read function `\verb/ADDDREAD/' and 
also print the descriptor with `\verb/ADDDWRIT/'. 
The rest of the example is as in the previous examples 
with integer or rational number coefficients except 
that we use new polynomials. The coefficients enclosed 
in parenthesis to allow the distributive polynomial input routines 
to switch to rational function input routines for the 
input of the coefficients.

The first algebraic number ring is the field ${\bf Q}(i)$, where 
$i$ is the imaginary number. 
The specification `\verb/( i, ( i**2 + 1 ) )/'
defines the variable `\verb/i/' and the defining irreducible polynomial
`\verb/( i**2 + 1 )/' for `i'. 

{\footnotesize %-------------------------
\begin{verbatim} 
   (*Complex Algebraic Number ----------------------- *) 
   (*domain descriptor      <var> <minimal polynomial> *) 
   dp:=ADDDREAD().          AF( i, ( i**2 + 1 ) ) 
 
   ADDDWRIT(dp).
 
   (*variable list 2 *)
   V:=LIST("x","y","z"). 
 
   (*Polynomials *)
   P:=DILRD(V,dp).
 
   (
   ( ( 3 + 4 i ) z**3 - x ),
   ( y + z**5 + ( i**2 + 2 ) ) 
   )
 
   DILWR(P,V). 
 
   (* computations *)
   q:=DIPEXP(FIRST(P),3).
 
   DILWR(LIST(q),V). 
\end{verbatim}
}

Next we discuss the output as produced by the above example. \\ 
`\verb/(1 0 (2 (1 1) 0 (1 1)) (2 1 0 1) 1 ((26)) () -1)/' is the 
internal representation of the algebraic number domain descriptor.
`\verb/((26))/' is the internal representation 
of the variable list `\verb/(i)/'.
`\verb/()/' denotes an empty isolating interval and 
`\verb/-1/' denotes the decimal flag $s=-1$ (which are the defaults). 
`\verb/(2 (1 1) 0 (1 1))/' is the rational minimal polynomial 
and `\verb/(2 1 0 1)/' is the integral minimal polynomial. 
`\verb/1/' denotes that the polynomials are irreducible. 
The first comment `\verb/(* prime *)/' indicates that the 
polynomial is prime and the second comment gives a 
more verbose description of the domain.
The rest of the example is as in the previous examples 
with integer or rational number coefficients. 

{\footnotesize %-------------------------
\begin{verbatim} 
   ANS: (1 0 (2 (1 1) 0 (1 1)) (2 1 0 1) 1 ((26)) () -1)
   MAS: AF( i, (  i**2 +1 ) ) (* prime *)  (* Algebraic Number *) 
   ANS: ((56) (58) (60))
 
   ( ( 4 i +3 ) z**3 - x )
 
   (  z**5 + y + 1  )
 
   Time: read = 0, eval = 33, print = 17, gc = 0.

( ( 44 i -117 ) z**9 -( 72 i -21 ) x z**6 +( 12 i +9 ) x**2 z**3 - x**3 )
\end{verbatim}
}

The second example is a real algebraic number ring
${\bf Q}\lbrack \alpha \rbrack$, where 
$\alpha$ is a root of $(X^2 - 2)(X - 3)$.
The specification `\verb/( w2, ( (w2**2 - 2) (w2 - 3) ) )/'
defines the variable `\verb/w2/' and the defining squarefree polynomial 
`\verb/( w2**3 -3 w2**2 -2 w2 +6 )/' for `w2'. 
`\verb/( 1, 2 )/' defines the isolating interval $( 1, 2 \rbrack$ 
for $\sqrt{2}$ and `\verb/10/' defines the 
decimal flag to be $10$. 
 
{\footnotesize %-------------------------
\begin{verbatim}
   (*Real Algebraic Number 1---------------------- *) 
   (*domain descriptor      (<var>, <minimal polynomial>[, (r1,r2)[, s]] ) *) 
   dp:=ADDDREAD().          AF( w2, ( (w2**2 - 2) (w2 - 3) ), ( 1, 2 ), 10 ) 
 
   ADDDWRIT(dp).
 
   (*variable list 2 *)
   V:=LIST("x","y","z"). 
 
   (*Polynomials *)
   P:=DILRD(V,dp).
 
   (
   ( ( 1 + w2  ) z**3 - x ),
   ( y + z**5 + ( w2**2 + 32 ) ) 
   )

   DILWR(P,V). 

   (* computations *)
   q:=DIPEXP(FIRST(P),3).
 
   DILWR(LIST(q),V). 
\end{verbatim}
}

Next we discuss the output as produced by the above example. \\ 
`\verb/((1 0 (3 (1 1) 2 (-3 1) 1 (-2 1) 0 (6 1)) (3 1 2 -3 1 -2 0 6) 2/ \\ 
\verb/((54 2)) ((1 1) (2 1)) 10)/' is the 
internal representation of the algebraic number domain descriptor.
`\verb/((54 2))/' is the internal representation 
of the variable list `\verb/(w2)/'.
`\verb/((1 1) (2 1))/' is the internal representation of the 
isolating intervall $( 1, 2 \rbrack$ and 
`\verb/10/' denotes the decimal flag $s=10$. 
`\verb/(3 (1 1) 2 (-3 1) 1 (-2 1) 0 (6 1))/' is the 
rational minimal polynomial and `\verb/(3 1 2 -3 1 -2 0 6)/' is the 
integral minimal polynomial. 
`\verb/2/' denotes that the polynomials are irreducible. 
The first comment `\verb/(* squarefree *)/' indicates that the 
polynomial is squarefree and the second comment gives a 
more verbose description of the domain.
The rest of the example is as in the previous examples 
with integer or rational number coefficients, only the
polynomial coefficients are printed with 
$10$ places after the decimal point. 
 
{\footnotesize %-------------------------
\begin{verbatim}
   MAS: (  w2**3 -3 w2**2 -2 w2 +6 )
   ANS: (1 0 (3 (1 1) 2 (-3 1) 1 (-2 1) 0 (6 1)) (3 1 2 -3 1 -2 0 6) 2 
             ((54 2)) ((1 1) (2 1)) 10)
   Time: read = 17, eval = 216, print = 0, gc = 0.
   MAS: AF( w2, (  w2**3 -3 w2**2 -2 w2 +6 ), ( 1, 2 ), 10 ) 
                   (* squarefree *)  (* Algebraic Number *) 
   ANS: ((56) (58) (60))
 
   ( 2.4142135624 z**3 - x )
 
   (  z**5 + y +34.0000000000 )
 
   Time: read = 0, eval = 766, print = 0, gc = 0.

( 14.0710678119 z**9 -17.4852813742 x z**6 +7.2426406871 x**2 z**3 - x**3 )
\end{verbatim}
}


The third example is a real algebraic number ring
${\bf Q}\lbrack \alpha \rbrack$, where 
$\alpha$ is a root of $(X^2 - 2)(X - 3)^2$.
The specification `\verb/( w2, ( (w2**2 - 2) (w2 - 3)**2 ) )/'
defines the variable `\verb/w2/' and the defining 
reducible and non squarefree polynomial \\ 
`\verb/( w2**4 -6 w2**3 +7 w2**2 +12 w2 -18 )/' for `w2'. 
`\verb/( 1, 2 )/' defines the isolating interval $( 1, 2 \rbrack$ 
for $\sqrt{2}$. No decimal flag is specified. 

{\footnotesize %-------------------------
\begin{verbatim} 
   (*Real Algebraic Number 2---------------------- *) 
   (*domain descriptor      (<var>, <minimal polynomial>[, (r1,r2)[, s]] ) *) 
   dp:=ADDDREAD().          AF( w2, ( (w2**2 - 2) (w2 - 3)**2 ), ( 1, 2 ) ) 
 
   ADDDWRIT(dp).
 
   (*variable list 2 *)
   V:=LIST("x","y","z"). 
 
   (*Polynomials *)
   P:=DILRD(V,dp).
 
   (
   ( ( 1 + w2  ) z**3 - x ),
   ( y + z**5 + ( w2**2 + 32 ) ) 
   )
 
   DILWR(P,V). 

   (* computations *)
   q:=DIPEXP(FIRST(P),3).
 
   DILWR(LIST(q),V). 
\end{verbatim}
} 


Next we discuss the output as produced by the above example. \\ 
`\verb/(1 0 (4 (1 1) 3 (-6 1) 2 (7 1) 1 (12 1) 0 (-18 1))/ \\
\verb/(4 1 3 -6 2 7 1 12 0 -18) 0 ((54 2)) ((1 1) (2 1)) -1)/' is the 
internal representation of the algebraic number domain descriptor.
`\verb/((54 2))/' is the internal representation 
of the variable list `\verb/(w2)/'.
`\verb/((1 1) (2 1))/' is the internal representation of the 
isolating intervall $( 1, 2 \rbrack$ and 
`\verb/-1/' denotes the decimal flag $s=-1$. \\
`\verb/(4 (1 1) 3 (-6 1) 2 (7 1) 1 (12 1) 0 (-18 1))/' is the 
rational minimal polynomial and `\verb/(4 1 3 -6 2 7 1 12 0 -18)/' 
is the integral minimal polynomial. 
`\verb/0/' denotes that the polynomials are reducible 
and not squarefree. 
The first comment `\verb/(* reducible *)/' indicates that the 
polynomial is reducible and not squarefree and the second comment 
gives a more verbose description of the domain.
The rest of the example is as in the previous examples 
with integer or rational number coefficients. The
polynomial coefficients are printed as polynomials 
in `\verb/w2/', since the decimal flag was $-1$ by default.
 
{\footnotesize %-------------------------
\begin{verbatim} 
   MAS: (  w2**4 -6 w2**3 +7 w2**2 +12 w2 -18 )
   ANS: (1 0 (4 (1 1) 3 (-6 1) 2 (7 1) 1 (12 1) 0 (-18 1)) 
             (4 1 3 -6 2 7 1 12 0 -18) 0 ((54 2)) ((1 1) (2 1)) -1)
   Time: read = 16, eval = 50, print = 17, gc = 0.
   MAS: AF( w2, (  w2**4 -6 w2**3 +7 w2**2 +12 w2 -18 ), ( 1, 2 ) ) 
                   (* reducible *)  (* Algebraic Number *) 
   ANS: ((56) (58) (60))
 
   ( (  w2 +1 ) z**3 - x )
 
   (  z**5 + y +(  w2**2 +32 ) )
 
   Time: read = 0, eval = 16, print = 0, gc = 0.

( (  w2**3 +3 w2**2 +3 w2 +1 ) z**9 -( 3 w2**2 +6 w2 +3 ) x z**6 +( 3 w2 +3 ) 
 x**2 z**3 - x**3 )
\end{verbatim}
}


\subsection{Gr\"obner bases over various domains} %--------

In this section we list two examples of Gr\"obner base computations 
over the domains of modular digits and rational functions.
The input that follows is as described in the examples before, 
except that the algorithm for Gr\"obner base computation 
`\verb/DIPGB/' is called.

{\footnotesize %-------------------------
\begin{verbatim} 
   (*Modular Digit ----------------------------- *) 
   (*domain descriptor         <modulus> *) 
   dp:=ADDDREAD().          MD 17
 
   ADDDWRIT(dp).
 
   (*variable list *)
   V:=LIST("B","S","T","Z","P","W"). xxx:=DIPVDEF(V). 
 
   (*Polynomials *)
   P:=DILRD(V,dp).
 
   ( 
   ( 45 P + 35 S - 165 B - 36 ), 
   ( 35 P + 40 Z + 25 T - 27 S ), 
   ( 15 W + 25 S P + 30 Z - 18 T - 165 B**2 ), 
   ( - 9 W + 15 T P + 20 S Z ), 
   ( P W + 2 T Z - 11 B**3 ), 
   ( 99 W - 11 B S + 3 B**2 ) 
   ) 

   (*Syntax: <polynomial list> *) 
   DILWR(P,V).
 
   (* computations *)
   Q:=DIPGB(P,1). 
   DILWR(Q,V).
\end{verbatim}
}

The computation takes place in the statement 
`\verb/Q:=DIPGB(P,1)/.'
`\verb/P/' is the list of input polynomials 
and `\verb/1/' is the trace flag, which requests 
intermediate output of the reduced S-polynomials.

{\footnotesize %-------------------------
\begin{verbatim} 
   ANS: (4 0 17 1)
   MAS: MD 17 (* prime. *) (* Modular Digit *) 
   ANS: ((13) (47) (49) (61) (41) (55))
 
   ( 11 P + S +5 B +15 )
   (  P +6 Z +8 T +7 S )
   ( 15 W +8 S P +13 Z +16 T +5 B**2 )
   ( 8 W +15 T P +3 S Z )
   (  P W +2 T Z +6 B**3 )
   ( 14 W +6 B S +3 B**2 )
 
   2216 ms,  326 cells,
   1 crit3,  1 crit4,  1 spoly,  1 hpoly,
   15 pairs,  14 restp,  0.933+ quot.
 
   H=( 15 Z +3 T +8 S +12 B +2 )
 
   4466 ms,  752 cells,
   3 crit3,  2 crit4,  1 spoly,  1 hpoly,
   20 pairs,  17 restp,  0.850 quot.
 
   H=( 13 S T +5 B T +15 T +15 S**2 +8 S +10 B**2 )
 
   ... 

   40066 ms,  41062 cells,
   152 crit3,  14 crit4,  4 spoly,  4 hpoly,
   152 pairs,  0 restp,  0.000 quot.
 
   Time: read = 0, eval = 42800, print = 100, gc = 0.

( 11 B**10 +13 B**9 +13 B**8 +8 B**7 +2 B**6 + B**5 +14 B**4 +4 B**3 +8 B**2 +6
  B +3 )
( 11 S +12 B**8 +2 B**7 +14 B**6 +9 B**5 +11 B**4 +12 B**3 +16 B**2 +5 B +6 )
( 5 T +12 B**9 +5 B**8 +13 B**7 +7 B**6 +5 B**5 +15 B**4 +2 B**3 +13 B**2 
  +11 B +9 )
( 15 Z +3 B**9 +13 B**8 +13 B**7 +2 B**6 +9 B**5 +8 B**3 +9 B**2 +3 B +8 )
( 11 P +2 B**8 +6 B**7 +8 B**6 +10 B**5 +16 B**4 +2 B**3 +14 B**2 +3 B +16 )
( 14 W +12 B**9 +2 B**8 +14 B**7 +9 B**6 +11 B**5 +12 B**4 +16 B**3 +8 B**2 
  +6 B )
\end{verbatim}
}

In the next example we compute a Gr\"obner base over 
the rational function field in $4$ variables. 
Except of the domain descriptor and the input polynomials, 
the example is as the previous example.

{\footnotesize %-------------------------
\begin{verbatim} 
   (*Rational Function ----------------------- *) 
   (*domain descriptor        <var list> *) 
   dp:=ADDDREAD().          RF(A1,A2,A3,A4)
 
   ADDDWRIT(dp).

   (*variable list 2 *) 
   V:=LIST("X1","X2","X3","X4").  xxx:=DIPVDEF(V). 
 
   (*Polynomials *)
   P:=DILRD(V,dp).
 
   (
   ( X4 - ( A4 - A2 )),
   ( X1 + X2 + X3 + X4 - ( A1 + A3 + A4 )),
   ( X1 X3 + X1 X4 + X2 X3 + X3 X4 - ( A1 A4 + A1 A3 + A3 A4 )),
   ( X1 X3 X4 - ( A1 A3 A4 ))
   )

   DILWR(P,V). 

   (* computations *)
   Q:=DIPGB(P,1). 
   DILWR(Q,V).
\end{verbatim}
}

The output is as follows. 

{\footnotesize %-------------------------
\begin{verbatim} 
   ANS: (6 (4 0) ((11 1) (11 2) (11 3) (11 4))) 
   MAS: RF(A1,A2,A3,A4) (* Rational Function *) 
   ANS: ((57 1) (57 2) (57 3) (57 4))
   ANS: ((13) (47) (49) (61) (41) (55))
 
   (  X4 -(  A4 - A2 ) )
   (  X4 + X3 + X2 + X1 -(  A4 + A3 + A1 ) )
   (  X3 X4 + X1 X4 + X2 X3 + X1 X3 -(  A3 A4 + A1 A4 + A1 A3 ) )
   (  X1 X3 X4 -  A1 A3 A4  )
 
   1950 ms,  389 cells,
   1 crit3,  1 crit4,  1 spoly,  1 hpoly,
   6 pairs,  5 restp,  0.833+ quot.
 
   H=(  X3 + X2 + X1 -(  A3 + A2 + A1 ) )
 
   ...
 
   14584 ms,  63521 cells,
   24 crit3,  6 crit4,  1 spoly,  1 hpoly,
   24 pairs,  0 restp,  0.000 quot.
 
   Time: read = 0, eval = 16316, print = 117, gc = 0.

(  X1**3 -(  A3 A4 + A1 A4 + A1 A3 )/(  A4 - A2 ) X1**2 +(  A1 A3 A4**2 + A1 A3
**2 A4 + A1**2 A3 A4 )/(  A4**2 -2 A2 A4 + A2**2 ) X1 -  A1**2 A3**2 A4**2 /(
A4**3 -3 A2 A4**2 +3 A2**2 A4 - A2**3 ) )
 
(  X2 +(  A4**2 -2 A2 A4 + A2**2 )/  A1 A3 A4  X1**2 -(  A3 A4**2 + A1 A4**2 - 
A2 A3 A4 - A1 A2 A4 - A1 A2 A3 )/  A1 A3 A4  X1 +(  A4 - A2 ) )
 
(  X3 -(  A4**2 -2 A2 A4 + A2**2 )/  A1 A3 A4  X1**2 +(  A3 A4**2 + A1 A4**2 - 
A2 A3 A4 + A1 A3 A4 - A1 A2 A4 - A1 A2 A3 )/  A1 A3 A4  X1 -(  A4 + A3 + A1 ) )
 
(  X4 -(  A4 - A2 ) )
 
   Time: read = 17, eval = 66, print = 0, gc = 0.
\end{verbatim}
}

This is the end of the examples and so the 
end of the section on the arbitrary domain system. 

%{\footnotesize %-------------------------
%\begin{verbatim} 
%\end{verbatim}
%}
%{\footnotesize %-------------------------
%\begin{verbatim} 
%\end{verbatim}
%}



