The partition function