Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8811481
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T03:22:34+00:00 2026-06-14T03:22:34+00:00

How do I translate this C++ program that uses hypergeometric distribution functions from the

  • 0

How do I translate this C++ program that uses hypergeometric
distribution functions from the GNU Scientific Library

http://www.gnu.org/software/gsl/manual/html_node/The-Hypergeometric-Distribution.html

into a C++ program that instead uses similar functions from the Boost library?

#include <cstdlib>
#include <iostream>
#include <gsl/gsl_randist.h>
#include <gsl/gsl_cdf.h>

int main(int argc,char *argv[]) {
  unsigned int n1 = 256;
  unsigned int n2 = 1583;
  unsigned int t = 300;
  unsigned int k = 40;
  std::cout << gsl_ran_hypergeometric_pdf(k, n1, n2, t)
            << std::endl
            << gsl_cdf_hypergeometric_P(k, n1, n2, t)
            << std::endl;
  return EXIT_SUCCESS;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T03:22:35+00:00Added an answer on June 14, 2026 at 3:22 am

    Here is a translation into Boost functions:

    #include <cstdlib>
    #include <iostream>
    #include <boost/math/distributions/hypergeometric.hpp>
    #include <boost/math/policies/policy.hpp>
    
    int main(int argc, char *argv[]) {
      unsigned int n1 = 256;
      unsigned int n2 = 1583;
      unsigned int t = 300;
      unsigned int k = 40;
      boost::math::hypergeometric_distribution<double> hg_dist(n1, t, n1 + n2);
      std::cout << boost::math::pdf<double>(hg_dist, k)
                << std::endl
                << boost::math::cdf<double>(hg_dist, k)
                << std::endl;
      return EXIT_SUCCESS;
    }
    

    For more info see
    http://www.boost.org/doc/libs/1_52_0/libs/math/doc/sf_and_dist/html/math_toolkit/dist/dist_ref/dists/hypergeometric_dist.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Could someone translate this, into a syntax that uses the built in variables? \\myserver\builds\mybuild\Daily_20090525.1\Release\_PublishedWebsites\myWebsite
I have this link which i need to translate in a php variable. http://www.facebook.com/dialog/apprequests?app_id=346824075388300&to=1149862205&message=Facebook+Dialogs+are+so+easy%21&redirect_uri=http%3A%2F%2Fpenelope-ns.net%2Ffb%2F
As a pet project I want to build a program that translate from English
I want to add a new (fstream) function in a program that already uses
I need to translate an old program working on AS/400 that was picking random
I've got a little objective-c utility program that renders a convex hull. (This is
I have a Python 2.5 program with code at https://www.dropbox.com/s/wh1sgpsd248x85m/PopGen.zip When I execute this
i have to translate this EBNF to bison: <compound-statement> ::= begin [ <statement> (
how to translate this to C# import java.io.*; import java.net.*; class SimpleServer { private
How do you translate this perl subroutine into a PHP function? sub disagreement {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.