This experiment makes a small stochastic calculation reproducible and inspectable. It runs in the browser, generates points in a unit square, classifies them against a quarter-circle, and records the estimate after each point. The companion article explains the geometry and sampling variation; this page describes the actual tool and its data.

Controls and outputs

The initial run requests 2,000 points with seed 42. Change the sample count or seed and run the calculation again. The new-seed control provides another sequence without changing the mathematical model. The tool accepts up to 50,000 points per run.

Two views answer different questions. The point cloud shows how the region is sampled. The convergence trace shows how the running estimate changes over the sequence. The numerical results report the final estimate, inside count, and error relative to the mathematical constant \(\pi\).

To keep the cloud usable, it displays at most the first 2,000 points. This is a display limit: the calculation still uses the requested total, and the export retains every generated point. The points shown at larger sample counts are a prefix of the sequence, rather than a new sample produced for the picture.

Reproducibility and data provenance

All coordinates are generated by the browser's seeded pseudorandom generator. They are illustrative simulation data, not observations of a physical process or an externally collected dataset.

The same seed and count reproduce a run in this implementation. Increasing the count with the same seed extends the same sequence. A seed does not have a universal meaning across programming languages: a Python or spreadsheet generator can use the same integer and produce different coordinates.

The full CSV export provides one row per generated point:

Column Meaning
sample Position in the generated sequence
x, y Coordinates within the unit square
inside Whether the point satisfies the quarter-circle test
running_estimate Four times the cumulative inside fraction

An independent check can count the inside classifications and calculate \(4k/n\). The last running estimate should agree with that value. Retain the seed and requested count alongside an exported file when comparing runs.

Design decisions and limits

The calculation uses ordinary JavaScript and stays local to the page. Canvas draws the points, while a vector chart presents the convergence trace. Numerical results provide a readable alternative to interpreting the colours or shapes.

This is a deliberately bounded learning tool. It does not establish that a pseudorandom generator is suitable for every scientific application, and the displayed error describes this run rather than a guarantee for the next one. The cap on sample count keeps the interaction responsive; it is not a mathematical convergence threshold.

Useful investigations include comparing equal counts across seeds, extending one sequence, and checking an exported calculation independently. The experiment is complete as an interactive explanation of a sampling method; it does not claim a novel numerical algorithm or measured research result.

References

  1. StatLect: Monte Carlo method