abax 0.1.47

A lightweight Rust library providing high-precision mathematical constants and special functions, including Bernoulli numbers, Riemann Zeta values, robust incomplete gamma functions, and probability distribution functions like normal and lognormal CDF.
Documentation

abax

A lightweight Rust library providing high-precision mathematical constants and special functions.

Crates.io License docs.rs Crates.io Size Crates.io Total Downloads

Features

  • Mathematical Constants:

    • Bernoulli numbers (B2n) up to n=16.
    • Riemann Zeta function values for integers 2 through 16.
    • Euler-Mascheroni constant.
    • Stirling series coefficients for asymptotic expansions.
  • Special Functions:

    • Gamma and Polygamma Functions:
      • gamma(x): Gamma function Γ(x) computed with the Lanczos approximation and reflection formula.
      • gammaln(x): Natural logarithm of the Gamma function ln(Γ(x)) using Stirling's approximation.
      • digamma(x), trigamma(x), tetragamma(x): Polygamma functions ψ(n)(x) implemented with reflection and recurrence shifting.
      • psi(k, x): Polygamma interface for arbitrary order $k$ with stable handling of poles and infinities.
      • gammainc(x, a, lower, scaled): Regularized incomplete gamma function with scaling for improved conditioning.
      • gammaincinv(y, a, lower): Robust inverse incomplete gamma function using a combined Halley-Newton-Bisection method.
    • Beta Functions:
      • beta(z, w), betaln(z, w): Beta function and its natural logarithm.
      • betainc(x, z, w, lower): Regularized incomplete beta function Ix(z,w).
      • betaincinv(y, z, w, lower): Inverse of the regularized incomplete beta function.
    • Error Functions:
      • erf(x), erfc(x), erfcx(x): Error function, complementary error function, and scaled variant.
      • erfinv(x), erfcinv(x): Inverse error functions implemented with piecewise rational approximations.
  • Probability Distributions:

    Family PDF CDF Inverse (Quantile)
    Normal normpdf(x, μ, σ) normcdf(x, μ, σ, upper) norminv(p, μ, σ)
    Lognormal lognpdf(x, μ, σ) logncdf(x, μ, σ, upper) logninv(p, μ, σ)
    Student's T tpdf(x, v) tcdf(x, v, upper) tinv(p, v)
    Noncentral T nctpdf(x, ν, δ) nctcdf(x, ν, δ, upper) nctinv(p, ν, δ)
    Gamma gampdf(x, a, b) gamcdf(x, a, b, upper) gaminv(p, a, b)
    Beta betapdf(x, a, b) betacdf(x, a, b, upper) betainv(p, a, b)
    Exponential expdf(x, λ) expcdf(x, λ, upper) expinv(p, λ)
    Chi-squared chi2pdf(x, v) chi2cdf(x, v, upper) chi2inv(p, v)
    Weibull wblpdf(x, a, b) wblcdf(x, a, b, upper) wblinv(p, a, b)
    Extreme Value evpdf(x, μ, σ) evcdf(x, μ, σ, upper) evinv(p, μ, σ)
    Generalized Extreme Value gevpdf(x, k, σ, μ) gevcdf(x, k, sigma, mu, upper) gevinv(p, k, sigma, mu)
    Poisson poisspdf(x, λ) poisscdf(x, λ, upper) poissinv(p, λ)
    Binomial binopdf(x, n, p) binocdf(x, n, p, upper) binoinv(y, n, p)

Usage

Add this to your Cargo.toml:

[dependencies]
abax = "*"

License

This project is licensed under the MIT License - see the LICENSE file for details.

Repository

Source code is available on GitHub.