next up previous
Next: Defining Commands for a Up: Solving the Gambler's Ruin Previous: The Exact Solution of

Approximating the Solution of the Gambler's Ruin Problem via Simulation

The analysis above gave us the probability that the gambler will achieve the goal given the initial amount of money, the amount of money that the gambler wants to win, and the probabilities of winning and losing on each wager. For this simple problem it is possible to determine an exact solution. For more difficult problems an exact solution may exist, but may be impractical or impossible to determine. In these cases we can try to simulate the process of interest on a computer and determine some quantitative information about the problem from the results of the simulations. To build a computer simulator of the process, we must translate the description of the process into a set of rules that can be implemented into a computer code. In the present case, we will be interested in the process of a gambler entering a casino and playing a game many times until the money runs out or some additional amount of money is gained. In this section we will build a computer code that will simulate a single gambler.

Each time we run the computer simulation, we will determine the result for a single gambler. Finding out what happens to a single gambler will not tell us what the probability of achieving the goal is. In order to get an idea of the probability achieving the goal is to generate the results of many gamblers. After doing a large number of these simulations we can compute some statistics on the number of times the gambler would win or lose and how long these results take to happen. In particular, if we use our computer code to simulate what happens to 500 gamblers, we can compute an approximation to the probability of achieving the goal by dividing the number of winners by 500. By simulating more gamblers, we should be able to obtain better approximations of the probability. We will return to this after developing and implementing the simulator.

Beginning with a simulation of the Gambler's Ruin problem is the best strategy for illustrating how statistical simulation works. First, we have an exact solution which can be used for comparison with the results of the simulation. We can test the accuracy of our simulator. Also, we are already familiar with this problem which will make writing the simulator easier. In fact, we have already quantified most of the information we need in obtaining the exact solution. This means we can spend a little more time on the details of writing the necessary Mathematica code. Finally, we should start with a simple case before tackling more complicated problems.

Using computer simulations is a relatively cheap way to obtain quantitative information about a process. We could simulate the process related to the Gambler's Ruin problem by standing in front of a casino and handing out an initial amount of money to a large number of people who would in turn go through the process we are trying to achieve the goal. However, this would be rather expensive and we can just as easily have a computer simulate the process. All we have to do is translate the process into a computer code.



Subsections
next up previous
Next: Defining Commands for a Up: Solving the Gambler's Ruin Previous: The Exact Solution of
Joe Koebbe 2003-10-01