Hi Derek,

like this?

myfunction<-function(xmin, xmax, number_of_values)
 {
 xvalues<-seq(from=xmin, to=xmax, by = ((xmax - xmin)/(number_of_values -
1)))
 outputvalues<-xvalues^2+(xmax/xvalues)^3*runif(number_of_values)
 return(outputvalues)
 }
my.values<-myfunction(1,10,100)
min(my.values)
max(my.values)
plot(my.values)
bests

milton



On Fri, Jul 10, 2009 at 11:11 PM, Derek An <derekan2@gmail.com> wrote:

> Dear All,
>
> Does anyone know how to get the maximum/minimum value of a function using
> R,
>
> I think there should be an instruction, but i can not find it in help files
>
> Thank you in advance for your help :)
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
> and provide commented, minimal, self-contained, reproducible code.
>

	[[alternative HTML version deleted]]


