This package provides functionality to automatically recognize and evaluate a class of definite integrals frequently encountered in statistical physics, especially in the context of Bose-Einstein and Fermi-Dirac statistics. (Will probably be useful to about two people on the planet.)
These integrals have the general form:
where:
-
$p$ is the power of the integration variable$x$ , -
$\alpha > 0$ is a scaling factor (inverse temperature), -
$\mu$ is the chemical potential, - the
$-$ sign corresponds to bosons (Bose-Einstein), - the
$+$ sign corresponds to fermions (Fermi-Dirac).
The module recognizes such integrals symbolically and returns an exact result using known special functions (gamma, polylog, etc.), whenever possible.
--
If we try to evaluate the following integral in Sympy, we won't get very far:
In [1]: from sympy import symbols, Integral, exp, oo
...: x = symbols('x')
...: I = Integral(x**3 / (exp(x) - 1), (x, 0, oo))
...: I.doit()
Out[1]: Integral(x**3/(exp(x) - 1), (x, 0, oo))This is where our Bose-Fermi Integral Evaluator comes into play:
In [2]: from bosefermi import bose_fermi_integral
...: bose_fermi_integral(I)
Out[2]: pi**4/15Result:
%%timeit
bose_fermi_integral(I)
1.37 ms ± 30.2 μs per loop (mean ± std. dev. of 7 runs, 1,000 loops each)This integral corresponds, up to a Gamma prefactor, to the standard Bose-Einstein or Fermi-Dirac integral defined in physics:
or
The following symbolic forms are supported:
| Integral | Result |
|---|---|
| ... |
# For now, clone and use directly:
git clone https://github.com/klimanek/Bose-Fermi.git
cd Bose-Fermi
pip install -e .This package is designed for eventual integration into SymPy. Contributions are warmly welcome!
- Bug reports: Found an integral that should work but doesn't? Please report it!
- New patterns: Know of related integrals from physics/mathematics? Let's add them!
- Performance improvements: Optimizations in pattern matching are always appreciated.
- SymPy integration: Help with integrating this into the main SymPy codebase.
We're actively working on integrating this functionality into SymPy's main integration engine. The goal is to make these evaluations available automatically when you call .doit() on supported integrals.