On Thu, 05 Jan 2006 09:47:02 -0600, Robert Kern <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote:
>> On 4 Jan 2006 12:46:47 -0800, "Raven" <[EMAIL PROTECTED]> wrote:
>
>>>The problem with Stirling's approximation is that I need to calculate
>>>the hypergeometric hence the factorial for numbers with
Bengt Richter wrote:
> On 4 Jan 2006 12:46:47 -0800, "Raven" <[EMAIL PROTECTED]> wrote:
>>The problem with Stirling's approximation is that I need to calculate
>>the hypergeometric hence the factorial for numbers within a large range
>>e.g. choose(14000,170) or choose(5,2)
>
> It seems you are hi
On 4 Jan 2006 12:46:47 -0800, "Raven" <[EMAIL PROTECTED]> wrote:
>Cameron Laird wrote:
>
>> This thread confuses me.
>>
>> I've lost track of the real goal. If it's an exact calculation of
>> binomial coefficients--or even one of several other potential
>> targets mentioned--I echo Steven D'Apran
"Raven" <[EMAIL PROTECTED]> writes:
> The problem with Stirling's approximation is that I need to calculate
> the hypergeometric hence the factorial for numbers within a large range
> e.g. choose(14000,170) or choose(5,2)
Stirling's approximation to second order is fairly accurate even at
low valu
Cameron Laird wrote:
> This thread confuses me.
>
> I've lost track of the real goal. If it's an exact calculation of
> binomial coefficients--or even one of several other potential
> targets mentioned--I echo Steven D'Aprano, and ask, are you *sure*
> the suggestions already offered aren't adequ
In article <[EMAIL PROTECTED]>,
Raven <[EMAIL PROTECTED]> wrote:
>Well, what to say? I am very happy for all the solutions you guys have
>posted :-)
>For Paul:
>I would prefer not to use Stirling's approximation
>
>
>The problem with long integers is that to calculate the hypergeometric
>I need to
Travis E. Oliphant wrote:
> Notice the keyword for the comb function (in scipy) lets you use it to
> compute exact values. SciPy does not just automatically use the long
> integer because this will always slow you down.
>
> comb(N, k, exact=0)
>
> Combinations of N things taken k at a time.
>
>
Raven wrote:
> Thanks Steven for your very interesting post.
>
> This was a critical instance from my problem:
>
>
from scipy import comb
>>>
comb(14354,174)
>
> inf
>
> The scipy.stats.distributions.hypergeom function uses the scipy.comb
> function, so it returned nan since it tries t
Bengt Richter wrote:
> ISTM you wouldn't get zero if you scaled by 10**significant_digits (however
> many
> you require) before dividing. E.g., expected hits per trillion (or septillion
> or whatever)
> expresses probability too. Perhaps that could work in your calculation?
>
> Regards,
> Beng
Bengt Richter wrote:
> ISTM you wouldn't get zero if you scaled by 10**significant_digits (however
> many
> you require) before dividing. E.g., expected hits per trillion (or septillion
> or whatever)
> expresses probability too. Perhaps that could work in your calculation?
>
> Regards,
> Bengt
Scott David Daniels ha scritto:
> You should really look into the timeit module -- you'll get nice
> solid timings slightly easier to tweak.
This seems a very interesting module, I will give it a try as soon as
possible. Thanks Scott.
Ale
--
http://mail.python.org/mailman/listinfo/python-list
On 2 Jan 2006 03:35:33 -0800, "Raven" <[EMAIL PROTECTED]> wrote:
[...]
>
>The problem with long integers is that to calculate the hypergeometric
>I need to do float division and multiplication because integer division
>returns 0. A solution could be to calculate log(Long_Factorial_Integer)
ISTM yo
Raven wrote:
> ...
> def main():
> t = time.time()
> for i in range(1000):
> r = hypergeometric(6,6,30,6)
> print time.time() - t
>
> t = time.time()
> for i in range(1000):
> r = hypergeometric_gamma(6,6,30,6)
> print time.time() - t
>
> and the result is:
>
> 0.038644790649
Well, what to say? I am very happy for all the solutions you guys have
posted :-)
For Paul:
I would prefer not to use Stirling's approximation
The problem with long integers is that to calculate the hypergeometric
I need to do float division and multiplication because integer division
returns 0.
Steven D'Aprano wrote:
> On Sun, 01 Jan 2006 14:24:39 -0800, Raven wrote:
>
>> Thanks Steven for your very interesting post.
>>
>> This was a critical instance from my problem:
>>
>from scipy import comb
> comb(14354,174)
>> inf
>
> Curious. It wouldn't surprise me if scipy was using flo
On Sun, 01 Jan 2006 14:24:39 -0800, Raven wrote:
> Thanks Steven for your very interesting post.
>
> This was a critical instance from my problem:
>
from scipy import comb
comb(14354,174)
> inf
Curious. It wouldn't surprise me if scipy was using floats, because 'inf'
is usually a float
"Raven" <[EMAIL PROTECTED]> writes:
> Yes I am calculating hundreds of hypergeometric probabilities so I need
> fast calculations
Can you use Stirling's approximation to get the logs of the factorials?
--
http://mail.python.org/mailman/listinfo/python-list
Thanks Steven for your very interesting post.
This was a critical instance from my problem:
>>>from scipy import comb
>>> comb(14354,174)
inf
The scipy.stats.distributions.hypergeom function uses the scipy.comb
function, so it returned nan since it tries to divide an infinite. I
did not tried to
On Sat, 31 Dec 2005 16:24:02 -0800, Raven wrote:
> Thanks to all of you guys, I could resolve my problem using the
> logarithms as proposed by Robert. I needed to calculate the factorial
> for genomic data, more specifically for the number of genes in the
> human genome i.e. about 30.000 and that
Thanks to all of you guys, I could resolve my problem using the
logarithms as proposed by Robert. I needed to calculate the factorial
for genomic data, more specifically for the number of genes in the
human genome i.e. about 30.000 and that is a big number :-)
I didn't know gmpy
Thanks a lot, real
Raven <[EMAIL PROTECTED]> wrote:
> Hi to all, I need to calculate the hpergeometric distribution:
>
>
>choose(r, x) * choose(b, n-x)
> p(x; r,b,n) = -
>choose(r+b, n)
>
> choose(r,x) is the binomial coeffic
On Mon, 26 Dec 2005 12:18:55 -0800, Raven wrote:
> Hi to all, I need to calculate the hpergeometric distribution:
>
>
>choose(r, x) * choose(b, n-x)
> p(x; r,b,n) = -
>choose(r+b, n)
>
> choose(r,x) is the
Raven wrote:
> Hi to all, I need to calculate the hpergeometric distribution:
>
>
>choose(r, x) * choose(b, n-x)
> p(x; r,b,n) = -
>choose(r+b, n)
>
> choose(r,x) is the binomial coefficient
> I use the factor
Raven wrote:
> Hi to all, I need to calculate the hpergeometric distribution:
>
>
>choose(r, x) * choose(b, n-x)
> p(x; r,b,n) = -
>choose(r+b, n)
>
> choose(r,x) is the binomial coefficient
> I use the fact
24 matches
Mail list logo