# Implementation of Incomplete Fermi-Dirac Integral in Mathematica

I'm working on a special algorithm to implement a more accurate effective mass calculation for hole carriers in silicon in Mathematica. This rather involved algorithm uses incomplete Fermi-Dirac Integrals of the form:

$$\mathscr F_j(x,b)=\frac1{\Gamma(j+1)}\int_b^\infty \frac{t^j}{e^{t-x}+1}\mathrm dt$$

Fincomplete[j_, x_, b_] :=1/Gamma[j + 1] Integrate[t^j/(E^(t - x) + 1), {t, b, ∞},
Assumptions -> j > 0]


A call to this function with $b=0$ yields the complete Fermi-Dirac integral representation by the nicely implemented PolyLog function within Mathematica:

In[1]:=  Fincomplete[j, x, 0]
Out[1]:= -PolyLog[1 + j, -E^x]


However, if one wants to evaluate the incomplete Fermi-Dirac integral, the expression stays unevaluated, indicating that there is no straightforward solution available.

In[2]:=  Fincomplete[j,x,b]
Out[2]:= Integrate[t^j/(1 + E^(t - x)), {t, b, ∞}, Assumptions -> j > 0]/Gamma[1 + j]


Now, my question(s):

1. Any idea which of the multitude of mathematical functions within Mathematica could be leveraged to implement the incomplete Fermi-Dirac integral? Could the Nielsen generalized polylogarithm function mentioned within the Mathematica help system be of any service?

2. Does anybody have this integral already implemented? There are some series expansions quoted on the web, e.g. Computation of the complete and incomplete Fermi-Dirac integral. However, the reference quotes that the series expansions converge rather slowly, and I would like to leave the implementation of the reference above as last resort, since this would take some time and maybe there is an easier way in Mathematica?

-

## migrated from stackoverflow.comOct 29 '12 at 1:14

This question came from our site for professional and enthusiast programmers.

"Could the Nielsen generalized polylogarithm function mentioned within the Mathematica help system be of any service?" - so far as I can tell, no; there isn't a straightforward relationship between the incomplete FD integral and Nielsen's polylogarithm. –  Guess who it is. Oct 29 '12 at 1:32
Anyway, if you're looking for quick-and-dirty numerical evaluation, you can use NIntegrate[] for the purpose. Method -> "DoubleExponential" is particularly convenient for the task. –  Guess who it is. Oct 29 '12 at 1:44
"Does anybody have this integral already implemented?", yes, partially here: gnu.org/software/gsl/manual/html_node/… –  alfC Oct 14 '14 at 21:34

As I've noted in the comments, you can do a quick-and-dirty implementation using NIntegrate[] with the option setting Method -> "DoubleExponential":

FermiDiracF[j_, x_] := FermiDiracF[j, x, 0];

FermiDiracF[j_, x_, b_] :=
Module[{prec = Precision[{j, x, b}], bn, jn, mp, tmp, xn},
mp = TrueQ[prec === MachinePrecision]; If[mp, prec = $MachinePrecision]; {jn, xn, bn} = SetPrecision[{j, x, b}, prec + 5]; tmp = Quiet[ NIntegrate[t^jn/(E^(t - xn) + 1), {t, bn, Infinity}, Method -> "DoubleExponential", WorkingPrecision -> prec]/jn!, {NIntegrate::inum, NIntegrate::ncvi, NIntegrate::slwcon, NIntegrate::rnderr}]; If[! FreeQ[tmp, NIntegrate], Return[$Failed]]; If[mp, N[tmp], tmp]] /;
Positive[j] && (InexactNumberQ[j] || InexactNumberQ[x] || InexactNumberQ[b])


Some sample plots:

Plot[Table[FermiDiracF[j, 2, b], {j, {1/3, 1/2, 1, 3/2, 2, 3}}] // Evaluate, {b, 0, 7}]


Plot3D[FermiDiracF[3/2, x, b], {x, -5, 5}, {b, 0, 10}, PlotRange -> All]


-
(One can of course do something similar for incomplete Bose-Einstein integrals...) –  Guess who it is. Oct 29 '12 at 3:15
Is this better than just evaluating N[PolyLog[...]]? –  alfC Oct 14 '14 at 21:32
PolyLog[] is useful for the complete integrals. The incomplete integrals do not admit a polylogarithmic representation, AFAIK. –  Guess who it is. May 1 at 19:31