Improper integral of $\exp(-x)|\sin(x)|$ I encountered the following improper integral: $I=\int\limits_0^\infty  {{e^{ - x}}\left| {\sin x} \right|dx}$. I solved the problem as follows:
$I=\int\limits_0^\pi  {{e^{ - x}}\sin xdx}  - \int\limits_\pi ^{2\pi } {{e^{ - x}}\sin xdx}  + \int\limits_{2\pi }^{3\pi } {{e^{ - x}}\sin xdx}  + ... + {\left( { - 1} \right)^n}\int\limits_{n\pi }^{\left( {n + 1} \right)\pi } {{e^{ - x}}\sin xdx}  + ...$
Because: $\int {{e^{ - x}}\sin xdx}  = \frac{{ - {e^{ - x}}\left( {\sin x + \cos x} \right)}}{2}$ then we have:
$I = \left. {\frac{{ - {e^{ - x}}\left( {\sin x + \cos x} \right)}}{2}} \right|_0^\pi  - \left. {\frac{{ - {e^{ - x}}\left( {\sin x + \cos x} \right)}}{2}} \right|_\pi ^{2\pi } + ... + {\left( { - 1} \right)^n}\left. {\frac{{ - {e^{ - x}}\left( {\sin x + \cos x} \right)}}{2}} \right|_{n\pi }^{\left( {n + 1} \right)\pi } + ...$
or:
$I = 0.5 + 1\left( {{e^{ - \pi }} + {e^{ - 2\pi }} + {e^{ - 3\pi }} + ...} \right)= 0.5 + \frac{1}{{{e^\pi } - 1}}$
My question is: Is there any better and more general method to solve this problem, that I can apply in some other similar problems?
 A: Shifting the argument of the integrand by $\pi$ amounts to multiplying by $-e^{-\pi}$.
Assume you know that
$$J=\int_0^\infty e^{-x}\sin x\, dx=\frac12,$$ which is easily established with $e^{-x}\sin x=\Im{e^{(-1+i)x}}\to J=-\Im(-1+i)^{-1}$.
Then
$$K=J+Je^{-\pi}=\frac12(1+e^{-\pi})$$ is the integral of the first arch (i.e. from $0$ to $\pi$), by cancellation of the other arches. And by summing on all rectified arches (that form a geometric series), the requested integral is
$$I=\frac K{1-e^{-\pi}}=\frac12\frac{1+e^{-\pi}}{1-e^{-\pi}}=\frac12\coth\frac\pi2.$$

A: Note that by letting $t=x-k\pi$, we have that
$$\int_{k\pi}^{(k+1)\pi}e^{-x}|\sin(x)|dx=\int_{0}^{\pi}e^{-(t+k\pi)}|\sin(t+k\pi)|dx\\=e^{-k\pi}\int_{0}^{\pi}e^{-t}|\sin(t)| dt=e^{-k\pi}\int_{0}^{\pi}e^{-t}\sin(t) dt\\=e^{-k\pi}\cdot\left[- \frac{e^{ -t}}{2}(\sin t + \cos t) \right]_0^{\pi}=e^{-k\pi}\cdot\frac{1+e^{-\pi}}{2}.$$
Hence 
$$I=\frac{1+e^{-\pi}}{2}\sum_{k\geq 0}e^{-k\pi}=\frac{1+e^{-\pi}}{2(1-e^{-\pi})}=\frac{1}{2} + \frac{1}{{{e^\pi } - 1}}$$
which now is the same of your edited result.
