gncpy.math.get_hessian

get_hessian(x, fnc, f_args=(), step_size=0.0001220703125)[source]

Calculates the hessian of a function.

Numerically calculates the hessian using the central difference method.

Parameters:
  • x (numpy array) – DESCRIPTION.

  • fnc (callable) – The function to evaluate, must be of the form f(x, *f_args).

  • f_args (tuple, optional) – Additional arguments for the function. The default is ().

  • step_size (float, optional) – Step size for differentiation. The default is np.finfo(float).eps**(1 / 4).

Returns:

Hessian of the function.

Return type:

N x N array