Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: hypogeometric sum
Replies: 11   Last Post: Mar 31, 2008 3:25 PM

 Messages: [ Previous | Next ]
 Olli Lehtonen Posts: 2 Registered: 3/29/08
Re: hypogeometric sum
Posted: Mar 29, 2008 4:24 PM

On 29 maalis, 08:04, gsgs <ster...@aol.com> wrote:
> I need to integrate the routine into my existing C-program
> typical values are:
> k~200,r~1000,n~2000,w~400
> h(k;r,n,w)=b(w,k)*b(n-w,r-k)/b(n,r) ,
> k<=w,r-k<=n-w,r>=n and the result must be between 0 and 1
>
> desired precision is 20 decimal digits
> variables are of type "double" in C

Maybe you could use GSL http://www.gnu.org/software/gsl/ which
provides, for example, cumulative hypergeometric distribution:

#include <stdio.h>
#include <gsl/gsl_cdf.h>

int main (void)
{
unsigned int k,n1,n2,t;
k=200;
n1=400;
n2=1600;
t=1000;
printf("%15.12g\n", gsl_cdf_hypergeometric_P(k,n1,n2,t) );
return 0;
}

gives

0.522286920875

Date Subject Author
3/28/08 Sterten
3/28/08 Dann Corbit
3/28/08 Dann Corbit
3/28/08 Sterten
3/28/08 Dann Corbit
3/29/08 Sterten
3/29/08 nic@temme.net
3/29/08 David W. Cantrell
3/29/08 Olli Lehtonen
3/30/08 Sterten
3/30/08 Ian Smith
3/31/08 Sterten