# To choose contour for integrals Include singularities or not.

When we calculate the improper integral for $f(x)=\frac{\sin x}{x}$, We think of the following function as $\frac{\exp(iz)}{z}$ whose imaginary part on the real axis is $\frac{\sin x}{x}$. And Contour $C$ will consist of the real axis from $r$ to $R$, the semicircle in the upper half plane from $R$ to $-R$, the real axis from $-R$ to $-r$, and the semicircle in the upper half-plane from $-r$ to $r$. The center of the two semicircles is the origin. We can get the value by using Residue theorem as $\int_{0\leq x} \frac{\sin x}{x} dx = \frac{\pi}{2}$

In fact, this is true even if contour is chosen differently. For example, We choose the semicircle in lower half plane from $-r$ to $r$ even if Cantor does not contain the origin.

I wonder if this can be generalized. I wonder if I am free to choose the appropriate contour(Include singularities or not.) when integrating the function as $g(x) = \frac{1}{x^2-5x+4}$

$$\lim_{R\rightarrow\infty}\int_{C_R}f(z)e^{iaz}dz= 0$$ if $a>0$, $C_R$ is the upper-half-plane countour, and $\lim_{R\rightarrow\infty}\max_{0\leq\theta\leq\pi}\vert f(Re^{i\theta})\vert = 0$. If $a<0$, you have to use the lower half-plane integral - the upper half-plane one is no longer guaranteed to converge. Similarly, if $a>0$, you have to use the UHP integral - the lower half-plane one might not converge. You can pretty much always flip the "small" contours, but again it tends to be easier to avoid computing residues, so choosing the contour to avoid enclosing poles is usually faster.