Stored energy of a solenoid (source code)

= Stored energy of a solenoid
{title2=$U=\tfrac12LI^2$}

The <magnetic energy> stored in a linear <solenoid> of constant <self-inductance> $L$ is
$$
U=\frac12LI^2,
\qquad
U\approx\frac{B^2}{2\mu_0}A\ell
$$
in the <long-solenoid approximation>. The first formula is an <inductor> relation; the second identifies its storage with <magnetic energy> in the interior <magnetic field>, under the vacuum-core approximation. This agreement joins the <electrical circuit> description to the spatial <magnetic field> description. The expression $B^2/(2\mu_0)$ is the vacuum magnetic <energy density>. https://s3.amazonaws.com/edx-textbooks/mit_802_textbook/Chapter11.pdf[MIT 8.02 course notes, §11.3: magnetic energy and its density]{ref}.

A short derivation starts from the terminal <electric potential difference> $v_L=L\,dI/dt$, with positive <electric current> entering the terminal at higher potential. The absorbed <power> is $v_LI$, and integrating from zero <electric current> gives
$$
U=\int_0^I Li\,di=\frac12LI^2.
$$
The result describes recoverable storage in the <inductor>; <Joule heating> in the wire is a separate expenditure of <energy>. https://www.feynmanlectures.caltech.edu/II_17.html#Ch17-S8[Feynman lectures, II.17–8: inductance and magnetic energy]{ref}.

For the long-coil example, $L\approx4.9348\,\mathrm{mH}$ and $I=0.50\,\mathrm A$ give $U\approx6.1685\times10^{-4}\,\mathrm J=0.61685\,\mathrm{mJ}$. Substituting the ideal $B\approx1.256637\,\mathrm{mT}$ and volume $A\ell\approx9.8175\times10^{-4}\,\mathrm{m^3}$ into $B^2A\ell/(2\mu_0)$ gives the same value. Doubling <electric current> quadruples stored <magnetic energy>. In a real coil, reducing <electric current> can return this <energy> to an <electrical circuit>, or release it as <Joule heating> in a closed <RL circuit>.