Recasting magnetic hysteresis problem in terms of Rayleigh’s variational principle | Synapse