All problems
Poisson Process Probability
Problem
Probability that a Poisson process with rate lam has exactly k events in the time interval (t1, t2).
The count is Poisson distributed with mean lam * (t2 - t1). Return 0.0 when lam < 0, t2 < t1 or k < 0.
Hint
Only the interval length enters the mean, not the absolute times.
Test cases
case 1
in: [2,0,1,0]
expected: 0.1353352832366127
case 2
in: [3,1,3,2]
expected: 0.044617539179994455
case 3
in: [1,0,2,3]
expected: 0.1804470443154836
case 4
in: [1,2,1,1]
expected: 0
Starter codePython
import math
def poisson_process_probability(lam, t1, t2, k):
# Your code here
pass4 test cases · run your code against them in the editor