The Museum of HP Calculators

HP Forum Archive 19

 OT: Math questionMessage #1 Posted by KC on 20 May 2009, 2:28 a.m. One day when I was waiting a bus in the bus-stop, a question came to my mind: Let's say I didn't know the exact schedule of the bus, what I knew was that a bus would come every 30 min. I knew that, on average, I would need to wait 15 min. Now the fact was that on the bus-stop, there were two different-numbered buses that I could take to the destination, so my question was: assuming both buses would depart every 30 min., on average, how long would I need to wait for either bus to come? I could not figure that out instantly in my mind, so I came back home and tried to derive the formula for that. Since I'm not a Mathematics major, after quite a looooog time I came up with the following formula: t=D/(n+1) where t=average time to wait; D=departure time (e.g. 30 min.); n=no. of buses that I can take Here are the questions: 1. Is my formula correct? I can only gurantee that it is correct for n=1. 2. If it was correct, it seems that it is very simple. So is there an intuitive way of thinking (and solving) the problem? Again, I can only "see" the result for n=1. Best regards, KC

 Re: OT: Math questionMessage #2 Posted by Michael Andersson on 20 May 2009, 4:41 a.m.,in response to message #1 by KC Let's assume you have two busses, if they arrive out of phase you would have a bus every 15 min an average waiting time of 7.5 min. On the other hand if they always arrive at the same time (in phase) the average waiting time would be 15 min also for two buses. So if several buses are involved the problem seems to be much more complicated, but since I'm not a mathematician either I think someone else can give a much more detailed answer.Best RegardsMichael

 Re: OT: Math questionMessage #3 Posted by Thomas Radtke on 20 May 2009, 10:31 a.m.,in response to message #2 by Michael Andersson Quote:On the other hand if they always arrive at the same time (in phase) the average waiting time would be 15 min also for two buses So it's maybe a linear problem and therefore always the avarage of the two extreme combinations?

 Re: OT: Math questionMessage #4 Posted by Michael Andersson on 20 May 2009, 11:27 a.m.,in response to message #3 by Thomas Radtke The point I was trying to make is that if you have several buses to choose from you will have a solution that depends on some kind of phase angles between the time tables. However, assuming all the time tables have been coordinated so the different buses arrive at constant intervals your solution below (t=D/2^n) should be correct. /Michael

 Re: OT: Math questionMessage #5 Posted by Thomas Radtke on 20 May 2009, 10:25 a.m.,in response to message #1 by KC Maybe t = D / 2^n

 Re: OT: Math questionMessage #6 Posted by Chuck on 20 May 2009, 11:04 a.m.,in response to message #1 by KC Here's a possibility... suppose the the second bus arrives c minutes after the first bus. Then, c/30 of the time you would wait c/2 minutes, and (30-c)/30 of the time you would have to wait (30-c)/2 minutes. This gives your weighted-average wait time: ``` c^2 (30-c)^2 c^2 - 30c +450 --- + -------- = --------------- 60 60 30 ``` When c=0 this gives you 15 minutes, and when c=15 you get 7.5 minutes, and all others in between. This might be correct. CHUCK Edited: 20 May 2009, 11:05 a.m.

 Re: OT: Math questionMessage #8 Posted by Jonathan Eisch on 20 May 2009, 12:54 p.m.,in response to message #7 by PeterP Quote: Why is the correct answer 50%? It might make more sense if you read it as: "he arrives on time and waits for at least 10 min?" After waiting for 10 minutes, he has already determined that the bus is not 0-10 minutes late (80% of the time). So, the remaining options are: that the bus was early (10% of the time), or the bus is more than 10 minutes late (10% of the time). Since they are equally likely, the answer is 50%. -Jonathan

 Re: OT: Math questionMessage #9 Posted by PeterP on 20 May 2009, 2:38 p.m.,in response to message #8 by Jonathan Eisch yes, if he waits for at least 10', the answer is 50%. small words can be very important... Thnks Jonathan..

 Re: OT: Math questionMessage #10 Posted by Chuck on 20 May 2009, 1:05 p.m.,in response to message #7 by PeterP I think as soon as you bring in the variance of arrival a Poisson distribution might be needed. The assumption here is that the arrival times are fixed, and with no variance. I ran a short simulation on mathematica. This one only shows 1000 arrivals. Any more than that, the graph of the mean-wait-time is obscured by the parabola: CHUCK Edited: 20 May 2009, 1:08 p.m.

 Re: OT: Math questionMessage #11 Posted by KC on 21 May 2009, 1:35 a.m.,in response to message #10 by Chuck Thanks for all your positive response. However, I'm still not convinced. I think the formulat = D / 2^n only holds true if, as Michael said, the two buses are completely out of phrase. In reality, the phrase between the two buses may be random, even if they are not supposed to be, due to complicated traffic conditions (but we can still assume that traffic conditions would not affect the frequency of the same numbered-buses since they experienced the same traffic conditions). Assuming the phrase is random, so for the case of two buses, the average waiting time should be between 7.5 and 15 min. Best regards,KC

 Re: OT: Math questionMessage #12 Posted by Thomas Radtke on 21 May 2009, 5:05 a.m.,in response to message #11 by KC Yes, for 2 buses, it is between 15' and 7.5'. For 3 buses, the same logic applies (D is in the range of 15' and 3.75'. Taking the mean of both extreme conditions... t = ( D / 2 + D / 2^n ) / 2 ...gives a linear approximation. Well, the trick is probably to integrate all possible phases. But wouldn't this result in the same formula? Can anyone without (unlike me) a dyscalculia enlight me? :^) Unfortunately, with zero buses the answer would be 22'30" which makes no sense to me, so I declare n>0 ;-). Edited: 21 May 2009, 5:06 a.m.

 Re: OT: Math questionMessage #13 Posted by Bob Wang on 22 May 2009, 12:57 a.m.,in response to message #7 by PeterP An interesting property of Poisson processes is the "Axiom of Bad Luck"

 Re: OT: Math questionMessage #14 Posted by Valentin Albillo on 21 May 2009, 9:36 a.m.,in response to message #1 by KC Hi, KC: Your t=D/(n+1) formula is correct. It can be arrived at in a number of ways, but let's try a Monte Carlo approach by running a simulation in our trusty HP-71. This little 3-line (108-byte) program here will run a simulation for any given number of trials N and from 1 to 5 buses: ``` 10 DESTROY ALL @ INPUT N @ RANDOMIZE 1 @ FOR B=1 TO 5 @ S=0 20 FOR I=1 TO N @ T=RND*30 @ FOR J=2 TO B @ T=MIN(T,RND*30) @ NEXT J 30 S=S+T @ NEXT I @ DISP USING "D,2X,2D.2D";B;S/N @ NEXT B ``` ` ` Upon running it with 1000 trials, then 100,000 (under Emu71 to save time) we have: ``` >RUN ? 1000 1 14.84 2 10.04 3 7.39 4 5.98 5 5.10 >RUN ? 100000 1 14.98 2 9.98 3 7.51 4 6.02 5 5.02 ``` and the numbers clearly are going to 15, 10, 7.5, 6, and 5, respectively, i.e. 30/2, 30/3, 30/4, 30/5, and 30/6, thus the best fit to them is indeed your formula, t=D/(n+1). Best regards from V. Edited: 21 May 2009, 9:39 a.m.

 Re: OT: Math questionMessage #15 Posted by Chuck on 21 May 2009, 10:45 a.m.,in response to message #14 by Valentin Albillo Aha. My quadratic gives the distribution of the wait times for two buses. The average value of the function does indeed give a mean wait time of 10 minutes for two buses.

Go back to the main exhibit hall