\Header{area}{Adaptive Numerical Integration}
\keyword{nonlinear}{area}
\begin{Description}\relax
Integrate a function of one variable over a finite range using a
recursive adaptive method.  This function is mainly for
demonstration purposes.
\end{Description}
\begin{Usage}
\begin{verbatim}
area(f, a, b, ..., fa = f(a, ...), fb = f(b, ...),
     limit = 10, eps = 1e-05)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{f}] The integrand as an \code{S} function object.  The variable of integration must be
the first argument.

\item[\code{a}] Lower limit of integration.

\item[\code{b}] Upper limit of integration.

\item[\code{...}] Additional arguments needed by the integrand.

\item[\code{fa}] Function value at the lower limit.

\item[\code{fb}] Function value at the upper limit.

\item[\code{limit}] Limit on the depth to which recursion is allowed to go.

\item[\code{eps}] Error tolerance to control the process.

\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The method divides the interval in two and compares the values given by
Simpson's rule and the trapezium rule.  If these are within eps of each
other the Simpson's rule result is given, otherwise the process is applied
separately to each half of the interval and the results added together.
\end{Details}
\begin{Value}
The integral from \code{a} to \code{b} of \code{f(x)}.
\end{Value}
\begin{References}\relax
Venables, W. N. and Ripley, B. D. (1994)
\emph{Modern Applied Statistics with S-Plus.} Springer.
pp. 105--110.
\end{References}
\begin{Examples}
\begin{ExampleCode}
area(sin, 0, pi)  # integrate the sin function from 0 to pi.
\end{ExampleCode}
\end{Examples}

