Energy stored in the magnetic field of an inductor:
$ \displaystyle \xi = i R + L\frac{di}{dt} $
$ \displaystyle \xi i = i^2R + L i\frac{di}{dt} $
Here , ξ i is the power supplied by the battery, i2R is the electrical power dissipated in the resistance and Li(di/dt) is the Rate of energy stored in the inductor
ξ i dt = i2Rdt + Li di
Energy stored in the inductor is
$ \displaystyle U_B = \int_{0}^{I}L i di $
$ \displaystyle U_B = \frac{1}{2}L I^2 $
Exercise : Referring to the previous illustration find the energy stored in the inductor when the current I is dropped to a value of 5A.