\hypertarget{namespacepolynomial__functions}{}\doxysection{polynomial\+\_\+functions Module Reference}
\label{namespacepolynomial__functions}\index{polynomial\_functions@{polynomial\_functions}}


\doxysubsection{Detailed Description}
Polynomial functions. 

Date of creation\+: 2008.\+06.\+12 L. White

This module contains routines that handle polynomials. \doxysubsection*{Functions/\+Subroutines}
\begin{DoxyCompactItemize}
\item 
real function, public \mbox{\hyperlink{namespacepolynomial__functions_adb2b5d18db527314545e8e21638a2872}{evaluation\+\_\+polynomial}} (coeff, ncoef, x)
\begin{DoxyCompactList}\small\item\em Pointwise evaluation of a polynomial at x. \end{DoxyCompactList}\item 
real function, public \mbox{\hyperlink{namespacepolynomial__functions_a38462b1bc63d3f1f441e4d340c2b4627}{first\+\_\+derivative\+\_\+polynomial}} (coeff, ncoef, x)
\begin{DoxyCompactList}\small\item\em Calculates the first derivative of a polynomial evaluated at a point x. \end{DoxyCompactList}\item 
real function, public \mbox{\hyperlink{namespacepolynomial__functions_ae7112cbad01d6a9477bbaf4a9695ed7a}{integration\+\_\+polynomial}} (xi0, xi1, Coeff, npoly)
\begin{DoxyCompactList}\small\item\em Exact integration of polynomial of degree npoly. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Function/\+Subroutine Documentation}
\mbox{\Hypertarget{namespacepolynomial__functions_adb2b5d18db527314545e8e21638a2872}\label{namespacepolynomial__functions_adb2b5d18db527314545e8e21638a2872}} 
\index{polynomial\_functions@{polynomial\_functions}!evaluation\_polynomial@{evaluation\_polynomial}}
\index{evaluation\_polynomial@{evaluation\_polynomial}!polynomial\_functions@{polynomial\_functions}}
\doxysubsubsection{\texorpdfstring{evaluation\_polynomial()}{evaluation\_polynomial()}}
{\footnotesize\ttfamily real function, public polynomial\+\_\+functions\+::evaluation\+\_\+polynomial (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in)}]{coeff,  }\item[{integer, intent(in)}]{ncoef,  }\item[{real, intent(in)}]{x }\end{DoxyParamCaption})}



Pointwise evaluation of a polynomial at x. 

The polynomial is defined by the coefficients contained in the array of the same name, as follows\+: C(1) + C(2)x + C(3)x$^\wedge$2 + C(4)x$^\wedge$3 + ... where C refers to the array \textquotesingle{}coeff\textquotesingle{}. The number of coefficients is given by ncoef and x is the coordinate where the polynomial is to be evaluated. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em coeff} & The coefficients of the polynomial \\
\hline
\mbox{\texttt{ in}}  & {\em ncoef} & The number of polynomial coefficients \\
\hline
\mbox{\texttt{ in}}  & {\em x} & The position at which to evaluate the polynomial \\
\hline
\end{DoxyParams}


