This is topic For the love of god, please help me in forum Officers' Lounge at Flare Sci-Fi Forums.


To visit this topic, use this URL:
https://flare.solareclipse.net/ultimatebb.php/topic/10/1540.html

Posted by PsyLiam (Member # 73) on :
 
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 by TSN (Member # 31) on :
 
You've a mathematical function named w/ the French word for "fish"?

------------------
"What he did to that walrus gentle-man was inexcusable."
-T. Herman Zweibel on "Mr. Woodrow Wood-pecker", The Onion, 7-Nov-2000
 


Posted by Krenim (Member # 22) on :
 
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.

Any corrections or other data?

------------------
Kang/Kodos in '04!
 


Posted by PsyLiam (Member # 73) on :
 
No, apart from X! being X Factorial, in case you didn't know.

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
 


Posted by Vacuum robot lady from Spaceballs (Member # 239) on :
 
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 by Krenim (Member # 22) on :
 
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?"

------------------
Kang/Kodos in '04!
 


Posted by Jeff Raven (Member # 20) on :
 
If my roommate could look at the source code, he might be able to help ya

------------------
"I'm not like George Bush. If he wins or loses, life goes on. I will do anything to win." - Al Gore, Newsweek, 1999

 


Posted by PsyLiam (Member # 73) on :
 
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 by AndrewR (Member # 44) on :
 
An intruiging concept this... "cop-muter" does it really silence police officers as I've heard it does?

------------------
"This is cooling, faster than I can..." Tori Amos "Cooling"
 


Posted by Bernd (Member # 6) on :
 
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 by Charles Capps (Member # 9) on :
 
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!"
 


Posted by Bernd (Member # 6) on :
 
Charles: That is probably the reason I never really cared about it.

------------------
"Species 5618, human. Warp-capable, origin grid 325, physiology inefficient, below average cranium capacity, minimum redundant systems, limited regenerative abilities."
Ex Astris Scientia
 


Posted by PsyLiam (Member # 73) on :
 
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
 


Posted by Bernd (Member # 6) on :
 
It would be so easy in Pascal or C!

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

 


Posted by Nim (Member # 205) on :
 
*comes in to see if could aid*
*notices programming-codes*
*mimics painting by Edvard Munch*
 


© 1999-2024 Charles Capps

Powered by UBB.classic™ 6.7.3