geometricPdf

Evaluates the discrete geometric probability density function (PDF).

Synopsis

geometricPdf (ix, pin)

Required Arguments

int ix (Input)
Argument for which the discrete geometric PDF is to be evaluated. ix must be non-negative.
float pin (Input)
Probability parameter of the discrete geometric PDF (the probability of success for each independent trial). pin must be in the open interval (0, 1).

Return Value

The probability that a discrete geometric random variable having parameter pin will be equal to ix. A value of NaN is returned if an input value is in error.

Description

The function geometricPdf evaluates the discrete geometric probability density function (PDF), defined

\[f(I|p) = p(1-p)^I, \phantom{...} 0 < p < 1\]

where the return value f(Ip) is the probability that I = ix trials would be observed before observing a success, and input parameter p = pin is the probability of success for each independent trial.

Example

In this example, we evaluate the discrete geometric PDF at ix = 3, pin = 0.25.

from __future__ import print_function
from numpy import *
from pyimsl.stat.geometricPdf import geometricPdf

ix = 3
pin = 0.25

p = geometricPdf(ix, pin)

print("The probability density of a discrete geometric")
print("random variable with probability parameter pin = %4.2f" % pin)
print("and value ix = %1i is %8.6f" % (ix, p))

Output

The probability density of a discrete geometric
random variable with probability parameter pin = 0.25
and value ix = 3 is 0.105469