darkhistory.electrons.ics.BE_integrals.F1¶
-
darkhistory.electrons.ics.BE_integrals.
F1
(a, b, epsrel=0)¶ Definite integral of x/[(exp(x) - 1)].
This is computed from the indefinite integral
\[\int dx \frac{x}{e^x - 1} = x \log\left(1 - e^{-x} \right) - \text{Li}_2\left(e^{-x}\right) = x \log\left(1 - e^{-x} \right) - \text{Sp}\left( 1 - e^{-x} \right) + \frac{\pi^2}{6} \,,\]where Sp is Spence’s function, as implemented in
scipy.special.spence
.Parameters: - a : ndarray
Lower limit of integration. Can be either 1D or 2D.
- b : ndarray
Upper limit of integration. Can be either 1D or 2D.
- epsrel : float
Target relative error associated with series expansion. If zero, then the error is not computed. Default is 0. If the error is larger than
epsrel
, then the Taylor expansions used here are insufficient. Higher order terms can be added very easily, however.
Returns: - float
The resulting integral.
See also
Notes
For a or b > 0.01, the exact analytic expression is used, whereas below that we use a series expansion. This avoids numerical errors due to computation of log(1 - exp(-x)) and likewise in the spence function. Note that scipy.special.spence can only take float64 numbers, so downcasting is necessary for 0.01 < x < 3.