[R] optim bug/help?
rkevinburton at charter.net
rkevinburton at charter.net
Wed Oct 22 22:37:08 CEST 2008
In the documentation for 'optim' it gives the following function:
fr <- function(x) { ## Rosenbrock Banana function
x1 <- x[1]
x2 <- x[2]
100 * (x2 - x1 * x1)^2 + (1 - x1)^2
}
optim(c(-1.2,1), fr)
When I run this code I get:
$par
[1] 1.000260 1.000506
I am sure I am missing something but why isn't 1,1 a better answer? If I plug 1,1 in the function it seems that the function is zero. Whereas the answer given gives a function result of 8.82e-8. This was after 195 calls to the function (as reported by optim). The documentation indicates that the 'reltol' is about 1e-8. Is this the limit that I am bumping up against?
Kevin
More information about the R-help
mailing list