Integral using complex numbers shortcut I want to compute the following integral
$$- \frac{1}{M(\lambda_1-\lambda_2)}\int\limits_{-\infty}^t(e^{\lambda_1(t-t')}-e^{\lambda_2(t-t')})(\beta\omega A\sin\omega t' +g)\;dt'$$
Here the integral that's not trivial is
$$\int_{-\infty}^t (e^{\lambda_1(t-t')}-e^{\lambda_2(t-t')}) \sin\omega t'\; dt'.$$
If I use $\sin \omega t' = \frac{1}{2i}(e^{i\omega t'}-e^{-j\omega t'})$, then I get that the last integral is:
$$\left[\frac{e^{\lambda_1t + (i\omega - \lambda_1)t'}}{i\omega-\lambda_1}+\frac{e^{\lambda_1t - (i\omega + \lambda_1)t'}}{i\omega+\lambda_1}+\frac{e^{\lambda_2t + (i\omega - \lambda_2)t'}}{-i\omega+\lambda_2}-\frac{e^{\lambda_2t - (i\omega + \lambda_2)t'}}{i\omega+\lambda_2}\right]^t_{-\infty}\tag{1}$$
which diverges.
My question is. Can I assume that the integral is the imaginary part of whatever comes out if I use $\sin\omega t' = Im(e^{i\omega t'})$? I mean, I will mix this exponential with the others and I'm not sure if after I do some algebra and take the imaginary part I will get a true result. Also, why does the expression in (1) diverge (I don't see that I made any mistake)?
I appreciate your help.
 A: We must assume that $\text{Re}\{\lambda_n\}<0$, ($n=1,2$) in order to render the integral convergent.  Then, we can write the integral of interest as 
$\begin{align}
\int_{-\infty}^t \left( e^{\lambda_1(t-t')}-e^{\lambda_2(t-t')} \right)\sin(\omega t')\,\,dt'&=\text{Im}\left\{\int_{-\infty}^t \left( e^{\lambda_1(t-t')}-e^{\lambda_2(t-t')} \right)e^{i\omega t'}\,\,dt'\right\}\\\\
&=\text{Im}\left\{e^{\lambda_1 t}\int_{-\infty}^t  e^{-(\lambda_1-i\omega)t'}\,\,dt'-e^{\lambda_2 t}\int_{-\infty}^te^{-(\lambda_2-i\omega)t'}\,\,dt'\right\}\\\\
&=\text{Im}\left\{e^{i\omega t}\left(\frac{1}{\lambda_2-i\omega}-\frac{1}{\lambda_1-i\omega}\right)\right\}
\end{align}$
Note that we have
$$\text{Im}\left\{e^{i\omega t}\frac{1}{\lambda_n-i\omega}\right\}= \text{Im}\left\{e^{i\omega t}\frac{\lambda_n^*+i\omega}{|\lambda_2-i\omega|^2} \right\}$$
where $n=1,2$, and $z^*$ denotes the complex conjugate of $z$.  Then, 
$$\text{Im}\left\{e^{i\omega t}\frac{1}{\lambda_n-i\omega}\right\}= \frac{(\omega-\lambda_{ni})\cos (\omega t)+\lambda_{nr} \sin(\omega t)}{|\lambda_n-i\omega|^2} $$
where $z_r$ and $z_i$ designate the real and imaginary parts of $z$, respectively.
