Solution (source code)

= Solution

Because $\nabla\cdot\mathbf B=0$, a <magnetic vector potential> can be introduced with $\mathbf B=\nabla\times\mathbf A$. It is not unique: $\mathbf A+\nabla\chi$ gives the same field. In <magnetostatics>, the <Coulomb gauge> $\nabla\cdot\mathbf A=0$ gives $\nabla^2\mathbf A=-\mu_0\mathbf J$ in vacuum. For localized <electric currents>,
$$
\mathbf A(\mathbf r)=\frac{\mu_0}{4\pi}\int
\frac{\mathbf J(\mathbf r')}{|\mathbf r-\mathbf r'|}\,dV'.
$$
A <magnetic scalar potential> is more restricted. In a simply connected current-free region of constant permeability, write $\mathbf B=-\nabla\psi$; then $\nabla^2\psi=0$. Alternatively define the scalar potential for $\mathbf H$, differing by a constant permeability factor. \b[A single-valued scalar potential generally cannot cover a domain encircling a net <electric current>], even where the local curl vanishes. The <vector> potential does not require the field itself to be curl-free.