This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: problems when using gsl_ran_ugaussian


> well,
>
> you have to print a double, not a long int.
> try
> printf("%f \n",a) ;
> and
> printf("%f\n",gsl_ran_ugaussian_pdf(1.5)) ;
>
> and you'll get the correct values.

Excuse me for the '%ld', it was the idea of a friend that I have tested.. I 
have the same problem with the '%f'. I have tested the following lines :

  a=gsl_ran_ugaussian_pdf(15000) ;
  printf("%f\n",a) ;
  printf("%f\n",gsl_ran_ugaussian_pdf(15000)) ;
  a=gsl_ran_ugaussian_pdf(15000) ;
  printf("%f\n",a) ;

  a=gsl_ran_ugaussian_pdf(0) ;
  printf("%f\n",a) ;
  printf("%f\n",gsl_ran_ugaussian_pdf(0)) ;
  a=gsl_ran_ugaussian_pdf(0) ;
  printf("%f\n",a) ;

and this results in :
32.000000
32.000000
50.000000
50.000000
50.000000
0.000000

The 3 first results must be the same, they are not..
The 3 last too, same conclusion..

Moreover, I thought that the result would be the sum from -inf to x.. Then, 
the value for 15000 must be 1, and for 0, 0.5.. But maybe I am mistaken on 
this point, am I ?

.Yves.

-: Unix IS user-friendly, it just chooses its friends very carefully. :-


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]