All problems
Inspection Paradox Mean Interval
Problem
For a renewal process with exponential interarrival times of rate lam, the interval containing a randomly chosen time is length-biased. Its mean is:
E[interval] = E[X^2] / E[X] = 2 / lam.
Return 0.0 for lam <= 0.
Hint
The exponential has E[X^2] = 2 / lam^2 and E[X] = 1 / lam.
Test cases
case 1
in: [1]
expected: 2
case 2
in: [0.5]
expected: 4
case 3
in: [2]
expected: 1
case 4
in: [0]
expected: 0
Starter codePython
def inspection_paradox_mean_interval(lam):
# Your code here
pass4 test cases · run your code against them in the editor