% $Id: coeffRing.tex,v 1.1.1.2 2004/10/04 17:25:12 nthiery Exp $
\begin{Mhelppage}{coeffRing}{N.~Thiéry}[ImplState=stable,TestState=stable,DocState=stable]
\begin{MInfo}
  \eng{coefficient ring of a polynomial}
\end{MInfo}

\begin{MIntro}
  \eng{\Mthis\Mex{(p)} returns the coefficient ring of \Mpar{p}.}
\end{MIntro}

\begin{MCalls}
  \Mcall{P}
  \Mcall{p}
\end{MCalls}

\begin{MParameters}
  \param{P}
  \eng{a polynomial domain or free module}
  \param{p}
  \eng{a polynomial or free module element}
\end{MParameters}

\begin{MReturnValue}
  \eng{A domain}
\end{MReturnValue}

\begin{MDetails}
  \eng{\Mthis(p) allows to query in a uniform way the coefficient ring
    of the polynomial \Mpar{p} or the polynomial domain \Mpar{P}.
  }%
  \eng{\Mpar{P} can be a polynomial domain
    (\Mup{Dom::UnivariatePolynomial}{x},
    \Mup{Dom::DistributedPolynomial}{[x,y]}, \Mseq{}), or more
    generally some module with basis (\Mup{Cat::ModuleWithBasis}).
  }%
  \eng{\Mpar{P} can also be of the form \Mupc{polylib::Poly}{[x,y],K}.
    If \Mex{K} is \Mup{Expr} or \Mupc{IntMod}{n}, then the
    corresponding domains \Mupc{Dom::ExpressionField}{} or
    \Mupc{Dom::IntegerMod}{p} is returned. See \Mup{poly} for the
    details about \Mup{Expr} and \Mupc{IntMod}{n}.
  }%
  \eng{\Mpar{p} can be a kernel polynomial (\Mup{DOM_POLY}), or an
    element of one of the above domains}
\end{MDetails}

\MKeywords{polynomial, coefficient ring, free module}

\begin{MExample}{ex1}
  \eng{We define a polynomial ring over the ring of integers modulo
    $4$, and query for its coefficient ring:}
  \begin{Mexin}
P := Dom::UnivariatePolynomial(x, Dom::IntegerMod(4)):
polylib::coeffRing(P)
  \end{Mexin}
  \begin{Mexout}
                      Dom::IntegerMod(4)
  \end{Mexout}
  \eng{The coefficient ring of the elements of this domain can be
    queried the same way}:
  \begin{Mexin}
polylib::coeffRing(P(x))
  \end{Mexin}
  \begin{Mexout}
                      Dom::IntegerMod(4)
  \end{Mexout}
  Matrices are also defined over some coefficient ring:
  \begin{Mexin}
polylib::coeffRing(Dom::Matrix(Dom::IntegerMod(3)))
  \end{Mexin}
  \begin{Mexout}
                      Dom::IntegerMod(3)
  \end{Mexout}
\end{MExample}

\begin{MExample}{ex-Expr}
  \eng{When no coefficient ring is specified, \Mup{poly} currently
    constructs kernel polynomials over the fake domain Expr instead of
    the mathematically equivalent field \Mupc{Dom::ExpressionField}{}
    of arbitrary expression (this happens to be more efficient with
    the current kernels):}
  \begin{Mexin}
extop(poly(x))
  \end{Mexin}
  \begin{Mexout}
                         x, [x], Expr
  \end{Mexout}
  \Mex{\Mthis{} returns \Mupc{Dom::ExpressionField}{} in this case:}
  \begin{Mexin}
polylib::coeffRing(poly(x))
  \end{Mexin}
  \begin{Mexout}
                    Dom::ExpressionField()
  \end{Mexout}
  \eng{This makes it possible to plug the result right away as
    coefficient ring of some other domain:}
  \begin{Mexin}
Dom::UnivariatePolynomial(x, polylib::coeffRing(poly(x)))
  \end{Mexin}
  \begin{Mexout}
Dom::UnivariatePolynomial(x, Dom::ExpressionField(), LexOrder)
  \end{Mexout}
\end{MExample}

\begin{MChanges}
  \version{3.0}
  \new
\end{MChanges}

\end{Mhelppage}

%%% Local Variables: 
%%% mode: latex
%%% TeX-master: main
%%% End: 
