Field of a cylindrical bar magnet calculated with Ampère's model

Two models are used to calculate the magnetic fields of and the forces between magnets. The physically correct method is called the Ampère model while the easier model to use is often the Gilbert model.

Ampère model: In the Ampère model, all magnetization is due to the effect of microscopic, or atomic, circular, also called Ampèrian currents throughout the material. The net effect of these microscopic bound currents is to make the magnet behave as if there is a macroscopic electric current flowing in loops in the magnet with the magnetic field normal to the loops. The Ampère model gives the exact magnetic field both inside and outside the magnet. It is usually difficult to calculate the Ampèrian currents on the surface of a magnet, though, whereas it is often easier to find the effective poles for the same magnet.

Gilbert model: However, a version of the magnetic pole approach is used by professional magneticians to design permanent magnets. In this approach, the pole surfaces of a permanent magnet are imagined to be covered with so-called magnetic charge, north pole particles on the north pole and south pole particles' on the south pole, that are the source of the magnetic field lines. If the magnetic pole distribution is known, then outside the magnet the pole model gives the magnetic field exactly. In the interior of the magnet this model fails to give the correct field. This pole model is also called the Gilbert model of a magnetic dipole. Griffiths suggests (p. 258): "My advice is to use the Gilbert model, if you like, to get an intuitive 'feel' for a problem, but never rely on it for quantitative results."

### Magnetic dipole moment

Far away from a magnet, the magnetic field created by that magnet is almost always described (to a good approximation) by a dipole field characterized by its total magnetic dipole moment, . This is true regardless of the shape of the magnet, so long as the magnetic moment is non-zero. One characteristic of a dipole field is that the strength of the field falls off inversely with the cube of the distance from the magnet's center.

The magnetic moment, therefore, of a magnet is a measure of its strength and orientation. A loop of electric current, a bar magnet, an electron, a molecule, and a planet all have magnetic moments. More precisely, the term magnetic moment normally refers to a system's **magnetic dipole moment**, which produces the first term in the multipole expansion of a general magnetic field.

Both the torque and force exerted on a magnet by an external magnetic field are proportional to that magnet's magnetic moment. The magnetic moment, like the magnetic field it produces, is a vector field; it has both a magnitude and direction. The direction of the magnetic moment points from the south to north pole of a magnet. For example the direction of the magnetic moment of a bar magnet, such as the one in a compass is the direction that the north poles points toward.

In the physically correct Ampère model, magnetic dipole moments are due to infinitesimally small loops of current. For a sufficiently small loop of current, , and area, , the magnetic dipole moment is:

,

where the direction of is normal to the area in a direction determined using the current and the right-hand rule. As such, the SI unit of magnetic dipole moment is ampere meter2. More precisely, to account for solenoids with many turns the unit of magnetic dipole moment is Ampere-turn meter2.

In the Gilbert model, the magnetic dipole moment is due to two equal and opposite magnetic charges that are separated by a distance, . In this model, is similar to the electric dipole moment due to electrical charges:

,

where m is the 'magnetic charge'. The direction of the magnetic dipole moment points from the negative south pole to the positive north pole of this tiny magnet.

### Magnetic force due to non-uniform magnetic field

Magnets are drawn into regions of higher magnetic field. The simplest example of this is the attraction of opposite poles of two magnets. Every magnet produces a magnetic field that is stronger near its poles. If opposite poles of two separate magnets are facing each other, each of the magnets are drawn into the stronger magnetic field near the pole of the other. If like poles are facing each other though, they are repulsed from the larger magnetic field.

The Gilbert model almost predicts the correct mathematical form for this force and is easier to understand qualitatively. For if a magnet is placed in a uniform magnetic field then both poles will feel the same magnetic force but in opposite directions, since they have opposite magnetic charge. But, when a magnet is placed in the non-uniform field, such as that due to another magnet, the pole experiencing the large magnetic field will experience the large force and there will be a net force on the magnet. If the magnet is aligned with the magnetic field, corresponding to two magnets oriented in the same direction near the poles, then it will be drawn into the larger magnetic field. If it is oppositely aligned, such as the case of two magnets with like poles facing each other, then the magnet will be repelled from the region of higher magnetic field.

,

where the gradient ∇ is the change of the quantity m · B per unit distance, and the direction is that of maximum increase of m · B. To understand this equation, note that the dot product m · B = mBcos(), where and represent the magnitude of the m and B vectors and is the angle between them. If m is in the same direction as B then the dot product is positive and the gradient points 'uphill' pulling the magnet into regions of higher B-field (more strictly larger m · B). B represents the strength and direction of the magnetic field. This equation is strictly only valid for magnets of zero size, but is often a good approximation for not too large magnets. The magnetic force on larger magnets is determined by dividing them into smaller regions having their own m then summing up the forces on each of these regions.

### Gilbert Model

The Gilbert model assumes that the magnetic forces between magnets are due to magnetic charges near the poles. While physically incorrect, this model produces good approximations that work even close to the magnet when the magnetic field becomes more complicated, and more dependent on the detailed shape and magnetization of the magnet than just the magnetic dipole contribution. Formally, the field can be expressed as a multipole expansion: A dipole field, plus a quadrupole field, plus an octopole field, etc. in the Ampère model, but this can be very cumbersome mathematically.

### Calculating the magnetic force

Calculating the attractive or repulsive force between two magnets is, in the general case, an extremely complex operation, as it depends on the shape, magnetization, orientation and separation of the magnets. The Gilbert model does depend on some knowledge of how the 'magnetic charge' is distributed over the magnetic poles. It is only truly useful for simple configurations even then. Fortunately, this restriction covers many useful cases.

#### Force between two magnetic poles

If both poles are small enough to be represented as single points then they can be considered to be point magnetic charges. Classically, the force **between two** magnetic poles is given by:

where

is force (SI unit: newton) 1 and 2 are the magnitudes of magnetic poles (SI unit: ampere-meter) is the permeability of the intervening medium (SI unit: tesla meter per ampere, henry per meter or newton per ampere squared) is the separation (SI unit: meter).

The pole description is useful to practicing magneticians who design real-world magnets, but real magnets have a pole distribution more complex than a single north and south. Therefore, implementation of the pole idea is not simple. In some cases, one of the more complex formulas given below will be more useful.