math

A Basic Monte-Carlo Simulation in Common Lisp

Monte-Carlo simulations are algorithms that approximate numerical results by repeatedly sampling some space. Generally, the more samples you collect, the higher the accuracy of the result. In this blog post I am going to demonstrate how to use such a technique to approximate the value of the mathematical constant pi. The high level idea is as follows. We know the area of a circle can be found using the formula A = pi * r ^ 2, where r is the radius of the circle.