hessian
hessian(f, x)Take the Hessian matrix of a function of a parameter vector.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| f | callable | A function taking a numeric vector and returning one number. | required |
| x | array_like | The point to differentiate at. | required |
Returns
| Name | Type | Description |
|---|---|---|
| numpy.ndarray | The square symmetric Hessian. |
Examples
>>> import corehydropy as ch
>>> ch.hessian(lambda p: p[0]**2 + 2 * p[1]**2 + p[0] * p[1], [1.0, 2.0]).round(3)
array([[2., 1.],
[1., 4.]])