The above treatment applies to quantum statistical mechanics, where a physical system inside a finite-sized box will typically have a discrete set of energy eigenstates, which we can use as the states s above. In quantum mechanics, the partition function can be more formally written as a trace over the state space (which is independent of the choice of basis): Z = tr ⁡ ⁡ ( e − − β β H ^ ^ ) , where Ĥ is the quantum Hamiltonian operator. The exponential of an operator can be defined using the exponential power series.