You are on page 1of 1

1 1: Bisection method

Bonus Lab 3:
Recall the casino game from earlier in the course:
Game 1. You make your bet and start with one 1 point. The casino generates a random number between
0.52 and 1.52, and multiplies your points by that amount. The game ends after 10,000 rounds, after which,
the casino pays you twice your bet if you have more than 1 point. Otherwise, you lose your bet.
Perhaps surprisingly, despite the fact that each round you, on average, earn points, this is a bad game.
The odds of you losing are very large. Further, if you adjust the game so that a random number is between
0.55 and 1.55, then the odds always in your favor.
Let us consider a generalization of the game-
Game 2. Let x, y 0 be given. You make your bet and start with one 1 point. The casino generates a
random number between 1 + x y/2 and 1 + x + y/2, and multiplies your points by that amount. The game
ends after 10,000 rounds, after which, the casino pays you twice your bet if you have more than 1 point.
Otherwise, you lose your bet.
In other words, we can adjust the window for which the random number is chosen. To see that this aect
the result, let y be 0, then for any x > 0, however small, you will end up with more than one point and win
even though the (expected) multiplier is 1 + x which can be as close to 1 as you would like. This stands in
contrast to the first game where the expected multiplier is 1.02 and you will likely lose.
We define g(y) to be the function that, for fixed y, returns the value of x in the second game above which
results in an even (50%) chance of winning and losing. Your task is to numerically determine the function
g(y) for 0 y 2, and make the corresponding plot (say for y at increments of 0.1). Additionally, you
should document your methods and briefly discuss their inaccuracies and/or limitations.

You might also like