Problem of Integration by Parts involving algebraic and exponential functions Can anyone please help me in solving this integration problem  $\int \frac{e^x}{1+ x^2}dx \, $?
Actually, I am getting stuck at one point while solving this problem via integration by parts.
 A: Since $x^2+1=(x+i)(x-i)$, partial fraction decomposition leads to $$\frac 1{x^2+1}=\frac 1{2i}\Big(\frac{1}{x-i}-\frac{1}{x+i}\Big)=-\frac i{2}\Big(\frac{1}{x-i}-\frac{1}{x+i}\Big)$$ So $$I=\int \frac{e^x}{1+ x^2}\,dx =-\frac i{2}\int\Big(\frac{e^x}{x-i}-\frac{e^x}{x+i}\Big)\,dx=-\frac i{2}\int\Big(\frac{e^i\,e^{x-i}}{x-i}-\frac{e^{-i}\,e^{x+i}}{x+i}\Big)\,dx$$ Now make change of variable $y=x-i$ for the first and $z=x+i$ for the second. So $$I=-\frac {i e^i}{2}\int \frac{e^y}y dy+\frac {i e^{-i}}{2}\int \frac{e^z}z dz$$ and remember that $$\int\frac {e^t} t dt=\text{Ei}(t)$$ which finally makes $$I=\frac{1}{2}\, i \,e^{-i}\, \text{Ei}(x+i)-\frac{1}{2}\, i\, e^i\, \text{Ei}(x-i)$$ with $i\,e{^i}=-\sin (1)+i \cos (1)$ and $i\,e^{-i}=\sin (1)+i \cos (1)$.
