Displaying 1 result from an estimated 1 matches for "banana2".
Did you mean:
banana
2005 Dec 04
1
Understanding nonlinear optimization and Rosenbrock's banana valley function?
...b
}
nlm(banana1, c(-1.2, 1)) # solved the problem in 24 iterations
nlminb(c(-1.2, 1), banana, Dbanana)# solution in 35 iterations
D2banana <- function(x){
a11 <- (2 - 400*(x[2] - x[1]^2) + 800*x[2]*x[1]^2)
a21 <- (-400*x[1])
matrix(c(a11,a21,a21,200),2,2)
}
banana2 <- function(x){
b <- 100*(x[2]-x[1]^2)^2+(1-x[1])^2
attr(b, "gradient") <- Dbanana(x)
attr(b, "hessian") <- D2banana(x)
b
}
nlm(banana2, c(-1.2, 1))
# Found the valley but not the minimum
# in the default 100 iterations.
nlm(banana2, c(-1.2, 1), iterlim=...