Search code examples
mathwolfram-mathematicadistributionuniformpower-law

Generating power-law distributed numbers from uniform distribution – found 2 approaches: which one is correct?


I am trying to generate power-law distributed numbers ranging from 0 to 1 from a uniform distribution. I found two approaches and I am not sure which one is right and which one is wrong.

1st Source: Wolfram:

enter image description here

2nd Source: Physical Review (Page 2):

enter image description here

Where: y = uniform variate, n = distribution power, x0 and x1 = range of the distribution, x = power-law distributed variate.

The second one only gives decent results for x0 = 0 and x1 = 1, when n is between 0 and 1.


Solution

  • If y is a uniform random variable between 0 and 1, then 1-y also is. Thereby letting z = 1-y you can transform your formula (1) as :

    x = [(x_1^{n+1}-(x_1^{n+1}-x_0^{n+1}) z]^{1/(n+1)}

    which is then the same as your formula (2) except for the change n -> (-n).

    So I suppose that the only difference between these two formula in the notation on how n relates to the power law decay (unfortunately the link you gave for the Wolfram alpha formula is invalid so I cannot check which notation they use).