Created
December 2, 2020 21:05
-
-
Save Pengeszikra/b4156ab48ac3d21bdee68a7fa670fc23 to your computer and use it in GitHub Desktop.
Binomial
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fact = n => n ? fact(n - 1) * n : 1; | |
| const coefficients = (n,k) => Math.round(fact(n) / (fact(k) * fact(n - k))); | |
| const binomial = (p, n, k) => coefficients(n, k) * (p ** k) * ((1 - p) ** (n - k)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment