Univeristy of Alabama in Huntsville


IDL Routines from Phillip Bitzer and UAH Lightning Group

summary     class     fields     routine details     file attributes



Stats, ATS606, Binomial

This routine plots a binomial distribution for a given number of trials N and probability of success p. Of course, the binomial distribution is given by: $$ P(n) = {N \choose n} p^n (1-p)^{N-n} $$

Running this routine gives a plot of $P(n)$ vs. $N$.

In addition, this routine will shade the area under the curve for all values greater than or equal to $N*p$, the first moment of a binomial distribution.

WARNING: Very little error checking has been implemented. Careful not to open any black holes!


The routine is relatively straightforward:

ats_binomial_example, 100, 0.2

Also see the main level program.

Author information


Phillip M. Bitzer, University of Alabama in Huntsville, pm.bitzer "AT" uah.edu


Modification History:

First written: Sometime in 2012. Moved to the official ATS606 repo; accordingly, the name has been changed. 20130129 PMB Added a NOSHADE keyword. 20130129 PMB


top ats_binomial_example

ats_binomial_example [, num] [, p] [, /NOSHADE]

Calculate and plot the binomial distribution.


num in optional type=numeric scalar default=100

The number of trials. Must be greater than zero.

p in optional type=numeric scalar default=0.2

The probability of success. Must be a value between 0 and 1.


NOSHADE in optional type=boolean default=0B

Set this keyword to suppress the shading of the curve

File attributes

Modification date: Thu Oct 12 20:53:54 2017
Lines: 34
Docformat: rst rst