pub fn gradient_2_point<T>(
f: &T,
x: &[f64],
step_size: Option<f64>,
) -> Result<Vec<f64>, ErrorsJSL>Expand description
The gradient ∇f(x) of a scalar function of several variables by central differences, one
coordinate at a time (2n evaluations).
step_size is relative: coordinate i is perturbed by h · max(|xᵢ|, 1), with default
h = ε^{1/3} (about ten correct digits for well-scaled functions).