Re: [Rd] RFC: lchoose() vs lfactorial() etc

2009-12-17 Thread Petr Savicky
On Thu, Dec 17, 2009 at 03:10:49PM +0100, Martin Maechler wrote: [...] > MM> This, of course, is an even more compelling reason to implement > MM> the change of return log(abs(choose(.,.)), > MM> and at the moment, I'd even plan to "backport" that to R "2.10.1 > MM> patched", as th

Re: [Rd] RFC: lchoose() vs lfactorial() etc

2009-12-17 Thread Martin Maechler
> "MM" == Martin Maechler > on Tue, 15 Dec 2009 14:54:18 +0100 writes: > "PS" == Petr Savicky > on Tue, 15 Dec 2009 10:52:43 +0100 writes: PS> On Tue, Dec 15, 2009 at 09:49:28AM +0100, Martin Maechler wrote: >>> lgamma(x) and lfactorial(x) are defined to return

Re: [Rd] RFC: lchoose() vs lfactorial() etc

2009-12-15 Thread Martin Maechler
> "PS" == Petr Savicky > on Tue, 15 Dec 2009 10:52:43 +0100 writes: PS> On Tue, Dec 15, 2009 at 09:49:28AM +0100, Martin Maechler wrote: >> lgamma(x) and lfactorial(x) are defined to return >> >> ln|Gamma(x)| {= log(abs(gamma(x)))} or ln|Gamma(x+1)| respectively.

Re: [Rd] RFC: lchoose() vs lfactorial() etc

2009-12-15 Thread Robin Hankin
Martin Becker wrote: Robin Hankin wrote: ... Is this the place to discuss having complex arguments for gamma()? ... If this discussion starts I would second the wish for the functionality of gsl's lngamma_complex in base R. Do you mean gsl or GSL? ;-) [the GNU scientific library is 'GSL'

Re: [Rd] RFC: lchoose() vs lfactorial() etc

2009-12-15 Thread Martin Becker
Robin Hankin wrote: ... Is this the place to discuss having complex arguments for gamma()? ... If this discussion starts I would second the wish for the functionality of gsl's lngamma_complex in base R. Best wishes Martin -- Dr. Martin Becker Statistics and Econometrics Saarland University

Re: [Rd] RFC: lchoose() vs lfactorial() etc

2009-12-15 Thread Petr Savicky
On Tue, Dec 15, 2009 at 09:49:28AM +0100, Martin Maechler wrote: > lgamma(x) and lfactorial(x) are defined to return > > ln|Gamma(x)| {= log(abs(gamma(x)))} or ln|Gamma(x+1)| respectively. > > Unfortunately, we haven't chosen the analogous definition for > lchoose(). > > So, currently > >

Re: [Rd] RFC: lchoose() vs lfactorial() etc

2009-12-15 Thread Robin Hankin
Hi Martin I think you're absolutely right about this; One thing I need again and again is a multinomial function, and usually define: > lmultinomial function (x) { lfactorial(sum(x)) - sum(lfactorial(x)) } > multinomial function (x) { exp(lmultinomial(x)) } It would be nice to have this

[Rd] RFC: lchoose() vs lfactorial() etc

2009-12-15 Thread Martin Maechler
lgamma(x) and lfactorial(x) are defined to return ln|Gamma(x)| {= log(abs(gamma(x)))} or ln|Gamma(x+1)| respectively. Unfortunately, we haven't chosen the analogous definition for lchoose(). So, currently > lchoose(1/2, 1:10) [1] -0.6931472 -2.0794415NaN -3.2425924NaN