A calculation of the Fermi function