Qu

hessian

Builtin index · REPL & diagnostics

hessian(f, x, [step=])

Input: f, x, step · Output: no output

What it is

Takes a scalar-valued function f and a point x, and returns the n x n matrix of second derivatives, symmetrized. This is *not* a Jacobian of grad: the backward pass builds its adjoints from plain untracked values, so the gradient it returns carries no tape node and cannot be differentiated a second time. Instead the inner derivative is exact (reverse-mode) and the outer one is central finite differences of that analytic gradient, so the error is the O(step^2) truncation term alone rather than the compounded error of differencing f itself twice. step= sets the relative step, default 1e-5, scaled by

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
hessian(f, x, [step=])
f scalar or matrixTakes a scalar-valued function f and a point x, and returns the n x n matrix of second derivatives, symmetrized.
x scalar or matrixTakes a scalar-valued function f and a point x, and returns the n x n matrix of second derivatives, symmetrized.
step optionalstep= sets the relative step, default 1e-5, scaled by .
not documented yetThis is *not* a Jacobian of grad: the backward pass builds its adjoints from plain untracked values, so the gradient it returns carries no tape node and cannot be differentiated a second time.

Examples

No documentation example calls this form yet. The REPL & diagnostics chapter is where one belongs.