From murdoch at stats.uwo.ca  Mon Mar 30 22:37:51 2009
From: murdoch at stats.uwo.ca (Duncan Murdoch)
Date: Mon, 30 Mar 2009 16:37:51 -0400
Subject: [Rd] Gamma funtion(s) bug
In-Reply-To: <XFMail.090330195538.Ted.Harding@manchester.ac.uk>
References: <XFMail.090330195538.Ted.Harding@manchester.ac.uk>
Message-ID: <49D12D9F.1000203@stats.uwo.ca>

On 3/30/2009 2:55 PM, (Ted Harding) wrote:
> On 30-Mar-09 18:40:03, Kjetil Halvorsen wrote:
>> With R 2.8.1 on ubuntu I get:
>>> gamma(-1)
>> [1] NaN
>> Warning message:
>> In gamma(-1) : NaNs produced
>>> lgamma(-1)
>> [1] Inf
>> Warning message:
>> value out of range in 'lgamma'
>> 
>> Is'nt the first one right, and the second one (lgamma)
>> should also be NaN?
>> Kjetil
> 
> That is surely correct! Since lim[x->(-1)+] gamma(x) = +Inf,
> while lim[x->(-1)-] gamma(x) = -Inf, at gamma(-1) one cannot
> choose between +Inf and -Inf, so surely is is NaN.

But lgamma(x) is log(abs(gamma(x))), so it looks okay to me.

Duncan Murdoch



[Rd] Gamma funtion(s) bug
Duncan Murdoch