Function Repository Resource:

HessianMatrix

Source Notebook

Compute the Hessian matrix of a function with respect to a list of variables

Contributed by: Wolfram|Alpha Math Team

ResourceFunction["HessianMatrix"][expr,{var1,var2,}]

computes the Hessian matrix of the expression expr with respect to the given variables.

Examples

Basic Examples (3) 

Compute the Hessian matrix of an expression:

In[1]:=
ResourceFunction["HessianMatrix"][x Cos[y], {x, y}]
Out[1]=

Compute the Hessian matrix of another expression:

In[2]:=
ResourceFunction["HessianMatrix"][4 x^2 - y^3, {x, y}]
Out[2]=

Compute the Hessian matrix of another expression:

In[3]:=
ResourceFunction["HessianMatrix"][x^3 - 2 x y - y^6, {x, y}]
Out[3]=

Take the determinant of this result:

In[4]:=
Det[%]
Out[4]=

Compare this to the result obtained using of ResourceFunction["HessianDeterminant"]:

In[5]:=
ResourceFunction["HessianDeterminant"][
  x^3 - 2 x y - y^6, {x, y}] // Expand
Out[5]=

Publisher

Wolfram|Alpha Math Team

Version History

  • 4.0.0 – 23 March 2023
  • 3.1.0 – 11 May 2021
  • 3.0.0 – 24 January 2020
  • 2.0.0 – 06 September 2019
  • 1.0.0 – 05 August 2019

Related Resources

License Information