All problems
M/M/1 Wait Exceedance Probability
Problem
For a stable M/M/1 queue, return the probability that a customer waits more than time t:
P(W > t) = rho * exp(-(mu - lam) * t).
Return 0.0 when the queue is unstable or inputs are invalid.
Hint
The waiting time is exponential with rate mu - lam, taken with probability rho.
Test cases
case 1
in: [1,2,1]
expected: 0.18393972058572117
case 2
in: [1,2,0]
expected: 0.5
case 3
in: [2,4,2]
expected: 0.00915781944436709
case 4
in: [1,1,1]
expected: 0
Starter codePython
import math
def mm1_wait_exceed_probability(lam, mu, t):
# Your code here
pass4 test cases · run your code against them in the editor