On the value of $e^{ix}$ at $\pm \infty$ Consider the integral $$ \int_{-\infty}^{+\infty} e^{ix} \, dx.$$
Integrating, we have $$\left[-ie^{ix}\vphantom{\frac11}\right]_{-\infty}^{+\infty},$$
and we need to evaluate the limits of $e^{ix}$ at ${-\infty}$ and ${+\infty}$ which, as far as I understand, do not exist since the function is oscillatory.
But if we now evaluate the integral using contour integration: $$ \oint_{-\infty}^{+\infty} e^{iz} \, dz.$$ Closing in the upper half plane, so that $e^{iz} = e^{ix}e^{-y} \rightarrow 0 $ as $y\rightarrow 0$, the contribution of the semi-circle to the contour goes to $0$, and we get that the integral is $0$.
What is the correct anwer and what is the reason of this inconsistency?
 A: Matt Samuel's answer seems unclear because of what it omits.  Following up on his comments:
$$
\int_{-R}^R e^{ix}\,dx = \left[\frac{e^{ix}}{i}\right]_{-R}^R = \frac{e^{iR}-e^{-iR}}{i} = 2\sin R
$$
and that does not approach a limit as $R\to\infty$; hence the value of the improper integral does not exist.
Since the function is an entire function, its integral along a closed curve is $0$. Consequently the integral of $x\mapsto e^{ix}$ along the semicircle centered at $0$ and of radius $R$ in the upper half-plane from $+R$ to $-R$ must be $-2\sin R$, and the limit of that as $R\to\infty$ does not exist.
It is argued that for $x,y$ real, $e^{i(x+iy)}\to 0$ as $y\to+\infty$ (which is true) and that therefore (and here's the mistake) the integral along the semicircle must go to $0$.
The question is then: What is wrong with that argument?  Matt Samuel's answer in its present form does not address that.
Two things:


*

*As the value of the function along the upper parts of the curve gets smaller, the curve gets longer.  As the values go to $0$, they are multiplied by a length that goes to $\infty$, and when one quantity goes to $0$ as another goes to $\infty$, then their product may approach a finite positive number: for example $x\cdot\dfrac 1 x$ does that as $x\to+\infty$.

*The values of the function at the parts of the curve that are close to the real axis do not go to $0$ as the curve grows.
If, for example, we could say that the values of a non-negative function $f_n$ are less than $1/n$ on the interval $[0,1]$ (which interval does not get longer as $n\to\infty$, then we can say that $\displaystyle \int_0^1 f_n(x)\,dx\to0$ as $n\to\infty$.  But
$$
\int_0^n \frac 1 n \,dx \text{ does not approach $0$ as } n\to\infty
$$
despite the fact that $1/n\to0$ as $n\to\infty$.  And
$$
\int_0^1 \frac 1 {nx}\,dx\text{ does not approach $0$ as }n\to\infty
$$
despite the fact that $1/(nx)\to0$ as $n\to\infty$ for each value of $x$.  In this second example, the problem is that the function will always be large when $x$ is near $0$.
A: The integral over the upper portion of the semicircle exactly cancels the integral over the real axis, so it no more has a limit than the original integral does. In fact the integral over the upper part for a semicircle of radius $r$ evaluates to exactly $-2\sin r$, cancelling the $2\sin r$ obtained by integrating over the real axis.
