math_audio_test_functions/functions/shubert.rs
1//! Shubert test function
2
3use ndarray::Array1;
4
5/// Shubert function - highly multimodal with many global minima
6/// Global minimum: f(x) = -186.7309 (2D), multiple locations
7/// Bounds: x_i in [-10, 10]
8pub fn shubert(x: &Array1<f64>) -> f64 {
9 x.iter()
10 .map(|&xi| {
11 (1..=5)
12 .map(|i| {
13 let i_f64 = i as f64;
14 i_f64 * ((i_f64 + 1.0) * xi + i_f64).cos()
15 })
16 .sum::<f64>()
17 })
18 .product()
19}