On hysteresis in elasto-plasticity and in ferromagnetism