Module special_functions
:- use_module(library(numerics/special_functions)).
Special math functions in the Error, Gamma and Beta families
The underlying Rust implementations come from the puruspe crate.
erf(+Xexpr, -Erf)
X is Xexpr ∈ ℝ, Erf is erf(X).
erfc(+X, -Erfc)
Erfc is erfc(X) for X ∈ ℝ.
inverf(+ErfX, -X)
X is erf⁻¹(ErfX) for ErfX ∈ (-1,1).
inverfc(+ErfcX, -X)
X is erfc⁻¹(ErfcX) for ErfcX ∈ (0,2).
gamma(+X, -Gamma)
Gamma is Γ(X), the [ordinary] gamma function evaluated at X ∈ ℝ.
gamma(+A, +X, -Gamma)
Gamma is Γ(A,X), the upper incomplete gamma function, where A > 0 is the shape parameter and X ≥ 0 is the lower limit of integration.
gamma_P_Q(+A, +X, -P, -Q)
For shape parameter A > 0 and lower limit of integration X ≥ 0,
P is γ(A,X)/Γ(X), the regularized lower incomplete gamma function, and
Q is Γ(A,X)/Γ(X), the regularized upper incomplete gamma function.
invgammp(+A, +P, -X)
Given shape parameter A > 0 and probability P ∈ [0,1),
X is the unique solution of P = P(A,X), where P(-,-) is the regularized lower incomplete gamma function.
log_gamma(+X, -LogGamma)
LogGamma is ln(Γ(X)), the natural logarithm of Γ(X).
beta(+X, +Y, -B)
B is B(X,Y) ≡ Γ(X)*Γ(Y)/Γ(X+Y)
betai(+A, +B, +X, -Ix)
Given:
shape parameters A > 0 and B > 0,
upper limit of integration X ∈ [0,1],
Ix is Iₓ(A,B) ≡ B(X;A,B)/B(A,B), the regularized incomplete beta function;
invbetai(+A, +B, +P, -X)
Given:
shape parameters A > 0 and B > 0,
probability P ∈ [0,1],
X ∈ [0,1] is the unique solution of P = Iₓ(A,B) ≡ B(X;A,B)/B(A,B).
test_special_functions
Run all tests defined in this module. (These tests succeed when they find counterexamples, so the 'desirable' result is false
.)
test(+Name, ?Goal)
Tests have the signature established by @bakaq's testframework, each with a user-facing string Name, and a Goal which serves as an _assertion by succeeding iff the Name'd desirable property holds.