[Patches] [ python-Patches-660618 ] math.loggamma(z)

noreply@sourceforge.net noreply@sourceforge.net
Wed, 01 Jan 2003 13:53:18 -0800


Patches item #660618, was opened at 2003-01-01 03:21
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=660618&group_id=5470

Category: Modules
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Raymond Hettinger (rhettinger)
>Assigned to: Nobody/Anonymous (nobody)
Summary: math.loggamma(z)

Initial Comment:
Add a function to compute ln(gamma(z)).  It's fast 
and easy to compute but is a major PITA when you 
need it and don't have it available.

It is useful by itself, for factorials, binomial 
coefficients, combinatorics, and for computing the 
beta function.

I'm not for growing the mathmodule by much, but 
this and an incomplete gamma are a fine pair of 
basic building blocks and belong in the tool chest.

----------------------------------------------------------------------

>Comment By: Raymond Hettinger (rhettinger)
Date: 2003-01-01 16:53

Message:
Logged In: YES 
user_id=80475

Thanks for the link.  Revised the patch to use the 
coefficients published there.  Also, incorporated the 
knowledge of how to use it in the docs.

While another module has its merits, I greatly prefer 
putting this function in the mathmodule because that is 
the first place someone would look for it.  It is not out of 
place with tanh() or the other double to double functions. 

The users of the mathmodule are more likely to be in 
educational or scientific settings rather than being 
everyday python users.  And the docs make it clear how to 
use the function.



----------------------------------------------------------------------

Comment By: Tim Peters (tim_one)
Date: 2003-01-01 11:56

Message:
Logged In: YES 
user_id=31435

No numeric functions are "fast and easy" to do in a portable 
and robust way.  The second lngamme function here:

http://lib.stat.cmu.edu/apstat/245

claims better accuracy with fewer terms, and because that 
website is well-known in the stats world, is more 
trustworthy than a random site with many copyright claims 
and bizarre formatting <wink>.

That said, I'm at best -0 on adding functions to the math 
module that require custom code and can't even be 
explained to the vast bulk of Python's users.  (Yes, I know 
lngamma is a basic building block -- for the relatively small 
collection of people who play with that kind of block.).

In contrast, an "advanced functions"/"special functions" 
module would be great.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=660618&group_id=5470