zenno: format & lint fixes
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import * as math from "mathjs";
|
||||
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);
|
||||
// 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user