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
------------------
"What he did to that walrus gentle-man was inexcusable."
-T. Herman Zweibel on "Mr. Woodrow Wood-pecker", The Onion, 7-Nov-2000
X = Customers per minute for current minute.
A = Average customers per minute for past minutes.
Fish(X) = Predicted customers per minute for next minute.
Any corrections or other data?
------------------
Kang/Kodos in '04!
Of course, what they stand for doesn't really matter that much, since they are just variable fields. But any help would be appreciated.
------------------
"I am in one of those rare periods of life where I am convinced I am a sexy devil."- Simon "Sol System" Sizer
------------------
"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
------------------
Kang/Kodos in '04!
------------------
"I'm not like George Bush. If he wins or loses, life goes on. I will do anything to win." - Al Gore, Newsweek, 1999
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
------------------
"This is cooling, faster than I can..." Tori Amos "Cooling"
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
class KillMeNow {
public static void main(String args[]) {
System.out.println("All this work just to print ONE LINE. Kill me now!");
}
}
------------------
"Uh, Cody, what has the Mullah of Cappistan been smoking?"
"MILKSHAKES. I HAVE BEEN SMOKING MILKSHAKES!"
------------------
"Species 5618, human. Warp-capable, origin grid 325, physiology inefficient, below average cranium capacity, minimum redundant systems, limited regenerative abilities."
Ex Astris Scientia
------------------
"I am in one of those rare periods of life where I am convinced I am a sexy devil."- Simon "Sol System" Sizer
Well, I use to say "Dah-tah". Is that okay?
------------------
"Species 5618, human. Warp-capable, origin grid 325, physiology inefficient, below average cranium capacity, minimum redundant systems, limited regenerative abilities."
Ex Astris Scientia