posted
Okay, I don't want to look like the sort of person who runs to the internet everytime he can't do something. However...
I have been banging away at this for a week. I might be able to do it too, if I wasn't feeling to grungy (I thought there was only one fresher's flue a term. Damn it).
Anyway, I'm trying to right a JAVA program for my course that calculates how many people are likely to walk into a shop. Yeah, yeah, I know...
Anyway, I've written it all, the application class, the loops and blah, the table printing thing. The only part I can't get to work is the actual equation.
Poisson(X) = (A^X x e^-A)/X!
Where X is the number of customer arrivals in a minute, and a is the average number of customer arrivals per minute. I've got the factorial class sorted, and the e is Euler's constant, which is defined in the Math class (Math.e), but after trying for ages, I still can't get a bloody formula that works. Do I have to break it down into stages, or what?
Stupid Java. Hate world.
------------------ "I am in one of those rare periods of life where I am convinced I am a sexy devil."- Simon "Sol System" Sizer
posted
Hmm... Before I proceed to mull this around in my mind, let me make sure I have this right:
X = Customers per minute for current minute. A = Average customers per minute for past minutes. Fish(X) = Predicted customers per minute for next minute.
posted
It depends on what type of shop it is. There would be more people entering a store that sells, say, merchandise of the adult entertainment industry persuasion, than a store devoted to selling bananas covered in rabbit fur...
------------------ "Karate is a form of martial arts in which people who have had years and years of training can, using only their hands and feet, make some of the worst movies in the history of the world." - Dave Barry
posted
One more question: Is there a specific question that needs to be answered with this equation, like something along the lines of "If x customers enter the store in the first minute, calculate the number of customers that will arrive in the nth minute?"
posted
Actually, the program requires the user to input how many average customers there are per minuter. If it's greater than 6, then it prints all the Piosson(X) possibilites from average-5 to average+5. If it's less than 6, then it prints all the Piosson(X) from 1 to average+5. In a nice little table. But I've got that part sorted. It's just getting JAVA to actually calculate that formula.
Jeff: I'm writing the source code. Er, unless you mean he'd be able to tell me what I'm doing wrong. I'm not on the copmuter science network at the moment, so I can't get to my files.
------------------ "I am in one of those rare periods of life where I am convinced I am a sexy devil."- Simon "Sol System" Sizer
posted
I have no idea of Java at all and I didn't check the formula itself, but just try the following: A^X x e^-A = e^(X ln A) x e^-A = e^(-A + X ln A)
Denominator: You may simply calculate X! = (1 x 2 x 3 x 4 x .. x X) in a loop where you increase i from 0 to X, and multiply the product p so far with i each time. There may be a floating point overflow, if you have too many customers, though.
------------------ "Species 5618, human. Warp-capable, origin grid 325, physiology inefficient, below average cranium capacity, minimum redundant systems, limited regenerative abilities." Ex Astris Scientia
posted
Bernd: I kind of had that idea. It's not that I'm getting the wrong answer. It's that the program won't compile in the first place. I hate JAVA. And, er, people who say "dartar" instead of "day-ta". Damn them all.
------------------ "I am in one of those rare periods of life where I am convinced I am a sexy devil."- Simon "Sol System" Sizer