Re: Interesting Simulation Problems....
- To: mathgroup@smc.vnet.net
- Subject: [mg12192] Re: [mg12084] Interesting Simulation Problems....
- From: Robert Pratt <rpratt@math.unc.edu>
- Date: Fri, 1 May 1998 03:08:43 -0400
The problem can be formulated as follows. Let X and Y be independent
uniformly distributed random real variables on the closed interval
[0,60]. Since X and Y represent the arrival times and the two people
meet if and only if the arrival times are within 20 minutes of each
other, we want to compute Prob(|X-Y|<=20). We can do this directly by
computing the area of the region in the first quadrant of the xy-plane
determined by x=>0, x<=60, y>=0, y<=60, and |x-y|<=20, as can be
displayed in Mathematica with the following command.
Show[Graphics[{GrayLevel[0.5],
Polygon[{{0,0},{20,0},{60,40},{60,60},{40,60},{0,20}}]}],
AspectRatio->Automatic,Axes->True,AxesLabel->{"X","Y"},
Ticks->{{0,20,40,60},{0,20,40,60}},GridLines->{{60},{60}}];
The area of this region is 2000. Dividing by 3600, which is the area of
the 60 by 60 square, gives 5/9 as the desired probability.
We can simulate n such clock meetings as follows.
ClockMeeting[n_]:=(meet=0;
Do[{ {x,y}=Table[60 Random[], {2}];
If[Abs[x-y]<=20, meet++]},{n}];
Print[N[meet/n]])
ClockMeeting[10000]
Rob Pratt
Department of Mathematics
The University of North Carolina at Chapel Hill CB# 3250, 331 Phillips
Hall
Chapel Hill, NC 27599-3250
rpratt@math.unc.edu
http://www.math.unc.edu/Grads/rpratt/
On Sat, 25 Apr 1998, LinLi Chee wrote:
> Hi there, the following are some interesting simulation problems. Just
> wonder how i can do it with mathematica ....
>
> 2. Meeting Under the Clock (This problem is posed by Julian Simon(1994))
>
> Two persons agree to arrive at the two clock sometime between 1 pm
> and 2 pm and to
> stay for 20 minutes. What is the probability that they will be there
> at the same time?
>
> tie@cscn.com