TensorTonicTensorTonic
Problems
Study PlansProjectsNewInterviewPricingFeedback
Problems
Loading...
1 / 1

Poisson Probability Mass Function & Cumulative Distribution Function

Probability and Statistics
Medium

For a Poisson distribution with rate λ\lambdaλ, compute the probability of exactly kkk events:

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

Also compute the probability of at most kkk events:

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​

Here, iii is a possible event count and lam represents λ\lambdaλ. Return a dictionary containing pmf and cdf as Python floats.

Loading visualization...

Examples

Input: lam = 3.0, k = 2

Output: {"pmf": 0.224042, "cdf": 0.42319}

Explanation: The CDF adds the probabilities for zero, one, and two events.

Input: lam = 2.5, k = 0

Output: {"pmf": 0.082085, "cdf": 0.082085}

Input: lam = 1.0, k = 1

Output: {"pmf": 0.367879, "cdf": 0.735759}

Hint 1

Initialize the zero-event probability with math.exp(-lam).

Hint 2

Advance from count i - 1 to i by multiplying the previous probability by lam / i.

Requirements

  • Start with the probability of zero events
  • Use the recurrence between consecutive Poisson probabilities
  • Accumulate probabilities through k for the CDF
  • Return exactly pmf and cdf in a dictionary of Python floats

Constraints

  • lam is positive
  • k is an integer between 0 and 50
  • Use the Python standard library only
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

For a Poisson distribution with rate λ\lambdaλ, compute the probability of exactly kkk events:

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

Also compute the probability of at most kkk events:

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​

Here, iii is a possible event count and lam represents λ\lambdaλ. Return a dictionary containing pmf and cdf as Python floats.

Loading visualization...

Examples

Input: lam = 3.0, k = 2

Output: {"pmf": 0.224042, "cdf": 0.42319}

Explanation: The CDF adds the probabilities for zero, one, and two events.

Input: lam = 2.5, k = 0

Output: {"pmf": 0.082085, "cdf": 0.082085}

Input: lam = 1.0, k = 1

Output: {"pmf": 0.367879, "cdf": 0.735759}

Hint 1

Initialize the zero-event probability with math.exp(-lam).

Hint 2

Advance from count i - 1 to i by multiplying the previous probability by lam / i.

Requirements

  • Start with the probability of zero events
  • Use the recurrence between consecutive Poisson probabilities
  • Accumulate probabilities through k for the CDF
  • Return exactly pmf and cdf in a dictionary of Python floats

Constraints

  • lam is positive
  • k is an integer between 0 and 50
  • Use the Python standard library only
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.