hessian

Hessian matrix of second partial derivatives of a symbolic scalar function.

Category: Mathematics > Calculus

Syntax

H = hessian(f, v)

Second derivatives of f with respect to the variables in v.

H = hessian(f)

Uses all symbolic variables found in f.

Description

The Hessian describes the curvature of f. At a point where the gradient vanishes, a positive definite Hessian means a local minimum, a negative definite one a local maximum, and an indefinite one a saddle. It is also the Jacobian of the gradient.

Input arguments

f
Scalar symbolic expression.
v
Vector of symbolic variables.

Output arguments

H
Square symmetric matrix; entry (i, j) is diff(f, v(i), v(j)).

Example

Hessian of x^2 y

syms x y
H = hessian(x^2*y, [x y])
Output
H = 
[2*y, 2*x]
[2*x,   0]

See also

jacobian diff gradient eig