Chain state / trajectory Accepted sample Rejected proposal
⚠ Couldn't load the 3D engineThree.js failed to load from the CDN. Check your connection and reload.

Hamiltonian Monte Carlo: Leapfrog Sampling

Fitting a Bayesian model means characterising a posterior distribution that almost never has a closed form — so instead you sample from it. This simulator renders that posterior as a real 3D probability-density surface and runs Hamiltonian Monte Carlo on it exactly as Stan or PyMC would: each proposal samples a random momentum, integrates a physical trajectory across the surface with the leapfrog method, and accepts or rejects it by how well total energy was conserved. Watch the chain glide along a correlated ridge far more efficiently than a naive random walk could, tune the step size and trajectory length to see acceptance rate trade off against exploration, and switch to a bimodal target to see where even a gradient-aware sampler can get stuck in one mode.