[R] maximum/minimum value of a function

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Sat Jul 11 09:07:59 CEST 2009


On Sat, Jul 11, 2009 at 6:24 AM, milton ruser<milton.ruser at gmail.com> wrote:

> my.values<-myfunction(1,10,100)
> min(my.values)
> max(my.values)

 That finds the minimum and maximum of a limited sample from a
univariate function. Extending this method to ten dimensions might be
a bit tricky...

If you want to find the min or max of a function to a higher
resolution or of higher dimensionality then you need an optimisation
algorithm.

 In R, see help(optim), help(optimise) and help(nlminb). Which one to
use will depend on your function and parameter constraints.

Barry




More information about the R-help mailing list