Skip to content
DeepForgeby svx
All problems
MediumProbabilitypr-074

Interarrival Exponential Probability

Problem

Probability that the first interarrival time T of a Poisson process with rate lam falls in (a, b):

P(a < T < b) = e^(-lam * a) - e^(-lam * b).

Return 0.0 when lam < 0, a < 0 or b < a.

Hint

Subtract the survival function values at the two endpoints.

Test cases

case 1
in: [1,0,1]
expected: 0.6321205588285577
case 2
in: [2,1,2]
expected: 0.11701964434787852
case 3
in: [1,0,0]
expected: 0
case 4
in: [0.5,2,4]
expected: 0.23254415793482963
Starter codePython
import math


def interarrival_exponential_probability(lam, a, b):
    # Your code here
    pass

4 test cases · run your code against them in the editor