\Header{optimize}{One Dimensional Optimization}
\alias{optimise}{optimize}
\keyword{optimize}{optimize}
\begin{Description}\relax
The function \code{optimize} searches the interval from
\code{lower} to \code{upper} for a minimum or maximum of
the function \code{f} with respect to its first argument.

It uses Fortran code (from Netlib) based on algorithms given in the
reference.

\code{optimise} is an alias for \code{optimize}.\end{Description}
\begin{Usage}
\begin{verbatim}
optimize(f = , interval = , lower = min(interval),
        upper = max(interval), maximum = FALSE,
        tol = .Machine$double.eps^0.25, ...)
optimise(f = , interval = , lower = min(interval),
        upper = max(interval), maximum = FALSE,
        tol = .Machine$double.eps^0.25, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{f}] the function to be optimized. The function is
either minimized or maximized over its first argument
depending on the value of \code{maximum}.
\item[\code{interval}] a vector containing the end-points of the interval
to be searched for the minimum.
\item[\code{lower}] the lower end point of the interval
to be searched.
\item[\code{upper}] the upper end point of the interval
to be searched.
\item[\code{maximum}] logical. Should we maximize or minimize (the default)?
\item[\code{tol}] the desired accuracy.
\item[\code{...}] additional arguments to \code{f}.
\end{ldescription}
\end{Arguments}
\begin{Value}
A list with components \code{minimum} (or \code{maximum})
and \code{objective} which give the location of the minimum (or maximum)
and the value of the function at that point.\end{Value}
\begin{References}\relax
Brent, R. (1973)
\emph{Algorithms for Minimization without Derivatives.}
Englewood Cliffs N.J.: Prentice-Hall.\end{References}
\begin{SeeAlso}\relax
\code{\Link{nlm}}, \code{\Link{uniroot}}.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
f <- function (x,a) (x-a)^2
xmin <- optimize(f, c(0, 1), tol = 0.0001, a = 1/3)
xmin
\end{ExampleCode}
\end{Examples}

