The Rosenbrock function (also known as Rosenbrock's valley or banana function) is a classic test function with a narrow, curved valley. While often described as unimodal, it is technically multimodal for \(n \geq 4\).

F05(x)

Arguments

x

Numeric vector of input values (minimum length 2).

Value

Numeric scalar representing the function value.

Details

Formula: $$f(x) = \sum_{i=1}^{n-1} \left[100(x_{i+1} - x_i^2)^2 + (x_i - 1)^2\right]$$

Global minimum: \(f(1, 1, ..., 1) = 0\)

Characteristics:

  • Type: Unimodal (for n < 4), Multimodal (for n >= 4)

  • Separable: No

  • Differentiable: Yes

  • Convex: No

  • Default bounds: \([-30, 30]^n\)

  • Default dimensions: 50

The global minimum lies inside a long, narrow, parabolic-shaped flat valley. Finding the valley is trivial, but converging to the global minimum is difficult.

See also

test-functions for an overview of all test functions, get_function_details to retrieve function parameters.

Examples

F05(c(1, 1))       # Returns 0 (global minimum)
#> [1] 0
F05(c(0, 0))       # Returns 1
#> [1] 1
F05(c(1, 1, 1, 1)) # Returns 0 (global minimum in 4D)
#> [1] 0