Monte Carlo Method

The central computational problem of equilibrium statistical mechanics is the evaluation of ensemble averages ⟨A⟩=∑CA(C) Peq(C)\langle A\rangle = \sum_C A(C)\,P_{\mathrm{eq}}(C) with Peq(C)=e−βE(C)/ZP_{\mathrm{eq}}(C)=e^{-\beta E(C)}/Z the Boltzmann distribution over configurations CC. For an Ising model on a modest 20×20×2020\times20\times20 lattice the configuration space holds 28000≈1024082^{8000}\approx 10^{2408} states — direct summation is forever impossible. The Monte Carlo method replaces the exact sum by a statistical estimate built from a finite, cleverly chosen sample of configurations, and it is the single idea that made computational statistical mechanics a quantitative science. The naive plan of drawing configurations uniformly at random and weighting each by e−βEe^{-\beta E} is useless: in the thermodynamic limit the equilibrium probability concentrates on an exponentially small sliver of configuration space near the typical energy, so a uniform sample almost never lands where the integrand is large. The resolution is importance sampling — generate configurations directly with probability Peq(C)P_{\mathrm{eq}}(C), so that ⟨A⟩\langle A\rangle collapses to a plain arithmetic mean 1N∑iA(Ci)\tfrac1N\sum_i A(C_i) over the sampled chain, with every term contributing comparably. To sample PeqP_{\mathrm{eq}} without ever knowing ZZ, one builds a Markov chain on configuration space whose transition rule leaves PeqP_{\mathrm{eq}} invariant. The engineering of that rule — the Metropolis acceptance test, the detailed-balance condition it enforces, the ergodicity that pins down a unique stationary state — is the subject of its own dedicated articles; this one owns the statistical foundation underneath them all: why sampling beats enumeration, how the estimator behaves, and what actually sets the error bar. That last question has a surprising and beautiful answer — the accuracy of a Monte Carlo estimate improves as N−1/2N^{-1/2} regardless of how many dimensions the integral has, the property that makes the method scale where deterministic quadrature catastrophically fails.

Key takeaways
  • Monte Carlo (MC) estimates high-dimensional thermodynamic averages ⟨A⟩=Z−1∑CA(C)e−βE(C)\langle A\rangle = Z^{-1}\sum_C A(C)e^{-\beta E(C)} by sampling configurations stochastically rather than enumerating them.
  • Naive uniform sampling fails catastrophically: the Boltzmann weight is sharply peaked, so almost every uniform sample contributes negligibly. Importance sampling draws configurations with probability proportional to their equilibrium weight, giving every sample comparable weight.
  • The statistical error of the MC estimator falls as σ/N\sigma/\sqrt{N} — and crucially this rate is independent of dimension, the decisive advantage over grid quadrature whose error grows as N−1/dN^{-1/d}.
  • Correlated samples inflate the error: the effective sample count is Neff=N/(2τint)N_{\mathrm{eff}}=N/(2\tau_{\mathrm{int}}), so the integrated autocorrelation time τint\tau_{\mathrm{int}} must be measured, not assumed.
  • MC never requires the partition function ZZ; the machinery for building the chain lives in the Metropolis–Hastings and detailed-balance articles, which this one recalls by name.
  • Key idea: sample configuration space in proportion to the Boltzmann weight (importance sampling) and estimate ⟨A⟩\langle A\rangle as a time average; the error then decays as N−1/2N^{-1/2} no matter the dimension, which is why Monte Carlo wins where enumeration and quadrature both die.
The core insight

Sample configuration space in proportion to the Boltzmann weight (importance sampling) and estimate ⟨A⟩\langle A\rangle as a time average along the sampled chain; the statistical error decays as σ/N\sigma/\sqrt{N} independent of the dimension, which is why Monte Carlo defeats both direct enumeration and grid quadrature in high dimensions.

Where this lives today

