The BINOMIAL function computes the probability that in a cumulative binomial (Bernoulli) distribution, a random variable *X* is greater than or equal to a user-specified value *V*, given *N* independent performances and a probability of occurrence or success *P* in a single performance:

This routine is written in the IDL language. Its source code can be found in the file binomial.pro in the lib subdirectory of the IDL distribution.

## Examples

Compute the probability of obtaining at least two 6s in rolling a die four times. The result should be 0.131944.

result = BINOMIAL(2, 4, 1.0/6.0)

PRINT, result

Compute the probability of obtaining exactly two 6s in rolling a die four times. The result should be 0.115741.

result = BINOMIAL(2, 4, 1./6.) - BINOMIAL(3, 4, 1./6.)

PRINT, result

Compute the probability of obtaining three or fewer 6s in rolling a die four times. The result should be 0.999228.

result = BINOMIAL(0, 4, 1./6.) - BINOMIAL(4, 4, 1./6.)

PRINT, result

## Syntax

*Result* = BINOMIAL(*V*,* N*,* P* [, /DOUBLE] [, /GAUSSIAN] )

## Return Value

This function returns a single- or double-precision floating point scalar or array that contains the value of the probability.

## Arguments

### V

A non-negative integer specifying the minimum number of times the event occurs in *N* independent performances.

### N

A non-negative integer specifying the number of performances.

### P

A non-negative single- or double-precision floating-point scalar or array, in the interval [0.0, 1.0], that specifies the probability of occurrence or success of a single independent performance.

### DOUBLE

Set this keyword to force the computation to be done in double-precision arithmetic.

### GAUSSIAN

Set this keyword to use the Gaussian approximation, by using the normalized variable *Z* = (*V* – *NP*)/SQRT(*NP*(1 – *P*)). The Gaussian approximation is useful when *N* is large and neither *P* nor (1–*P*) is close to zero, where the binomial summation may overflow.

The GAUSSIAN keyword can be set to one of the following values:

- GAUSSIAN=1: Gaussian approximation will be used
- GAUSSIAN=0: Gaussian approximation will not be used
- GAUSSIAN not specified: Gaussian will be automatically used in case of binomial overflow and not used otherwise

## Examples

## Version History

Pre 4.0 |
Introduced |

## See Also

CHISQR_PDF, F_PDF, GAUSS_PDF, T_PDF