Solution (source code)

= Solution

Take the divergence of the <Ampère-Maxwell equation>. Since the divergence of a curl is zero, <Gauss's law> gives
$$
0=\mu_0\nabla\cdot J
+\mu_0\epsilon_0\frac{\partial}{\partial t}(\nabla\cdot E)
=\mu_0\left(\nabla\cdot J+\frac{\partial\rho}{\partial t}\right).
$$
Thus
$$
\frac{\partial\rho}{\partial t}+\nabla\cdot J=0,
$$
which is <charge conservation from Maxwell equations>. Integrating over a fixed volume and using the divergence theorem yields
$$
\frac{dQ}{dt}=-\int_{\partial V}J\cdot n\,dS.
$$
Charge in $V$ is conserved provided no current crosses $\partial V$. For total charge in all space, the corresponding assumption is sufficient decay of $J$ so that the flux at infinity vanishes.