BINOMIALPROB numberOfTrials probabilityOfSuccess [numberOfSuccesses] resultVector

The BINOMIALPROB command computes the probability of k successes in n independent trials given a probability of success, where n is numberOfTrials, probabilityOfSuccess is the probability of one success, and k is the numberOfSuccesses.

If the numberOfSuccesses is omitted, then the BINOMIALPROB command computes the probabilities for all k such that 0 <= k <= n and replaces the contents of resultVector with those values, in order. In other words, resultVector will contain the probabilities for k=0, k=1, k=2, ... k=n. ResultVector will therefore have n+1 elements because of the k=0 element being the first.

NumberOfTrials must be > 0. probabilityOfSuccess must be between 0.0 and 1.0. numberOfSuccesses must be >= 0. If numberOfTrials or numberOfSuccesses is non-integer, it will be truncated to an integer. (For example, 3.4, 3.5, and 3.9 will all be truncated to 3.0.)

If you roll a 6-sided die 200 times, what is the probability that it will land with 6 up exactly 45 times? If the die is fair, its probability of landing on 6 is one out of 6, or 0.1666666. Therefore, the following commands will produce the desired answer:

BINOMIALPROB 200 0.1666666667 45 probability
PRINT probability

The above program produces the following output:

probability: 0.0070618677399964525

If you wanted to know the probability of the die landing on six 45 or more times out of 200, you can use this program:

BINOMIALPROB 200 0.1666666667 probabilities
TAKE probabilities 46,201 probs45AndUp
SUM probs45AndUp sumProbs45AndUp
PRINT sumProbs45AndUp

The above program uses the BINOMIALPROB command to create a list of probabilities for all numbers of successes from 0 to 200. This happens because the numberOfSuccesses has been omitted from the command. Then the program uses the TAKE command to copy those probabilities for 45 successes through 200 successes into a new vector, probs45AndUp. IMPORTANT: in the TAKE command, note that since the first element of the probabilities vector is for 0 successes (not one) it follows that the probability for 45 successes will be the 46th element in the vector and that for the last element will be the 201st. Finally, the program sums the selected probabilities and prints the result. The above program produces the following output:

sumProbs45AndUp: 0.01989445126283927

If you wanted to create a table of binomial probabilities, you might use something like the following program.

BINOMIALPROB 10 0.5 Probabilities
COPY 0,10 Successes
PRINT table successes%10.2f probabilities%3.6f

Which produces the following table in the Output Window:

Successes     Probabilities	
0             0.000977	
1             0.009766	
2             0.043945	
3             0.117188	
4             0.205078	
5             0.246094	
6             0.205078	
7             0.117188	
8             0.043945	
9             0.009766	
10            0.000977

See XYPLOT for an example that plots the output of the BINOMIALPROB command.