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.  
 A: 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.
A: The equation $F=(NI)^2\mu_0A/2g^2$ should help. This equation gives the force in Newtons of an electromagnet  given the number of turns in the electromagnetic coil ($N$), the current flowing through the electromagnet ($I$), the magnetic permeability of a vacuum ($\mu_0$, or just mu _0 in Google), the cross-sectional frontal area of the ferromagnetic material ($A$), and the distance of the ferromagnetic material ($g$). The units for $A$ and $g$ are arbitrary, as long as you're consistent with the usage. $F$ will always be in Newtons, and $\mu_0$ is a constant of nature (sometimes called the magnetic constant). 
Good luck with whatever you're using this for!
