% polynomial part 12.2.91 hk

%\setcounter{chapter}{5}

\chapter{Polynomial Systems}

Besides the integers and rational numbers the most important 
data types are polynomials. 
Polynomials are always represented in some 
(internal) canonical form and not as general LISP S--expressions. 
The most important canonical representations are:
\begin{itemize}
\item recursive representation,
\item distributive (or distributed) representation,
\item dense representation.
\end{itemize}
These representations will be discussed in the following sections.
For every representation there are algorithms to 
read and write polynomials, select parts of polynomials,
construct polynomials and to
perform basic arithmetic of polynomials  
(like sum, product, remainder, evaluation, substitution). 

For more advanced methods like 
polynomial greatest common divisors or 
multivariate polynomial factorization there are 
algorithms for the recursive polynomial repesentation.
For Gr\"obner bases and 
polynomial ideal decomposition or 
solving systems of polynomial equations there are 
algorithms for the distributive polynomial representation. 
The dense representation is mainly used 
for algorithms for fast univariate polynomial remainder 
computations.

There is a varity of 
application dependent `fine tunings' of representations 
to optimize space, time or programming complexity 
of the algorithms 
which are not discussed here 
(and which are only partly available in the current system).   

Program libraries are composed from the
ALDES / SAC--2 computer algebra system by \cite{Collins 82},
from the DIP polynomial system, which is based on the former,
by \cite{Gebauer Kredel 83}, \cite{Gebauer Kredel 83a}
and from further extensions by \cite{Kredel 87},
\cite{Kredel 88a}, \cite{Kredel 88b}, \cite{Kredel 90a}.
The collection of algorithms and global variables
are called `systems'. The systems are broken
into modules according to specific characteristics
of subcollections of the algorithms.

The available ALDES / SAC--2  polynomial libraries 
are the following:
\begin{quote}
  ALDES / SAC--2 Polynomial System, \\
  ALDES / SAC--2 Algebraic Number System, \\
  ALDES / SAC--2 Polynomial GCD and Resultant System, \\
  ALDES / SAC--2 Polynomial Factorization System, \\
  ALDES / SAC--2 Real Root System. 
\end{quote}

