Function fermi_function¶
-
double
o2scl
::
fermi_function
(double E, double mu, double T, double limit = 40.0)¶ Calculate a Fermi-Dirac distribution function safely.
\( \left[1+\exp\left(E/T-\mu/T\right)\right]^{-1} \)
This calculates a Fermi-Dirac distribution function guaranteeing that numbers larger than \( \exp(\mathrm{limit}) \) and smaller than \( \exp(-\mathrm{limit}) \) will be avoided. The default value of
limit=40
ensures accuracy to within 1 part in \( 10^{17} \) compared to the maximum of the distribution (which is unity).Note that this function may return Inf or NAN if
limit
is too large, depending on the machine precision.