Mathematical energy storage