Energy stored in a magnet system