Hi all,

I'm using optimize() to find the minimum of the following function f, and 
minimize it (without 

f<-function(delta,P,U){
    minimiz<-P+delta*U
    x<-minimiz[1]
    y<-minimiz[2]
    z<-100*(y-x^2)^2+(1-x)^2
    return(z)
}

result<-optimize(f, interval=c(-1, 10000), P=c(0.99,1.01), U=c(1,0))
result


Nothing unexpected in the output so far:

> result<-optimize(f, interval=c(-1, 10000), P=c(0.99,1.01), U=c(1,0))
> result
$minimum
[1] 0.01498144

$objective
[1] 2.482991e-05


But, when I choose a larger Interval in the optimization method:

result<-optimize(f, interval=c(-100, 100000), P=c(0.99,1.01), U=c(1,0))
result

> result<-optimize(f, interval=c(-100, 100000), P=c(0.99,1.01), U=c(1,0))
> result
$minimum
[1] -1.989997

$objective
[1] 4.01


The result gets worse (even though the old interval is included in the new one).

In fact I don't want any restrictons for the interval values (something like 
interval=(-Inf, Inf) or at least the interval should be as large as possible.

Does anyone know this strange behavior? Where does it come from?

Thank you,
Fabian
                                          
        [[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
and provide commented, minimal, self-contained, reproducible code.

Reply via email to