April 30th, 2003, 10:11 AM
Here is the problem.
One worker have a probability of 2% to deliver an item each hour.
The aim is to write a function that will calculate how much item would go out from factory during an hour if I have X workers.
Input would be X (number of worker) and a random value that will be compared to probability.
with 1 worker
0 item => 98%
1 item => 2%
if i call foo(X) 100 times, I will (theorically) get 98 times 0 and 2 times 1.
I actually have this function coded with looping over each worker, it is quite heavy and i would like to find a mathematical way to do it...
ItemAmount = 0
For (worker = 1 to X)
RandomValue = Random(0,99)
if (RandomValue < 2)
// Quite heavy isn't it ?
April 30th, 2003, 04:23 PM
if a worker have a probability of 2% to deliver an item each hour, n workers have a probability of (2*n)% .
Because if every n independent event have a probability P(xi)=a the total probability is
So your function can be rewritten as:
i'm quite interested in cumalitive probability at the moment. haven't got too far though yet. one useful phrase to look for is 'cumulative poisson'. here's something i found on it. i'm not going to pretend i understand it, but this may or may not be of use to you (free book though) :
6.2 Incomplete Gamma Function, Error
Function, Chi-Square Probability Function,
Cumulative Poisson Function -
M3xican: They do are independant, but your formula simulation tell me if an item was built or not... I want to know How much items went out of production. Your formula says "At least one item went out".
Balance: Thanks, will take a look...
Others: Question still pending =)
Last edited by M3xican; July 2nd, 2003 at 12:56 PM.
M3xican, I don't mean to be rude, but I can't see any basis to your response - it makes no sense. Perhaps you could elaborate on how you came to it.
Balance is correct - use an inverse cumulative poisson function to generate your random value from the uniform value generated by rand(). If my memory serves me right then an inverse cumulative normal / gaussian distribution will also suffice where the number of workers is large enough (>=250 in this case).
are markov chains even more useful for things like this? i've read a few bits and bobs on probability, and as soon as it gets into cumulative stuff in particular, markov chains seem to get mentioned. again, not going to pretend i actually understand what i'm talking about. would like to though, very much.
Last edited by balance; May 8th, 2003 at 01:45 PM.
likewise, i'm no expert but my answer would be no.
as i understand it, markov chains could only apply if the situation being modelled were to involved a sequence of non-independent tests - whereas the question above concerns a collection of simultaneous - and, i would assume, independent - tests.
for example if we modelled not just the increased number of workers but also an increased number of hours, we could modify our binary probability model so that the probability of delivery in a given hour is related to whether delivery was achieved in the previous hour - as might be the case in practise.
i don't know what other conditions would need to be met etc - like i say i'm not an expert
mmmh it seems that I will have to search after my class notes =(
"The ultimate knowledge is reached when it does not bring new questions..."
-- Usaphdas encyclopedia XV.4
would characters from usual text be applicable to that do you think?
i'm not sure if i get what you mean - but if the probability of a given character "coming next" was dependent on the previous character but independent of it's predecessors then i guess so.
yes, that's what i was meaning. ok, thanks.