% $Date: 2004/10/04 17:25:12 $ $Author: nthiery $ $Revision: 1.1.1.3 $

\begin{Mhelppage}{Tos}%
  {V. Prosper}%
  \begin{MInfo}
    \eng{converts any symmetric function into a \Mex{s}-polynomial}
  \end{MInfo}
  
  \MDeclareOption{\Collect}{Collect}
  \MDeclareOption{\NoExpand}{NoExpand}
  
  \begin{MCalls}
    \Mcall{sf\Mopt{,b}\Mopt{,Collect}\Mopt{,NoExpand}}
  \end{MCalls}

  \begin{MParameters}
    \param{sf}
    \eng{any symmetric function}
    \param{b}
    \eng{converts only \Mex{b}-polynomials appearing in \Mex{sf}}
  \end{MParameters}
  \begin{MOptions}
    \option{\NoExpand}
    \eng{keeps the recursive structure of \Mex{sf}}
    \option{\Collect}
    \eng{expresses the result on the \Mex{s}-basis}
  \end{MOptions}

  \begin{MIntro}
    \eng{The {\Mthis} function converts any symmetric function into a
      \Mex{s}-polynomial.
      
      The symmetric function sf is expanded and the result is not
      collected.
      
      One may convert only \Mex{b}-polynomials of \Mex{sf} by adding
      the base \Mex{b} in the arguments.
      
      One may preserve the recursive structure of \Mex{sf} by adding
      the argument \Mex{\NoExpand}.
      
      One may collect the result by adding the argument
      \Mex{\Collect}.  The result will be collected in all
      \Mex{s}-polynomials appearing in \Mex{sf}.  }
  \end{MIntro}

\begin{MExample}{ex1}
\begin{Mexin}
muEC::SYMF::Tos( (e[1,1] - k*h[1,1])^2 * q - p[1]^3 );
\end{Mexin}
\begin{Mexout}
q s[4] + 2 q s[2, 2] + 3 q s[3, 1] + 3 q s[2, 1, 1] +

   q s[1, 1, 1, 1] - s[3] - 4 k q (s[3, 1] + s[2, 1, 1]) -

   2 k q (s[4] + s[2, 2] + s[3, 1]) -

                                                   2
   2 k q (s[2, 2] + s[2, 1, 1] + s[1, 1, 1, 1]) + k  q s[4] +

      2                2                2
   2 k  q s[2, 2] + 3 k  q s[3, 1] + 3 k  q s[2, 1, 1] +

    2
   k  q s[1, 1, 1, 1] - 2 s[2, 1] - s[1, 1, 1]
\end{Mexout}
% \begin{Mexout}[hide]
% s[3]*(-1) + q*s[4] + s[2, 1]*(-2) + q*s[2, 2]*2 + q*s[3, 1]*3 +
% k^2*q*s[4] + s[1, 1, 1]*(-1) + q*s[2, 1, 1]*3 + k^2*q*s[2, 2]*2 +
% k^2*q*s[3, 1]*3 + q*s[1, 1, 1, 1] + k^2*q*s[2, 1, 1]*3 +
% k^2*q*s[1, 1, 1, 1] + k*q*(s[3, 1] + s[2, 1, 1])*(-4) +
% k*q*(s[4] + s[2, 2] + s[3, 1])*(-2) +
% k*q*(s[2, 2] + s[2, 1, 1] + s[1, 1, 1, 1])*(-2)
% \end{Mexout}
\begin{Mexin}
muEC::SYMF::Tos( (e[1,1] - k*h[1,1])^2 * q - p[1]^3, Collect );
\end{Mexin}
\begin{Mexout}
    2
(q k  - 2 q k + q) s[1, 1, 1, 1] - 2 s[2, 1] - s[1, 1, 1] +

         2
   (3 q k  - 6 q k + 3 q) s[2, 1, 1] +

         2
   (3 q k  - 6 q k + 3 q) s[3, 1] +

         2                              2
   (2 q k  - 4 q k + 2 q) s[2, 2] + (q k  - 2 q k + q) s[4] -

   s[3]
\end{Mexout}
% \begin{Mexout}[hide]
% s[3]*(-1) + s[2, 1]*(-2) + s[1, 1, 1]*(-1) + s[4]*(q + k *q*(-2) + k^2*q) +
% (q + k*q*(-2) + k^2*q)*s[1, 1, 1, 1] + s[2, 2]*(q*2 + k*q*(-4) + k^2*q*2) +
% s[3, 1]*(q*3 + k*q*(-6) + k^2*q*3) + s[2, 1, 1]*(q*3 + k*q*(-6) + k^2*q*3)
% \end{Mexout}
\begin{Mexin}
muEC::SYMF::Tos( (e[1,1] - k*h[1,1])^2 * q - p[1]^3, Collect,
     NoExpand );
\end{Mexin}
\begin{Mexout}
                                            2       3
          q (s[2] (k - 1) + (k - 1) s[1, 1])  - s[1]
\end{Mexout}
% \begin{Mexout}[hide]
% s[1]^3*(-1) + q*(s[2]*(k*(-1) + 1) + s[1, 1]*(k*(-1) + 1))^2
% \end{Mexout}
\begin{Mexin}
muEC::SYMF::Tos( (e[1,1] - k*h[1,1])^2 * q - p[1]^3, NoExpand, h );
\end{Mexin}
\begin{Mexout}
                                           2       3
           q (k (s[2] + s[1, 1]) - e[1, 1])  - p[1]
\end{Mexout}
% \begin{Mexout}[hide]
    % p[1]^3*(-1) + q*(e[1, 1] + k*(s[2] + s[1, 1])*(-1))^2
% \end{Mexout}
\end{MExample}

\MRelatedFunctions{Toe,Toh,Tom,Top,SfAddBasis,Sf}
\end{Mhelppage}
