Exponential integral: something is wrong.

Consider the function $$E(z)=\int_{-\infty}^z\frac{e^t}{t}dt.\quad (1)$$ Substituting $t\mapsto -u$ one obtains

$$E(z)=-\int_{-z}^{\infty}\frac{e^{-u}}{u}du\equiv Ei(z).\quad (2)$$

It is already surprising that the ugly definiton (2) and not (1) is usually used for $Ei(z)$. Much worser is the fact that both definitions lead to different results upon expanding the functions. For this we use the usual trick (standard branch cut along the negative real semi-axis is assumed, if necessary):

$$Ei(z)=-\int_{-z}^{\infty}\frac{e^{-u}}{u}du +\int_0^{-z}\frac{1-e^{-u}}{u}du-\int_0^{-z}\frac{1-e^{-u}}{u}du\\ =\left[\left.-e^{-u}\ln u\right|_{-z}^\infty-\int_{-z}^\infty e^{-u}\ln u du\right]+\left[\left.(1-e^{-u})\ln u\right|_0^{-z}-\int_0^{-z}e^{-u}\ln u du\right]+\int_0^z\frac{e^t-1}{t}dt\\ =\ln(-z)+\gamma+\sum_{n=1}^\infty\frac{z^n}{n!n}.$$

Applying the same trick for (1) one obtains: $$E(z)=\int_{-\infty}^z\frac{e^{u}}{u}du- \int_0^{z}\frac{e^{u}-1}{u}du+\int_0^{z}\frac{e^{u}-1}{u}du\\ =\left[\left.e^{u}\ln u\right|_{-\infty}^z-\int_{-\infty}^z e^{u}\ln u du\right]-\left[\left.(e^{u}-1)\ln u\right|_0^{z}-\int_0^{z}e^{u}\ln u du\right]+\int_0^z\frac{e^u-1}{u}dt\\ =\ln(z)-\int_{-\infty}^0e^u\ln u du+\sum_{n=1}^\infty\frac{z^n}{n!n}= \ln(z)-\int_0^{\infty}e^{-t}\ln(-t)dt+\sum_{n=1}^\infty\frac{z^n}{n!n}\\ =\ln(z)-\int_0^{\infty}e^{-t}(\ln t+i\pi)dt+\sum_{n=1}^\infty\frac{z^n}{n!n} =\ln(z)-i\pi+\gamma+\sum_{n=1}^\infty\frac{z^n}{n!n}.$$

The problem is that the equality $\ln(-z)=\ln(z)-i\pi$ with usual restriction $-i\pi<\arg(z)\le i\pi$ is valid only in the upper complex half-plane (including the negative real semi-axis). In the lower complex half-plane (including the positive real semi-axis) the two values differs by $2\pi i$.

Which result is correct? Where is hidden the error, resulting in the contradiction?

• What constraints are put on $z$? If non-real $z$ are allowed, what is the interpretation of $\int_{-\infty}^z$ resp. of $\int_{-z}^{+\infty}$? Since the integrand has a simple pole at $0$, the integral is path-dependent. – Daniel Fischer Dec 18 '15 at 12:57
• As I have mentioned branch cut along the negative real axis (from $-\infty$ to 0) is assumed. Then the integral value should not depend on path. – user Dec 19 '15 at 7:13
• @user299762: Only use one account. Then you can comment under your own posts. – Jyrki Lahtonen Dec 19 '15 at 8:22