Phoenix

0 Reputation

2 Badges

15 years, 323 days

MaplePrimes Activity


These are replies submitted by Phoenix

Example:

The following Maple program calculates the probability that 4 cards contain a set in 2-dimensonal game (i.e. total 9 cards):

 

with(combinat):

cards:=[[0,0],[0,1],[0,2],[1,0],[1,1],[1,2],[2,0],[2,1],[2,2]]:

all4cards:=choose(cards,4):

ct:=0:

for i from 1 to binomial(9,4) do

trifrom4:=choose(all4cards[i],3):

b:=false:

for j from 1 to binomial(4,3) do

  t:= trifrom4[j]:

  if (t[1]+t[2]+t[3] mod 3 = [0,0]) then b:=true: end if:

end do:

if (b) then ct:=ct+1 end if:

end do:

print (ct/binomial(9,4));

 

Page 1 of 1