Monte Carlo Simulation for Estimating π: Algorithm Principle and Error Analysis
Abstract
Monte Carlo simulation is a stochastic numerical method that approximates solutions to mathematical problems via repeated random sampling. Owing to its conceptual simplicity and broad applicability, it has become a foundational computational tool across physics, finance, engineering, and data science. This paper examines the algorithmic principle of Monte Carlo π estimation and systematically analyzes factors governing simulation accuracy. A Python-based numerical simulation is implemented: uniformly distributed random points are generated within a unit square, and the value of π is estimated by counting points falling inside the inscribed quarter circle. Experiments with varying sample sizes are conducted to assess their impacts on estimation accuracy and convergence behavior, and the influence of pseudo-random number generation on simulation outcomes is also discussed. The results confirm that estimation stability improves with increasing sample size, and the simulation error decays approximately at a rate proportional to the inverse square root of the sample size. This study elucidates the mathematical fundamentals underlying Monte Carlo simulation and offers an intuitive case for understanding the properties, strengths, and limitations of stochastic numerical methods. The findings deepen understanding of the relationship between sample size and simulation accuracy, and provide theoretical and practical support for extending Monte Carlo methods to more complex numerical simulation and uncertainty analysis tasks.
References
- Metropolis, N., & Ulam, S. (1949). The Monte Carlo method.Journal of the American Statistical Association, 44(247), 335–341.
- Hammersley, J. M., & Handscomb, D. C. (1964).Monte Carlo methods. Methuen.
- Fishman, G. S. (1996).Monte Carlo: Concepts, algorithms, and applications. Springer.
- Robert, C. P., & Casella, G. (2004).Monte Carlo statistical methods(2nd ed.). Springer.
- Owen, A. B. (2013).Monte Carlo theory, methods and examples. Stanford University.
- Kalos, M. H., & Whitlock, P. A. (2008).Monte Carlo methods(2nd ed.). Wiley.
- Kroese, D. P., Taimre, T., & Botev, Z. I. (2011).Handbook of Monte Carlo methods. Wiley.
- Rubinstein, R. Y., & Kroese, D. P. (2016).Simulation and the Monte Carlo method(3rd ed.). Wiley.
- Matsumoto, M., & Nishimura, T. (1998). Mersenne Twister: A 623-dimensionally equidistributed uniform pseudo-random number generator.ACM Transactions on Modeling and Computer Simulation, 8(1), 3–30.
- Niederreiter, H. (1992).Random number generation and quasi-Monte Carlo methods. Society for Industrial and Applied Mathematics.
- Caflisch, R. E. (1998). Monte Carlo and quasi-Monte Carlo methods.Acta Numerica, 7, 1–49.
- Lemieux, C. (2009).Monte Carlo and quasi-Monte Carlo sampling. Springer.