A bar magnet is often approximated simply as a magnetic dipole with north and south magnetic poles separated by a distance . This is not accurate when the magnet has a significant size, so that magnetic lines of force also emanate from the central portion of the magnet. In this Demonstration, we consider a cylindrical bar magnet of length , radius , and magnetization —the magnetic moment per unit volume, which is characteristic of the ferromagnetic material. The magnetization is assumed to be uniform throughout the volume of the magnet, which neglects slight inhomogeneities and possible deviations from the assumed relation .

The magnetic induction outside the magnet can conveniently be expressed as the negative gradient of a magnetostatic potential: . For a point magnetic dipole , . This is integrated over the volume of the magnet. It is most convenient to work in cylindrical coordinates: for the source and , , for the field point ( can arbitrarily be set equal to 0, in view of the anticipated cylindrical symmetry). The detailed computation is given in Details below. A simplifying feature is that integration over shows that the problem can be reduced to two magnetic monopolar disks separated by the distance .

For ease of visualization, only the field lines in the medial plane of the magnet are shown. The three-dimensional field can easily be pictured by virtue of the cylindrical symmetry about the axis. The lines of force originate from the north pole on the right and terminate on the south pole on the left. Magnetic-induction magnitudes are not emphasized in this Demonstration, only the geometry of field lines.

The magnetic scalar potential is given by a triple integral in cylindrical coordinates:

which can be interpreted as originating from two parallel, oppositely charged monopolar disks of radius separated by a perpendicular distance . The result can be expressed in terms of elliptic functions with complicated arguments and the expressions for the magnetic field components and are even more complicated. It is much easier to do the computations numerically, taking advantage of Mathematica's very efficient NIntegrate routines.