help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] Beginner help with gsl_ran_chisq_pdf


From: Regis Smith
Subject: [Help-gsl] Beginner help with gsl_ran_chisq_pdf
Date: Sun, 03 Jun 2012 17:48:13 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.4) Gecko/20120427 Firefox/10.0.4 Iceape/2.7.4

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

[Prev in Thread] Current Thread [Next in Thread]