Extreme precision

Binomial probability calculator

 
 
 

Mode:       

Precision:         

       

Warning:  The Slow and Experimental settings can be very slow. Factors which might make them especially slow include:

● Large values of n.¹
● Calculating cumulative probablities rather than a simple binomial probability, especially for large values of k.²
● Long decimal or repeating decimal values of p (or their rational equivalents).³

The the Slow (extreme precision) setting is typically 20× to 5000× slower than the Quick (default) setting, and it can be even worse. That can easily exceed the approximately three minute time limit of this server. If that happens, an error message should display (and usually does).

Enter the desired values above, and then click: 

P(k) = (n! / ((n-k)!⋅k!)) ⋅ p^k ⋅ q^(n-k)


References & credits: 

1. Hover your mouse cursor over the parameters & options in the input form, for “tool-tip” help.

2. If you download binomcalc.pl and run it with no parameters, it displays a brief help message.

3. Pierce, Rod (2020). “The Binomial Distribution,” Math Is Fun.

4. OnlineMathLearning Binomial Distribution lesson.

5. There are many other on-line binomial probability calculators, but most fail for large values of n. Here are the best ones I've found. I tested them with a difficult binomial probability calculation (n=35,750), here are the results. (Hover your mouse over the links below for my comments about each tool.):

6. This tool is written in Perl 5, and it uses the Perl BigRat module.

7. This tool uses GMP, the GNU Multiple Precision arithmetic library.

8. Q: What's with that odd “.sphp” file extension, anyhow?

A: This webpage is unusually designed, using HTML, PHP, CGI Perl, GMP, and a smidgen of JavaScript. Just as .shtml is HTML with Server-Side Includes, .sphp is PHP with Server-Side Includes (CGI Perl).


Download: 

To download this binomial probability calculator, as a standalone program, right-click here (preview), and “save link as,” or “save target as,” or similar. It is written in Perl, so you'll need to have Perl installed to use it. On Windows I use 64-bit Strawberry Perl (currently v5.38.2.2), but most other recent version 5 Perls should also work. 32-bit Strawberry Perl works, but it's nearly twice as slow.
(There are no warranties, express nor implied, but you can contact me if you have difficulty.)


Footnotes: 

1 Large values of n make the calculation slower. For example, if  perl binomcalc.pl m=cu a=s n=50000 k=10 p=1/10000   takes five seconds, then  perl binomcalc.pl m=cu a=s n=100000 k=10 p=1/10000   might take 13 seconds.

2 Calculating cumulative probablities, rather than a simple binomial probability, makes the calculation slower, especially for large values of k. For example, calculating cumulative probabilities for k=100 requires calculating binomial probabilities for 101 different values of k, and summing them.

3 Long decimal or repeating decimal values of p (or their rational equivalents) can make the calculation slower. This mainly affects the “Experimental” precision settings. For example, if  perl binomcalc.pl m=acu a=x n=35750 k=3 p=1/10000 b=1   takes 1½ seconds, then  perl binomcalc.pl m=acu a=x n=35750 k=3 p=1/9999 b=1   might take 2½ minutes.

 

 

Last modified: 29-Feb-2024 (version 39)
By David A. Burton.
The “last modified” date & version number on this web page are maintained automatically by TLIB Version Control.
 

SeaLevel.info