One of the most celebrated constants in the scientific world is the representation for π. Although its origins are in geometry and it simply refers to the ratio of the length of circumference of a circle to the length of diameter of the same circle, it has managed to influence other aspects of life, including entertainment (where it served as a motivation for a character Pi in the bestseller and winner of several Oscar awards, Life of Pi). In the context of simulations, my interest in estimating π is to show how this problem can be couched in the form of a simulation problem (where the idea of random variables does not seem to be as transparent as the two earlier examples). To understand how best to use simulations to estimate π, the reader should first note that the area of a circle with unit radius is trivially π. Hence the area of such a circle in first quadrant (i.e., a quarter of the circle) is simply

As can be seen in Figure 4.1, if one is allowed to throw a dart randomly onto a square paper of unit length sides, then the proportion of times the dart falls into the shaded region should in the long run be the area of the quarter

TABLE 4.11 Simulating an M/M/l Queue

FIGURE 4.1 Inscribing a Square of Unit Length with a Quarter Circle

of a circle with unit radius (i.e., ). To simulate this dart-throwing exercise, one can randomly draw a uniform random variable along the horizontal axis and make another independent draw along the vertical axis. By computing the distance of this random coordinate from the origin, one can determine if the simulated coordinate is in the gray region or out of the gray region. Computing the proportion of times this randomly selected coordinate falls into the gray region and equating it to, one can estimate. Table 4.12, shows the implementation of this estimation.

As can be seen from Table 4.12 (cell B1 and B2), the randomly generated coordinate is (0.763, 0.993). This point is illustrated in Figure 4.1. The reader can also see from both Table 4.12 and Figure 4.1, the distance of the simulated coordinate from the origin exceeds 1 – resulting in a score of 0. Keeping track of the proportion of times that the value in cell B3 is less than 1 for 5,000 runs gives one a value of 0.784. Equating this to the value of gives a value of 3.136 for .

TABLE 4.12 Simulating Pi

Found a mistake? Please highlight the word and press Shift + Enter