### Estimating the value of Pi using Monte Carlo Method

The very first moment I was shown this, I was amazed. Estimating something using random events is pretty amazing. The first time I did this in MATLAB, but now, I think I will attempt to do the same in JavaScript.

The undelying concept of Monte Carlo Method is to use randomness to determine the value. The method is often used to solve problems that are hard to determine exactly, when there is enough statistical data available.

Let us define a square centered at the origin with side of length 2. A circle centered at the origin is inscribed in this square.

The assumption that we are using in this method is that if we randomly take a few points within the square, the ratio of the number of points that falls within the circle to the total points taken is equal to that of the area of the square and the circle. That is,

Area of square / area of circle = totalRandomSamples / totalPointsInCircle Let us write a JavaScript program that could do perform this with a huge number of random sample p…

The undelying concept of Monte Carlo Method is to use randomness to determine the value. The method is often used to solve problems that are hard to determine exactly, when there is enough statistical data available.

Let us define a square centered at the origin with side of length 2. A circle centered at the origin is inscribed in this square.

The assumption that we are using in this method is that if we randomly take a few points within the square, the ratio of the number of points that falls within the circle to the total points taken is equal to that of the area of the square and the circle. That is,

Area of square / area of circle = totalRandomSamples / totalPointsInCircle Let us write a JavaScript program that could do perform this with a huge number of random sample p…