Bob asks Alice for lunch together. They agree to meet at the train station at noon.

Assume that they arrive at the station uniformly from 12:00 to 12:30 independently.

That is, they arrive at the station anytime from 12:00 to 12:30 with equal probability.

This assignment is to simulate this situation with number of simulation ns=1000. The

following steps will guide you to perform this simulation.

(a) Using the number 23700 as the random seed, generate ns=1000

random numbers from U(0,30) and save them to alice. This represent Alice’s

arrival time (0=12:00 and 30=12:30). Similarly generate ns=1000 random

numbers from U(0,30) and save them to bob. This represent Bob’s arrival time.

(b) They both agree that they will wait for each other for at most 10 minutes. For

example, if Alice arrive at the station 12:05, then she will leave if Bob doesn’t

show up on or before 12:15. Write R commands to compute the proportion that

they will meet (among these ns simulations).

(c) Suppose they agree to wait for each other for at most 5 minutes instead of 10

minutes. Write R commands to compute the proportion that they will meet.

(d) Write R command(s) to count how many times (out of these ns simulations) that

Alice arrives before Bob.

(e) Combine alice and bob to form a nsx2 matrix T with alice in the first column and

bob in the second column.

(f) Select all the rows in T correspond to the case that Alice arrives before Bob and

save them to AB. Similarly select all the rows in T correspond to the case that

Bob arrives before Alice or they arrive at the same time and save them to BA.

That is, the number of rows in AB plus the number of rows in BA should be ns.

(g) Suppose Alice will wait for Bob for only at most 5 minutes while Bob will wait

for Alice for at most 10 minutes. Write R commands to compute the proportion

that they will meet (among these ns simulations).

(h) Compute the probability of they will meet in part (b), (c) and (g) respectively.