Quick Start¶
Example 1 — Gamma function:
import numpy as np
from specialfunctions import gamma
print(gamma(5)) # -> 24.0
print(gamma(0.5)) # -> sqrt(π) ≈ 1.7724538509
Example 2 — Bessel functions:
from specialfunctions import bessel_j0, bessel_j1
import numpy as np
x = np.linspace(0, 10, 100)
j0_vals = bessel_j0(x)
j1_vals = bessel_j1(x)
print(f"J0(0) = {bessel_j0(0.0)}") # -> 1.0
print(f"J1(0) = {bessel_j1(0.0)}") # -> 0.0
Example 3 — Error functions:
from specialfunctions import erf, erfc, erfinv
import numpy as np
print(erf(1.0)) # -> 0.8427007929
print(erfc(1.0)) # -> 0.1572992071
print(erfinv(0.5)) # -> 0.4769362762
Example 4 — Orthogonal polynomials:
from specialfunctions import legendre_poly, chebyshev_t
import numpy as np
x = np.linspace(-1, 1, 50)
p3 = legendre_poly(3, x) # Legendre P_3(x)
t4 = chebyshev_t(4, x) # Chebyshev T_4(x)