Build reliable chains for Boltzmann and Gaussian targets. See acceptance, autocorrelation, and effective sample size. Download tables, validate settings, and compare runs quickly today.
These example settings illustrate typical stable runs. Your numbers will differ because sampling is stochastic.
| Target | Key parameters | σprop | Burn | Thin | Saved | Typical acceptance | Typical ⟨x⟩ |
|---|---|---|---|---|---|---|---|
| Harmonic Boltzmann | β=1, k=1 | 1.0 | 1000 | 2 | 5000 | 35–65% | ≈ 0 |
| Double-well Boltzmann | β=1, a=1, b=4 | 0.9 | 3000 | 3 | 8000 | 25–55% | ≈ 0 (symmetric) |
| Gaussian | μ=2, σ=0.7 | 0.7 | 800 | 2 | 6000 | 40–70% | ≈ 2 |
This tool uses the Metropolis-Hastings rule to sample a one-dimensional target density p(x).
For correlated samples, uncertainty is estimated using the integrated autocorrelation time:
MCMC is essential when direct sampling is hard but relative probabilities are available. In physics this includes Boltzmann ensembles and Bayesian calibration of models. It is also used in lattice models and rare-event sampling where solutions are unavailable. Correlation can hide under error bars, so diagnostics matter.
The calculator uses a Gaussian random-walk proposal x′ = x + σpropN(0,1) and Metropolis acceptance α = min(1, p(x′)/p(x)). For Boltzmann targets p(x) ∝ exp(−βU(x)), the log ratio is −β[U(x′)−U(x)]. Only ratios are required, so normalization constants never enter the decision.
σprop controls exploration. Very small steps give high acceptance (>80%) but slow movement. Very large steps yield frequent rejection (<20%). For many stable 1D cases, 30–70% acceptance balances travel distance and acceptance, though τint is the final judge.
Total iterations equal burn + samples×thin, matching the internal loop. Burn-in discards initial transients, especially when x0 starts far from typical regions. Thinning reduces stored points; it does not remove correlation, so prefer larger chains unless storage is limited.
The tool estimates the integrated autocorrelation time τint from the autocorrelation sequence until it turns non‑positive. Effective sample size is Neff ≈ N/(2τint). Example: N=5000 and τint=8 gives Neff≈312, and the standard error scales as √(Var/Neff).
For the harmonic potential U=½kx², increasing β or k tightens the distribution, with typical fluctuations ∝ 1/√(βk). The double-well U=ax⁴−bx² has minima near ±√(b/2a). At high β, barrier crossings become rare and τint grows.
Use the histogram to spot multimodality or long tails. A symmetric double-well should show both wells over long runs; one‑sided occupancy often means poor mixing. Watch for large τint, low Neff, or means that drift across seeds—then increase steps, adjust σprop, or change x0.
Export CSV to compute custom observables, re-bin histograms, or compare chains. The PDF summarizes acceptance, τint, Neff, and uncertainty for x and your chosen observable. Fix the seed to reproduce identical chains when documenting parameter scans or proposal tuning studies.
For many one-dimensional problems, 30–70% is a practical range. Below ~20% proposals are too aggressive; above ~80% steps are often too small and mixing slows. Use τint and Neff to confirm.
MCMC is stochastic, so finite chains fluctuate. If Neff is small, estimates vary more. Increase saved samples, reduce τint by tuning σprop, and ensure burn-in is long enough.
Not usually for correctness. Thinning mainly reduces stored points and file size. The uncertainty calculation already accounts for autocorrelation using τint. If storage is fine, prefer keeping more samples rather than discarding them.
The tool estimates τint from the autocorrelation function, then computes Neff ≈ N/(2τint). The standard error is SE ≈ √(Var/Neff). This inflates errors when samples are strongly correlated.
At larger β, barrier crossings become rare, so the chain can remain near one mode for long periods. Increase steps, try different x0, or lower β to test mixing. Consider adjusting σprop if acceptance is extreme.
Enter an integer seed and keep all inputs unchanged. The pseudo-random sequence and the resulting chain will match run-to-run, enabling consistent comparisons between proposal scales or target parameter settings.
Select U(x) to estimate mean potential energy for the Boltzmann targets. For fluctuation measures, use x² or x⁴. Compare means with their standard errors and watch Neff to ensure the estimate is well-resolved.
Important Note: All the Calculators listed in this site are for educational purpose only and we do not guarentee the accuracy of results. Please do consult with other sources as well.