A Geometric random variable X counts the number of trials needed to obtain the first success. Evaluate its PMF at every value in k:
P(X=k)=(1−p)k−1pIts expected number of trials is:
E[X]=p1Here, p is the success probability and every k is a positive integer. Return a dictionary containing pmf as a NumPy array and mean as a Python float.
Input: k = [1, 2, 3], p = 0.2
Output: {"pmf": [0.2, 0.16, 0.128], "mean": 5.0}
Explanation: Each additional failure multiplies the next PMF value by 0.8, while the expected waiting time is 1 divided by 0.2.
Input: k = [1], p = 0.5
Output: {"pmf": [0.5], "mean": 2.0}
Use (1.0 - p) ** (k - 1) * p for the vectorized PMF.
The distribution mean is 1.0 / p.
Sign in to take notes on this problem
Accepts: array
Accepts: number
A Geometric random variable X counts the number of trials needed to obtain the first success. Evaluate its PMF at every value in k:
P(X=k)=(1−p)k−1pIts expected number of trials is:
E[X]=p1Here, p is the success probability and every k is a positive integer. Return a dictionary containing pmf as a NumPy array and mean as a Python float.
Input: k = [1, 2, 3], p = 0.2
Output: {"pmf": [0.2, 0.16, 0.128], "mean": 5.0}
Explanation: Each additional failure multiplies the next PMF value by 0.8, while the expected waiting time is 1 divided by 0.2.
Input: k = [1], p = 0.5
Output: {"pmf": [0.5], "mean": 2.0}
Use (1.0 - p) ** (k - 1) * p for the vectorized PMF.
The distribution mean is 1.0 / p.
Sign in to take notes on this problem
Accepts: array
Accepts: number