Frank has a tablecloth covered with 1 cm diameter black polka dots. The polka dots form a square grid with 2 cm between neighboring centers.
He takes a flat 4 cm by 4 cm piece of clear plastic and paints four 1 cm diameter circles on it in the same pattern as on the tablecloth. After laying the tablecloth on a flat surface, he randomly tosses the piece of plastic onto it.
To three significant figures, what is the probability that none of the polka dots on the plastic will overlap any portion of any of the polka dots on the tablecloth?
Both the relative placement and angular orientation affect the outcome.
The table cloth will have dots centered at all even positions on the Cartesian plane (even x and even y).
The x coordinate of one of the centers on the tossed plastic will be chosen at random, from zero to 2, and the same for the y coordinate. The rotation will be randomly chosen between zero and 360°.
For ease of programming all measurements will be halved. The dots will be 1 unit apart and 1/2 unit in diameter. As the radius is 1/4 unit for both the table cloth and the tossed plastic a distance of 1/2 unit (1/4 unit from each of the two radii) is the closest to avoid an overlap.
Each dot center on the tossed plastic will have its distance measured to each of the four center points on the tablecloth grid nearest it, found by taking the floor and ceiling of the x and y coordinates independently.
The program does 10 sets of 100 million trials each and reports the complement of the number of hits divided by number of trials (100,000,000).
for ttt=1:10
hits=0;
for trial=1:100000000
x=rand;y=rand;
angle=360*rand;
pt(1,:)=[x,y];
pt(2,:)=[x+cosd(angle),y+sind(angle)];
angle=angle-90;
pt(3,:)=[x+cosd(angle),y+sind(angle)];
angle=angle+45;
pt(4,:)=[x+cosd(angle)*sqrt(2),y+sind(angle)*sqrt(2)];
hit=false;
for ptNo=1:4
p=pt(ptNo,:);
ptT(1,:)=floor(p);
ptT(2,:)=ceil(p);
ptT(3,:)=[floor(p(1)),ceil(p(2))];
ptT(4,:)=[ceil(p(1)),floor(p(2))];
for i=1:4
d=norm(p-ptT(i,:));
if d<.5
hit=true;
break
end
end
if hit
break
end
end
if hit
hits=hits+1;
end
end
% hits
% hits/trial
1-hits/trial
end
>> tableclothAndPolkaDots
ans =
0.02489226
ans =
0.02492838
ans =
0.02494222
ans =
0.02492589
ans =
0.02493308
ans =
0.02494155
ans =
0.02492736
ans =
0.02490672
ans =
0.02491326
ans =
0.02491421
>>
All of these round to 0.0249, and most are slightly larger than that, rather than smaller. It amounts to about 1 in 40.15.
|
Posted by Charlie
on 2024-12-17 09:50:55 |