Numerical approximation of hysteresis problems