Modify the program CoinTosses to toss a coin [math]n[/math] times and print out after every 100 tosses the proportion of heads minus 1/2. Do these numbers appear to approach 0 as [math]n[/math] increases? Modify the program again to print out, every 100 times, both of the following quantities: the proportion of heads minus 1/2, and the number of heads minus half the number of tosses. Do these numbers appear to approach 0 as [math]n[/math] increases?
Modify the program CoinTosses so that it tosses a coin [math]n[/math] times and records whether or not the proportion of heads is within .1 of .5 (i.e.,between .4 and .6). Have your program repeat this experiment 100 times. About how large must [math]n[/math] be so that approximately 95 out of 100 times the proportion of heads is between .4 and .6?
In the early 1600s, Galileo was asked to explain the fact that, although the number of triples of integers from 1 to 6 with sum 9 is the same as the number of such triples with sum 10, when three dice are rolled, a 9 seemed to come up less often than a 10---supposedly in the experience of gamblers.
- Write a program to simulate the roll of three dice a large number of times and keep track of the proportion of times that the sum is 9 and the proportion of times it is 10.
- Can you conclude from your simulations that the gamblers were correct?
In raquetball, a player continues to serve as long as she is winning; a point is scored only when a player is serving and wins the volley. The first player to win 21 points wins the game. Assume that you serve first and have a probability .6 of winning a volley when you serve and probability .5 when your opponent serves. Estimate, by simulation, the probability that you will win a game.
Consider the bet that all three dice will turn up sixes at least once in [math]n[/math] rolls of three dice. Calculate [math]f(n)[/math], the probability of at least one triple-six when three dice are rolled [math]n[/math] times. Determine the smallest value of [math]n[/math] necessary for a favorable bet that a triple-six will occur when three dice are rolled [math]n[/math] times. (DeMoivre would say it should be about [math]216\log 2 = 149.7[/math] and so would answer 150---see Exercise. Do you agree with him?)
In Las Vegas, a roulette wheel has 38 slots numbered 0, 00, 1, 2, ..., 36. The 0 and 00 slots are green and half of the remaining 36 slots are red and half are black. A croupier spins the wheel and throws in an ivory ball. If you bet 1 dollar on red, you win 1 dollar if the ball stops in a red slot and otherwise you lose 1 dollar. Write a program to find the total winnings for a player who makes 1000 bets on red.
Another form of bet for roulette is to bet that a specific number (say 17) will turn up. If the ball stops on your number, you get your dollar back plus 35 dollars. If not, you lose your dollar. Write a program that will plot your winnings when you make 500 plays of roulette at Las Vegas, first when you bet each time on red (see Exercise), and then for a second visit to Las Vegas when you make 500 plays betting each time on the number 17. What differences do you see in the graphs of your winnings on these two occasions?
An astute student noticed that, in our simulation of the game of heads or tails (see Example), the proportion of times the player is always in the lead is very close to the proportion of times that the player's total winnings end up 0. Work out these probabilities by enumeration of all cases for two tosses and for four tosses, and see if you think that these probabilities are, in fact, the same.
The Labouchere system for roulette is played as follows. Write down a list of numbers, usually 1, 2, 3, 4. Bet the sum of the first and last, [math]1 + 4 = 5[/math], on red. If you win, delete the first and last numbers from your list. If you lose, add the amount that you last bet to the end of your list. Then use the new list and bet the sum of the first and last numbers (if there is only one number, bet that amount). Continue until your list becomes empty. Show that, if this happens, you win the sum, [math]1 + 2 + 3 + 4= 10[/math], of your original list. Simulate this system and see if you do always stop and, hence, always win. If so, why is this not a foolproof gambling system?
Another well-known gambling system is the martingale doubling system. Suppose that you are betting on red to turn up in roulette. Every time you win, bet 1 dollar next time. Every time you lose, double your previous bet. Suppose that you use this system until you have won at least 5 dollars or you have lost more than 100 dollars. Write a program to simulate this and play it a number of times and see how you do. In his book The Newcomes, W. M. Thackeray remarks “You have not played as yet? Do not do so; above all avoid a martingale if you do.”[Notes 1] Was this good advice?
Notes