TensorTonicTensorTonic
Problems
Study PlansProjectsInterviewPricingFeedback
Problems
Loading...
1 / 1

Poisson Probability Mass Function & Cumulative Distribution Function

Probability and Statistics
Medium

Implement the Poisson distribution Probability Mass Function (PMF) and Cumulative Distribution Function (CDF). The Poisson distribution models the count of events in a fixed interval with average rate λ.

Poisson Distribution:

Probability Mass Function:

P(X=k)=e−λλkk!P(X = k) = \frac{e^{-\lambda} \lambda^{k}}{k!} P(X=k)=k!e−λλk​

Cumulative Distribution Function:

P(X≤k)=∑i=0ke−λλii!P(X \le k) = \sum_{i=0}^{k} \frac{e^{-\lambda} \lambda^{i}}{i!} P(X≤k)=i=0∑k​i!e−λλi​

Function Arguments

  • lam: float - Rate parameter (λ > 0)
  • k: int - Number of events (k ≥ 0)
Loading visualization...

Examples

Input: lam=3, k=2

Output: pmf≈0.2240, cdf≈0.4232

Input: lam=2.5, k=0

Output: pmf≈0.0821, cdf≈0.0821

Input: lam=1.0, k=1

Output: pmf≈0.3679, cdf≈0.7358

Hint 1

Use np.log() and np.exp() for numerical stability in factorial computation.

Hint 2

For CDF, sum PMF values from i=0 to k using a loop.

Hint 3

Use np.sum(np.log(np.arange(1, k+1))) for log factorial.

Requirements

  • Return tuple: (pmf, cdf)
  • Both pmf and cdf: scalar floats
  • Use stable log factorial computation
  • No loops over factorial calculation

Constraints

  • λ > 0, k ≥ 0 ≤ 50
  • NumPy only; time limit: 300ms
Try Similar Problems
Binomial Pmf CdfBernoulli PmfGeometric Pmf MeanExpected Value DiscreteSample Var Std

Sign in to take notes on this problem

Case 1
Case 2
Case 3

Accepts: number

Accepts: number

You must run your code first.
PrevNext

Poisson Probability Mass Function & Cumulative Distribution Function

Probability and Statistics
Medium

Implement the Poisson distribution Probability Mass Function (PMF) and Cumulative Distribution Function (CDF). The Poisson distribution models the count of events in a fixed interval with average rate λ.

Poisson Distribution:

Probability Mass Function:

P(X=k)=e−λλkk!P(X = k) = \frac{e^{-\lambda} \lambda^{k}}{k!} P(X=k)=k!e−λλk​

Cumulative Distribution Function:

P(X≤k)=∑i=0ke−λλii!P(X \le k) = \sum_{i=0}^{k} \frac{e^{-\lambda} \lambda^{i}}{i!} P(X≤k)=i=0∑k​i!e−λλi​

Function Arguments

  • lam: float - Rate parameter (λ > 0)
  • k: int - Number of events (k ≥ 0)
Loading visualization...

Examples

Input: lam=3, k=2

Output: pmf≈0.2240, cdf≈0.4232

Input: lam=2.5, k=0

Output: pmf≈0.0821, cdf≈0.0821

Input: lam=1.0, k=1

Output: pmf≈0.3679, cdf≈0.7358

Hint 1

Use np.log() and np.exp() for numerical stability in factorial computation.

Hint 2

For CDF, sum PMF values from i=0 to k using a loop.

Hint 3

Use np.sum(np.log(np.arange(1, k+1))) for log factorial.

Requirements

  • Return tuple: (pmf, cdf)
  • Both pmf and cdf: scalar floats
  • Use stable log factorial computation
  • No loops over factorial calculation

Constraints

  • λ > 0, k ≥ 0 ≤ 50
  • NumPy only; time limit: 300ms
Try Similar Problems
Binomial Pmf CdfBernoulli PmfGeometric Pmf MeanExpected Value DiscreteSample Var Std

Sign in to take notes on this problem

Case 1
Case 2
Case 3

Accepts: number

Accepts: number

You must run your code first.