zenno/doc/frbm: update with charts &c.

This commit is contained in:
2026-05-23 16:18:24 -04:00
parent 3ab17cf9b0
commit bd99cfaa6d
7 changed files with 678 additions and 171 deletions
+9
View File
@@ -0,0 +1,9 @@
import * as math from "mathjs";
export function binomPMF(p: number, n: number, k: number): number {
// Operate in log domain for precision.
const lc = math.lgamma(n+1) - math.lgamma(k+1) - math.lgamma(n-k+1);
const lpk = k * math.log(p);
const lr = (n - k) * math.log(1 - p);
return math.exp(lc + lpk + lr);
}