### abstract

- We present closed analytical expressions for the particle and kinetic energy spatial densities at finite temperatures for a system of noninteracting fermions (bosons) trapped in a d-dimensional harmonic oscillator potential. For d=2 and 3, exact expressions for the N-particle densities are used to calculate perturbatively the temperature dependence of the splittings of the energy levels in a given shell due to a very weak interparticle interaction in a dilute Fermi gas. In two dimensions, we obtain analytically the surprising result that the |l|-degeneracy in a harmonic oscillator shell is not lifted in the lowest order even when the exact, rather than the Thomas-Fermi expression for the particle density is used. We also demonstrate rigorously (in two dimensions) the reduction of the exact zero-temperature fermionic expressions to the Thomas-Fermi form in the large-N limit.