[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] wrong results of the function gsl_cdf_ugaussian_Pinv
From: |
Regis Smith |
Subject: |
Re: [Help-gsl] wrong results of the function gsl_cdf_ugaussian_Pinv |
Date: |
Thu, 15 May 2014 21:26:46 -0700 |
On May 13, 2014, at 9:25 AM, Dafna Hirschfeld <address@hidden> wrote:
> #include <gsl/gsl_math.h>
> #include <stdio.h>
>
> int main(){
> double x= 0.5;
> double res = gsl_cdf_ugaussian_Pinv(x);
> printf("icdf(%f)=%f\n",x,res);
> return 0;
> }
>
> For some reason the output is: *icdf(0.500000)=1.000000*
>
> Which is wrong, it should be: *icdf(0.500000)=0.000000 (because P(X<0)=0.5)*
>
> Did I do something wrong?
>
You have to include <gsl/gsl_cdf.h>. From the info page:
"The functions for random variates and probability density functions
described in this section are declared in 'gsl_randist.h'. The
corresponding cumulative distribution functions are declared in
'gsl_cdf.h’.”