function b = BinomialProbability(n,k,p)
% BinomialProbability(n,k,p)
% This function provides the probability of surviving k of n trials for
% which the probability of each trial is p (for success) or 1-p for
% failure.
%
% So, if one has a 60% chance of surviving each event, there are 10 events,
% and you want to know the chance of surviving 4, and only 4, events then
% n=10, k=4, p=0.60
%
%
% IT'S NOT FANCY, BUT IT WORKS.
% Michael Robbins
% michaelrobbinsusenet@yahoo.com
q = 1 - p;
C = combination(n,k);
b = C .* p.^k .* q.^(n-k);