TITLE: Integrating $\int_0^{2\pi}e^{\cos{(x)}}\cos{(\sin{(x)})}\,dx$. Antiderivative evaluates out to be $0$ when it clearly isn't.
QUESTION [7 upvotes]: I have a function
$$f(x)=e^{\cos{(x)}}\cos{(\sin{(x)})}$$
that I want to integrate from $0$ to $2\pi$.
Using Mathematica, the indefinite integral evaluates out to be $$\frac{-i\operatorname{Ei}(e^{ix})+i\operatorname{Ei}(e^{-ix})}{2}+C$$ where $\operatorname{Ei}(x)$ is the exponential integral.
When I ask Mathematica the definite integral directly, it gives a $2\pi$, but when I try to use the fundamental theorem of calculus,
$$\implies\left.\frac{-i\operatorname{Ei}(e^{ix})+i\operatorname{Ei}(e^{-ix})}{2}\right|^{2\pi}_0=\frac{-i\operatorname{Ei}(e^{2\pi\cdot i})+i\operatorname{Ei}(e^{2\pi\cdot -i})}{2}-\frac{-i\operatorname{Ei}(e^{0i})+i\operatorname{Ei}(e^{-0i})}{2}$$
$$\implies\frac{-i\operatorname{Ei}(1)+i\operatorname{Ei}(1)}{2}-\frac{-i\operatorname{Ei}(1)+i\operatorname{Ei}(1)}{2}=0$$
Why do I get an incorrect value of 0 when I try to use the fundamental theorem of calculus on this integral?

REPLY [5 votes]: Graph the alleged antiderivative $(-i\operatorname{Ei}(e^{ix})+i\operatorname{Ei}(e^{-ix}))/{2}$:

The fundamental theorem of calculus is not applicable using this as antiderivative, since this is not a continuous function.