For an electromagnet with a cylindrical bore, producing a pure multipole field of order
, the stored magnetic energy is:

Here,
is the permeability of free space,
is the effective length of the magnet (the length of the magnet, including the fringing fields),
is the number of turns in one of the coils (such that the entire device has
turns), and
is the current flowing in the coils. Formulating the energy in terms of
can be useful, since the magnitude of the field and the bore radius do not need to be measured.
Note that for a non-electromagnet, this equation still holds if the magnetic excitation can be expressed in Amperes.
The equation for stored energy in an arbitrary magnetic field is:[3]

Here,
is the permeability of free space,
is the magnitude of the field, and
is an infinitesimal element of volume. Now for an electromagnet with a cylindrical bore of radius
, producing a pure multipole field of order
, this integral becomes:

Ampere's Law for multipole electromagnets gives the field within the bore as:[4]

Here,
is the radial coordinate. It can be seen that along
the field of a dipole is constant, the field of a quadrupole magnet is linearly increasing (i.e. has a constant gradient), and the field of a sextupole magnet is parabolically increasing (i.e. has a constant second derivative). Substituting this equation into the previous equation for
gives:




