# Force of electromagnet on piece of iron

I can find equations to give the force of an electromagnet on a piece of iron when the iron touches the electromagnet.

But what about when the iron is some distance from the electromagnet? Presumably the force depends on the shape/size of the iron piece as well as the location of the piece away from the magnet.

If anybody can tell me how to calculate this, even if I have to write a numerical calculation routine, I would appreciate any direction on this.

-
 Are you just asking about the force exerted by a magnetic dipole? – Kitchi Feb 11 at 21:23 You'd have to solve for the magnetic field first, which will be function of the pemiability and shape of the core and the other piece. Then you could integrate the force. Probably only possible in practise to do computationally with some sort of finite element technique for other than special case controlled shapes. – Olin Lathrop Feb 11 at 21:47

I believe you can approximate the iron as a collection of dipoles, and calculate the potential energy as $$\frac{1}{2} \int(MB)\rm{d}V$$ over the volume of the iron, where $M$ is the magnetization and $B$ is the total field. This becomes impossibly difficult with a nonlinear magnetic material and an asymmetrical magnet. As always, the gradient of potential energy gives force. Good luck.