All problems
Poisson Process Expected Arrival Time
Problem
For a Poisson process with rate lam, the time of the k-th event is the sum of k independent exponential interarrival times, each with mean 1 / lam. Return the expected time of the k-th event, which is k / lam. Return 0.0 for lam <= 0 or k < 0, and 0.0 for k = 0.
Hint
Linearity of expectation over the k independent interarrival times.
Test cases
case 1
in: [2,3]
expected: 1.5
case 2
in: [0.5,1]
expected: 2
case 3
in: [1,0]
expected: 0
case 4
in: [4,2]
expected: 0.5
case 5
in: [0.25,5]
expected: 20
Starter codePython
def poisson_expected_arrival_time(lam, k):
# Your code here
pass5 test cases · run your code against them in the editor