Expand description
Special functions and probability distributions implemented from scratch.
The implementation follows the standard series and continued-fraction
methods for the regularized incomplete gamma and beta functions
(Numerical Recipes style, with explicit iteration bounds and a structured
NonConvergence error). No statrs or platform erf is used; on wasm32
every transcendental falls back to libm.
Functionsยง
- abs
- beta_
cdf - beta_
pdf - beta_
quantile - beta_sf
- Upper tail
P(X > x), computed from the mirrored regularized incomplete beta function rather than1 - cdf. - binomial_
cdf - binomial_
pmf - chi_
square_ cdf - chi_
square_ pdf - chi_
square_ quantile - chi_
square_ sf - erf
- Error function, computed from the regularized incomplete gamma:
erf(x) = P(1/2, x^2)forx >= 0. - erfc
- Complementary error function, computed from the regularized upper incomplete gamma so that the positive tail keeps full relative accuracy.
- exp
- exponential_
cdf - exponential_
pdf - exponential_
quantile - exponential_
sf - Upper tail
P(X > x)computed fromexpdirectly so largexkeeps relative accuracy (never1 - cdf). - f_cdf
- f_pdf
- f_
quantile - f_sf
- Upper tail
P(X > x), computed directly from the regularized incomplete beta function so largexkeeps relative accuracy. - gamma_
cdf - gamma_p
- Regularized lower incomplete gamma
P(a, x). - gamma_
pdf - gamma_q
- Regularized upper incomplete gamma
Q(a, x). - gamma_
quantile - ibeta
- Regularized incomplete beta
I_x(a, b). - invert_
monotone - Invert a strictly increasing CDF by bracket expansion, bisection, and
Newton polishing. The tolerance is relative (
1e-15), comfortably inside the documented1e-12requirement. - lgamma
- Lanczos approximation to ln|Gamma(x)|.
- ln
- lognormal_
cdf - lognormal_
pdf - lognormal_
quantile - negative_
binomial_ cdf - negative_
binomial_ pmf - normal_
cdf - normal_
pdf - normal_
quantile - normal_
sf - Upper tail
P(X > x), computed witherfcso large positivexkeeps relative accuracy (never1 - cdf). - poisson_
cdf - poisson_
pmf - sin
- sqrt
- student_
t_ cdf - student_
t_ pdf - student_
t_ quantile - student_
t_ sf - uniform_
cdf - uniform_
pdf - uniform_
quantile