\Header{uniroot}{One Dimensional Root Finding}
\keyword{optimize}{uniroot}
\begin{Usage}
\begin{verbatim}
uniroot(f, interval, lower = min(interval), upper = max(interval),
        tol = .Machine$double.eps^0.25, maxiter = 1000, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\texttt{f}] the function for which the root is sought.
\item[\texttt{interval}] a vector containing the end-points of the interval
to be searched for the root.
\item[\texttt{lower}] the lower end point of the interval to be searched.
\item[\texttt{upper}] the upper end point of the interval to be searched.
\item[\texttt{tol}] the desired accuracy (convergence tolerance).
\item[\texttt{maxiter}] the maximum number of iterations.
\item[\texttt{...}] additional arguments to \texttt{f}.
\end{ldescription}
\end{Arguments}
\begin{Description}
The function \texttt{uniroot} searches the interval from \texttt{lower}
to \texttt{upper} for a zero of the function \texttt{f} with respect to
its first argument.\end{Description}
\begin{Details}
Either \texttt{interval} or both \texttt{lower} and \texttt{upper} must be
specified.  The function uses Fortran subroutine \file{"zeroin"} (from
Netlib) based on algorithms given in the reference below.

If the algorithm does not converge in \texttt{maxiter} steps, a warning
is printed and the current approximation is returned.\end{Details}
\begin{Value}
A list with four components: \texttt{root} and \texttt{f.root} give the
location of the root and the value of the function evaluated at that
point. \texttt{iter} and \texttt{estim.prec} give the number of iterations
used and an approximate estimated precision for \texttt{root}.\end{Value}
\begin{References}
Brent, R. (1973).
\emph{Algorithms for Minimization without Derivatives}.
Englewood Cliffs, NJ: Prentice-Hall.\end{References}
\begin{SeeAlso}
\texttt{\Link{polyroot}} for all complex roots of a polynomial;
\texttt{\Link{optimize}}, \texttt{\Link{nlm}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
f <- function (x,a) x - a
str(xmin <- uniroot(f, c(0, 1), tol = 0.0001, a = 1/3))
str(uniroot(function(x) x*(x^2-1) + .5, low=-2, up=2, tol = 0.0001),dig=10)
str(uniroot(function(x) x*(x^2-1) + .5, low=-2, up=2, tol = 1e-10 ),dig=10)
\end{ExampleCode}
\end{Examples}