Monte Carlo importance sampling is the workhorse behind precision critical-exponent studies (single-spin Metropolis on the 2D Ising model reproduces Onsager's kBTc/J=2/ln⁡(1+2)≈2.269k_BT_c/J=2/\ln(1+\sqrt2)\approx2.269, then finite-size scaling extracts β=1/8\beta=1/8, γ=7/4\gamma=7/4, ν=1\nu=1), behind lattice QCD (where gauge-link configurations are importance-sampled with weight e−SEe^{-S_E} to compute hadron masses), and behind the fermion-sign problem that still blocks quantum Monte Carlo for frustrated and fermionic systems. The very same Markov-chain-Monte-Carlo machinery — with the posterior distribution playing the role of PeqP_{\mathrm{eq}} — is the engine of modern Bayesian statistics and probabilistic machine learning, where again only ratios of unnormalized densities are ever needed. Simulated annealing, treating a cost function as an energy and cooling an artificial temperature, turns the method into a general-purpose global optimizer.

The physical picture

Imagine estimating the average altitude of a mountain range weighted by population. Throwing darts at the map uniformly (naive sampling) wastes almost every dart on empty ocean. Instead, drop a hiker who preferentially steps toward where people live — after wandering long enough, the fraction of time spent at each spot equals its population. That is importance sampling: the random walker visits each configuration in proportion to its Boltzmann weight, so the raw average of the observable along the walk already carries the correct thermal weighting. The single deepest fact about the method is how its error shrinks. Because the sample mean of NN (independent) draws has variance σ2/N\sigma^2/N, the statistical error is σ/N\sigma/\sqrt N — and nothing in that statement mentions the dimension of the configuration space. A deterministic grid, by contrast, must place points along every axis: with NN points spread over dd dimensions the spacing is N−1/dN^{-1/d} and the quadrature error scales the same way, becoming hopeless for dd in the thousands. Monte Carlo trades a fast N−1/dN^{-1/d} (small dd) for a dimension-blind N−1/2N^{-1/2}, and above a handful of dimensions the trade is overwhelmingly favourable. There is one subtlety that separates honest error bars from wishful ones: successive states of a Markov chain are correlated. "How many samples" is not the number of sweeps but the number of statistically independent configurations, which is smaller by a factor of twice the integrated autocorrelation time τint\tau_{\mathrm{int}}. Near a critical point τint\tau_{\mathrm{int}} blows up — large correlated domains take enormous numbers of local moves to reorganize — which is exactly the failure the cluster-algorithms article is built to cure.

Figure
Monte Carlo error ∝ N⁻¹ᐟ² beats grid quadrature N⁻¹ᐟᵈ in high dimension
log N (number of samples) log error MC: slope −1/2 grid, d=10: slope −1/20 grid, d=1 MC keeps falling — dimension-blind
Figure
Importance sampling: uniform draws miss the sharp Boltzmann peak; weighted draws land on it
configuration coordinate (energy shell) Boltzmann weight P_eq(C) ∝ e^(−βE) uniform draws (× miss the peak) importance draws land on the peak

The core equations

The quantity we want is a thermal average over configuration space; the intractable object inside it is the partition function ZZ, whose exponentially large sum is precisely what we never wish to compute. Everything that follows is engineered to avoid ZZ.

⟨A⟩=∑CA(C) Peq(C),Peq(C)=e−βE(C)Z,Z=∑Ce−βE(C)(1)\langle A\rangle = \sum_{C} A(C)\,P_{\mathrm{eq}}(C),\qquad P_{\mathrm{eq}}(C)=\frac{e^{-\beta E(C)}}{Z},\quad Z=\sum_{C}e^{-\beta E(C)} \qquad (1)

where: CC — a microstate/configuration (e.g. all spin values); A(C)A(C) — observable in configuration CC; E(C)E(C) — energy of CC; β=1/(kBT)\beta=1/(k_BT) — inverse temperature; ZZ — partition function (the intractable normalization). If we could draw configurations CiC_i directly from PeqP_{\mathrm{eq}}, the weighted sum would become an unweighted arithmetic mean. This is the importance-sampling estimator, and it is unbiased: its expectation is exactly ⟨A⟩\langle A\rangle.

⟨A⟩≈AˉN=1N∑i=1NA(Ci),Ci∼Peq(2)\langle A\rangle \approx \bar A_N = \frac{1}{N}\sum_{i=1}^{N} A(C_i),\qquad C_i\sim P_{\mathrm{eq}} \qquad (2)

where: AˉN\bar A_N — sample mean over NN configurations drawn from PeqP_{\mathrm{eq}}; CiC_i — the ii-th sampled configuration. The way to reach PeqP_{\mathrm{eq}} is a Markov chain whose stationary distribution is PeqP_{\mathrm{eq}}. The chain's one-step rule updates the probability vector by a stochastic matrix WW; the whole art of constructing WW — Metropolis acceptance, detailed balance, ergodicity — is owned by the metropolis-hastings-algorithm and detailed-balance articles, which this one recalls rather than repeats.

∑C′W(C→C′)=1,Pt+1(C′)=∑CPt(C) W(C→C′)(3)\sum_{C'} W(C\to C') = 1,\qquad P_{t+1}(C') = \sum_C P_t(C)\,W(C\to C') \qquad (3)

where: W(C→C′)W(C\to C') — transition probability from CC to C′C' in one MC step; Pt(C)P_t(C) — probability of being in CC at step tt. For the sampled averages to be trusted, the fluctuation of the estimator must be quantified. For independent samples the variance of the mean is simply σA2/N\sigma_A^2/N; because Markov-chain samples are correlated, that variance is inflated by 2τint2\tau_{\mathrm{int}}, defining an effective sample size.

τint=12+∑t=1∞ρA(t),ρA(t)=⟨A0At⟩−⟨A⟩2⟨A2⟩−⟨A⟩2(4)\tau_{\mathrm{int}} = \tfrac12 + \sum_{t=1}^{\infty}\rho_A(t),\qquad \rho_A(t)=\frac{\langle A_0 A_t\rangle-\langle A\rangle^2}{\langle A^2\rangle-\langle A\rangle^2} \qquad (4)

where: ρA(t)\rho_A(t) — normalized autocorrelation function of AA at lag tt; τint\tau_{\mathrm{int}} — integrated autocorrelation time (in MC steps).

Var(AˉN)=σA2N (2τint)=σA2Neff,Neff=N2τint(5)\mathrm{Var}(\bar A_N) = \frac{\sigma_A^2}{N}\,(2\tau_{\mathrm{int}}) = \frac{\sigma_A^2}{N_{\mathrm{eff}}},\qquad N_{\mathrm{eff}}=\frac{N}{2\tau_{\mathrm{int}}} \qquad (5)

where: σA2=⟨A2⟩−⟨A⟩2\sigma_A^2=\langle A^2\rangle-\langle A\rangle^2 — equilibrium variance of AA; NeffN_{\mathrm{eff}} — effective number of independent samples.

Derivation AWhy importance sampling beats uniform sampling

The goal here is to make quantitative the loose claim that "uniform sampling wastes darts." We compare two unbiased estimators of the same average ⟨A⟩\langle A\rangle — one drawing configurations uniformly and reweighting, one drawing directly from PeqP_{\mathrm{eq}} — and show that the uniform estimator's variance is astronomically larger because the Boltzmann weight spans many orders of magnitude across the space it samples. The lesson is that unbiasedness is cheap; controlled variance is the real prize, and only importance sampling delivers it.

Step 1. Write the uniform-sampling estimator. Draw CiC_i uniformly from the Ω\Omega total configurations; to stay unbiased, reweight each by Ω Peq(Ci)\Omega\,P_{\mathrm{eq}}(C_i):

Aˉ unif=1N∑iA(Ci) Ω e−βE(Ci)Z.\bar A^{\,\mathrm{unif}} = \frac{1}{N}\sum_i A(C_i)\,\Omega\,\frac{e^{-\beta E(C_i)}}{Z}.

Why the factor ΩPeq\Omega P_{\mathrm{eq}}: it converts the uniform density 1/Ω1/\Omega into the target density PeqP_{\mathrm{eq}}, so E[Aˉ unif]=⟨A⟩\mathbb E[\bar A^{\,\mathrm{unif}}]=\langle A\rangle exactly.

Step 2. Examine the weights. Because Peq(C)∝e−βE(C)P_{\mathrm{eq}}(C)\propto e^{-\beta E(C)} is sharply peaked, the weights ΩPeq\Omega P_{\mathrm{eq}} range over exponentially many orders of magnitude. A handful of samples near the typical energy carry essentially all the weight; the rest contribute noise. Why this is fatal: the estimator variance is dominated by these rare large-weight events, so it behaves as if only a tiny effective fraction of the NN samples counted.

Step 3. Contrast the importance-sampling estimator. Drawing Ci∼PeqC_i\sim P_{\mathrm{eq}} directly,

AˉN=1N∑iA(Ci),Var(AˉN)=VarPeq(A)N,\bar A_N=\frac1N\sum_i A(C_i),\qquad \mathrm{Var}(\bar A_N)=\frac{\mathrm{Var}_{P_{\mathrm{eq}}}(A)}{N},

so the variance is set only by the physical spread of AA in equilibrium — finite and modest. Why this is the whole point: every term now contributes comparably, and the ZZ-dependent exponential weights never appear. Verified: variance-reduction ratio computed numerically for ⟨x2⟩\langle x^2\rangle under a Gaussian in verify_aq-sm-monte-carlo-method.py; importance sampling variance is orders of magnitude below uniform-reweighting variance.

Go deeper · Derivation B · 1 minDimension-independent error and the autocorrelation inflation
Derivation BDimension-independent error and the autocorrelation inflation

This derivation establishes the two headline facts about Monte Carlo accuracy: that the error falls as N−1/2N^{-1/2} with a prefactor that knows nothing about the dimension, and that correlations between successive chain states multiply the naive variance by 2τint2\tau_{\mathrm{int}}. Together they explain both why Monte Carlo scales to thousands of dimensions and why honest error bars require measuring the autocorrelation time rather than assuming samples are independent.

Step 1. Independent-sample error. For NN independent draws the central limit theorem gives Var(AˉN)=σA2/N\mathrm{Var}(\bar A_N)=\sigma_A^2/N, hence error σA/N\sigma_A/\sqrt N. Why dimension drops out: σA\sigma_A is a single number — the equilibrium spread of the scalar AA — with no reference to how many coordinates CC has. The rate N−1/2N^{-1/2} is therefore universal across dimension, unlike grid quadrature whose N−1/dN^{-1/d} spacing degrades with dd.

Step 2. Expand the variance of the mean for a correlated stationary sequence:

Var(AˉN)=1N2∑i,j=1N(⟨AiAj⟩−⟨A⟩2)=σA2N2∑i,jρA(∣i−j∣).\mathrm{Var}(\bar A_N)=\frac{1}{N^2}\sum_{i,j=1}^{N}\big(\langle A_iA_j\rangle-\langle A\rangle^2\big)=\frac{\sigma_A^2}{N^2}\sum_{i,j}\rho_A(|i-j|).

Why cross terms matter: off-diagonal correlations ρA(∣i−j∣)\rho_A(|i-j|) no longer vanish, so the double sum exceeds the diagonal.

Step 3. Count lag multiplicities. There are NN diagonal terms and 2(N−t)2(N-t) terms at lag tt:

Var(AˉN)=σA2N2[N+2∑t=1N−1(N−t)ρA(t)].\mathrm{Var}(\bar A_N)=\frac{\sigma_A^2}{N^2}\Big[N + 2\sum_{t=1}^{N-1}(N-t)\rho_A(t)\Big].

Step 4. Take N≫τintN\gg\tau_{\mathrm{int}}, so (N−t)/N→1(N-t)/N\to1:

Var(AˉN)→σA2N[1+2∑t=1∞ρA(t)]=σA2N 2τint.\mathrm{Var}(\bar A_N)\to\frac{\sigma_A^2}{N}\Big[1+2\sum_{t=1}^{\infty}\rho_A(t)\Big]=\frac{\sigma_A^2}{N}\,2\tau_{\mathrm{int}}.

Why the factor 2τint2\tau_{\mathrm{int}}: the bracket is exactly 2τint2\tau_{\mathrm{int}} with τint=12+∑tρA(t)\tau_{\mathrm{int}}=\tfrac12+\sum_t\rho_A(t). Correlated samples behave as if only N/(2τint)N/(2\tau_{\mathrm{int}}) independent measurements were made — quoting σ/N\sigma/\sqrt N with NN = number of sweeps understates the true error by 2τint\sqrt{2\tau_{\mathrm{int}}}. Verified: the N−1/2N^{-1/2} slope is fit numerically (log-log) and the 2τint2\tau_{\mathrm{int}} inflation checked against a known AR(1) autocorrelation in verify_aq-sm-monte-carlo-method.py.

Limiting cases

CaseResultMeaning
Many independent sampleserror=σA/N\mathrm{error}=\sigma_A/\sqrt NDimension-independent N−1/2N^{-1/2} convergence; the defining scaling that beats quadrature in high dd.
Strong correlationNeff=N/(2τint)N_{\mathrm{eff}}=N/(2\tau_{\mathrm{int}})Autocorrelation reduces the effective sample count; near criticality τint∼Lz\tau_{\mathrm{int}}\sim L^z (critical slowing down), the province of cluster algorithms.
High temperatureβ→0, e−βΔE→1\beta\to0,\ e^{-\beta\Delta E}\to1Almost every proposed move accepted; the walk decorrelates fast and τint\tau_{\mathrm{int}} is small.
Low temperatureβ→∞\beta\to\inftyUphill moves almost always rejected; the chain freezes into local minima and may be non-ergodic on practical timescales — tempering/annealing needed.
Continuous (off-lattice)⟨A⟩=∫d3Nr A e−βU∫d3Nr e−βU\langle A\rangle=\dfrac{\int \mathrm d^{3N}r\,A\,e^{-\beta U}}{\int \mathrm d^{3N}r\,e^{-\beta U}}Configurational averages factor from kinetic ones; MC samples positions only, with displacements tuned for ∼50%\sim50\% acceptance.

Worked examples

Example 1 — Variance reduction by importance sampling. Estimate ⟨x2⟩\langle x^2\rangle for a standard Gaussian p(x)=e−x2/2/2πp(x)=e^{-x^2/2}/\sqrt{2\pi} (exact answer 11) two ways, and compare the estimator variances.

Step 1. Importance sampling: draw xi∼p(x)x_i\sim p(x) and average xi2x_i^2. The per-sample variance is Var(x2)=⟨x4⟩−⟨x2⟩2=3−1=2\mathrm{Var}(x^2)=\langle x^4\rangle-\langle x^2\rangle^2 = 3-1 = 2, so with NN samples the estimator variance is 2/N2/N.

Step 2. Uniform reweighting: draw xix_i uniformly on [−L,L][-L,L] (take L=5L=5) and average the weighted integrand wixi2w_i x_i^2 with wi=2L p(xi)w_i = 2L\,p(x_i). The weights range from 2L p(0)≈3.992L\,p(0)\approx 3.99 down to 2L p(5)≈1.5×10−52L\,p(5)\approx 1.5\times10^{-5} — five orders of magnitude — so the estimator variance is far larger.

Step 3. Numerically (verify script, N=105N=10^5): the importance-sampling estimator has variance ≈2/N\approx 2/N; the uniform-reweighting estimator has variance roughly an order of magnitude larger for the same NN, with the gap widening as LL grows. The lesson: both are unbiased, but only importance sampling has controlled variance. The importance-sampling estimator is dramatically more efficient — the concrete payoff of sampling from PeqP_{\mathrm{eq}}.

Example 2 — The N−1/2N^{-1/2} law and autocorrelation inflation. A run reports N=106N=10^6 sweeps and an integrated autocorrelation time τint=50\tau_{\mathrm{int}}=50. Find the honest error inflation and the effective sample size.

Step 1. The variance is multiplied by 2τint=2×50=1002\tau_{\mathrm{int}} = 2\times 50 = 100, so the standard error is 100=10\sqrt{100}=\mathbf{10} times larger than the naive σA/N\sigma_A/\sqrt N estimate.

Step 2. The effective number of independent samples is Neff=N/(2τint)=106/100=104N_{\mathrm{eff}}=N/(2\tau_{\mathrm{int}})=10^6/100=\mathbf{10^4}. A student quoting σA/106\sigma_A/\sqrt{10^6} overstates the precision by a factor of ten — the difference between a credible and a fictitious error bar.

Origins · 1 minstanislaw ulam and how this was discovered
SU
stanislaw ulam
1909–1984 · Polish-American mathematician who, recovering from illness at Los Alamos in 1946 and idly computing the odds of winning solitaire, realized that statistical sampling could estimate quantities too hard to compute exactly. With John von Neumann he turned the idea into a computational method for neutron diffusion on the ENIAC, and Nicholas Metropolis named it "Monte Carlo" after the casino. Ulam also co-invented the Teller–Ulam design for thermonuclear weapons and worked on nonlinear dynamics (the Fermi–Pasta–Ulam–Tsingou problem).

History
1777
— Buffon's needle: the first recorded Monte Carlo estimate, of π from random throws
1946
— Ulam conceives statistical sampling while playing solitaire during convalescence at Los Alamos
1947
— von Neumann applies the method to neutron transport on ENIAC; Metropolis coins the name "Monte Carlo"
1949
— Metropolis and Ulam publish "The Monte Carlo Method" in J. Amer. Stat. Assoc.
1953
— Metropolis, Rosenbluth, Rosenbluth, Teller and Teller introduce importance sampling via the acceptance rule
1970
— Hastings generalizes the acceptance rule to asymmetric proposals
1987
— Swendsen and Wang defeat critical slowing down with cluster updates

Going further

References. Pathria & Beale, Statistical Mechanics, 4th ed., Ch. 16 (Computer Simulations) · Kardar, Statistical Physics of Fields, Ch. on Monte Carlo / numerical methods · Sethna, Statistical Mechanics: Entropy, Order Parameters, and Complexity, Ch. 8 · Landau & Binder, A Guide to Monte Carlo Simulations in Statistical Physics, 4th ed. · Metropolis, Rosenbluth, Rosenbluth, Teller & Teller, J. Chem. Phys. 21, 1087 (1953) · Newman & Barkema, Monte Carlo Methods in Statistical Physics (1999).

Provenance. A verifier should recompute: (1) the variance reduction of importance vs uniform sampling for ⟨x2⟩\langle x^2\rangle under a Gaussian (this article's verify script); (2) the N−1/2N^{-1/2} error slope and the 2τint2\tau_{\mathrm{int}} inflation factor (Newman & Barkema eqs. 3.18–3.21); (3) the 2D Ising critical temperature 2/ln⁡(1+2)=2.2691…2/\ln(1+\sqrt2)=2.2691\ldots (Onsager; Pathria Ch. 13). Stationarity via detailed balance and ergodic convergence are owned by the detailed-balance and metropolis-hastings articles and recalled here by name.

Builds on: Markov Processes and the Markov Property · The Master Equation · Detailed Balance and Microscopic Reversibility · Chapman–Kolmogorov Equation. Leads to: Metropolis–Hastings Algorithm · Cluster Algorithms and Critical Slowing Down · Molecular Dynamics Simulation · Fokker–Planck Equation.

Is Monte Carlo "time" the same as physical time?

No — Monte Carlo time is fictitious. It is a sequence of stochastic moves engineered to sample the correct statics, not a solution of any equation of motion. With single-spin updates the fictitious dynamics happens to resemble physical Glauber kinetics, but in general MC guarantees only correct equilibrium averages. To obtain genuine transport coefficients (diffusion, viscosity) you need molecular dynamics or kinetic Monte Carlo with physically rated transitions; the molecular-dynamics article owns that side of the story.

Where does the actual Markov chain and acceptance rule come from?

This article owns the statistical foundation — importance sampling, the estimator, the error scaling. The construction of the transition rule WW (the Metropolis acceptance test min⁡(1,e−βΔE)\min(1,e^{-\beta\Delta E}), the Hastings correction for asymmetric proposals, and the proof that these satisfy detailed balance) is owned by the Metropolis–Hastings Algorithm article, and the detailed-balance condition itself by the Detailed Balance article. This one recalls them by name rather than re-deriving them.

Is detailed balance necessary for correct sampling?

No — it is sufficient but not necessary. The necessary and sufficient condition for PeqP_{\mathrm{eq}} to be stationary is the weaker global balance ∑CPeq(C)W(C→C′)=Peq(C′)\sum_C P_{\mathrm{eq}}(C)W(C\to C')=P_{\mathrm{eq}}(C'). Detailed balance is the stronger pairwise condition, convenient because it makes the acceptance rule depend only on ΔE\Delta E. Non-reversible ("lifted") MC satisfies global balance without detailed balance and can decorrelate faster; the trade-off is that the acceptance rule is harder to design.

How do I actually measure the autocorrelation time?

Estimate the normalized autocorrelation ρA(t)\rho_A(t) from the time series, then sum it with a self-consistent windowing cutoff (sum until ρA\rho_A is buried in noise, typically a window of a few τint\tau_{\mathrm{int}}). Alternatives are binning/blocking analysis — group the data into blocks of increasing size and watch the block-mean variance plateau — and the jackknife. All three converge to the same 2τint2\tau_{\mathrm{int}} inflation; blocking is the most robust for beginners because it needs no explicit autocorrelation fit.

Why does the error stop improving near a critical point?

Because τint\tau_{\mathrm{int}} diverges. Near a continuous transition the correlation length ξ\xi grows and, for local updates, ordered domains of size ξ\xi can only be rearranged by a random walk of single flips, giving τint∼ξz∼Lz\tau_{\mathrm{int}}\sim\xi^z\sim L^z with z≈2z\approx2 — critical slowing down. Since Neff=N/(2τint)N_{\mathrm{eff}}=N/(2\tau_{\mathrm{int}}) collapses, error bars stop shrinking. Cluster algorithms fix this by flipping whole correlated domains at once, driving zz toward zero.

Does importance sampling introduce bias?

No. Both the uniform-reweighting estimator and the importance-sampling estimator are unbiased — their expectations equal ⟨A⟩\langle A\rangle exactly. The difference is entirely in the variance: uniform reweighting has astronomically larger variance because the weights span many orders of magnitude. This is the key conceptual point of Example 1: unbiasedness is easy to arrange; controlled variance is what importance sampling buys you.

Can Monte Carlo handle continuous, off-lattice systems?

Yes. For fluids one samples the configurational integral with random particle displacements in the NVTNVT ensemble, tuning the step size for ∼50%\sim50\% acceptance. Grand-canonical MC (insertion/deletion moves), Gibbs-ensemble MC (two coexisting boxes exchanging particles and volume) and Widom test-particle insertion for the chemical potential extend the method to phase equilibria — all complementary to molecular dynamics, which integrates equations of motion instead of proposing random moves.

Before this

Where this leads