Learn R Programming

roptim (version 0.1.5)

example1_rosen_nograd_bfgs: Example 1: Minimize Rosenbrock function (with numerical gradient) using BFGS

Description

Minimize Rosenbrock function (with numerical gradient) using BFGS.

Usage

example1_rosen_nograd_bfgs()

Arguments

Examples

Run this code
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, NULL, method = "BFGS")

## corresponding C++ implementation:
example1_rosen_nograd_bfgs()

Run the code above in your browser using DataLab