[R] Optimize multiple variable sets

peter dalgaard pdalgd at gmail.com
Mon Dec 6 15:39:43 CET 2010

On Dec 6, 2010, at 15:15 , Jonathan P Daily wrote:

> Correct me if I'm wrong, but isn't the minimal x value in your example the 
> same regardless of what positive coefficient you apply to x? If that is 
> the case, you would expect the same min(x) for each iteration.
> i.e. in the interval [0,1] the minimum x value of x^2 + x is the same as 
> x^2 + 100000000*x, at x = 0.

You're wrong --- slightly. The returned $minimum is the x, the y is  $objective. But the interval given doesn't bracket the minimum, as you'll clearly see if you put int=c(-10,10). The only puzzling bit is that optimize() doesn't actually return the left endpoint, but rather the first evaluation point inside the interval. The rather wide tolerance of .Machine$double.eps^0.25  == 0.0001220703 probably plays a role in this.

Peter Dalgaard
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com

More information about the R-help mailing list