exact partition function