Probability function of the hypergeometric distribution
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
stats::hypergeometricPF(N
, X
, n
)
stats::hypergeometricPF(N, X, n)
returns
a procedure representing the probability function
for
of
the hypergeometric distribution with "population size" N
,
"success population size" X
and "sample
size" n
.
The procedure f:=stats::hypergeometricPF(N, X, n)
can
be called in the form f(x)
with arithmetical expressions x
.
The return value of f(x)
is either a floatingpoint
number, an exact numerical value, or a symbolic expression:
If x
is a noninteger numerical value, f(x)
returns 0 or 0.0,
respectively.
If x
is an integer or the floatingpoint
equivalent of an integer, while N
is a positive
integer and both X
and n
are
nonnegative integers, then an explicit numerical value is returned.
The function f
reacts to properties of identifiers
set via assume
.
If any of the parameters is symbolic with properties as follows, then 0, 1 or a symbolic result is returned:
If X = N, then f(x) = 1 for x = n and f(x) = 0 for x ≠ n. If n = N, then f(x) = 1 for x = X and f(x) = 0 for x ≠ X.
If X = N  1, then for x = n, for x = n  1 and f(x) = 0 for x ≠ n, n  1.
If n = N  1, then for x = X, for x = X  1 and f(x) = 0 for x ≠ X, X  1.
If X = 1, then for x = 0, for x = 1 and f(x) = 0 for x ≠ 0, 1.
If n = 1, then for x = 0, for x = 1 and f(x) = 0 for x ≠ 0, 1.
If X = 0 or n = 0, then f(x) = 1 for x = 0 and f(x) = 0 for x ≠ 0.
If x
and all parameters but N
are
numerical and the assumption on N
is assume(N
> X)
, then symbolic values are returned.
f(x)
returns the symbolic call stats::hypergeometricPF(N,
X, n)(x)
in all other cases.
Numerical values for N
are only accepted
if they are positive integers.
Numerical values for X
are only accepted
if they are nonnegative integers.
Numerical values for n
are only accepted
if they are nonnegative integers.
Note:
If 
Note that for large numbers, floatingpoint results are computed
much faster than exact results. If floatingpoint approximations are
desired, pass a floatingpoint number x
to stats::hypergeometricPF
.
The function is sensitive to the environment variable DIGITS
which
determines the numerical working precision.
We compute the probability function with N = 20, X = 4 and n = 3 at various points:
f := stats::hypergeometricPF(20, 4, 3): f(infinity), f(0), f(1/2), f(1), f(2), f(4), f(infinity)
f(0.2), f(0.0), f(0.7), f(1.0), f(2.0), f(2.7), f(3.0), f(4.0)
delete f:
We use symbolic arguments:
f := stats::hypergeometricPF(N, X, n): f(x), f(8), f(8.0)
When real numbers are assigned to N, X and n, the function f starts to produce explicit results if the argument is numerical:
N := 15: X := 6: n := 5: f(0), f(1), f(2.0), f(3.5), f(4)
delete f, N, X, n, x:
If one or more parameters are symbolic, usually a symbolic call is returned. Some combinations of symbolic and numeric values for N, X, n and x, however, may yield symbolic or numeric results:
f := stats::hypergeometricPF(N, X, n): X := 1: f(1), f(0), f(1), f(3/2), f(2), f(3)
X := N: f(1), f(n), f(n + 1)
delete f, X:
If x and all parameters but N are numerical and N is assumed to be greater than X, a symbolic expression is returned:
X := 6: assume(N > X): f := stats::hypergeometricPF(N, X, 5): f(2), f(4), f(5.0)
delete f, N, X:

The "population size": an arithmetical expression representing a positive integer 

The "success population size": an arithmetical expression representing a nonnegative integer 

The "sample size": an arithmetical expression representing a nonnegative integer 