wu :: forums
« wu :: forums - Feeding time at the zoo »

Welcome, Guest. Please Login or Register.
Nov 28th, 2024, 4:55pm

RIDDLES SITE WRITE MATH! Home Home Help Help Search Search Members Members Login Login Register Register
   wu :: forums
   riddles
   medium
(Moderators: Eigenray, SMQ, Grimbal, william wu, Icarus, towr, ThudnBlunder)
   Feeding time at the zoo
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: Feeding time at the zoo  (Read 836 times)
TimMann
Senior Riddler
****






   
WWW

Gender: male
Posts: 330
Feeding time at the zoo  
« on: Oct 4th, 2003, 2:20am »
Quote Quote Modify Modify

Here's a problem that came up at my work. I'll try to couch it as a story problem, but I haven't been able to come up with a very realistic story, so bear with me.
 
Petey is going to the zoo. He'll have to wait in line for some random amount of time before he can get in. Once he gets in, he wants to see both the penguins and the peacocks being fed. The penguins are fed 100 times per week, evenly spaced, and the peacocks are fed 128 times a week, evenly spaced. (These are hungry birds, and they are up at all hours!) The penguins and peacocks have their cages right next to each other, and the feedings take practically no time, so Petey doesn't have to worry about transit time between them or missing one feeding while watching the other.
 
OK, so the question is: starting from when he is let in, what is the expected length of time that Petey will have to wait until both the penguins and the peacocks have been fed at least once?
 
(It's a little hard to explain how this came up at work. I was trying to understand a software performance problem, and I measured that a certain part of the program was taking a surprising amount of time to run on the average. I had a hunch that it was waiting to get one each of two different kinds of clock interrupt, one that occurs at 100 Hz and the other at 128 Hz. So I wanted to know whether my measurement agreed with this model.)
 
I don't have a neat way to compute this. The only method I thought of uses a definite integral. I'll be interested to see if anyone has a better one. I didn't go back and check my probability textbook from 20-some years ago...
« Last Edit: Oct 4th, 2003, 2:28am by TimMann » IP Logged

http://tim-mann.org/
James Fingas
Uberpuzzler
*****





   
Email

Gender: male
Posts: 949
Re: Feeding time at the zoo  
« Reply #1 on: Oct 6th, 2003, 10:43am »
Quote Quote Modify Modify

Am I understanding correctly that he doesn't need to choose which cage he stands in front of? He can look at both cages at once?
 
In that case, we can model it as the expectation of the maximum of two random variables: one uniformly distributed on (0, week/100), and one uniformly distributed on (0, week/128). Breaking this into two cases, we can solve quite simply:
 
If the penguins get fed in the first week/128, then the expectation is the maximum of two random variables uniformly distributed on (0, week/128), which is 2/3*week/128. This happens with probability (week/128)/(week/100)=100/128.
 
If the penguins do not get fed in the first week/128, then the expected time is the expectation of a random variable uniformly distributed on (week/128, week/100), (week/100 + week/128)/2 = week*228/25600. This happens with probability 28/128.
 
The total expectation is therefore 0.006017 weeks, which is roughly a week/166.
IP Logged

Doc, I'm addicted to advice! What should I do?
TimMann
Senior Riddler
****






   
WWW

Gender: male
Posts: 330
Re: Feeding time at the zoo  
« Reply #2 on: Oct 6th, 2003, 1:31pm »
Quote Quote Modify Modify

Yes, you understood the problem correctly. I didn't know (or forgot) the result that you used in the first case, so I did it the hard way. Do you know of a way to derive that result other than by integrating, as follows?
 
Let X, Y be random variables uniformly distributed over the interval [0, 1]. We want to find E(max(X, Y)). There are two cases, Y <= X and Y > X. For the first, P(Y <= X | X = x) = x and the value of max(X, Y) in this case is X; for the second, P(Y > X | X = x) = (1-x) and the expected value of max(X, Y) in this case is E(Y | Y > x) = (x + 1)/2. So E(max(X, Y) | X = x) = x2 + (1 - x)(x + 1)/2 = (x2 + 1)/2.  Then we can compute E(max(X,Y)) by integrating this from x=0 to x=1. The result is 2/3.
IP Logged

http://tim-mann.org/
James Fingas
Uberpuzzler
*****





   
Email

Gender: male
Posts: 949
Re: Feeding time at the zoo  
« Reply #3 on: Oct 7th, 2003, 8:16am »
Quote Quote Modify Modify

No, I don't know a better way. I did it the hard way for the Calculator Game problem. The expectation for the maximum of n variables all uniform on (0,1) is n/(n+1). It's an interesting result that reminds me of the centroid of a triangle, or computing the volume of a cone with an arbitrarily-shaped base. Perhaps our resident mathians have some deep insight...
IP Logged

Doc, I'm addicted to advice! What should I do?
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »

Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board