The Math Forum



Search All of the Math Forum:

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


Math Forum » Discussions » sci.math.* » sci.math.num-analysis

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

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Olli Lehtonen

Posts: 2
Registered: 3/29/08
Re: hypogeometric sum
Posted: Mar 29, 2008 4:24 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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




Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2017. All Rights Reserved.