[Python-3000] adding gamma and error functions to math module
Raymond Hettinger
python at rcn.com
Wed Jul 16 18:19:02 CEST 2008
From: "nirinA raseliarison" <nirina at mail.blueline.mg>
>> >>> from test.test_random import gamma
. . .
> there is a simple implementation in Python at:
> http://en.wikipedia.org/wiki/Lanczos_approximation
> with coefficients slightly different from those in
> test_random.py, one gets:
. . .
> with the gamma from gcc under linux,
> which uses the MPFR library,
> the result is not really satisfying:
> using the code from numerical recipes chap 6:
. . .
>
> and from the scipy package,
> which uses the cephes math library:
...
> i'll check if an appropriate choice of
> of a set of coefficients or extending the
> number of coefficients can lead to a more
> accurate result.
Discussions of "my approximation is better/faster/etc than yours" can be interminable.
Recommend you put together your favorite approximation in a recipe.
The one in test.random is suffices well for its purpose.
Raymond
More information about the Python-3000
mailing list