# Computing the partition function from a Metropolis Monte Carlo sample

I must be missing something. I could not find an answer in similar posts.

Suppose I have an energy $$E(x)$$ and have sampled many points, $$\{x_1, x_2, ..., x_N\}$$ through a Metropolis Monte Carlo simulation. If the space is high enough dimension such that numerically integrating over the space is impossible, what are my options for estimating the partition function (or free energy)?

P.S. I don't really care about the accuracy of the estimate. This question is more for didactic reasons than for practical ones.

• Sampled according to which distribution? -- Note that from a normalized sample of the Gibbs distribution, you cannot reconstruct the normalization (unless you use the sample to estimate the entropy and compute the free energy). Jul 8, 2021 at 9:40
• What is each individual point $x_i$? Jul 8, 2021 at 9:55
• Correct, I was assuming the canonical ensemble. And $x \in \mathbb{R}^N$ where $N$ is the dimension of the space. $x_i$ is a single point in $\mathbb{R}^N$ and is the $i$th point in the sample. Jul 9, 2021 at 10:19

Metropolis Monte Carlo is a method for calculating averages, like $$\langle f(x)\rangle = \frac{\int f(x)p(x)dx}{\int p(x)dx}.$$ One cannot however calculate the normalization constant, $$Z=\int p(x)dx$$. In physics this is usually not a problem, since the partition function is not a measurable quantity - it is a convenient tool for deriving equations analytically, but it is not really a goal in itself, and not needed when performing numerical calculations.