Definition at line 20 of file polynomial\+\_\+functions.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{20 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)} :: coeff\textcolor{comment}{ !< The coefficients of the polynomial}}
\DoxyCodeLine{21   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)} :: ncoef\textcolor{comment}{ !< The number of polynomial coefficients}}
\DoxyCodeLine{22 \textcolor{keywordtype}{  real},               \textcolor{keywordtype}{intent(in)} :: x\textcolor{comment}{     !< The position at which to evaluate the polynomial}}
\DoxyCodeLine{23   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{24   \textcolor{keywordtype}{integer} :: k}
\DoxyCodeLine{25 \textcolor{keywordtype}{  real}    :: f    \textcolor{comment}{! value of polynomial at x}}
\DoxyCodeLine{26 }
\DoxyCodeLine{27   f = 0.0}
\DoxyCodeLine{28   \textcolor{keywordflow}{do} k = 1,ncoef}
\DoxyCodeLine{29     f = f + coeff(k) * ( x**(k-\/1) )}
\DoxyCodeLine{30 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{31 }
\DoxyCodeLine{32   evaluation\_polynomial = f}
\DoxyCodeLine{33 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacepolynomial__functions_a38462b1bc63d3f1f441e4d340c2b4627}\label{namespacepolynomial__functions_a38462b1bc63d3f1f441e4d340c2b4627}} 
\index{polynomial\_functions@{polynomial\_functions}!first\_derivative\_polynomial@{first\_derivative\_polynomial}}
\index{first\_derivative\_polynomial@{first\_derivative\_polynomial}!polynomial\_functions@{polynomial\_functions}}
\doxysubsubsection{\texorpdfstring{first\_derivative\_polynomial()}{first\_derivative\_polynomial()}}
{\footnotesize\ttfamily real function, public polynomial\+\_\+functions\+::first\+\_\+derivative\+\_\+polynomial (\begin{DoxyParamCaption}\item[{real, dimension(\+:), intent(in)}]{coeff,  }\item[{integer, intent(in)}]{ncoef,  }\item[{real, intent(in)}]{x }\end{DoxyParamCaption})}



Calculates the first derivative of a polynomial evaluated at a point x. 

The polynomial is defined by the coefficients contained in the array of the same name, as follows\+: C(1) + C(2)x + C(3)x$^\wedge$2 + C(4)x$^\wedge$3 + ... where C refers to the array \textquotesingle{}coeff\textquotesingle{}. The number of coefficients is given by ncoef and x is the coordinate where the polynomial\textquotesingle{}s derivative is to be evaluated. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em coeff} & The coefficients of the polynomial \\
\hline
\mbox{\texttt{ in}}  & {\em ncoef} & The number of polynomial coefficients \\
\hline
\mbox{\texttt{ in}}  & {\em x} & The position at which to evaluate the derivative \\
\hline
\end{DoxyParams}


