Val Kalatsky <kalatsky <at> gmail.com> writes: > You'll need some patience to get non-zeros, especially for k=1e-5 > > In [84]: np.sum(np.random.gamma(1e-5,size=1000000)!=0.0) > Out[84]: 7259 > that's less than 1%. For k=1e-4 it's ~7%
To clarify: the distribution is peaked at numbers that are too small to be represented as floating-point numbers in the computer. The returned zeros indicate underflow, i.e., some positive numbers between zero and the floating point number closest to zero (~ 1e-308). To work around this, you need to do some math to redefine the problem so that the numbers involved fall into a region where the floating point numbers are dense. -- Pauli Virtanen _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion