This project has moved and is read-only. For the latest updates, please go here.

Emulating MS Excel BINOMDIST Function with Math.NET

Aug 7, 2009 at 2:11 PM

Hi everyone,

I'd appreciate if someone can help me with emulating the MS Excel BINOMDIST Function in Math.NET.   MS Excel funcition Syntax is:

Number_s   is the number of successes in trials.
Trials   is the number of independent trials.
Probability_s   is the probability of success on each trial.
Cumulative   is a logical value that determines the form of the function. If cumulative is TRUE, then BINOMDIST returns the cumulative distribution function, which is the probability that there are at most number_s successes; if FALSE, it returns the probability mass function, which is the probability that there are number_s successes.

And it seems that I have one 2 of those 4 parameters available in Math.NET:

NumberOfTrials Gets or sets the number of trials parameter. 
ProbabilityOfSuccess Gets or sets the success probability parameter. 

Does anyone know hoy to map these 2 functions?

José María

Aug 9, 2009 at 5:12 PM

Hi Jose,

First, note that we still have to port the binomial distribution from Math.NET Iridium to Math.NET Numerics. That being said, using Math.Net Iridium, the parameters that specify the number of trials and the success probabilities can be specified in the constructor. Then, one can call the ProbabilityMass function with the third parameter to get the value when BINOMDIST has the 4th param set to FALSE and one can call the CumulativeDistribution function to map to the BINOMDIST with the 4th param set to TRUE.

Hope that helps.

Cheers, Jurgen

Aug 11, 2009 at 10:06 AM

Btw, the Math.NET Iridium UnitTests come with examples on how to emulate the similar Excel functions TDIST, GAMMADIST and GAMMAINV, so you may want to have a look at them there.


Aug 11, 2009 at 10:50 PM

Jurgen, Chris,

Thank you so much for the quick and clear answer, it worked perfectly!  

José María