Solution (source code)

= Solution

Let $x^\mu=(ct,\mathbf x)$, let $\tau$ be <proper time>, and define the <four-velocity> and <four-momentum> by
$$
u^\mu=\frac{dx^\mu}{d\tau}=\gamma(c,\mathbf v),
\qquad
p^\mu=mu^\mu=(\mathcal E/c,\mathbf p).
$$
If $F^{\mu\nu}$ is the <electromagnetic field tensor>, the covariant <Lorentz force> law is
$$
\boxed{\frac{dp^\mu}{d\tau}=qF^{\mu\nu}u_\nu}.
$$
The temporal component and three spatial components respectively give
$$
\boxed{\frac{d\mathcal E}{dt}=q\mathbf E\cdot\mathbf v},
\qquad
\boxed{\frac{d\mathbf p}{dt}
=q(\mathbf E+\mathbf v\times\mathbf B)}.
$$
Here $\mathcal E=\gamma mc^2$ is the relativistic <energy> and $\mathbf p=\gamma m\mathbf v$ is the relativistic <momentum>. In the nonrelativistic <limit>, $\gamma\to1$, so the spatial equation becomes
$$
m\frac{d\mathbf v}{dt}
=q(\mathbf E+\mathbf v\times\mathbf B),
$$
the usual Lorentz-force law.