Lesson 11 of 15
Poisson & Exponential Distributions
Rare Events and Waiting Times
Poisson Distribution
counts the number of rare events in a fixed interval, where is the average rate:
Examples: customers arriving per hour, mutations per genome, photons hitting a detector.
Exponential Distribution
models the waiting time between consecutive Poisson events:
Memoryless property: . The distribution forgets how long you have already waited.
import math
lam = 2.0 # 2 events per hour on average
# P(exactly 2 events in one hour)
pmf = math.exp(-lam) * lam**2 / math.factorial(2)
print(round(pmf, 4)) # 0.2707
# P(wait ≤ 1 hour for next event)
cdf = 1 - math.exp(-lam * 1.0)
print(round(cdf, 4)) # 0.8647
Your Task
Implement poisson_and_exponential(lam, k, x) that prints:
- Poisson PMF:
- Exponential CDF:
- Exponential mean:
All rounded to 4 decimal places.
Pyodide loading...
Loading...
Click "Run" to execute your code.