Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Sage Probability

Please help me write a sage function for the following problem:

Suppose a gambler starts with R1000. He repeatedly plays a game where the initial bet is R100. The gambler has a 60% chance of losing the game (in which case he gets nothing), but a 40% chance of winning and doubling his money (ie, he gets back R200). If the gambler loses all of his money, he is ruined and stops playing. If the gambler reaches R2000, he also stops playing. Otherwise, the gambler keeps playing. What is the probability that the gambler stops with R2000? What is the probability he is ruined?

Write a simulation to empirically determine the probabilities. Run your simulation 10000 times. What are the probabilities for ruin and winning?

click to hide/show revision 2
retagged

Sage Probability

Please help me write a sage function for the following problem:

Suppose a gambler starts with R1000. He repeatedly plays a game where the initial bet is R100. The gambler has a 60% chance of losing the game (in which case he gets nothing), but a 40% chance of winning and doubling his money (ie, he gets back R200). If the gambler loses all of his money, he is ruined and stops playing. If the gambler reaches R2000, he also stops playing. Otherwise, the gambler keeps playing. What is the probability that the gambler stops with R2000? What is the probability he is ruined?

Write a simulation to empirically determine the probabilities. Run your simulation 10000 times. What are the probabilities for ruin and winning?