This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: bug in gsl_ran_chisq_pdf
- From: Martin Jansche <jansche at ling dot ohio-state dot edu>
- To: <gsl-discuss at sources dot redhat dot com>
- Date: Tue, 8 Apr 2003 13:38:37 -0400 (EDT)
- Subject: Re: bug in gsl_ran_chisq_pdf
On Tue, 8 Apr 2003 keith dot briggs at bt dot com wrote:
> In gsl-1.3, gsl_ran_chisq_pdf(0.0,nu) is wrong.
>
> It returns 0.0 whatever nu is.
That seems to be the default behavior, absent the indication of a
domain error. The Gamma pdf on x requires x > 0, so it does make some
sense to return 0 for any x outside the defined domain.
You seem to be suggesting that the limit for x->0 from above be
returned instead.
> It should return Inf for nu=1.
> It should return 0.5 for nu=2.
> It should return 0.0 for nu>2.
The parameter nu is declared double, so your suggestion is not
exhaustive. You probably meant to say
raise an error for nu <= 0
return Inf for 0 < nu < 2
return 0.5 for nu == 2
return 0.0 for nu > 2
Anyway, I haven't seen an explicit statement about the desired
behavior of the _pdf functions when the main argument is outside the
domain of definition. Personally, I find the currently implemented
behavior reasonable: the univariate PDFs in GSL are defined on
single intervals, and the _pdf functions return 0 for values outside
the interval (the _cdf functions would have to return 0 below the
defined interval and 1 above).
- martin