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

More from Math Visualization

Other simulators in this category — or see all 78.

View category →
NewUniversity / research

LMS / NLMS Adaptive Noise Cancellation

Primary p = s + v with v a fixed unknown FIR of Gaussian reference x[n]. Watch an L-tap FIR adapt by LMS or NLMS so error e = p − wᵀx → s; running MSE and ‖w − h‖.

Launch Simulator
NewUniversity / research

DCT & JPEG Quantization (8×8)

64×64 luma: 8×8 DCT with −128 shift, ISO luminance quant table scaled by JPEG quality, or zigzag AC truncation (keep K). Click a block for coefficient heatmaps and zigzag trace.

Launch Simulator
NewUniversity / research

PLL (Phase-Locked Loop)

Discrete-time analog-style PLL: multiplier PD e = K_d sin(φ_ref − φ_VCO), PI loop filter, VCO ω = ω_fr + K_v u; step ω_ref to explore lock, capture, and steady-state phase error.

Launch Simulator
NewUniversity / research

ΔΣ (1-bit) Modulator

First- and second-order discrete-time ΔΣ with ±1 quantizer: shaped quantization noise, sine test tone, boxcar reconstruction, and Hann-windowed error spectrum (last 1024 samples).

Launch Simulator
NewUniversity / research

Polyphase L/M Resampling

Zero-stuff by L, Hamming-windowed sinc FIR at the high rate with min(π/L,π/M) cutoff, then decimate by M; spectra in/out and Noble-identity polyphase intuition.

Launch Simulator
NewUniversity / research

Mandelbrot Deep Zoom

Drag/wheel deep zoom into the Mandelbrot set with smooth continuous coloring and named landmarks.

Launch Simulator
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

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

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

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

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.