Solution (source code)

= Solution

In <magnetostatics>, <Ampère's circuital law> in vacuum is
$$
\oint_C\mathbf B\cdot d\boldsymbol\ell=\mu_0I_{\rm enc},
\qquad\nabla\times\mathbf B=\mu_0\mathbf J.
$$
It is especially useful when symmetry makes the tangential field constant on an <Amperian loop>. It gives $B=\mu_0I/(2\pi r)$ for an infinite straight wire, $B\simeq\mu_0nI$ inside a long <solenoid>, and $B\simeq\mu NI/(2\pi r)$ in an ideal <toroid>. The long-solenoid and toroidal expressions neglect fringing.

For time-dependent fields, <displacement current> is essential:
$$
\oint_C\mathbf B\cdot d\boldsymbol\ell
=\mu_0I_{\rm enc}+\mu_0\epsilon_0\frac{d\Phi_E}{dt}.
$$
In matter, the corresponding macroscopic form is $\oint\mathbf H\cdot d\boldsymbol\ell=I_{\rm free}+d\!\int\mathbf D\cdot d\mathbf A/dt$. \b[The enclosed <electric current> alone is sufficient only in the magnetostatic limit.]