Exponential arrival distribution in Python

Discussion in 'Python' started by Ricky, Nov 28, 2012.

  1. Ricky

    Ricky Guest

    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
    Ricky, Nov 28, 2012
    #1
    1. Advertising

  2. Ricky

    David Hutto Guest

    >> 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
    David Hutto, Nov 28, 2012
    #2
    1. Advertising

  3. Ricky

    David Hutto Guest

    David Hutto, Nov 28, 2012
    #3
  4. Ricky

    Paul Rubin Guest

    Ricky <> 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_distribution#Generating_Poisson-distributed_random_variables
    Paul Rubin, Nov 28, 2012
    #4
  5. 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/2012/01/simpy-slides-in-our-company-and-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 <> 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
    Albert Chun-Chieh Huang, Nov 28, 2012
    #5
  6. Ricky

    duncan smith Guest

    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
    duncan smith, Nov 29, 2012
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike
    Replies:
    0
    Views:
    585
  2. Gordon Beaton

    Re: CHRIST: THE ARRIVAL

    Gordon Beaton, Dec 26, 2005, in forum: Java
    Replies:
    2
    Views:
    566
    Gordon Beaton
    Dec 26, 2005
  3. Per
    Replies:
    1
    Views:
    360
    Howard
    Apr 18, 2005
  4. Milton J. Vidrine, Jr.

    Arrival date

    Milton J. Vidrine, Jr., May 15, 2006, in forum: Java
    Replies:
    0
    Views:
    385
    Milton J. Vidrine, Jr.
    May 15, 2006
  5. Norm Goertzen

    New Arrival to Python

    Norm Goertzen, Aug 25, 2005, in forum: Python
    Replies:
    5
    Views:
    381
Loading...

Share This Page