Skip to main content

hessian_2_point

Function hessian_2_point 

Source
pub fn hessian_2_point<T>(
    f: &T,
    x: &[f64],
    step_size: Option<f64>,
) -> Result<Vec<Vec<f64>>, ErrorsJSL>
where T: Fn(&[f64]) -> f64,
Expand description

The Hessian ∇²f(x) of a scalar function by central differences: second differences on the diagonal and the four-point cross difference off it (1 + 2n + 2n(n − 1) evaluations).

step_size is relative, with default h = ε^{1/4} (about eight correct digits): the step that balances the O(h²) truncation error of a second difference against its ε/h² rounding error.