s-news
[Top] [All Lists]

Re: gamma function

To: "Brian Ripley" <ripley@stats.ox.ac.uk>
Subject: Re: gamma function
From: "David Smith" <dsmith@insightful.com>
Date: Fri, 30 Jan 2004 11:24:32 -0800
Cc: "s-news" <s-news@wubios.wustl.edu>
Thread-index: AcPnXtXIQsaJdgfOSlu6ybRoHJ6/ngABFsAg
Thread-topic: [S] gamma function
Brian Ripley writes:
> That's not what help(gamma) gives on my Linux S-PLUS 6.1 
> system, and it does give help on gamma and not [dpq]gamma
> (which are in help(GAMMA)).

Yep, this was on S-PLUS 6.2 for Windows. We made several improvements to the
distribution functions (and their documentation!) in that release. The same
improvements are in the 6.2 Unix version (but that shipped only recently, so
not everyone has it yet).

> Under Windows, neither give useful information, and I suspect 
> David was using 6.2 under Windows and that has got a case-insensitivity 
> problem ....

Yes, that's an annoying "feature" of Microsoft HTML Help.  But there are
links from help(gamma) to help(GAMMA) so that info is easier to find now.

> Most OSes have gamma and lgamma as functions in libc, and indeed the 
> current C standard requires that.  My guess is that 
> Insightful call the standard C functions where available.

Actually, we use our own implementation of the algorithms as described.  Not
all systems implement the C standard to include gamma/lgamma -- lgamma is
commonly in libm but the references I've seen say that lgamma is not in the
ANSI or Posix standards. On some Unix systems gamma and lgamma are identical
functions:
both compute log(abs(gamma(x))) and also set a global variable to say whether
gamma(x) was positive or negative.

By providing our own implementation we can ensure the calculation works and
gives the same answer across all the systems supported by S-PLUS. It also
means we can incorporate improved calculations for complex arguments, amongst
other things. 

# David

-- 
David M Smith <dsmith@insightful.com>
Product Manager, Insightful Corp, Seattle WA
Tel: +1 (206) 802 2360
Fax: +1 (206) 283 6310

New Insightful Miner 3! Discover how Pfizer, Bank of America and others are
using Insightful Miner -- a highly scalable data analysis workbench. Learn
more at http://www.insightful.com/products/iminer


<Prev in Thread] Current Thread [Next in Thread>