>
"Hit return to load the program":
with(plots):
with(plottools):
ProbData:=proc(BD,print)
local i,H,P1,P2;
H:=[];
for i from 1 to BD do
H:=[op(H),[i,100-100*evalf(
(factorial(BD))/(factorial(BD-i)*BD^(i))
)]];
od;
if print=list
then
lprint(H);
fi;
P1:=pointplot(H,color=red);
P2:=plot(50,x=0..BD,color=blue);display(P1,P2,title="Probability of Coincidence Plot",labels=["Number of People",Probability]);
end:
Warning, the name arrow has been redefined
Warning, the name arrow has been redefined
>
"Given 365 birthdays, here we graph the grobaility of a coincidence for each N < 365. You can change 365 to any number you like, and the nolist option can be cahnges to list to see the actual numbers. ":
ProbData(365,nolist);
>
"Here, in the month case, we include the list":
ProbData(12,list);
[[1, 0.], [2, 8.33333333], [3, 23.61111111], [4, 42.70833333], [5, 61.80555556], [6, 77.71990741], [7, 88.85995370], [8, 95.35831404], [9, 98.45277135], [10, 99.61319284], [11, 99.93553214], [12, 99.99462768]]