I'd like to approximate the force from a solenoid, or at the very least find a formula which is proportional to the force so that I can experimentally find the constant for my particular case. Apparently an exact answer to this is hard and involves quantum physics that is a bit beyond me; something about the Ising model. I've found $F =\frac{(NI)^2 μ_0A}{2g^2}$, where $N$ is number of loops, $I$ is current though the solenoid, $A$ is cross-sectional area of the inside of the solenoid and $g$ is the "is the length of the gap between the solenoid and a piece of metal". I found that here.
Is this a decent approximation? If so could you more rigorously define $g$, because I don't know what distance this is supposed to be? If it is not, what might I use instead? I found the Gilbert model on Wikipedia that is apparently a good approximation of the force between magnets. Could I use this to approximate the force on a piece of iron from a solenoid?