A: According to Wolfram|Alpha, no closed form exists. However, that doesn't mean we can't make any progress at all.
We can use the substitution $x=\tan{u}$, expand the resulting integrand as a power series in $\tan{u}$ and then each term can be expressed by way of a reduction formula.
Let $x=\tan{u}$. Then, ${\mathrm{d}x \over \mathrm{d}u} = \sec^{2}{u}$. Hence, we have
\begin{eqnarray*}
\int\frac{e^{x}}{1+x^{2}}\,\mathrm{d}x & = & \int\frac{e^{\tan{u}}}{1+\tan^{2}{u}}\sec^{2}{u}\,\mathrm{d}u\\
& = & \int e^{\tan{u}}\,\mathrm{d}u\\
& = & \int \left( 1+ \tan{u} + \frac{1}{2!}\tan^{2}{u}+ \ldots + \frac{1}{k!}\tan^{k}{u} + \ldots \right)\,\mathrm{d}u\\
& = & \int \left( \sum_{k=0}^{\infty}\frac{1}{k!}\tan^{k}{u} \right)\,\mathrm{d}u\\
& = & \sum_{k=0}^{\infty}\frac{1}{k!}I_{k},
\end{eqnarray*}
where, for each $k=0,1,2,\ldots$, we have $I_{k} = \int \tan^{k}{u}\,\mathrm{d}u$.
Now we consider the reduction formula as follows: for $k\geq2$, we have
\begin{eqnarray*}
I_{k} & = & \int\tan^{k}{u}\,\mathrm{d}u\\
& = & \int (\sec^{2}{u}-1)\tan^{k-2}{u}\,\mathrm{d}u\\
& = & \int \sec^{2}{u}\tan^{k-2}{u}\,\mathrm{d}u - I_{k-2}
& = & \frac{1}{k-1}\tan^{k-1}{u} -I_{k-2}.
\end{eqnarray*}
Additionally, note that $I_{0} = u\,(+\text{constant})$ and $I_{1} = \log{\sec{u}}\,( + \text{constant} )$. Using the formula derived above and these two initial values, we can calculate $I_{k}$ for any value of $k$ (there may well be a general formula; I haven't checked).
Hence, we have a series representation of the integral to as many terms as we please; note also that each term in the series is basically a polynomial in $x=\tan{u}$ with an extra $\tan^{-1}{x}$ or $\log{\sec{\tan^{-1}{x}}}$ tacked on at the end.
A: http://www.wolframalpha.com/input/?i=integrate%28exp%28x%29%2F%281%2Bx*x%29%29
Read from the link
It cannot be solved using byparts
A: This is an alternative to the other answer I have provided. I have decided to add it as another answer because I think it uses a sufficiently different approach, and nobody else seems to have hinted at it. We begin just as we begun in my other answer to this same question, and continue until we reach $$\int e^{\tan{u}}\,\mathrm{d}u.$$ From here, the two answers diverge radically, and the content of this post will be entirely concerned with evaluating this integral, which in turn answers the question.
In the other answer, we expanded $e^{\tan{u}}$ as a power series in $\tan{u}$. Now, instead, we shall first expand $\tan{u}$ as a power series in terms of $u$. Then $e^{\tan{u}}$ is an infinite product of exponentials, each of which can be expanded as a power series. From this sequence of expansions, we produce a power series for $e^{\tan{u}}$ which can be integrated term-by-term.
The power series for $\tan{u}$, valid for $|u|<\pi/2$, is $$\tan{u} = \sum_{n=1}^{\infty} {B_{2n}(-4)^{n}(1-4^{n}) \over (2n)!}u^{2n-1} = u+\frac{u^{3}}{3}+\frac{2u^{5}}{15}+\ldots.$$
Hence, for $|u|<\pi/2$, we have
\begin{eqnarray*}
\exp{\tan{u}} & = & \exp{\left(\sum_{n=1}^{\infty} {B_{2n}(-4)^{n}(1-4^{n}) \over (2n)!}u^{2n-1}\right)}\\
& = & \prod_{n=1}^{\infty}\exp{\left( {B_{2n}(-4)^{n}(1-4^{n}) \over (2n)!}u^{2n-1}\right)}\\
& = & \exp{u}\cdot\exp{\frac{u^{3}}{3}}\cdot\exp{\frac{2u^{5}}{15}}\cdot\ldots\\
& = & \sum_{k=1}^{\infty} \left({B_{2}^{k}(-4)^{k}(1-4)^{k} \over k!2!^{k}}u^{k}\right) \cdot \sum_{k=1}^{\infty} \left({B_{4}^{k}(-4)^{2k}(1-4^{2})^{k} \over k!4!^{k}}u^{3k}\right)\cdot\ldots\\
& = & \left( 1+\frac{u}{1!}+\frac{u^{2}}{2!}+\ldots \right)\left( 1+\frac{u^{3}}{3^{1}\cdot1!}+\frac{u^{6}}{3^{2}\cdot2!}+\ldots \right)\left( 1+\frac{2u^{5}}{15\cdot1!}+\frac{2^{2}u^{10}}{15^{2}\cdot2!}+\ldots \right)\\
& = & 1 + u + \frac{u^{2}}{2!} + \left(\frac{u^{3}}{3!}+\frac{u^{3}}{3\cdot1!}\right) + \left(\frac{u^{4}}{4!}+\frac{u}{1!}\cdot\frac{u^{3}}{3\cdot1!}\right)\\
&& \;\; + \left(\frac{u^{5}}{5!} +\frac{u^{2}}{2!}\cdot\frac{u^{3}}{3\cdot1!}+ \frac{2u^{5}}{15}\right)+\ldots\\
& = & 1 + u + \frac{u^{2}}{2} + \frac{u^{3}}{2}+\frac{3u^{4}}{8}+\frac{37u^{5}}{120}+\ldots.
\end{eqnarray*}
This gives us a series that I think we should be able to integrate term-by-term, to get
\begin{eqnarray*}
\int e^{\tan{u}}\,\mathrm{d}u & = & \int(1 + u + \frac{u^{2}}{2} + \frac{u^{3}}{2}+\frac{3u^{4}}{8}+\frac{37u^{5}}{120}+\ldots)\,\mathrm{d}u\\
& = & \text{constant} + u + \frac{u^{2}}{2} +  \frac{u^{3}}{6}+\frac{u^{4}}{8}+\frac{3u^{5}}{40}+\frac{37u^{6}}{720}+\ldots.
\end{eqnarray*}
Therefore, assuming that our interval of integration is within $|\tan^{-1}{x}|<\pi/2$, we have
\begin{eqnarray*}
\int\frac{e^{x}}{1+x^{2}}\,\mathrm{d}x = \text{constant} + \tan^{-1}{x} + \frac{(\tan^{-1}{x})^{2}}{2}+ \frac{(\tan^{-1}{x})^{3}}{6}+\frac{(\tan^{-1}{x})^{4}}{8}+\frac{3(\tan^{-1}{x})^{5}}{40}+\frac{37(\tan^{-1}{x})^{6}}{720}+\ldots,
\end{eqnarray*}
and I'm pretty sure we can adjust this to other intervals of integration using the fact that $\tan{(u+\pi)}=\tan{u}$ for all $u\in\mathbb{R}$ for which $\tan{u}$ is defined.
