jeudi 5 février 2015

Generate Random variates with a certain Probability density function by python

I want to generate a random variate with maxwell energy distribution. The probablily density function is like :



def f(ene):
le=3
return 2(ene/pi/le**3)*np.exp(-ene/le)


I would like to generate 10000 samples like



f.rvs(scale,size)


How could I do it?





Aucun commentaire:

Enregistrer un commentaire