If I throw 1000 10centimeterlong needles on to a tiled floor, where each tile is a 10 cm x 30 cm rectangle, approximately how many needles will end up lying across a crack?
You may assume that the widths of both the needles and the cracks are negligible.
(In reply to
re: solution  second thoughts by Charlie)
The following program simulates the throw of one million needles to see what fraction fall on a crack. The center of the needle will necessarily fall within some tile, so the vertical position, y, is chosen as position 0 through 10 within whatever rectangle it falls in, and the horizontal position, x, as position 0 through 30. The orientation of the needle is uniformly random from 0 to 2 pi. If any end of the needle (5 units from the center) falls outside the bounds of the rectangle, a crossing of a crack is counted:
RANDOMIZE TIMER
DEFDBL AZ
pi = ATN(1) * 4
FOR trial = 1 TO 1000000
tr = tr + 1
yCtr = RND(1) * 10
xCtr = RND(1) * 30
orient = RND(1) * 2 * pi
yDiff = ABS(5 * SIN(orient))
xDiff = ABS(5 * COS(orient))
IF yCtr + yDiff > 10 OR yCtr  yDiff < 0 OR xCtr + xDiff > 30 OR xCtr  xDiff < 0 THEN
cross = cross + 1
END IF
NEXT trial
PRINT cross, tr, cross / tr
Three runs result in the following statistics for crossings, trials and their ratio:
742802 1000000 .742802
742227 1000000 .742227
742981 1000000 .742981
This confirms the .7427... probability of "second thoughts" over my originally posted "solution" of .7137..., for an expected 743 crossings in 1000 trials. Note the lower relative standard deviation here due to the large number of needles. Simulations with 1000 needles result in:
725
715
746
740
730
736
757
738
754
741
720
760
737
737
739
761
734
727
749
759
Edited on January 21, 2005, 3:01 pm

Posted by Charlie
on 20050121 14:57:14 