Derivation of Hamiltonian of charged particle in EM field I attempt to derive the Hamiltonian of a charged particle in an electromagnetic field but I come up with an additional term. Could you help me check my process?
Using SI units, the Lorentz force on a particle with charge $e$ is
$$
\mathbf{F} = e\mathbf{E} + e\mathbf{v\times B}.
$$
We may write $\mathbf{E}$ and $\mathbf{B}$ as
$$
\mathbf{E} = -\nabla\psi - \frac{\partial\mathbf{A}}{\partial t}
$$
and
$$
\mathbf{B} = \nabla\times\mathbf{A}.
$$
In Einstein's tensor notation, these equations may be written as
$$
F_i = eE_i + e\varepsilon_{ijk}v_jB_k,
$$
$$
E_i = -\frac{\partial \psi}{\partial x_i} - \frac{\partial A_i}{\partial t}
$$
and
$$
B_i = \varepsilon_{ijk}\frac{\partial}{\partial x_j}A_k.
$$
Thus, substituting these last equations on Lorentz's force law,
$$
F_i = -e\frac{\partial \psi}{\partial x_i} - e\frac{\partial A_i}{\partial t} + e\varepsilon_{ijk}\varepsilon_{klm}v_j\frac{\partial}{\partial x_l}A_m.
$$
I perform a permutation $\varepsilon_{ijk} = \varepsilon_{kij}$ and use the well-known relation between the Levi-Civita symbol and the Kronecker delta
$$
\varepsilon_{ijk}\varepsilon_{imn} = \delta_{jm}\delta_{kn} - \delta_{jn}\delta_{km}
$$
to obtain
$$
F_i = e\left(-\frac{\partial\psi}{\partial x_i} - \frac{\partial A_i}{\partial t} + v_j\frac{\partial A_j}{\partial x_i} - v_j\frac{\partial A_i}{\partial x_j}\right).
$$
I identify
$$
\frac{dA_i}{dt} = \frac{\partial A_i}{\partial t} + v_j\frac{\partial A_i}{\partial x_j},
$$
and hence obtain
$$
\frac{d}{dt}\left(p_i + eA_i\right) = e\left(-\frac{\partial\psi}{\partial x_i} + v_j\frac{\partial A_j}{\partial x_i}\right),
$$
where $p_i$ is the $i$th component of momentum and I applied Newton's second law.
The additional term $v_j\partial A_j/\partial x_i$ is the one that seems out of place and stops me from writing this as an equation derivable from Hamilton's equations of motion. Should this term vanish for some reason?
 A: I actually came upon my answer as I finished posting my question, so I might as well share it. The problem was that I was confusing canonical momentum with kinetic momentum. The momentum derivative in Newton's law refers to kinetic momentum $md\mathbf{q}/dt$, and the one in the charged particle Hamiltonian is the conjugate momentum, obtained by Legendre transform of the Lagrangian.
To show this, we consider that it is well-known that the Hamiltonian of the charged particle in an EM field is
$$
H = \frac{1}{2m}\left(p_j - eA_j\right)^2 + e\psi.
$$
Hamilton's equations of motion are
$$
\frac{dq_i}{dt} = \frac{\partial H}{\partial p_i} \qquad \frac{dp_i}{dt} = - \frac{\partial H}{\partial q_i}.
$$
From the first one, we obtain
$$
\frac{dq_i}{dt} = \frac{p_i}{m} - e\frac{A_i}{m}.
$$
From the second one
$$
\frac{dp_i}{dt} = \frac{e}{m}\left(p_j - eA_j\right)\frac{\partial A_j}{\partial q_i} - e\frac{\partial\psi}{\partial q_i}
$$.
Combining these to eliminate the canonical momentum $p_i$, we obtain
$$
\frac{d}{dt}\left(m\frac{dq_i}{dt} + eA_i\right) = e\left(\frac{dq_j}{dt}\frac{\partial A_j}{\partial q_i} - \frac{\partial\psi}{\partial q_i}\right)
$$,
which is the expression I obtained from writing Lorentz's force law in terms of the vector and scalar potentials in my original post, and thus proves that the well-known Hamiltonian is indeed correct, although this procedure would not have been possible had we not known the form of the Hamiltonian a priori.
I hope this helps other people who were stuck with the same problem.
