Will numerical routines for the Exponential Integral function E_n work when n is continuous?

232 Views Asked by At

So I am a mathematical biologist of sorts. I rely heavily on Mathematica which often provides analytic results couched in terms of special functions which I then try to go and learn about. Right now I am coming across results that include the Exponential Integral n function, E_n(x). I am interesting in implementing these results to fit a model to data using C++.

Having looked into E_n(x) a bit it seems that most discussions and numerical routines assume n is discrete, but the parameter Mathematica assigns to n is continuous in my application. I'm wondering if there's any reason I should avoid treating n as a continuous variable and, if not, where I can find routines that do not assume it is discrete. Are we safe in using open source routines and just changing the argument type?

1

There are 1 best solutions below

0
On BEST ANSWER

Your function is called the Generalized Exponential Integral $E_p(x)$ and is described in http://dlmf.nist.gov/8.19: $$E_p(x) = x^{p-1}\int_x^\infty \frac{e^{-t}}{t^p}\: d t \; = \int_1^\infty \frac{e^{-xt}}{t^p}\: d t\; , $$

Without a specific reference to the actual open source code, I guess that the discrete recurrence formula based on $E_1$ or your change of variable type will not work for non-integer $p$. The continued fraction representation remains valid for the translation $n\rightarrow p\;$ and might be already used by an incomplete gamma implementation.

The easiest way to compute $E_p(x)$ for modest $p$ is the relation to the incomplete gamma function (or its normalized form $Q$) given at http://dlmf.nist.gov/8.19.E1 $$E_p(x) = x^{p-1} \Gamma(1-p,x) = x^{p-1} Q(1-p,x)\: \Gamma(1-p)$$

The incomplete gamma function should already exist in a good numerical library for special functions (it is needed among others for statistical distributions).

For large $p$ you can use the asymptotic expansion from http://dlmf.nist.gov/8.20.E6 $$ E_p(\lambda p) \sim \frac{e^{-\lambda p}}{(\lambda +1)p} \sum\limits_{k=0}^{\infty} \frac{A_k(\lambda)}{(\lambda+1)^{2k}}\;\frac{1}{p^k}$$

Note that this actually can be used for the discrete $E_n$ too.