\HeaderA{intg}{Integration}{intg}
\keyword{math}{intg}
\begin{Description}\relax
This function calculates the integration of y with respect to x.
\end{Description}
\begin{Usage}
\begin{verbatim}
intg(y, x)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] a vector of real values, not necessarily sorted.
\item[\code{y}] a vector of function values at x.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
(x,y)s are sorted according to ascending x values and then
the integration is calculated as sum of the products of average of adjacent y values and the difference of adjacent x values.
\end{Details}
\begin{Author}\relax
Xiaochun Li
\end{Author}
\begin{Examples}
\begin{ExampleCode}
x <- seq(0, 1,length=100)
y <- x^2
intg(y, x)
\end{ExampleCode}
\end{Examples}

