In this CDF I explore the Gambler's ruin. In the above simulation, 2 gamblers (A and B) each start with half the capital. At each game 1 unit of capital is bet by each. It is illustrated from the viewpoint of player A (player B is the complement).

100 'rounds' between player A and B with planned number of games given. Although the 'amounts' are unrealistic, it illustrates the properties. Green coloured plots are those runs of games that have not reached ruin for either gambler. Red plots have stopped. The discrete choices for probabilities and small capital values were chosen for computational (time) convenience.

The probability that gambler A is in neither of the absorbing states after the number of games was calculated using powers of the transition matrix (exploiting the sparse array structure (central band)) and initial vector based on equal entry capital of each gambler. This is compared with the frequency of green games in the simulation.

The long run probability and expectation are calculated using the formulas derived from solving the recursive relations with absorbing states as boundary conditions.

The observed frequencies count the number of red plots, the red plots in which A wins and the fraction of red plots that A wins.

## No comments:

## Post a Comment