Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Exponential arrival distribution in Python

Reply
Thread Tools

Exponential arrival distribution in Python

 
 
Ricky
Guest
Posts: n/a
 
      11-28-2012

Hi all,

I am doing a project on traffic simulation. I want to introduce exponentialarrival distribution to precede this task. Therefore I want write a code in python for exponential arrival distribution. I am very new for programming and if anybody can help me on this that would be great.

Cheers,
Ricky
 
Reply With Quote
 
 
 
 
David Hutto
Guest
Posts: n/a
 
      11-28-2012
>> I am doing a project on traffic simulation. I want to introduce
>> exponential arrival distribution to precede this task. Therefore I want
>> write a code in python for exponential arrival distribution. I am very new
>> for programming and if anybody can help me on this that would be great.



First, I would suggest that you give yourself a GUI like tkinter,
wxpython to visualize the data. An average of the sequential(averaged
per 60 second intervals) traveled by drivers on the road, and at what
times.

Then, and I don't know why, but it seems you want a logarithmic, scale where:


for i in range(0,4)
print "%i = %i" % (i * 10 **i)

--
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com
 
Reply With Quote
 
 
 
 
David Hutto
Guest
Posts: n/a
 
      11-28-2012
I mean this one:

for i in range(0,4):
print "%i = %i" % (i * 10 **i)



--
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com
 
Reply With Quote
 
Paul Rubin
Guest
Posts: n/a
 
      11-28-2012
Ricky <(E-Mail Removed)> writes:
> I am doing a project on traffic simulation. I want to introduce
> exponential arrival distribution to precede this task. Therefore I
> want write a code in python for exponential arrival distribution.


I've never heard of an "exponential arrival distribution" and googling
fails. Do you mean an exponential distribution, that describes the
expected arrival times in a Poisson process? Python's "random" module
has the random.expovariate function for that:

http://docs.python.org/3/library/random.html

If you want an actual (discrete) Poisson distribution, see:

http://en.wikipedia.org/wiki/Poisson...ndom_variables

 
Reply With Quote
 
Albert Chun-Chieh Huang
Guest
Posts: n/a
 
      11-28-2012
Hi, Ricky,

Traffic simulation sounds like a good topic to use SimPy, which is a
discrete-event simulation library in Python,
c.f. http://simpy.sourceforge.net

Professor Norm Matloff wrote a very good tutorial on SimPy, and you can
download it here: http://heather.cs.ucdavis.edu/~matloff/simcourse.html
Also, I've presented this SimPy package before, my slides might be
helpful,
http://alberthuang314.blogspot.tw/20...-pyhug_26.html

In short, SimPy is a process-oriented discrete-event simulation package,
which will be easier to maintain than event-oriented discrete-event
simulation. It also contains some tools to help us to visualize
simulation data. It takes some time to study it, but if you would like to do
some simulation projects, it will definitely be a good investment! Have
fun with simulation!

with Regards,

Albert Huang

Ricky <(E-Mail Removed)> writes:

> Hi all,
>
> I am doing a project on traffic simulation. I want to introduce exponential arrival distribution to precede this task. Therefore I want write a code in python for exponential arrival distribution. I am very new for programming and if anybody can help me on this that would be great.
>
> Cheers,
> Ricky

 
Reply With Quote
 
duncan smith
Guest
Posts: n/a
 
      11-29-2012
On 28/11/12 21:34, Ricky wrote:
>
> Hi all,
>
> I am doing a project on traffic simulation. I want to introduce exponential arrival distribution to precede this task. Therefore I want write a code in python for exponential arrival distribution. I am very new for programming and if anybody can help me on this that would be great.
>
> Cheers,
> Ricky
>


Maybe you mean something like,

>>> from random import expovariate
>>> expovariate(1)

0.09133428954823608
>>> expovariate(1)

2.5388809393383407
>>>


Duncan
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
New Arrival to Python Norm Goertzen Python 5 08-25-2005 10:01 PM
Thunderbird .8 Mail folder showing new arrival Dan C Firefox 3 12-06-2004 11:45 PM



Advertisments