\subsection{subpoly}
\label{labsubpoly}
\noindent Name: \textbf{subpoly}\\
\phantom{aaa}restricts the monomial basis of a polynomial to a list of monomials\\[0.2cm]
\noindent Library name:\\
\verb|   sollya_obj_t sollya_lib_subpoly(sollya_obj_t, sollya_obj_t)|\\[0.2cm]
\noindent Usage: 
\begin{center}
\textbf{subpoly}(\emph{polynomial}, \emph{list}) : (\textsf{function}, \textsf{list}) $\rightarrow$ \textsf{function}\\
\end{center}
Parameters: 
\begin{itemize}
\item \emph{polynomial} represents the polynomial the coefficients are taken from
\item \emph{list} represents the list of monomials to be taken
\end{itemize}
\noindent Description: \begin{itemize}

\item \textbf{subpoly} extracts the coefficients of a polynomial \emph{polynomial} and builds up a
   new polynomial out of those coefficients associated to monomial degrees figuring in
   the list \emph{list}. 
    
   If \emph{polynomial} represents a function that is not a polynomial, subpoly returns 0.
    
   If \emph{list} is a list that is end-elliptic, let be $j$ the last value explicitly specified
   in the list. All coefficients of the polynomial associated to monomials greater or
   equal to $j$ are taken.
\end{itemize}
\noindent Example 1: 
\begin{center}\begin{minipage}{15cm}\begin{Verbatim}[frame=single]
> p = taylor(exp(x),5,0);
> s = subpoly(p,[|1,3,5|]);
> print(p);
1 + x * (1 + x * (0.5 + x * (1 / 6 + x * (1 / 24 + x * 1 / 120))))
> print(s);
x * (1 + x^2 * (1 / 6 + x^2 / 120))
\end{Verbatim}
\end{minipage}\end{center}
\noindent Example 2: 
\begin{center}\begin{minipage}{15cm}\begin{Verbatim}[frame=single]
> p = remez(atan(x),10,[-1,1]);
> subpoly(p,[|1,3,5...|]);
x * (0.99986632941452949026018468446163586361700915018232 + x^2 * (-0.3303047850
2455936362667794059988443130926433421739 + x^2 * (0.1801592931781875646289423703
7824735129130095574422 + x * (2.284558411542478828511250156535857664242985696307
2e-9 + x * (-8.5156349064111377895500552996061844977507560037485e-2 + x * (-2.71
7563409627750199168187692393409435243830189218e-9 + x * (2.084511343071147293732
39910549169872454686955895e-2 + x * 1.108898611811290576571996643868266300817934
00489512e-9)))))))
\end{Verbatim}
\end{minipage}\end{center}
\noindent Example 3: 
\begin{center}\begin{minipage}{15cm}\begin{Verbatim}[frame=single]
> subpoly(exp(x),[|1,2,3|]);
0
\end{Verbatim}
\end{minipage}\end{center}
See also: \textbf{roundcoefficients} (\ref{labroundcoefficients}), \textbf{taylor} (\ref{labtaylor}), \textbf{remez} (\ref{labremez}), \textbf{fpminimax} (\ref{labfpminimax}), \textbf{implementpoly} (\ref{labimplementpoly})
