Heat Bath MCMC Sampling

Gibbs sampling & heat bath algorithm for 2D Ising model

Ising spins (red=+1, blue=−1)
Heat Bath Algorithm (Gibbs Sampler): For each spin s_i in turn, compute the conditional distribution P(s_i = +1 | neighbors) = σ(2β(J∑neigh + h)) where σ is the sigmoid function. Sample directly from this distribution — no accept/reject step needed. This is Gibbs sampling, guaranteed to converge to the Boltzmann distribution π(s) ∝ exp(−βH). The 2D Ising critical temperature is T_c = 2J/ln(1+√2) ≈ 2.269 (Onsager 1944 exact solution). Below T_c: spontaneous magnetization, long-range order. Above T_c: disordered phase. Near T_c: divergent correlation length, critical slowing down — the Markov chain mixes slowly (autocorrelation time ~ ξ²).