% LMex030208_4th.m
% Larsen & Marx (2006) 4th Edition, p 144
% Wipe your feet carpet cleaning problem
% Written by Eugene Gallagher, Eugene.Gallagher@umb.edu
% http://alpha.es.umb.edu/faculty/edg/files/edgwebp.html
% Written, 10/7/10, revised 1/12/11
% What is the probability of contacting 100 or more customers if
% 1000 phone calls are made in a community of 60000 which has
% 5000 potential customers
if exist('hygepdf','file')
    P=1-sum(hygepdf(0:99,60000,1000,5000))
elseif exist('LMTheorem030202_4th','file')
    P=1-sum(LMTheorem030202_4th(1000,0:99,5000,60000))
else
    disp('No hypergeometric function on path')
end
% can be solved using the cumulative hypergeometric probability
% distribution function as well; The cumulative distribution function
% is introduced in Definition 3.4.3 and Theorem 3.4.1
p = 1-hygecdf(99,60000,5000,1000)