I'm using GSL 1.14 on Debian Squeeze, and can't seem to get the chi
square pdf to work.

// file chisq_pdf.c
#include<stdio.h>
#include<stdlib.h>
#include<gsl/gsl_rng.h>

int main(int argc, char** argv)
{
    double x=atof(argv[1]), df=atof(argv[2]);
    printf("x=%f; df=%f; pdf=%f\n",x,df,gsl_ran_chisq_pdf(x,df));

    return 0;
}
// end file

I compile with "gcc chisq_pdf.c -lgsl -lgslcblas -lm -o chisq_pdf", but
all inputs give me zero.

$ ./chisq_pdf 4 3
x=4.000000; df=3.000000; pdf=0.000000
$ ./chisq_pdf 0 2
x=0.000000; df=2.000000; pdf=0.000000
./chisq_pdf 3 4
x=3.000000; df=4.000000; pdf=0.000000

I must be making an embarrassingly silly error.  Please help!  Thanks!

Regis


Reply via email to