Sheldon Ross 10: Exercise 3.20

Sheldon Ross 10 Exercise 3.20_miner_no cigar-01.jpg

Question: Consider Example 3.13, which refers to a miner trapped in a mine. Let N denote the total number of doors selected before the miner reaches safety. Also, let Ti denote the travel time  corresponding to the ith choice, i ≥ 1. Again let X denote the time when the miner reaches safety.

  1. Give an identity that relates X to N and the Ti
  2. What is E[N]?
  3. What is E[TN]?
  4. What is E[Σ Ti |N = n]?
  5. Using the preceding, what is E[X]?

Analytical Solution

  1. The first one is simply the sum of Ti where the index over i from 1 to N
  2. This section of the question is a little sneaky. Notice how the type of door that you take is dependent on the probability which is same for all the doors
    • This means that the expected number of doors is simply the reciprocal of the probability
    • I would suggest you to change the probability to not being same for all the doors, you will notice that the expected number of the doors is no longer equal to the reciprocal of any one of them
  3. Expected time taken for the Nth to be exited
    • Since the Nth door leads to the exit of the miner from entrapment, the time spent in the last step would always be the same and equal to 2 hours
    • This means that the expected time is also 2 hours
  4. Part 4 and Part 5 might seem deceptively similar. In the part 4, we are asked the expected time taken by the miner in entrapment given that we know the number of the doors taken whereas the part 5 asks for the expected time spent in entrapment without us knowing the actual number of the doors already visited
    • From the question, we know that exiting steps takes 2 hours
    • The other steps take 5 and 3 hours even though none of them lead to the exit
      • The expected time needed to complete steps before getting to the exiting door would be (ExpectedPreTime)*(n-1)
      • This would in-turn become 0.5(3+5)*(n-1) = 4(n-1)
    • The total time is 4(n-1)+2
  5. The last one is an extrapolation from the result from part 4
    • The answer would be E[4(n-1)+2] = 4E[n-1]+2 = 4*(3-1)+2 = 10

Simulation Solution

The simulations for this problem in one of my previous posts and here is the link. Just as a reference, I have included a new version of the code below.

from sys import stdout
from mathematica.random_functions import RandomChoice, RandomReal
from mathematica.lists import Transpose
from mathematica.string_operations import StringPadLeft, StringPadRight

print("Opening the text file")
_file = open(
    'your_file.txt',
    'w')

print("Initializing the loop and writing to the text file")

print("_" * 106)

_steps = 10000000
_subSteps = _steps // 100
for i in range(0, _steps):
    _n, _time = 0, 0
    while True:
        _n += 1
        _rand = RandomReal()
        if 0 <= _rand < 1 / 3:
            _time += 2
            break
        elif 1 / 3 <= _rand < 2 / 3:
            _time += 3
        elif 2 / 3 <= _rand <= 1:
            _time += 5
    _file.write({_n, _time}.__str__() + '\n')
    if (i + 1) % _subSteps == 0:
        stdout.write("\r" + ("\r" + ("#" * (i // _subSteps + 1)).ljust(100)) + " " + str(i // _subSteps + 1) + " %")
        stdout.flush()

End of the post 🙂


.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.