[Tutor] Gamma distribution function

culpritNr1 ig2ar-saf1 at yahoo.co.uk
Tue Jan 13 23:40:36 CET 2009


I just figured it out myself.

This is how to do it both the naive and the efficient way, respectively:

>>> import math
>>> from scipy import factorial
>>> lam = 1
>>> k = 2
>>> math.exp(-lam) * lam**k / factorial(k)
0.18393972058572117

>>> from scipy import stats
>>> stats.poisson.pmf(2,1)
array(0.18393972058572114)

thanks all anyway,

culpritNr1





Jervis Whitley wrote:
> 
> On Wed, Jan 14, 2009 at 8:27 AM, culpritNr1 <ig2ar-saf1 at yahoo.co.uk>
> wrote:
> 
>>
>>
>> there some kind of random.poisson()?
>>
>> Thank you,
>>
>> culpritNr1
>>
>> Hello try the scipy library:
>>>> from scipy import stats
>>>> lamb = 10
>>>> stats.distributions.poisson.rvs(lamb, loc=0)
> array([5])
>>>> stats.distributions.poisson.rvs(lamb, loc=0)
> array([14])
> 
> http://www.scipy.org/
> 
> cheers,
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 
> 

-- 
View this message in context: http://www.nabble.com/Gamma-distribution-function-tp21444899p21446064.html
Sent from the Python - tutor mailing list archive at Nabble.com.



More information about the Tutor mailing list