Semiclassical mechanics of the quadratic Zeeman effect