Skip to main content

math_audio_test_functions/functions/
quartic.rs

1//! Quartic test function
2
3use ndarray::Array1;
4
5/// Quartic function with noise - unimodal with added random noise
6/// Global minimum: f(x) ≈ 0 at x = (0, 0, ..., 0)
7/// Bounds: x_i in [-1.28, 1.28]
8pub fn quartic(x: &Array1<f64>) -> f64 {
9    x.iter()
10        .enumerate()
11        .map(|(i, &xi)| (i as f64 + 1.0) * xi.powi(4))
12        .sum::<f64>()
13    // Note: Original includes random noise, but we omit it for deterministic testing
14}