Flare Sci-fi Forums
Flare Sci-Fi Forums Post New Topic  New Poll  Post A Reply
my profile | directory login | search | faq | forum home

  next oldest topic   next newest topic
» Flare Sci-Fi Forums » Community » Officers' Lounge » For the love of god, please help me

   
Author Topic: For the love of god, please help me
PsyLiam
Hungry for you
Member # 73

 - posted      Profile for PsyLiam     Send New Private Message       Edit/Delete Post   Reply With Quote 
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


Registered: Mar 1999  |  IP: Logged
TSN
I'm... from Earth.
Member # 31

 - posted      Profile for TSN     Send New Private Message       Edit/Delete Post   Reply With Quote 
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


Registered: Mar 1999  |  IP: Logged
Krenim
Unholy Triangle Fella
Member # 22

 - posted      Profile for Krenim     Send New Private Message       Edit/Delete Post   Reply With Quote 
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!


Registered: Mar 1999  |  IP: Logged
PsyLiam
Hungry for you
Member # 73

 - posted      Profile for PsyLiam     Send New Private Message       Edit/Delete Post   Reply With Quote 
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


Registered: Mar 1999  |  IP: Logged
Vacuum robot lady from Spaceballs
astronauts gotta get paid
Member # 239

 - posted      Profile for Vacuum robot lady from Spaceballs     Send New Private Message       Edit/Delete Post   Reply With Quote 
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


Registered: Oct 1999  |  IP: Logged
Krenim
Unholy Triangle Fella
Member # 22

 - posted      Profile for Krenim     Send New Private Message       Edit/Delete Post   Reply With Quote 
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!


Registered: Mar 1999  |  IP: Logged
Jeff Raven
Always Right
Member # 20

 - posted      Profile for Jeff Raven     Send New Private Message       Edit/Delete Post   Reply With Quote 
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


Registered: Mar 1999  |  IP: Logged
PsyLiam
Hungry for you
Member # 73

 - posted      Profile for PsyLiam     Send New Private Message       Edit/Delete Post   Reply With Quote 
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


Registered: Mar 1999  |  IP: Logged
AndrewR
Resident Nut-cache
Member # 44

 - posted      Profile for AndrewR     Send New Private Message       Edit/Delete Post   Reply With Quote 
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"


Registered: Mar 1999  |  IP: Logged
Bernd
Guy from Old Europe
Member # 6

 - posted      Profile for Bernd     Send New Private Message       Edit/Delete Post   Reply With Quote 
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


Registered: Mar 1999  |  IP: Logged
Charles Capps
We appreciate your concern.
It is noted and stupid.
Member # 9

 - posted      Profile for Charles Capps     Send New Private Message       Edit/Delete Post   Reply With Quote 
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!"


Registered: Mar 1999  |  IP: Logged
Bernd
Guy from Old Europe
Member # 6

 - posted      Profile for Bernd     Send New Private Message       Edit/Delete Post   Reply With Quote 
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


Registered: Mar 1999  |  IP: Logged
PsyLiam
Hungry for you
Member # 73

 - posted      Profile for PsyLiam     Send New Private Message       Edit/Delete Post   Reply With Quote 
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


Registered: Mar 1999  |  IP: Logged
Bernd
Guy from Old Europe
Member # 6

 - posted      Profile for Bernd     Send New Private Message       Edit/Delete Post   Reply With Quote 
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


Registered: Mar 1999  |  IP: Logged
Nim
The Aardvark asked for a dagger
Member # 205

 - posted      Profile for Nim     Send New Private Message       Edit/Delete Post   Reply With Quote 
*comes in to see if could aid*
*notices programming-codes*
*mimics painting by Edvard Munch*

Registered: Aug 1999  |  IP: Logged
   

Quick Reply
Message:

HTML is enabled.
UBB Code™ is enabled.

Instant Graemlins
   


Post New Topic  New Poll  Post A Reply Close Topic   Feature Topic   Move Topic   Delete Topic next oldest topic   next newest topic
 - Printer-friendly view of this topic
Hop To:


© 1999-2024 Charles Capps

Powered by UBB.classic™ 6.7.3