The force between two magnets is an “inverse cube law” with the additional complication that there’s also a torque which tries to twist the magnets so they align north pole to south pole. Like poles ...