random numbers according to user defined distribution ??
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Thu Aug 7 01:50:42 EDT 2008
On Wed, 06 Aug 2008 21:09:30 -0700, Dan Bishop wrote:
>> There's no general way to create a random function for an arbitrary
>> distribution. I don't think there's a general way to *describe* an
>> arbitrary random distribution.
>
> What about the quantile function?
Well, sure, if you can write down the quantile function, c.d.f or p.d.f.
of a distribution, I suppose that counts as describing it, in some sense.
But even if we limit ourselves to distributions which are actually
useful, as opposed to arbitrary distributions that can't be described in
terms of any known mathematical function, there are serious practical
difficulties. I quote from the Wikipedia article on quantile functions:
"The quantile functions of even the common distributions are relatively
poorly understood beyond the use of simple lookup tables, which is at
odds with their importance in Monte Carlo sampling, where a sample from a
given distribution may be obtained in principle by applying its quantile
function to a sample from a uniform distribution. The exponential case
above is one of the very few distributions where there is a simple
formula."
http://en.wikipedia.org/wiki/Quantile_function
--
Steven
More information about the Python-list
mailing list