Displaying 1 result from an estimated 1 matches for "grra".
Did you mean:
gra
2000 Mar 17
1
optim: problem with additional arguments (PR#493)
...ditonal
argument. Note that the call to optim works fine unless a hessian is
requested.
## Rosenbrock Banana function, modified to take an additional
argument
fra <- function(x,a) {
x1 <- x[1]
x2 <- x[2]
a * (x2 - x1 * x1)^2 + (1 - x1)^2
}
grra <- function(x,a) {
x1 <- x[1]
x2 <- x[2]
c(-4*a * x1 * (x2 - x1 * x1) - 2 * (1 - x1), 2*a * (x2 - x1 *
x1))
}
a <- 100
xx <- c(-2.1,1)
optim(c(-1.2,1), fra, grra, method = "BFGS",a=100) # this
works
optim(c(-1.2,1), fra, grra, met...