Analytical thermodynamical properties of a two-dimensional electron gas in a magnetic field