Optional workshopsOptional workshops · 14 min
Benchmark a Monte Carlo estimate
Use an exact symbolic expectation to check a seeded simulation under the same model.
Maths refresher: Spread of outcomes versus error of a mean
Outcome variance describes how individual areas vary. To estimate the standard error of the mean for independent draws with finite variance, divide the sample standard deviation by the square root of the draw count.
More draws refine the simulated mean. They do not narrow the model’s distribution of possible individual areas.
Symbolic calculation can provide a reference for a numerical simulation. The comparison is meaningful only if both methods use the same inputs, domain and target quantity. Here radius is uniformly distributed between one and two, and area is .
Integrate over the stated uniform density to obtain exact mean area and variance. Then generate independent radius draws, transform each into area, and estimate the mean and its Monte Carlo standard error. The standard error describes numerical variability of the estimated mean, not the spread of individual areas.
A discrepancy larger than expected prompts inspection of the model translation or calculation. Agreement checks an implementation under this authored probability model; it does not establish that real radii are uniform. Preserve the seed, draw count, exact target, actual result and assumptions in the report.
Will increasing simulation draws reduce uncertainty about whether real radii follow the assumed uniform model?
Write a prediction (optional)
Exact model reference and seeded teaching simulation
Select Run Python with the code unchanged.
Your saved draft is open. To use the published code, select Restore example in Tools. Use Recover draft to bring back your code.
Tools
About Python
Python and the course packages can load while you read. Each run starts with fresh user variables; imported modules stay loaded. Stop replaces the worker. Runtime details ↗
Ctrl+Enter or ⌘+Enter runs Python.
Execution error
Technical error details
Your result
Python text output
Compare with the worked example
Executed from the published Python during the site build. Your own run appears above. Build environment ↗
Worked text output
Seed: 2026 Draws: 20000 Exact mean area: 7*pi/3 Exact outcome variance: 34*pi**2/45 Simulated mean: 7.340244733278218 Estimated MCSE: 0.019256502231656206 Difference in estimated SE units: 0.5121322025877172
Read the starter result
Compare Simulated mean with Exact mean area for the same authored model. The histogram shows the spread of individual areas. Estimated MCSE measures how much the simulated mean would vary across repeated runs.
Edit and compare
Replace draws = 20000 with draws = 80000 and select Run Python. Then replace seed = 2026 with seed = 2027 and select Run Python again. Compare Estimated MCSE and Simulated mean with the original run. Which quantity shows the more regular change when the sample size increases?
Scope. Independent uniform radii and finite moments are assumed. Agreement cannot validate those assumptions against reality.
Try a fresh case
A simulated mean agrees closely with the exact model mean. What does that support?
Need a hint?
Hint 1
Separate “does the code implement this model?” from “does this model describe reality?”
Hint 2
Identify what the exact integral assumes.
Write your investigation report
Record the question, mathematical assumptions and proposed checks before interpreting the result. After execution, add the derivation, numerical comparison and limits. The export includes the last successful run.