Skip to main content

math_audio_test_functions/functions/
easom.rs

1//! Easom test function
2
3use ndarray::Array1;
4
5/// Easom function - multimodal with very narrow global basin
6/// Global minimum: f(x) = -1 at x = (π, π)
7/// Bounds: x_i in [-100, 100]
8pub fn easom(x: &Array1<f64>) -> f64 {
9    let x1 = x[0];
10    let x2 = x[1];
11    -x1.cos()
12        * x2.cos()
13        * (-(x1 - std::f64::consts::PI).powi(2) - (x2 - std::f64::consts::PI).powi(2)).exp()
14}