Solution (source code)

= Solution

A <permanent magnet> retains a substantial <magnetization> without an applied coil <electric current>. In a ferromagnetic material this reflects microscopic magnetic moments, <magnetic domains> and their resistance to rearrangement. The history-dependent relation between applied field and <magnetization> gives <magnetic hysteresis>, remanence and coercivity. A soft core used in an <electromagnet> or <electrical transformer> is chosen for easy magnetization and small hysteretic loss; a permanent-magnet material must resist demagnetization.<The Feynman Lectures on Physics, Volume II by Richard Feynman and others>[Chapter 36, especially §36–3 and Figures 36–8 to 36–9: magnetization curves, remanence and hysteresis loss]{ref}

The macroscopic fields obey
$$
\boxed{\mathbf B=\mu_0(\mathbf H+\mathbf M),\qquad \nabla\times\mathbf H=\mathbf J_f,\qquad\nabla\cdot\mathbf B=0}
$$
in <magnetostatics>. The <magnetization> can be represented by equivalent <bound currents>,
$$
\mathbf J_b=\nabla\times\mathbf M,\qquad \mathbf K_b=\mathbf M\times\widehat{\mathbf n}.
$$
Thus both permanent magnetic matter and free coil <electric currents> generate a <magnetic field>. Its <magnetic field lines> form continuous loops; apparent north and south poles are not isolated magnetic charges.

In a long ideal <solenoid>, $H\simeq nI$. A linear core would give $B\simeq\mu_0\mu_r nI$, until saturation or other nonlinear effects invalidate a constant <magnetic permeability>. In a finite magnetic circuit, air gaps and demagnetizing fields affect the field strongly: because the gap has low <magnetic permeability>, it often needs most of the available magnetomotive force. A <permanent magnet> can have a nonzero internal $\mathbf H$ even when $\mathbf J_f=0$, because its boundaries create a demagnetizing field. Hence setting $\mathbf H=0$ merely because there is no free coil <electric current> is generally incorrect.