PhysSandbox
Classical MechanicsWaves & SoundElectricity & MagnetismOptics & LightGravity & OrbitsLabs
🌙Astronomy & The Sky🌡️Thermodynamics🌍Biophysics, Fluids & Geoscience📐Math Visualization🔧Engineering🧪Chemistry

Related simulators

Continue with similar topics in this category — or all 85 in Math Visualization.

View category →
NewUniversity / research

PCA / SVD Geometry

Launch Simulator

Covariance ellipse and SVD view of dimensionality reduction: principal components, explained variance, and rank-1 reconstruction error.

NewKids

Monte Carlo π

Launch Simulator

Uniform samples in a square; 4·(in disk)/N estimates π.

NewUniversity / research

Gaussian Process Regression

Launch Simulator

Interactive GP regression with RBF and Matérn kernels: tune length scale/noise, add observations by clicking, view posterior mean with uncertainty bands, and sample at max posterior variance.

NewUniversity / research

Bayesian Updating / Conjugate Priors

Launch Simulator

Beta-binomial Bayesian updating with prior/posterior curves, posterior predictive probability, and credible intervals.

NewUniversity / research

Gradient Descent Optimizers

Launch Simulator

Compare SGD, momentum, and Adam on a curved loss landscape; tune learning rate, curvature, stability, and iteration count.

NewUniversity / research

Power Iteration Eigenvalue Convergence

Launch Simulator

Visualize dominant eigenvector convergence: spectral gap ratio, Rayleigh quotient, eigen residual, and normalized power iterates on the unit circle.

PhysSandbox

Interactive physics, chemistry, and engineering simulators for students, teachers, and curious minds.

Physics

  • Classical Mechanics
  • Waves & Sound
  • Electricity & Magnetism

Science

  • Optics & Light
  • Gravity & Orbits
  • Astronomy & The Sky

More

  • Thermodynamics
  • Biophysics, Fluids & Geoscience
  • Math Visualization
  • Engineering
  • Chemistry

© 2026 PhysSandbox. Free interactive science simulators.

PrivacyTermsContact
Home/Math Visualization/Monte Carlo Integration & Variance Reduction

Monte Carlo Integration & Variance Reduction

Compare plain Monte Carlo, importance sampling, and stratified sampling for ∫f(x)dx, with convergence curves, standard error, and the 1/√N rate.

Integral and sampling

1200
4.5
0.35
12

Random stream

7

Measured values

Reference integral0.220362
Plain MC error0.001548
Importance error0.000481
Stratified error0.000370

All three estimators are unbiased for this one-dimensional integral, but their variance differs. Importance sampling helps when q(x) resembles the integrand shape; stratification reduces random clumping by forcing coverage across the interval.

Live graphs

About this model

Monte Carlo integration estimates an integral as an average over random samples, so the typical error decreases like 1/sqrt(N). This simulator compares three unbiased estimators for a one-dimensional integral: plain uniform sampling, importance sampling with q(x) shaped like the exponential envelope, and stratified sampling that forces coverage across subintervals. The convergence plot shows absolute error versus N, while the standard-error readouts reveal how variance reduction changes the constant in front of the same asymptotic rate.

Who it's for: Numerical methods, uncertainty quantification, statistics, computational physics, data science, and scientific computing courses.

Key terms

  • Monte Carlo integration
  • Variance reduction
  • Importance sampling
  • Stratified sampling
  • Standard error
  • Convergence rate

How it works

Monte Carlo integration simulator comparing plain uniform sampling, importance sampling, and stratified sampling with convergence near 1/sqrt(N).

Key equations

Plain MC: I ≈ (1/N) Σ f(U_i), U_i ~ Uniform(0,1)
Importance: I = E_q[f(X)/q(X)], stratified: sample inside each interval

Frequently asked questions

Does variance reduction beat the 1/sqrt(N) rate?
For ordinary independent Monte Carlo estimators, the asymptotic rate is still 1/sqrt(N). Variance reduction improves the variance constant, so the same number of samples can give a much smaller error.
When does importance sampling help?
It helps when the proposal density q(x) places samples where f(x) contributes most and the weights f(x)/q(x) do not fluctuate too much. A poor proposal can increase variance instead.