HP Forums
OT: Math question - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: OT: Math question (/thread-150967.html)



OT: Math question - kc - 05-20-2009

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 question - Michael Andersson - 05-20-2009

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 Regards
Michael


Re: OT: Math question - Thomas Radtke - 05-20-2009

Maybe t = D / 2^n


Re: OT: Math question - Thomas Radtke - 05-20-2009

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 question - Chuck - 05-20-2009

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 question - PeterP - 05-20-2009

KC,

I know very little about math so please take this with a large grain of salt (which might make it unpleasant to your pallet...)

I believe that waiting for a bus is called a poisson process and actually a quite famous question. A quick google found the following potentially interesting links and explanations:

Waiting For the Bus

The Waiting Time Paradox

Unfortunately, this google brought up another paradox that I don't understand:

Quote:
In G. Wright & P. Ayton (Eds.), "Subjective probability" (pp. 353-377). Chichester, UK: Wiley], a passenger waits for a bus that departs before schedule in 10% of the cases, and is more than 10 min delayed in another 10%. What are Fred's chances of catching the bus on a day when he arrives on time and waits for 10 min? Most respondents think his probability is 10%, or 90%, instead of 50%, which is the correct answer. The experiments demonstrate the difficulties people have in replacing the original three-category 1/8/1 partitioning with a normalized, binary partitioning, where the middle category is discarded.

Why is the correct answer 50%?

Cheers

Peter


Re: OT: Math question - Michael Andersson - 05-20-2009

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 question - Jonathan Eisch - 05-20-2009

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 question - Chuck - 05-20-2009

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 question - PeterP - 05-20-2009

yes, if he waits for at least 10', the answer is 50%. small words can be very important... Thnks Jonathan..


Re: OT: Math question - kc - 05-21-2009

Thanks for all your positive response. However, I'm still not convinced. I think the formula
t = 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 question - Thomas Radtke - 05-21-2009

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 question - Valentin Albillo - 05-21-2009

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 question - Chuck - 05-21-2009

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.


Re: OT: Math question - Bob Wang - 05-22-2009

An interesting property of Poisson processes is the "Axiom of Bad Luck"

Bad Luck