Definition at line 44 of file polynomial\+\_\+functions.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{44 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)} :: coeff\textcolor{comment}{ !< The coefficients of the polynomial}}
\DoxyCodeLine{45   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)} :: ncoef\textcolor{comment}{ !< The number of polynomial coefficients}}
\DoxyCodeLine{46 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{intent(in)}               :: x\textcolor{comment}{     !< The position at which to evaluate the derivative}}
\DoxyCodeLine{47   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{48   \textcolor{keywordtype}{integer}                               :: k}
\DoxyCodeLine{49 \textcolor{keywordtype}{  real}                                  :: f    \textcolor{comment}{! value of polynomial at x}}
\DoxyCodeLine{50 }
\DoxyCodeLine{51   f = 0.0}
\DoxyCodeLine{52   \textcolor{keywordflow}{do} k = 2,ncoef}
\DoxyCodeLine{53     f = f + real(k-\/1)*coeff(k) * ( x**(k-\/2) )}
\DoxyCodeLine{54 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{55 }
\DoxyCodeLine{56   first\_derivative\_polynomial = f}
\DoxyCodeLine{57 }

\end{DoxyCode}
\mbox{\Hypertarget{namespacepolynomial__functions_ae7112cbad01d6a9477bbaf4a9695ed7a}\label{namespacepolynomial__functions_ae7112cbad01d6a9477bbaf4a9695ed7a}} 
\index{polynomial\_functions@{polynomial\_functions}!integration\_polynomial@{integration\_polynomial}}
\index{integration\_polynomial@{integration\_polynomial}!polynomial\_functions@{polynomial\_functions}}
\doxysubsubsection{\texorpdfstring{integration\_polynomial()}{integration\_polynomial()}}
{\footnotesize\ttfamily real function, public polynomial\+\_\+functions\+::integration\+\_\+polynomial (\begin{DoxyParamCaption}\item[{real, intent(in)}]{xi0,  }\item[{real, intent(in)}]{xi1,  }\item[{real, dimension(\+:), intent(in)}]{Coeff,  }\item[{integer, intent(in)}]{npoly }\end{DoxyParamCaption})}



Exact integration of polynomial of degree npoly. 

The array of coefficients (Coeff) must be of size npoly+1. 
\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em xi0} & The lower bound of the integral \\
\hline
\mbox{\texttt{ in}}  & {\em xi1} & The lower bound of the integral \\
\hline
\mbox{\texttt{ in}}  & {\em coeff} & The coefficients of the polynomial \\
\hline
\mbox{\texttt{ in}}  & {\em npoly} & The degree of the polynomial \\
\hline
\end{DoxyParams}


Definition at line 64 of file polynomial\+\_\+functions.\+F90.


\begin{DoxyCode}{0}
\DoxyCodeLine{64 \textcolor{keywordtype}{  real},               \textcolor{keywordtype}{intent(in)} :: xi0\textcolor{comment}{   !< The lower bound of the integral}}
\DoxyCodeLine{65 \textcolor{keywordtype}{  real},               \textcolor{keywordtype}{intent(in)} :: xi1\textcolor{comment}{   !< The lower bound of the integral}}
\DoxyCodeLine{66 \textcolor{keywordtype}{  real}, \textcolor{keywordtype}{dimension(:)}, \textcolor{keywordtype}{intent(in)} :: Coeff\textcolor{comment}{ !< The coefficients of the polynomial}}
\DoxyCodeLine{67   \textcolor{keywordtype}{integer},            \textcolor{keywordtype}{intent(in)} :: npoly\textcolor{comment}{ !< The degree of the polynomial}}
\DoxyCodeLine{68   \textcolor{comment}{! Local variables}}
\DoxyCodeLine{69   \textcolor{keywordtype}{integer}                           :: k}
\DoxyCodeLine{70 \textcolor{keywordtype}{  real}                              :: integral}
\DoxyCodeLine{71 }
\DoxyCodeLine{72   integral = 0.0}
\DoxyCodeLine{73 }
\DoxyCodeLine{74   \textcolor{keywordflow}{do} k = 1,npoly+1}
\DoxyCodeLine{75     integral = integral + coeff(k) * (xi1**k -\/ xi0**k) / real(k)}
\DoxyCodeLine{76 \textcolor{keywordflow}{  enddo}}
\DoxyCodeLine{77 \textcolor{comment}{!}}
\DoxyCodeLine{78 \textcolor{comment}{!One non-\/answer-\/changing way of unrolling the above is:}}
\DoxyCodeLine{79 \textcolor{comment}{!  k=1}}
\DoxyCodeLine{80 \textcolor{comment}{!  integral = integral + Coeff(k) * (xi1**k -\/ xi0**k) / real(k)}}
\DoxyCodeLine{81 \textcolor{comment}{!  if (npoly>=1) then}}
\DoxyCodeLine{82 \textcolor{comment}{!    k=2}}
\DoxyCodeLine{83 \textcolor{comment}{!    integral = integral + Coeff(k) * (xi1**k -\/ xi0**k) / real(k)}}
\DoxyCodeLine{84 \textcolor{comment}{!  endif}}
\DoxyCodeLine{85 \textcolor{comment}{!  if (npoly>=2) then}}
\DoxyCodeLine{86 \textcolor{comment}{!    k=3}}
\DoxyCodeLine{87 \textcolor{comment}{!    integral = integral + Coeff(k) * (xi1**k -\/ xi0**k) / real(k)}}
\DoxyCodeLine{88 \textcolor{comment}{!  endif}}
\DoxyCodeLine{89 \textcolor{comment}{!  if (npoly>=3) then}}
\DoxyCodeLine{90 \textcolor{comment}{!    k=4}}
\DoxyCodeLine{91 \textcolor{comment}{!    integral = integral + Coeff(k) * (xi1**k -\/ xi0**k) / real(k)}}
\DoxyCodeLine{92 \textcolor{comment}{!  endif}}
\DoxyCodeLine{93 \textcolor{comment}{!  if (npoly>=4) then}}
\DoxyCodeLine{94 \textcolor{comment}{!    k=5}}
\DoxyCodeLine{95 \textcolor{comment}{!    integral = integral + Coeff(k) * (xi1**k -\/ xi0**k) / real(k)}}
\DoxyCodeLine{96 \textcolor{comment}{!  endif}}
\DoxyCodeLine{97 \textcolor{comment}{!}}
\DoxyCodeLine{98   integration\_polynomial = integral}
\DoxyCodeLine{99 }

\end{DoxyCode}
