Wednesday, July 1, 2015

Stochastic Geometry and Monte Carlo Simulations

For the past few weeks, I have been working on a summer research project with the Caltech SURF program. Today, I just learned about an interesting mathematical tool I had been using the whole time that I finally started to understand. It's called stochastic geometry.

Let's say that you'd like to generate a random, uniform distribution of points over some region. Assume that you have a function that outputs a uniform random distribution of real number decimals between 0 and 1.1 The method you use to generate a uniform distribution of points in any given region depends on the shape of the region over which you generate the points. A rectangular region is relatively simple. For a rectangular region that is n units wide and m units tall, you just need to generate a random x coordinate and a random y coordinate and multiply the resulting numbers by n and m, respectively. This generates two values that can be used as Cartesian coordinates to locate a random point in the rectangle. Do this many times and plot the resulting points on the rectangle. The result will be a rectangle filled uniformly with random points.

What about other shapes, such as the interior of a circle? This is a bit more complicated, because the range of possible y coordinates depends on the x coordinate chosen. You could, in theory, generate points in a square that contains the circular area of interest, and throw away points that were generated outside of the disk.2 But this isn't very efficient. Fortunately, polar coordinates make shapes like circles a bit easier to deal with. In polar coordinates, the location of any point is described by a radial distance r from the center of the disk and an angular distance θ from the zero angle. At first, it seems like you could generate random values for r and θ just like we did for the square, but this ends up favoring points in the center of the circle. Instead of being a random, uniform distribution, the disk, when filled, has an overabundance of points near the middle.3

To make a truly uniform, random distribution of points on the disk, we need to favor larger radii over smaller radii. This makes sense, because there are more possible points to pick from on the perimeter of a larger circle than on the perimeter of a smaller circle, because bigger circles have bigger perimeters. It turns out that the solution to this problem is to generate random values for r2, and then take the square root of these values to find r for plotting purposes.4

What good is generating a uniform distribution of points? In Monte Carlo simulations, a large number of random events are simulated in order to make statistical predictions about systems that cannot be easily modeled analytically. Being able to generate a uniform random distribution ensures that any deviations from uniform data are true properties of the system and not artifacts of the random generation process itself. For my research project, Monte Carlo simulations are being used to model the response of a telescope to incoming particles. Because the particular instrument I am working on is not easily analyzable, Monte Carlo simulations are invaluable for modeling what will happen when the telescope begins to take data.

***

1 This is a common feature of most programming languages.
2 Mathematicians call circular regions disks. Technically, a circle is just points on the perimeter of the disk.
It looks like this. Wolfram Mathworld has lots of other entries related to this subject, check it out if you are so inclined!
θ can simply be randomly generated. This is a consequence of the fact that generating a uniform random distribution of on the perimeter of a circle is as simple as generating a random value for θ and multiplying by 2π

No comments:

Post a Comment