\subsection{composepolynomials}
\label{labcomposepolynomials}
\noindent Name: \textbf{composepolynomials}\\
\phantom{aaa}computes an approximation to the composition of two polynomials and bounds the error\\[0.2cm]
\noindent Library name:\\
\verb|   sollya_obj_t sollya_lib_composepolynomials(sollya_obj_t, sollya_obj_t)|\\[0.2cm]
\noindent Usage: 
\begin{center}
\textbf{composepolynomials}(\emph{p},\emph{q}) : (\textsf{function}, \textsf{function}) $\rightarrow$ \textsf{structure}\\
\end{center}
Parameters: 
\begin{itemize}
\item \emph{p} and \emph{q} are polynomials
\end{itemize}
\noindent Description: \begin{itemize}

\item Given two polynomials $p$ and $q$, \textbf{composepolynomials}(\emph{p}, \emph{q}) computes an 
   approximation $r$ to the polynomial $(p \circ q)$ and bounds the
   error polynomial $r - (p \circ q)$ using interval arithmetic.

\item \textbf{composepolynomials} always returns a structure containing two elements,
   \texttt{poly} and \texttt{radii}.  The element
   \texttt{poly} is contains the approximate composed polynomial
   $r$. The element \texttt{radii} contains a list of $n + 1$ 
   intervals $a_i$ bounding the coefficients of the
   error polynomial, which is of the same degree $n$ as is the
   composed polynomial $(p \circ q)$.  This is, there exist
   $\alpha_i \in a_i$ such that 
   $$\sum\limits_{i=0}^n \alpha_i \, x^i = r(x) - (p \circ q)(x).$$

\item In the case when either of $p$ or $q$ is not a polynomial, \textbf{composepolynomials}
   behaves like \textbf{substitute} used in a literate structure. The list of intervals
   bounding the coefficients of the error polynomial is returned empty.
\end{itemize}
\noindent Example 1: 
\begin{center}\begin{minipage}{15cm}\begin{Verbatim}[frame=single]
> composepolynomials(1 + 2 * x + 3 * x^2 + 4 * x^3, 5 + 6 * x + 7 * x^2);
{ .radii = [|[0;0], [0;0], [0;0], [0;0], [0;0], [0;0], [0;0]|], .poly = 586 + x 
* (1992 + x * (4592 + x * (6156 + x * (6111 + x * (3528 + x * 1372))))) }
\end{Verbatim}
\end{minipage}\end{center}
\noindent Example 2: 
\begin{center}\begin{minipage}{15cm}\begin{Verbatim}[frame=single]
> print(composepolynomials(1/5 * x + exp(17) + log(2) * x^2, x^4 + 1/3 * x^2));
{ .radii = [|[-3.5873240686715317015647477332221852960774705712039e-43;3.5873240
686715317015647477332221852960774705712039e-43], [0;0], [-2.67276471009219564614
0536467151481878815196880105e-51;2.672764710092195646140536467151481878815196880
105e-51], [0;0], [-1.069105884036878258456214586860592751526078752042e-50;1.0691
05884036878258456214586860592751526078752042e-50], [0;0], [-2.138211768073756516
912429173721185503052157504084e-50;2.1382117680737565169124291737211855030521575
04084e-50], [0;0], [-1.069105884036878258456214586860592751526078752042e-50;1.06
9105884036878258456214586860592751526078752042e-50]|], .poly = 2.415495275357529
82147754351803858238798675673527228e7 + x^2 * (6.6666666666666666666666666666666
666666666666666666e-2 + x^2 * (0.27701635339554947882413690238424184089727779270
67 + x^2 * (0.46209812037329687294482141430545104538366675624017 + x^2 * 0.69314
718055994530941723212145817656807550013436026))) }
\end{Verbatim}
\end{minipage}\end{center}
\noindent Example 3: 
\begin{center}\begin{minipage}{15cm}\begin{Verbatim}[frame=single]
> composepolynomials(sin(x),x + x^2);
{ .radii = [| |], .poly = sin(x * (1 + x)) }
\end{Verbatim}
\end{minipage}\end{center}
See also: \textbf{substitute} (\ref{labsubstitute})
