### Background

Consider an electron with mass $1$ moving in $\mathbb R^n$ in under the influence of a static electromagnetic field. Up to identifying vector fields with differential forms, Maxwell's equations state that the electric force is given by a closed one-form and the magnetic field is given by a closed two-form. Since $\mathbb R^n$ is contractible, we can pick antiderivatives of each of these: let $C$ be the electric potential (a function on $\mathbb R^n$) and $B$ the magnetic potential (a one-form on $\mathbb R^n$). Again identifying vectors with covectors, the equations of motion of the electron are: $$ \ddot q = dB\cdot \dot q + dC \quad\quad \text{(EOM)} $$ where $q(t)$ is the position at time $t$, I have identified one-forms with vector fields, and $\cdot$ is the pairing that takes the two-form $dB$ and the vector $\dot q$ to a covector. (Pick your favorite sign, perhaps swapping $B$ for $-B$ below.)

Pick an open set $U \subseteq \mathbb R^n$ and let $Q: U \times [0,1] \to \mathbb R^n$ satisfy: $Q(x,0) = 0$, $Q(x,1) = x$, and $Q(x,-)$ is a solution to (EOM) for each $x \in \mathbb R^n$; i.e. $Q$ is a family of solutions to (EOM) starting at $0$ and parameterized by the value at $t=1$. Define the *Hamilton principal function* $S$ on $U$ by
$$ S(x) = \int_0^1 \left( \frac12 \left( \frac{\partial Q}{\partial t}(x,t)\right)^2 + B\bigl(Q(x,t)\bigr) \cdot \frac{\partial Q}{\partial t}(x,t) + C\bigl(Q(x,t)\bigr) \right) dt $$
$S$ depends on the choice of antiderivatives $B,C$ from the first paragraph. It satisfies:
$$ \frac{\partial S}{\partial x}(x) = \frac{\partial Q}{\partial t}(x,1) + B(x) $$
up to identifying vectors and covectors. So the differential $dS = \frac{\partial S}{\partial x}$ does not depend on the choice $C$ of antiderivative of the electric field. ~~By differentiating again, the Hessian $\frac{\partial^2 S}{\partial x^2}$ does not depend on the choice $B$ of antiderivative of the magnetic field.~~

### My question

~~I know how to prove that the Hessian of $S$ is nondegenerate on the open set $U$. I would like to know whether the Hessian is necessarily positive-definite?~~

Suppose that $B = 0$. (See my answer below when $B \neq 0$; sorry about bringing it into play before, I was confused.) Does it follow that the Hessian of $S$ is positive-definite?

### Some examples

I can work very few examples. In particular, I know the answer when $B = 0$ and $C(q)$ is homogeneous quadratic. Pick a basis in which $C(q)$ is diagonalized, and let the eigenvalues be $C_1,\dots,C_n$. Then the Hessian is diagonalized in the same basis. If $C_i = 0$, then the $i$th eigenvalue of the Hessian is $1$; if $C_i > 0$, then the $i$th eigenvalue of the Hessian is $C_i / \sinh^2\!\! \sqrt{C_i}$. If $C_i < 0$, then the $i$th eigenvalue is $|C_i| / \sin^2\!\! \sqrt{|C_i|}$. (Actually, this is true even if $C(q)$ is quadratic but not homogeneously so; let $C_i$ be the eigenvalues of the homogeneous part.)

But the other examples I've thought of seem to require either coupled ODEs or elliptic integrals, so I haven't solved them directly.

### Bonus question

I used the metric on $\mathbb R^n$ twice: once in (EOM) to identify the vector $\ddot q$ with the covector on the RHS, and once in the definition of $S$ to square the vector $\frac{\partial Q}{\partial t}$. But consistently changing the metric in both places allows everything to be defined still. Up to changing bases, the only way to change a metric is to change its signature. Anyway, in the quadratic case, changing the signature of the metric changes the signature of the Hessian in exactly the same way. So I expect that the correct statement is that the ratio of the Hessian to the metric is positive-definite. But I'm not sure.

### Bonus bonus question

Experts know that one can equations of motion and Hamilton principal functions for much more general Lagrangian functions $L: \mathbb R^{2n} \to \mathbb R$ — suppose that the matrix $\frac{\partial^2 L}{\partial v^2}(v,q)$ is invertible for every $(v,q)$, so that the equations of motion define a nondegenerate second-order ODE. Then is the Hessian of the action necessarily positive-definite?