Let's say a train arrives at a stop every 15 or 45 minutes with equal probability (1/2). What is the expected waiting time of a passenger for the next train if this passenger arrives at the stop at any random time. This means that the passenger has no sense of time nor know when the last train left and could enter the station at any point within the interval of 2 consecutive trains.
I was told 15 minutes was the wrong answer and my machine simulated answer is 18.75 minutes. I just don't know the mathematical approach for this problem and of course the exact true answer. Sincerely hope you guys can help me.
[self-study]
tag & read its wiki. Then tell us what you understand thus far, what you've tried & where you're stuck. We'll provide hints to help you get unstuck. $\endgroup$R
simulation. It processes several million people per second.n.trains <- 1e4; n.people <- 100 * n.trains; trains <- cumsum(ifelse(runif(n.trains) < 1/2, 15, 45)); people <- cumsum(rexp(n.people, rate=n.people/max(trains))); i <- c(rep(0, n.trains), rep(1, n.people))[order(c(trains, people))]; j <- length(trains) + 1 - rev(cumsum(rev(1-i))); k <- cumsum(i); waits <- (trains[j] - people[k])[i==1]; c(Mean=mean(waits, na.rm=TRUE), N=sum(!is.na(waits)))
$\endgroup$