The energy of steady currents
We can now use our knowledge that $U_{\text{total}}=-U_{\text{mech}}$ to find the true energy of steady currents in magnetic fields. We can begin with the true energy of a small current loop. Calling $U_{\text{total}}$ just $U$, we write \begin{equation} \label{Eq:II:15:16} U=\FLPmu\cdot\FLPB. \end{equation}  Although we calculated this energy for a plane rectangular loop, the same result holds for a small plane loop of any shape. We can find the energy of a circuit of any shape by imagining that it is made up of small current loops. Say we have a wire in the shape of the loop $\Gamma$ of Fig. 15–4. We fill in this curve with the surface $S$, and on the surface mark out a large number of small loops, each of which can be considered plane. If we let the current $I$ circulate around each of the little loops, the net result will be the same as a current around $\Gamma$, since the currents will cancel on all lines internal to $\Gamma$. Physically, the system of little currents is indistinguishable from the original circuit. The energy must also be the same, and so is just the sum of the energies of the little loops. If the area of each little loop is $\Delta a$, its energy is $I\Delta aB_n$, where $B_n$ is the component normal to $\Delta a$. The total energy is \begin{equation*} U=\sum IB_n\,\Delta a. \end{equation*}  Going to the limit of infinitesimal loops, the sum becomes an integral, and \begin{equation} \label{Eq:II:15:17} U=I\int B_n\,da=I\int\FLPB\cdot\FLPn\,da, \end{equation}  where $\FLPn$ is the unit normal to $da$. If we set $\FLPB=\FLPcurl{\FLPA}$, we can connect the surface integral to a line integral, using Stokes’ theorem, \begin{equation} \label{Eq:II:15:18} I\int_S(\FLPcurl{\FLPA})\cdot\FLPn\,da=I\oint_\Gamma\FLPA\cdot d\FLPs, \end{equation}  where $d\FLPs$ is the line element along $\Gamma$. So we have the energy for a circuit of any shape: \begin{equation} \label{Eq:II:15:19} U=I\underset{\text{circuit}}{\oint}\FLPA\cdot d\FLPs, \end{equation}  In this expression $\FLPA$ refers, of course, to the vector potential due to those currents (other than the $I$ in the wire) which produce the field $\FLPB$ at the wire. Now any distribution of steady currents can be imagined to be made up of filaments that run parallel to the lines of current flow. For each pair of such circuits, the energy is given by (15.19), where the integral is taken around one circuit, using the vector potential $\FLPA$ from the other circuit. For the total energy we want the sum of all such pairs. If, instead of keeping track of the pairs, we take the complete sum over all the filaments, we would be counting the energy twice (we saw a similar effect in electrostatics), so the total energy can be written \begin{equation} \label{Eq:II:15:20} U=\tfrac{1}{2}\int\FLPj\cdot\FLPA\,dV. \end{equation}  This formula corresponds to the result we found for the electrostatic energy: \begin{equation} \label{Eq:II:15:21} U=\tfrac{1}{2}\int\rho\phi\,dV. \end{equation}  So we may if we wish think of $\FLPA$ as a kind of potential for currents in magnetostatics. Unfortunately, this idea is not too useful, because it is true only for static fields. In fact, neither of the equations (15.20) and (15.21) gives the correct energy when the fields change with time.