I encountered a really counter-intuitive result this past week regarding the Hessians of a simple 2D Harmonic Oscillator:
It is clear that the energies for and
are the same, and the forces are identical in magnitude except opposite in direction.
However, while the internal Hessian and therefore positive semi-definite (PSD) every where w.r.t.
, this is not the case for the 4×4 Cartesian Hessian
. In fact, the Cartesian Hessian is PSD only if
, that is, it has only positive eigenvalues or zero. We can actually analytically show that the eigenvalues of the Cartesian Hessian are
and
where:
So if then the eigenvalue is negative (no longer PSD), and if
then the eigenvalue is positive (PSD).
To see this for yourself in sympy, the code is:
import sympy as sp from sympy.functions import Abs, sqrt from IPython.display import display, Math x0, x1, y0, y1, b = sp.symbols('x0 x1 y0 y1 b', real=True) U = ((sqrt((x0-x1)**2+(y0-y1)**2)-b)**2)/2 sp.init_printing() args = (x0, y0, x1, y1) H = sp.Matrix(list(sp.derive_by_array(sp.derive_by_array(U, args), args))) H = H.reshape(4,4) H = sp.simplify(H) H.eigenvals()