I am new to mathematica and I really struggling at finding the hessian for this function:
$$U=\sum_{i=1}^{N-1}\sum_{j=i+1}^{N}\varphi(r_{ij}),$$
where
$\qquad r_{ij}=\sqrt{(x_i^1-x_j^1)^2+(x_i^2-x_j^2)^2+(x_i^3-x_j^3)^2}$
$\qquad \varphi =4\epsilon_{ij} \left[\left(\frac{\sigma_{ij}}{r_{ij}}\right)^{12}-\left(\frac{\sigma_{ij}}{r_{ij}}\right)^{6}\right]$
$(x_i^1,x_i^2,x_i^3)$ are the Cartezian coordinates in $\mathbb{R}^3$ and $\epsilon_{ij}$ and $\sigma_{ij}$ are constants.
I looked at this answer, especially the second answer, but it is very complicated to follow. I don't understand the steps.
Any help is appreciated.
My try:
Format[r[i_, j_]] = Subscript[r, i, j]
Format[x[i_, m_]] = Subsuperscript[x, i, m]
r[i_, j_] = Sqrt[Sum[(x[i, m] - x[j, m])^2, {m, 1, 3}]]
Clear[U]
U =
4*eps*Sum[Sum[(sig/r[i, j])^12 - (sig/r[i, j])^6, {j, i + 1, n}], {i, 1, n - 1}]
D[D[U, x[i, m]], x[j, l]]