$\int_0^\pi e^{\cos x}\cos(x-\sin x) dx$ I’m not quite sure how to approach this problem using complex analysis. Mainly I’m confused int the contour to use after changing the integral by changing 
$\cos(x-\sin x)$
 to become 
$Re(e^{i(x-\sin x})$, so that the integral became
$$Re\int_0^\pi e^{\cos x}e^{i(x-\sin x)} dx$$
$$Re\int_0^\pi e^{(\cos x-i*\sin x)} e^{ix} dx$$
And then I subbed in 
$z=e^{ix}$
So then
$\frac{dz}{iz}=dx$
$$Re\int_C \frac{1}{iz} dz$$
But I’m not sure what contour to use to solve this
 A: Since $x - \sin x$ is odd in $x$, $\cos(x - \sin x)$ is even while $\sin(x - \sin x)$ is odd. This implies
$$\begin{align}
I \stackrel{def}{=} & \int_0^\pi e^{\cos x}\cos(x - \sin x)dx\\
= & \frac12 \int_{-\pi}^\pi e^{\cos x}\cos(x - \sin x)dx\\
= & \frac12 \int_{-\pi}^\pi e^{\cos x - i(x - \sin x)} dx\\
= &\frac12 \int_{-\pi}^\pi e^{e^{ix} - ix} dx\end{align}$$
Change variable to $z = e^{ix}$, $I$ becomes an contour integral over the unit circle.
$$I = \frac12 \oint_{|z|=1} \frac{e^{z}}{z} \frac{dz}{iz}
 = \frac{1}{2i} \oint_{|z| = 1} \frac{e^z}{z^2} dz
= \frac{2\pi i}{2i} \left.\frac{d e^z}{dz}\right|_{z=0}
= \pi$$
A: Quick proof without resorting to complex numbers
Let $$I(a)=\int_0^\pi e^{a\cos x}\cos(x-a\sin x) dx$$ Then
$\displaystyle I'(a)=\int_0^\pi e^{a\cos x}\big[\cos(x)\cos(x-a\sin x) +\sin(x)\sin(x-a\sin x)\big]\\ \quad =\int_0^\pi \text{e}^{a\cos x}\cos\Big(x-(x-a\sin x)\Big)=\int_0^\pi \text{e}^{a\cos x}cos(a\sin x)\,dx$ 
A simple calculation shows that. 
$\displaystyle I''(a)=\int_0^\pi \frac {\partial}{dx} [\text{e}^{a\cos x}cos(a\sin x)]\,dx =0$ we deduce $\displaystyle  I(a)=C a+K$
But $\displaystyle I'(0)=\pi$ and $\displaystyle I(0)=0$ then  $\displaystyle I(a)=\pi a$.
Our integral is equal to $\displaystyle I(1)=\pi$
A: The goal actually isn't to use a contour integral here. Instead, think of the integral that we wish to evaluate as
$$I=\Re\int_0^\pi e^{\cos(x)+i(x-\sin(x))}dx=\Re\int_0^\pi e^{e^{-ix}}e^{ix}dx$$
From here, the goal is to write the super-exponential as a power series to get
$$I=\Re\int_0^\pi e^{ix}\sum_{n=0}^\infty\frac{e^{-inx}}{n!}dx=\Re\sum_{n=0}^\infty\frac{1}{n!}\int_0^\pi e^{i(1-n)x}dx$$
The integral in question has a different evaluation for the case of $n=1$, where the integral is equal to $\pi$. For the others, we have
$$I=\Re\left(\frac{1}{i}(-1-1)+\pi+\sum_{n=2}^\infty\frac{1}{n!}\frac{1}{i(1-n)}((-1)^{n-1}-1)\right)$$
Each piece of the sum is imaginary, save for the single case of $n=1$, and so we have $I=\pi$.
A: \begin{align}\int_0^\pi \text{e}^{\cos x}\cos(x-\sin x) dx&=\int_0^\pi\text{e}^{\cos x}\cos x\cos(\sin x)dx+\int_0^\pi\text{e}^{\cos x}\sin x\sin(\sin x)dx\\
&=\Big[\sin(\sin x)\text{e}^{\cos x}\Big]_0^\pi+2\int_0^\pi\text{e}^{\cos x}\sin x\sin(\sin x)dx\\
&=2\int_0^\pi\text{e}^{\cos x}\sin x\sin(\sin x)dx\\
&=2\int_0^\pi\cosh(\cos x)\sin x\sin(\sin x)dx+2\int_0^\pi\sinh(\cos x)\sin x\sin(\sin x)dx\\
&=2\int_0^\pi\cosh(\cos x)\sin x\sin(\sin x)dx\\
&=4\int_0^{\frac{\pi}{2}}\cosh(\cos x)\sin x\sin(\sin x)dx\\
&=4\int_0^{\frac{\pi}{2}}\left(\left(\sum_{n=0}^\infty\frac{(-1)^n\sin^{2n+2}x}{(2n+1)!}\right)\left(\sum_{m=0}^\infty\frac{\cos^{2m} x}{(2m)!}\right)\right)\,dx\\
&=4\sum_{n=0}^\infty \left(\sum_{j=0}^n\frac{(-1) ^j}{(2j+1)!(2(n-j))!}\int_0^{\frac{\pi}{2}}\sin^{2j+2}x\cos^{2(n-j)}x\,dx\right)
\end{align}
For $p,q$ integers,
\begin{align}\int_0^{\frac{\pi}{2}}\sin^{2p}x\cos^{2q}x\,dx&=\frac{1}{2}\text{B}\left(p+\frac{1}{2},p+\frac{1}{2}\right)\\
&=\frac{1}{2}\frac{\Gamma\left(p+\frac{1}{2}\right)\Gamma\left(q+\frac{1}{2}\right)}{\Gamma\left(p+q+1\right)}\\
&=\frac{\pi}{2}\times \frac{(2p)!(2q)!}{2^{2(p+q)}(p+q)!p!q!}
\end{align}
Therefore, for $n\geq 0$, integer,
\begin{align}C_n&=\sum_{j=0}^n\frac{(-1) ^j}{(2j+1)!(2(n-j))!}\int_0^{\frac{\pi}{2}}\sin^{2j+2}x\cos^{2(n-j)}x\,dx\\
&=\frac{\pi}{2^{2(n+1)}(n+1)!}\sum_{j=0}^n\frac{(-1)^j}{j!(n-j)!}\\
&=\frac{\pi}{2^{2(n+1)}(n+1)!n!}\sum_{j=0}^n\frac{(-1)^jn!}{j!(n-j)!}\\
&=\frac{\pi}{2^{2(n+1)}(n+1)!n!}\sum_{j=0}^n (-1)^j\binom{n}{j}
\end{align}
Observe that,  $C_0=\dfrac{\pi}{4}$ and, for $n>0$, integer,
\begin{align}C_n&=\frac{\pi}{2^{2(n+1)}(n+1)!n!}(-1+1)^n\\
&=0
\end{align}
Therefore,
\begin{align}\int_0^\pi \text{e}^{\cos x}\cos(x-\sin x) dx&=4\times \frac{\pi}{4}\\
&=\boxed{\pi}
\end{align}
NB:
For $n\geq 0$, integer,
\begin{align}\Gamma\left(n+\frac{1}{2}\right)=\frac{(2n)!}{2^{2n}n!}\sqrt{\pi}\end{align}
For $x$ real,
\begin{align}\cos(\pi-x)=-\cos x\\
\sin(\pi-x)=-\sin x\\
\end{align}
$\text{B}$ is the Euler Beta function.
A: $$
\begin{align}
&\int_0^\pi e^{\cos(x)}\cos(x-\sin(x))\,\mathrm{d}x\\
&=\frac12\int_{-\pi}^\pi e^{\cos(x)}[\cos(x)\cos(\sin(x))+\sin(x)\sin(\sin(x))]\,\mathrm{d}x\tag1\\
&=\frac12\int_{-\pi}^\pi[\sinh(\cos(x))\cos(x)\cos(\sin(x))+\cosh(\cos(x))\sin(x)\sin(\sin(x))]\,\mathrm{d}x\tag2\\
&=\frac12\int_{-\pi}^\pi\frac{\sin\left(ie^{ix}\right)}{ie^{ix}}\,\mathrm{d}x\\
&-\frac12\int_{-\pi}^\pi i[\cosh(\cos(x))\cos(x)\sin(\sin(x))-\sinh(\cos(x))\sin(x)\cos(\sin(x))]\,\mathrm{d}x\tag3\\
&=\frac12\int_{-\pi}^\pi\frac{\sin\left(ie^{ix}\right)}{ie^{ix}}\,\mathrm{d}x\tag4\\
&=\frac12\oint_{|z|=1}\frac{\sin(z)}z\frac{\mathrm{d}z}{iz}\tag5\\[6pt]
&=\pi\tag6
\end{align}
$$
Explanation:
$(1)$: integrand is even
$(2)$: only terms with even powers of both $\sin(x)$ and $\cos(x)$ do not vanish
$(3)$: the integrand of $(2)$ is the real part of $\frac{\sin\left(ie^{ix}\right)}{ie^{ix}}$; here, we subtract off the imaginary part
$(4)$: the imaginary part of $\frac{\sin\left(ie^{ix}\right)}{ie^{ix}}$ consists of products of odd powers of $\sin(x)$ and $\cos(x)$
$(5)$: substitute $z=ie^{ix}$
$(6)$: the residue of $\frac{\sin(z)}{z^2}$ at $z=0$ is $1$
