[Numpy-discussion] Power distribution

Andrew Hawryluk HAWRYLA at novachem.com
Fri Aug 7 17:25:21 EDT 2009


Hmm ... good point.
It appears to give a probability distribution proportional to x**(a-1),
but I see no good reason why the domain should be limited to [0,1].

def test(a):
    nums =
plt.hist(np.random.power(a,100000),bins=100,ec='none',fc='#dddddd')
    x = np.linspace(0,1,200)
    plt.plot(x,nums[0][-1]*x**(a-1))

Andrew



> -----Original Message-----
> From: numpy-discussion-bounces at scipy.org [mailto:numpy-discussion-
> bounces at scipy.org] On Behalf Of alan at ajackson.org
> Sent: 7 Aug 2009 2:49 PM
> To: Discussion of Numerical Python
> Subject: Re: [Numpy-discussion] Power distribution
> 
> I don't think that is it, since the one in numpy has a range
restricted
> to the interval 0-1.
> 
> Try out hist(np.random.power(5, 1000000), bins=100)
> 
> >You might get better results for 'power-law distribution'
> >http://en.wikipedia.org/wiki/Power_law
> >
> >Andrew
> >
> >> -----Original Message-----
> >> From: numpy-discussion-bounces at scipy.org [mailto:numpy-discussion-
> >> bounces at scipy.org] On Behalf Of alan at ajackson.org
> >> Sent: 7 Aug 2009 11:45 AM
> >> To: Discussion of Numerical Python
> >> Subject: [Numpy-discussion] Power distribution
> >>
> >> Documenting my way through the statistics modules in numpy, I ran
> >> into the Power Distribution.
> >>
> >> Anyone know what that is? I Googled for it, and found a lot of
stuff
> >on
> >> electricity, but no reference for a statistical distribution of
that
> >> name. Does it have a common alias?
> >>
> >> --
> >>
>
>----------------------------------------------------------------------
> -
> >> | Alan K. Jackson            | To see a World in a Grain of Sand
> >|
> >> | alan at ajackson.org          | And a Heaven in a Wild Flower,
> >|
> >> | www.ajackson.org           | Hold Infinity in the palm of your
> hand
> >|
> >> | Houston, Texas             | And Eternity in an hour. - Blake
> >|
> >>
>
>----------------------------------------------------------------------
> -
> >> _______________________________________________
> >> NumPy-Discussion mailing list
> >> NumPy-Discussion at scipy.org
> >> http://mail.scipy.org/mailman/listinfo/numpy-discussion
> 
> 
> --
>
-----------------------------------------------------------------------
> | Alan K. Jackson            | To see a World in a Grain of Sand
|
> | alan at ajackson.org          | And a Heaven in a Wild Flower,
|
> | www.ajackson.org           | Hold Infinity in the palm of your hand
|
> | Houston, Texas             | And Eternity in an hour. - Blake
|
>
-----------------------------------------------------------------------
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion



More information about the NumPy-Discussion mailing list