|MadSci Network: Physics|
First, I apologize for the delay in posting this answer. I was out of town and forgot to notify the network. Second, to obtain a simple formula, it is necessary to make some assumptions. I will assume that the magnets are perfect dipoles, which means that the distance between the north and south pole of each magnet is much smaller than the distance between the magnets. If this is not true, the equation gets quite complicated. From "Introduction to Electrodynamics" by David J. Griffiths, Section 5.4, the magnetic field of a dipole at the origin pointing in the +z direction is B=-mu/4pi *m/r^3 in the z direction at a point on the x axis where m is the magnetic dipole moment and r is the distance from the dipole. Then the force of this dipole on another dipole situated on the x axis pointing in the +x direction is 3 mu m1 * m2/(4pi * x^4)in the z direction where m1 and m2 are the magnetic dipole moments of the first and second dipoles respectively. To model a theoretical force for equal magnetic dipoles, you can just let m1 = m2 =an arbitrary constant. You can work this out for different orientations of the dipoles. Griffiths is a good reference to use.
Try the links in the MadSci Library for more information on Physics.