How to evaluate the integral $\int_{0}^{2\pi}e^{-iA(x\cos\varphi+y\sin\varphi)}\cos(l\varphi)\,d\varphi$? $$\int_{0}^{2\pi}\exp\left(-iA(x\cos\varphi+y\sin\varphi)\right)\cos(l\varphi)\,d\varphi$$
I'm trying to evaluate the integral for an interference problem in Physics. When $y=0$, this reduces to the Bessel Function of the first kind, and when $l=1$, I can differentiate under the integral w.r.t. $x$ and evaluate the integral (which gives a first order Bessel function of the first kind). However, I'm looking for a more general answer, where $l$ is any integer, and $A$ is an arbitrary constant.
Here's a link to a similar question posted 2 years ago. How to solve integral $\int_0^{2\pi} e^{i(a\cos\phi + b\sin\phi)} \cos\phi\ d\phi$
 A: Let $\rho = \sqrt {x^2 + y^2}, \phi = \arctan(x, y)$. Then
$$\int_0^{2 \pi} e^{-i A (x \cos t + y \sin t)} \cos l t \,dt = \\
\int_0^{2 \pi} e^{-i A \rho \cos(t - \phi)} \cos l t \,dt =
\cos l \phi \int_0^{2 \pi} e^{-i A \rho \cos t} \cos l t \,dt = \\
2 \pi (-i)^l \cos l \phi \,J_l(A \rho).$$
A: Let's recall an integral form of Bessel function of first kind $J_\ell(y)$ for $\ell$ integer:
$$
J_\ell(y)=\frac{1}{2\pi}\int_0^{2\pi} e^{i(y\sin \varphi-\ell\varphi)}d\varphi
$$
which is a real number.
Now for your question, define the unit vector $\vec{n}(\varphi)=(\cos\varphi, \sin\varphi)$ and $\vec{r}=(x,y)$. Note that the exponent in the integrand is now
$$
-i(x\cos \varphi+y\sin\varphi)=-i\vec{n}\cdot \vec{r}
$$
Define the following integrals 
Similarly, define two more integrals
$$\begin{aligned}
I_\ell(\vec{r})&=\int_0^{2\pi} e^{-i\vec{n}(\varphi)\cdot\vec{r}}\cos (\ell \varphi) d\phi\\
I'_\ell(\vec{r})&=\int_0^{2\pi} e^{-i\vec{n}(\varphi)\cdot \vec{r}}\sin \ell \varphi d\varphi\\
\widetilde{I_\ell}(\vec{r})&=
\int_0^{2\pi} e^{-i[\vec{n}(\varphi)\cdot \vec{r}-\ell\varphi]} d\varphi = I_\ell(\vec{r})+iI'_\ell(\vec{r})
\end{aligned}
$$
Note that $I_\ell$ and $I'_\ell$ are both real if $\ell$ is even, and purely imaginary otherwise (use the fact that $\vec{n}\to -\vec{n}$ means $\varphi\to \pi+\varphi$). This means $I_\ell$ is the real part of $\widetilde{I}$ if $\ell$ is even, and it is equal to $i\mathfrak{I}(\widetilde{I_\ell})$ if $\ell$ is odd.
Moving on... Let $R_{\theta}$ be a rotation matrix (around $z$-axis, i.e. a 2D rotation) by an amount $\theta$. Note that in general $\vec{u}\cdot R_\theta \vec{v}=R_{-\theta}\vec{u}\cdot \vec{v}$. Moreover, $R_\theta \vec{n}(\varphi)=\vec{n}(\varphi+\theta)$. Using these facts, you find (I'll leave the details to you)
$$
\widetilde{I_\ell}(R_\theta\vec{r})=
e^{-i\theta \ell}
\widetilde{I_\ell}(\vec{r})
$$
At the same time, let $\theta(\vec{r})$ be such that $R_\theta \vec{r}=(0,Y)$ for $Y(\vec{r})=\sqrt{x^2+y^2}$ (no $x$-component). If you need a formula $\theta(\vec{r})=\pi/2-\arctan y/x$. Then
$$
\widetilde{I_\ell}(\vec{r})=e^{i\theta(\vec{r})\ell}\int_0^{2\pi} e^{-i(Y(\vec{r})\sin \varphi-\ell\varphi)}d\varphi=
2\pi e^{i\theta(\vec{r})\ell} J_\ell(Y(\vec{r}))
$$
Therefore
$$
\boxed{
I_\ell(\vec{r})=\begin{cases}
2\pi \cos [\theta(\vec{r})\ell] J_\ell(Y(\vec{r})) & \ell\text{ even}\\
2\pi i \sin [\theta(\vec{r})\ell] J_\ell(Y(\vec{r})) & \ell\text{ odd}
\end{cases}
}
$$
