To compute the gradient of a function, it can be made with matematica using Grad[f[x,y],{x,y}]

Suprisingly, it's not possible to compute the Hessian matrix (something as HessianMatrix[f[x,y],{x,y}], doesn't exist (I check in Wolfram website here, but nothing relevant). Is it possible that mathematica can't compute the Hessian of a function ? And if no (what I guess), how can I do ?

  • $\begingroup$ Here's a link in here: mathematica.stackexchange.com/questions/123403/… Also, very convenient now to just google anything you want in mathematica to find it usually here. That's what I did, I just googled: "Hessian matrix in mathematica" to get to that link. $\endgroup$ – Dominic Feb 19 at 13:10
  • 11
    $\begingroup$ D[f[x, y], {{x, y}, 2}] $\endgroup$ – cvgmt Feb 19 at 13:20
  • $\begingroup$ @Dominic: Thanks a lot for your message. Indeed, I found this link, but trying to apply it, didn't work with me... I'll see if I can apply it properly. $\endgroup$ – tiko Feb 19 at 13:21
  • 2
    $\begingroup$ Here's another from Mathworld: HessianH[f_, x_List?VectorQ] := D[f, {x, 2}] $\endgroup$ – Dominic Feb 19 at 13:23
  • 4
    $\begingroup$ Presumably, you entered something wrong when testing solution by @Dominic. With HessianH[f_, x_List?VectorQ] := D[f, {x, 2}] then HessianH[f[x, y], {x, y}] == D[f[x, y], {{x, y}, 2}] evaluates to True $\endgroup$ – Bob Hanlon Feb 19 at 14:11