I am having difficulty with 'Maple' syntax. Please see below and explain each line's purpose (the overall purpose of the procedure is to determine how many people must be at a gathering place before the probability is greater than or equal to1/2 that at least 2 people share the same birthday):
> birthday:=proc(N,M)
local L,day,j,i,d,count ;
count:=0;
day:=rand(1..366);
for j from 1 to M do
L:=[];
for i from 1 to N do
d:=day();
if member(d,L)=true then count:=count+1; break fi;
L:=[op(L),d];
od;
od;
evalf(count/M);
end:
You could also e-mail me directly to sandorgr8@yahoo.com so that I can obtain a better understanding with a dialog.
Thanks in advance!
Tags: