math_audio_test_functions/functions/alpine_n2.rs
1//! Alpine N2 test function
2
3use ndarray::Array1;
4
5/// Alpine N.2 function - multimodal with single global minimum
6/// Global minimum on `[0, 10]^N`: each dimension is near `7.917`, with
7/// 2D value approximately `-7.885`.
8/// Bounds: x_i in [0, 10]
9pub fn alpine_n2(x: &Array1<f64>) -> f64 {
10 -x.iter()
11 .map(|&xi| xi.max(0.0).sqrt() * xi.sin())
12 .product::<f64>()
13}