[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-gsl] Bug in gsl_ran_exponential?
From: |
Brian Gough |
Subject: |
Re: [Bug-gsl] Bug in gsl_ran_exponential? |
Date: |
Thu, 17 Aug 2006 21:17:01 +0100 |
User-agent: |
Wanderlust/2.14.0 (Africa) Emacs/21.3 Mule/5.0 (SAKAKI) |
At Wed, 16 Aug 2006 17:08:12 +0200,
Dr. Hans Ekkehard Plesser wrote:
> This means that gsl_rng_uniform_pos cannot return 0, even though
>
> p(x) = 1/mu exp(-x/mu)
>
> has its maximum p(x=0) = 1/mu at x=0.
Thanks for the bug report. I think it might be a good idea to make
sure that 0 is sampled---the following might work:
double u = gsl_rng_uniform (r);
return -mu * (u == 0.0 ? 0.0 : log (u));
Maybe there are some more of these lurking in the other routines too?
--
Brian Gough
Network Theory Ltd,
Publishing Free Software Manuals --- http://www.network-theory.co.uk/