# Where does the Euler-Mascheroni constant come from here?

As you probably know $$\int \frac{e^{x}}{x}dx=\operatorname{Ei}(x)+C$$. We can solve this using Taylor series: \begin{align}\operatorname{Ei}(x)+C=\int \frac{e^{x}}{x}dx&=\int \frac{\sum_{n=0}^{\infty}\frac{x^{n}}{n!}}{x}dx\\&=\int \sum_{n=0}^{\infty}\frac{x^{n-1}}{n!}dx\\&=\int\frac{1}{x}+\sum_{n=1}^{\infty}\frac{x^{n-1}}{n!}dx\\&=\ln(x)+\sum_{n=1}^{\infty}\int\frac{x^{n-1}}{n!}dx\\&=\ln(x)+\sum_{n=1}^{\infty}\frac{x^{n}}{n!n}\end{align} Now when I plug these values into wolfram alpha I'm off by the Euler-Mascheroni constant. It has a $$+C$$ in i so I'm not surprised its off by a constant but my question is why the Euler-Mascheroni constant. The true formula is: $$\operatorname{Ei}(x)=\gamma+\ln(x)+\sum_{n=1}^{\infty}\frac{x^{n}}{n!n}$$

• What is the definition of $Ei?$ Feb 18, 2021 at 16:10
• Note that the exponential integral function $\operatorname{Ei}(x)$ is a definite integral defined as $\int\limits_{-\infty}^{x}e^t/t\,\mathrm{d}t$. Feb 18, 2021 at 16:13
• To determine $C$, set $x=1$.
– J.G.
Feb 18, 2021 at 19:15

Alright we know that $$\operatorname{Ei(x)}=-E_{1}(-x)$$. We also know that $$E_{1}(x)=\int_{x}^{\infty}\frac{e^{-t}}{t}dt$$ So if we find the series representation of $$E_1(x)$$ We can fint the series representation of $$\operatorname{Ei(x)}$$ we're golden: $$E_{1}(x)=\int_{x}^{\infty}\frac{e^{-t}}{t}dt=\int_{x}^{1}\frac{e^{-t}}{t}dt+\int_{1}^{\infty}\frac{e^{-t}}{t}dt=\int_{1}^{\infty}\frac{e^{-t}}{t}dt-\int_{1}^{x}\frac{e^{-t}}{t}+\frac{1}{t}-\frac{1}{t}dt=\int_{1}^{\infty}\frac{e^{-t}}{t}dt-\int_{1}^{x}\frac{e^{-t}-1}{t}dt-\int_{1}^{x}\frac{1}{t}dt=\int_{0}^{1}\frac{e^{-t}-1}{t}dt-\ln(x)-\int_{0}^{1}\frac{e^{-t}-1}{t}dt-\int_{0}^{x}\frac{e^{-t}-1}{t}dt=-\gamma-\ln(x)-\int_{0}^{x}\frac{e^{-t}-1}{t}dt=-\gamma-\ln(x)-\sum_{n=1}^{\infty}\frac{(-1)^nx^{n}}{n!n}$$ Now just substitute and you get our formula for $$\operatorname{Ei}(x)$$: $$\operatorname{Ei(x)}=\gamma+\ln(x)+\sum_{n=1}^{\infty}\frac{x^{n}}{n!n}$$