This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Re: problems when using gsl_ran_ugaussian
I don't know if this is the problem but in the code you submitted
the header file gsl_randist.h
was not included, try add the line
#include <gsl/gsl_statistics.h>
af
On Monday 19 May 2003 17:29, Yves Caniou wrote:
> > 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. :-
--
**********************************************************************
Andrea Fortini
Ph.D. Student
Ornstein Laboratorium, room 021
Soft Condensed Matter
Debye Institute, Utrecht University
Princetonplein 5, 3584 CC Utrecht
The Netherlands
tel.: ++31 (0) 30 253 3519, fax: ++31 (0) 30 253 2706
e-mail: a.fortini@phys.uu.nl
**********************************************************************