Calculation of the hysteretic force between a superconductor and a magnet