Extension

rmath.special

Special mathematical functions. All functions accept float, list[float], Vector, or Array and return the matching type.

API Reference

FunctionDescription
gamma(x)Gamma function Γ(x). Extends factorial to real numbers: Γ(n) = (n-1)!
ln_gamma(x)Natural log of the absolute Gamma function: ln|Γ(x)|. Avoids overflow for large inputs.
erf(x)Error function erf(x) = (2/√π) ∫₀ˣ e⁻ᵗ² dt. Used in probability and statistics.
Polymorphic dispatch: Pass a float to get a float back. Pass a Vector or Array to get element-wise results of the same type.
special_example.py
import rmath.special as sp
import rmath.vector as rv

# Scalar
g = sp.gamma(5.0)  # 24.0 (= 4!)

# Vectorized
v = rv.Vector([0.5, 1.0, 1.5, 2.0])
erfs = sp.erf(v)  # Vector of erf values