The available DIP polynomial libraries 
are the following:
\begin{quote}
  DIP Common Distributive Polynomial System, \\
  DIP Distributive Integral Polynomial System, \\
  DIP Distributive Rational Polynomial System, \\
  DIP Distributive Arbitrary Domain Polynomial System, \\
  DIP Buchberger Algorithm System (Gr\"obner bases), \\
  DIP Polynomial Ideal Dimension System, \\
  DIP Zero--dimensional Polynomial Ideal Decomposition System, \\
  DIP Zero--dimensional Polynomial Ideal Real Root System. 
\end{quote}

As extension to the DIP system there are libraries 
for non--commutative polynomial rings of solvable type:
\begin{quote}
  DIP Non--commutative Rational Distributive Polynomial System, \\
  DIP Non--commutative Gr\"obner Base System, \\
  DIP Non--commutative Polynomial Center System. 
\end{quote}


\section{Coefficient Rings}

Although the representation of polynomials is independent 
of the representation of the coefficients the 
algorithms are implemented for specific coefficient rings.

Programms that work independently of the coefficient ring 
start with the program prefix `P' in case of the 
recursive polynomial representation 
and with `DI' in case of the 
distributive polynomial representation.

For the recursive representation there are 
algorithms for the following 
coefficient rings:
\begin{itemize}
\item integral numbers: $\Z$, 
      program prefix `IP' for `integral polynomial' 
\item rational numbers: $\Q$, 
      program prefix `RP' for `rational number polynomial' 
\item integral numbers modulo $m$: $\Z/_{(m)}$, 
      program prefix `MIP' for `modular integral polynomial' 
\item algebraic numbers over the rational numbers: 
      $\Q\lbrack X \rbrack/_{(m_{\alpha}(X))}$, 
      where $m_{\alpha}(X)$ denotes the minimal polynomial 
      of $\alpha$ over $\Q$,
      program prefix `AFP' for `algebraic number field polynomial'. 
\end{itemize}
In the section on the recursive polynomial representation we will 
discuss only polynomials over the integers.

For the distributive representation there are 
algorithms for the following 
coefficient rings:
\begin{itemize}
\item integral numbers: $\Z$, 
      program prefix `DIIP' for `distributive integral polynomial' 
\item rational numbers: $\Q$, 
      program prefix `DIRP' for `distributive rational 
      number polynomial' 
\end{itemize}
In the so called `distributive arbitrary 
domain polynomial system' there are algorithms 
for further coefficient rings. The common program prefix 
is `DIP' for `distributive arbitrary domain polynomial'.
\begin{itemize}
\item integral numbers modulo $m$: $\Z/_{(m)}$, 
\item algebraic numbers over the rational numbers: 
      $\Q\lbrack X \rbrack/_{(m_{\alpha}(X))}$, 
      where $m_{\alpha}(X)$ denotes the minimal polynomial 
      of $\alpha$ over $\Q$,
\item polynomial functions in $n$ variables over the integers: 
      $\Z\lbrack X_1, \ldots, X_n \rbrack$, 
\item rational functions in $n$ variables over the integers: \\
      ${\rm Quot}(\Z\lbrack X_1, \ldots, X_n \rbrack)$ 
      $\cong \Q(X_1, \ldots, X_n)$, 
\item rational polynomials in $n$ variables modulo a 
      polynomial ideal: \\ 
      $\Q\lbrack X_1, \ldots, X_n \rbrack/_{(m_1, \ldots, m_k)}$. 
\end{itemize}
In the section on the distributive polynomial representation we will 
discuss only polynomials over the rational numbers.


\section{Recursive Polynomial System} %----------------------

Let $R$ be a commutative ring with 1 and let 
$S = R \lbrack X_1, \ldots, X_r \rbrack$ denote a  
(commutative) polynomial ring in $r \geq 0$ variables  
(indeterminates) $X_1, \ldots, X_r$.
$S$ is isomorphic to an univariate polynomial ring 
over a polynomial ring with one less variable:
$$ S' =
 ( \ldots ( (R \lbrack X_1 \rbrack) \lbrack X_2 \rbrack ) 
   \ldots ) \lbrack X_r \rbrack.
$$
The elements of $S'$ are univariate polynomials in the 
{\bf main variable} $X_r$ with coefficients being 
polynomials in the ring  
$( \ldots (R\lbrack X_1 \rbrack ) \ldots) \lbrack X_{r-1} \rbrack$
when $r \geq 1$. 

{\bf Definition:}
Let $A(X_1, \ldots, X_r) \in S'$, $A \neq 0$ and $r \geq 1$,
then 
$$ A(X_1, \ldots, X_r) = 
   \sum_{i=1}^{k} A_i(X_1, \ldots, X_{r-1}) X_r^{e_i}
$$ 
with $A_i \neq 0$ for $i=1,\ldots,k$ and 
$e_k > e_{k-1} > \ldots > e_2 > e_1$. 
The {\bf recursive representation} of $A$ is the list
$$
  \alpha = ( e_k, \alpha_k, \ldots, e_2, \alpha_2, e_1, \alpha_1 ) 
$$   
where the $\alpha_i$ denote the  
recursive representations of the $A_i$ and the $e_i$ are 
non--negative $\beta$--integers, $i=1,\ldots,k$.  
If $A = 0$ then $\alpha = 0$ and 
if $r = 0$ then $\alpha$ is defined by the 
representation of the base coefficient ring.  

{\bf Notes:}
\begin{enumerate}
\item The variables $X_1, \ldots, X_r$ are not stored 
      in the representing list. This is different to 
      other computer algebra systems like REDUCE or muMATH.
\item The representation is sparse in the sence, that 
      only coefficients $\neq 0$ are stored.
\end{enumerate}

{\bf Examples:}
\begin{enumerate}
\item Let $S = \Z \lbrack X \rbrack$, that is $R = \Z$ and $r = 1$.
      Let $$A = 3 X^4 + 5,$$
      then $k = 2$ and $e_2 = 4, A_2 = 3, e_1 = 0, A_1 = 5$. 
      The representation is then 
      $$ \alpha = ( 4, 3, 0, 5 ). $$
\item Let $S = \Z \lbrack X, Y \rbrack$, 
      that is $R = \Z$ and $r = 2$.
      Let $$A = ( 3 X + 2 ) Y^2 + 5 X,$$
      then $k = 2$ and $e_2 = 2, A_2 = 3 X + 2, e_1 = 0, A_1 = 5 X$. 
      The representation is then 
      $$ \alpha = ( 2, ( 1, 3, 0, 2 ), 0, ( 1, 5 ) ). $$
\item Let $S = \Q \lbrack X, Y \rbrack$, 
      that is $R = \Q$ and $r = 2$.
      Let $$A = \frac{1}{4} X^2 Y - \frac{3}{5}$$
      then $k = 2$ and $e_2 = 1, A_2 = \frac{1}{4} X^2, 
                        e_1 = 0, A_1 = \frac{-3}{5} X^0$. 
      The representation is then 
      $$ \alpha = ( 1, ( 2, ( 1, 4 ) ), 0, ( 0, ( -3, 5 ) ) ). $$
\end{enumerate}


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

The programs of the most important recursive polynomial algorithms 
and their complexity are summarized in the following.
First the main complexity numbers are defined 
and then integral polynomial programs are discussed.

As the recursive definition of the polynomial ring 
and the recursive representation suggests 
the algorithms will be constructed in the following way:
\begin{enumerate}
\item Check for recursion base, case $r= 0$. 
      Perform the desired operations on the base coefficients. 
\item If $r \geq 1$ then 
      loop on the exponents in the main variable 
      and call the algorithm recursively on the coefficients. 
      Construct resulting polynomials.
\item Return the results. 
\end{enumerate}

The complexity of polynomial algorithms will 
therefore depend mainly on three factors:
\begin{enumerate}
\item the size of the base coefficients,
\item the degree of the polynomials and
\item the number of variables.  
\end{enumerate}
These quantities are defined precisely as follows.

Let $A \in S = R \lbrack X_1, \ldots, X_r \rbrack$, 
$r \geq 0$,
$A(X_1, \ldots, X_r) = 
   \sum_{i=1}^{k} A_i(X_1, \ldots, X_{r-1}) X_r^{e_i}$.
Then $\deg_i (A)$ denotes the degree of the polynomial $A$ 
in the variable $X_i$ for $i=1,\ldots,r$.
That is 
$$
  \deg_i (A) = \left\{
               \begin{array}{ll}
                      0   & \mbox{\rm \ if\ } A = 0 
                            \mbox{\rm \ or\ } r = 0 \\
                      e_k & \mbox{\rm \ if\ } i = r \\
                      \max \{ \deg_i (A_j) \mid j=1, \ldots, k \} & 
                            \mbox{\rm \ otherwise}. 
               \end{array}
               \right.
$$
Further define 
$d = \deg (A) = \max \{ \deg_i (A) \mid i=1, \ldots, r \}$.

With $L(A)$ we will denote the 
maximum of the length of the {\em base coefficients}.
That is  
$$
  L(A) = \left\{
         \begin{array}{ll}
                L(A_1) & \mbox{\rm \ if\ } r = 0 \\
                \max \{ L (A_j) \mid j=1, \ldots, k \} & 
                        \mbox{\rm \ otherwise}. 
         \end{array}
         \right.
$$
The length of integers and rational numbers are defined as in
section \ref{secCOMPL}.
Further let $L(A,B) = \max \{ L(A), L(B) \}$. 

Since only coefficients $\neq 0$ are stored in the polynomials
one would like to measure the number of terms in the polynomials.
This gives a more precise indication of the 
complexity in view of the size of the base coefficients. 
So we define 
$$
  {\rm term}(A) = \left\{
         \begin{array}{ll}
                1 & \mbox{\rm \ if\ } r = 0 \\
                \sum_{j=1}^{k} \ {\rm term}(A_j) & 
                        \mbox{\rm \ otherwise}. 
         \end{array}
         \right.
$$
Clearly it is bounded by 
$${\rm term}(A) \leq \deg(A)^r = d^r.$$

We will continue to write $L(a)$ for $O(L(a))$, 
i.e. we will not count for constant factors.
The computing time functions $t, \tma, \tmi, \ta$ 
are defined as before in section \ref{secCOMPL}.
\index{complexity}

\def\IP{{\cal IP}}
\def\Po{{\cal P}}
Let
$\A$ be the set of atoms,
$\L$ be the set of lists,
$\O = \A \cup \L$ be the set of objects,
$\I = \{ x \in \O: \ x$ represents an element of ${\rm \bf Z} \}$ 
be the set of integers, 
$\Po_r = \{ x \in \O: \ x$ represents a multivariate polynomial 
           in $r$ variables $\}$ 
be the set of recursive polynomials,
$\IP_r = \{ x \in \O: \ x$ represents a multivariate polynomial over
           ${\rm \bf Z}$ in $r$ variables $\}$ 
be the set of integral polynomials. 
\index{integral polynomial}\index{integer}
\index{polynomial}

We will first summarize selector functions which are 
independent of the base coefficient ring
and then turn to the algorithms for integral polynomials.
For decomposition and construction of polynomials  
the list processing functions $ADV2$, $FIRST2$ and $COMP2$ 
are used and will not be discussed here.

\begin{deflist}{$C \gets IPPROD(r,A,B)$}
\item[$e \gets PDEG(A)$] $A \in \Po_r$, $e \in \A$. 
     $e = \deg_r (A) = e_k$ is the degree of $A$ in the
     main variable.
     In recursive representation $t = 1$, $c = 0$. 
     \index{PDEG}
\item[$a \gets PLDCF(A)$] $A \in \Po_r$, $a \in \Po_{r-1}$. 
     $a = {\rm ldcf} (A) = A_k$ is the leading coefficient of $A$.
     In recursive representation $t = 2$, $c = 0$. 
     \index{PLDCF}
\item[$A' \gets PRED(A)$] $A \in \Po_r$, $A' \in \Po_r$. 
     $A' = {\rm red} (A) = \sum_{i=1,\ldots,k-1} A_i X_r^{e_i}$ 
     is the polynomial reductum of $A$.
     $t = 2$, $c = 0$. 
     \index{PRED}
\item[$a \gets PTRCF(A)$] $A \in \Po_r$, $a \in \Po_{r-1}$. 
     $a = {\rm trcf} (A) = A_1$ 
     is the trailing coefficient of $A$.
     $t^+ = 2 \deg_r(A)$, $c = 0$. 
     The factor $2$ comes in because also the exponents are 
     stored in the representing list of a polynomial. 
     \index{PTRCF}
\item[$a \gets PLBCF(r,A)$] $A \in \Po_r$, $a \in \Po_0$. 
     $a$ is the leading base coefficient of $A$ defined as
     $$a = {\rm lbcf} (r,A) =  
         \left\{
         \begin{array}{ll}
              {\rm ldcf} (A) & \mbox{\rm \ if\ } r = 1 \\
              {\rm lbcf} ({\rm ldcf} (A)) & \mbox{\rm \ if\ } r > 1.
         \end{array}
         \right.
$$
     $t = 2 r$, $c = 0$. 
     \index{PLBCF}
\item[$a \gets PTBCF(r,A)$] $A \in \Po_r$, $a \in \Po_0$. 
     $a$ is the trailing base coefficient of $A$ defined as
     $$a = {\rm tbcf} (r,A) =  
         \left\{
         \begin{array}{ll}
              {\rm trcf} (A) & \mbox{\rm \ if\ } r = 1 \\
              {\rm tbcf} ({\rm trcf} (A)) & \mbox{\rm \ if\ } r > 1.
         \end{array}
         \right.
$$
     $t^+ = 2 r \deg(A)$, $c = 0$. 
     \index{PTBCF}
\end{deflist}

We turn now to the discussion of  
polynomial algorithms which depend on the 
base coefficient field. 
Only integer base coefficients will be treated. 

\begin{deflist}{$C \gets IPPROD(r,A,B)$}
\item[$s \gets IPSIGN(r,A)$] $A \in \IP_r$, $s \in \{-1, 0, +1 \}$. 
     $s = ISIGN({\rm lbcf}(A))$ is the sign the 
     leading base coeficient of $A$.
     In recursive representation 
     $t^+ = 2 r + t^+_{ISIGN} = r + L(A)$, $c = 0$; 
     $t^- = 2 r +t^-_{ISIGN} = r + 1 = O(r)$. 
     \index{IPSIGN}
\item[$A' \gets IPNEG(r,A)$] $A, A' \in \IP_r$. 
     $A' = - A$ is the negation of $A$.
     $t^+ = {\rm term}(A) \cdot t^+_{INEG} 
            \leq \deg(A)^r L(A) = d^r L(A)$, 
     $c^+ = d^r L(A)$. 
     \index{IPNEG}
\item[$A' \gets IPABS(r,A)$] $A, A' \in \IP_r$. 
     If ${\rm sign}( {\rm lbcf} ( A ) ) = -1$ then $A' = - A$ 
     else $A' = A$.
     $t^- = t^-_{IPSIGN} = r$, $c^- = 0$; 
     $t^+ = t^+_{IPNEG} \leq d^r L(A)$, 
     $c^+ = c^+_{IPNEG} \leq d^r L(A)$. 
     \index{IPABS}
\item[$C \gets IPSUM(r,A,B)$] $A, B, C \in \IP_r$.
     $C = A + B$ is the sum of $A$ and $B$. 
     Let $l = \max \{ {\rm term}(A), {\rm term}(B) \}$,
         $d = \max \{ \deg(A), \deg(B) \}$ then 
     $t^+ = l \cdot t^+_{ISUM} \leq d^r L(A,B)$, 
     $c^+ = d^r L(A,B)$. 
     \index{IPSUM}
\item[$C \gets IPDIF(r,A,B)$] $A, B, C \in \IP_r$.
     $C = A - B$ is the difference of $A$ and $B$. 
     The computing times are the same as for $IPSUM$.
     \index{IPDIF}
\item[$C \gets IPPROD(r,A,B)$] $A, B, C \in \IP_r$.
     $C = A * B$ is the product of $A$ and $B$. 
     Let $l = \max \{ {\rm term}(A), {\rm term}(B) \}$,
         $d = \max \{ \deg(A), \deg(B) \}$ then 
     $t^+ = l^3 \cdot t^+_{IPROD} \leq d^{2r} L(A,B)^2$, 
     $c^+ = d^{2r} L(A,B)^2$. 
     \index{IPPROD}
\item[$IPQR(r,A,B; C,D)$] $A, B, C, D \in \IP_r$.
     $C = A / B$ is the quotient of $A$ and $B$ if it exists, 
     in this case $D = 0$ and $A = C B$. 
     (A sufficient condition is that ${\rm ldcf}(B)$ is a unit 
     in the coefficient ring.)
     If the quotient does not exist, then $D$ is a polynomial of 
     minimal degree (not neccessarily $\deg_r(D) < \deg_r(B)$, 
     but $\deg_r(D) \leq \deg_r(A)$) such that $A = C B + D$.
     Assume that the quotient exists, then  
     the computing time is proportional to that of 
     the product of $C$ and $B$. 
     The method used is also called {\bf trial division}, since 
     it is not a priori guaranteed that it succeeds.  
     \index{IPQR}
\item[$C \gets IPPSR(r,A,B)$] $A, B, C \in \IP_r$.
     $C$ is the pseudo remainder of $A$ and $B$.
     The pseudo remainder allways exists and is defined as 
     $${\rm ldcf}(B)^{\delta} \cdot A = Q \cdot B + C$$
     where $\delta \geq \deg_r(A) - \deg_r(B)$ and
     $\deg_r(C) < \deg_r(B)$.
     The computing time is proportional to 
     that of the product of $Q$ and $B$. 
     \index{IPPSR}
\item[$IPREAD(;r,A,V)$] $A \in \IP_r$, $V$ a variable list. 
     The polynomial $A$, the number of variables $r$ and the 
     variable list $V$ are read from the input stream.
     The accepted syntax is:
     \begin{verbatim}
coeff = ( integer | poly )
term  = coeff "*" identifier "**" atom
poly  = "(" term { ( "+" | "-" ) term } ")"  
     \end{verbatim}
     With the context conditions:
     \begin{enumerate}
     \item all \verb/identifier/s in the \verb/term/s 
           of a \verb/poly/nomial must be equal,
     \item the \verb/atom/s must be non--negative and given in 
           strictly decreasing order. 
     \end{enumerate}
     Note further that there are no optional parts 
     in this definition $!$\
     Due to this restricted syntax it is often 
     more convienient to use distributed representation 
     for input and output and to convert 
     the polynomials between the representations.
     \index{IPREAD}
\item[$IPWRIT(r,A,V)$] $A \in \IP_r$, $V$ a variable list. 
     The polynomial $A$ is written to the output stream.
     The output syntax is equal to the input syntax 
     of $IPREAD$. 
     \index{IPWRIT}
\end{deflist}
This concludes the summary of 
integral polynomial arithmetic functions.


For illustration we list 
the algorithms \verb/IPPROD/ and \verb/IPPGSD/ in Modula--2
in MAS.
The function of the algorithms should be clear from the 
step comments and polynomial representation 
discussed before.

{\footnotesize
\begin{verbatim}
  PROCEDURE IPPROD(RL,A,B: LIST): LIST;
  (*Integral polynomial product.  A and B are integral 
  polynomials in r variables, r ge 0.  C=A*B.*)
  VAR  AL, AP, AS, BL, BS, C, C1, CL, EL, FL, RLP: LIST;
  BEGIN
  (*1*) (*a or b zero.*)
        IF (A = 0) OR (B = 0) THEN C:=0; RETURN(C); END;
  (*2*) (*rl=0.*)
        IF RL = 0 THEN C:=IPROD(A,B); RETURN(C); END;
  (*3*) (*general case.*) AS:=CINV(A); BS:=CINV(B); C:=0; 
        RLP:=RL-1;
        REPEAT ADV2(BS, BL,FL,BS); AP:=AS; C1:=SIL;
               REPEAT ADV2(AP, AL,EL,AP);
                      IF RLP = 0 THEN CL:=IPROD(AL,BL); 
                         ELSE CL:=IPPROD(RLP,AL,BL); END;
                      C1:=COMP2(EL+FL,CL,C1);
                      UNTIL AP = SIL;
               C:=IPSUM(RL,C,C1);
               UNTIL BS = SIL;
        RETURN(C);
  (*6*) END IPPROD;
\end{verbatim}
}
\index{IPPROD}
The constructors and selectors for polynomials 
are the list processing functions \verb/COMP2/ and 
\verb/ADV2/. 
\verb/CINV/ means the constructive inverse list 
of its argument.
\verb/IPROD/ denotes the integer product.
\verb/IPSUM/ is the polynomial sum.


{\footnotesize
\begin{verbatim}
  PROCEDURE IPPGSD(RL,A: LIST): LIST; 
  (*Integral polynomial primitive greatest squarefree divisor.  
  A is an integral polynomial in r variables.  If A=0 then B=0.  
  Otherwise B is the greatest squarefree divisor of the primitive 
  part of A.*)
  VAR  B, BP, C, D: LIST; 
  BEGIN
  (*1*) (*a=0.*) 
        IF A = 0 THEN B:=0; RETURN(B); END; 
  (*2*) (*a ne 0.*) B:=IPPP(RL,A); 
        IF FIRST(B) > 0 THEN BP:=IPDMV(RL,B); 
           IPGCDC(RL,B,BP, C,B,D); END; 
        RETURN(B); 
  (*5*) END IPPGSD; 
\end{verbatim}
}
\index{IPPGSD}
\verb/IPPP/ denotes the algorithm which computes 
the primitive part of its argument.
\verb/IPDMV/ stands for derivation in the main variable
and \verb/IPGCDC/ means greatest common divisor and
cofactors. 
In abuse \verb/FIRST/ is used to determine the 
degree of the polynomial \verb/B/.


\subsection{Exercises} %----------------------

Since in the recursive polynomial system are only clumsy 
input / output facilities, we defer the exercises 
to the next section. There we will discuss also the 
conversions between the polynomial representations. 



\section{Dense Polynomial System} %----------------------

A short description of the data structures of the 
dense polynomial system is contained in this section.
No algorithms and no exercises will be presented. 

Again let $R$ be a commutative ring with 1 and let 
$S = R \lbrack X_1, \ldots, X_r \rbrack$ denote a  
(commutative) polynomial ring in $r \geq 0$ variables  
(indeterminates) $X_1, \ldots, X_r$.
$S$ is isomorphic to an univariate polynomial ring 
over a polynomial ring with one less variable:
$$ S' =
 ( \ldots ( (R \lbrack X_1 \rbrack) \lbrack X_2 \rbrack ) 
   \ldots ) \lbrack X_r \rbrack.
$$
The elements of $S'$ are univariate polynomials in the 
{\bf main variable} $X_r$ with coefficients being 
polynomials in the ring  
$( \ldots (R\lbrack X_1 \rbrack ) \ldots) \lbrack X_{r-1} \rbrack$
when $r \geq 1$. 

{\bf Definition:}
Let $A(X_1, \ldots, X_r) \in S'$, $A \neq 0$ and $r \geq 1$,
then 
$$ A(X_1, \ldots, X_r) = 
   \sum_{i=0}^{k} A_i(X_1, \ldots, X_{r-1}) X_r^i
$$ 
with $A_k \neq 0$.
The {\bf dense representation} of $A$ is the list
$$
  \alpha = ( k, \alpha_k, \ldots, \alpha_1, \alpha_0 ) 
$$   
where the $\alpha_i$ denote the  
dense representations of the $A_i$, $i=0,\ldots,k$.  
If $A = 0$ then $\alpha = 0$ and 
if $r = 0$ then $\alpha$ is defined by the 
representation of the base coefficient ring.  

{\bf Notes:}
\begin{enumerate}
\item The variables $X_1, \ldots, X_r$ are not stored 
      in the representing list. This is different to 
      other computer algebra systems.
\item The representation is dense in the sence, that 
      all coefficients, even those which are $= 0$, are stored.
\end{enumerate}

{\bf Examples:}
\begin{enumerate}
\item Let $S = \Z \lbrack X \rbrack$, that is $R = \Z$ and $r = 1$.
      Let $$A = 3 X^4 + 5,$$
      then $k = 4$, $A_4 = 3, A_0 = 5$ the other $A_i = 0$. 
      The representation is then 
      $$ \alpha = ( 4, 3, 0, 0, 0, 5 ). $$
\item Let $S = \Z \lbrack X, Y \rbrack$, 
      that is $R = \Z$ and $r = 2$.
      Let $$A = ( 3 X + 2 ) Y^2 + 5 X,$$
      then $k = 2$, $A_2 = 3 X + 2, A_1 = 0, A_0 = 5 X$. 
      The representation is then 
      $$ \alpha = ( 2, ( 1, 3, 2 ), 0, ( 1, 5, 0 ) ). $$
\item Let $S = \Q \lbrack X, Y \rbrack$, 
      that is $R = \Q$ and $r = 2$.
      Let $$A = \frac{1}{4} X^2 Y - \frac{3}{5}$$
      then $k = 1$, and $A_1 = \frac{1}{4} X^2, 
                         A_0 = \frac{-3}{5} X^0$. 
      The representation is then 
      $$ \alpha = ( 1, ( 2, (1,4), 0, 0 ), ( 0, (-3,5) ) ). $$
\end{enumerate}

We will not discuss algorithms for the dense polynomial 
representation since they are only used in special situations.






