bug-gsl
[Top][All Lists]
Advanced

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

Re: [Bug-gsl] gsl_sf_beta_inc returns 0.0 all the time


From: Brian Gough
Subject: Re: [Bug-gsl] gsl_sf_beta_inc returns 0.0 all the time
Date: Thu, 23 Dec 2010 14:24:02 +0000
User-agent: Wanderlust/2.15.6 (Almost Unreal) Emacs/23.2 Mule/6.0 (HANACHIRUSATO)

At Tue, 21 Dec 2010 21:38:03 -0800,
Andrew Schein wrote:
> Attached is a short program that attempts to reproduce a portion of the
> incomplete beta curve for comparison against a plot shown in Numerical
> Recipes in C++.  The numerical recipes plot varies x between (0,1) while
> setting a=b=0.5.
> 
> #include <stdio.h>
> #include <gsl/gsl_rng.h>
> 
> int main(int argc, char **argv) {
>     long i;
>     double x = 0.0;
>     double a = 0.5;
>     double b = 0.5;
>     for (i=0; i < 10; i++) {
>         x += 1.0/10.1;
>         double from_gsl = gsl_sf_beta_inc(a,b,x);
>         printf("a:%f b:%f x:%f betai(a,b,x):%f \n",a,b,x,from_gsl);
>     }
>     return 0;
> }

Hi.

Thanks for the test program (much appreciated).  I noticed there's no
#include <gsl_sf.h> -- with that it works for me, hopefully for you too.

-- 
Brian Gough


address@hidden:~/tmp$ gcc -Wall beta.c -lgsl -lgslcblas -lm
beta.c: In function 'main':
beta.c:12:5: warning: implicit declaration of function 'gsl_sf_beta_inc'

address@hidden:~/tmp$ gcc -Wall beta.c -lgsl -lgslcblas -lm # with #include 
<gsl_sf.h>
address@hidden:~/tmp$ ./a.out 
a:0.500000 b:0.500000 x:0.099010 betai(a,b,x):0.203780 
a:0.500000 b:0.500000 x:0.198020 betai(a,b,x):0.293589 
a:0.500000 b:0.500000 x:0.297030 betai(a,b,x):0.366944 
a:0.500000 b:0.500000 x:0.396040 betai(a,b,x):0.433330 
a:0.500000 b:0.500000 x:0.495050 betai(a,b,x):0.496848 
a:0.500000 b:0.500000 x:0.594059 betai(a,b,x):0.560239 
a:0.500000 b:0.500000 x:0.693069 betai(a,b,x):0.626191 
a:0.500000 b:0.500000 x:0.792079 betai(a,b,x):0.698575 
a:0.500000 b:0.500000 x:0.891089 betai(a,b,x):0.785891 
a:0.500000 b:0.500000 x:0.990099 betai(a,b,x):0.936549 




reply via email to

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