[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Request for combinatorial functions
From: |
Paul Kienzle |
Subject: |
Re: Request for combinatorial functions |
Date: |
Tue, 17 Apr 2007 07:02:37 -0400 |
On Apr 16, 2007, at 9:00 PM, Jordi Gutierrez Hermoso wrote:
I also see that the current factorial function in the 'Forge isn't
simply an alias for the gamma function, which it really should
be.
More correctly, use round(gamma(x+1))
This should be fixed. Looks like the factorial function was
written a long time ago, perhaps before the gamma function was
available.
No, there was just no compelling reason to use it.
I played around a bit to see if gamma(n+1) is any more accurate
than prod(1:n) as compared to exp(sum(log(1:n))) and found that
no it is not. Also, speed/space is not an issue since the
function is small and cheap in either case.
That said, I'm submitting the gamma version to address@hidden since
I've thrown in a few test cases.
- Paul