# Symbolic second variation (quadratic form matrix)

Mathematica has a calculus of variations package that can compute the first variational derivative symbolically, rather nicely.

Does anyone know if there is a way to compute the quadratic form matrix associated to the second variation of a given functional, in Mathematica? That package does not have it.

More specifically, to determine whether a function is a minimum or maximum (i.e. analog of the second derivative test in calculus), one needs to consider the spectrum of the quadratic form associated to the second variation of a functional. But this is rather hard to calculate in my case, and I cannot find a way to ask mathematica to compute it.

Somewhat related is this question, without an answer.

Just for details, in my case, the variational functional looks like: $$J[\phi,\theta] = \iiint_\Omega R(x,y,z; \phi,\theta,\partial_i\phi,\partial_i\theta,\partial_{ij}\phi,\partial_{ij}\theta)\,dV$$ where $\phi,\theta:\mathbb{R}^3\rightarrow\mathbb{R}$, the $\partial_i,\partial_{ij}$ denote all the first and second partial derivatives of $\theta$ and $\phi$, and $R:\mathbb{R}^3\rightarrow\mathbb{R}$ is a rather complicated function of space.