Integral with Dirac delta (me or wolfram mathematica?) I tried to compute with Wolfram Mathematica the following integral
$$I=\int_0^\pi\int_{-\infty}^\infty x e^{-jx\cos(\theta-\varphi)}f(\alpha\cos(\theta-\psi))\mathrm \, dx\mathrm \, d\theta$$
where  $-\pi\leq\varphi,\psi\leq\pi$.
Assuming that the inner intergral is by definition the derivative of the Dirac delta function I get:
$$I=2\pi j\int_0^\pi\delta'(\cos(\theta-\varphi))f(\alpha\cos(\theta-\psi)) \, \mathrm \, d\theta$$
Wolfram Mathematica tells me that 
$$I_\mathrm{wolfram}=0$$
Then I tried to do it by hand. If I use the definition of a delta function:
$$
\begin{eqnarray}
I_\mathrm{me}=\delta^{'} (\cos(\theta-\varphi))&=&\left[ \sum_i \frac{\delta(\theta-\varphi-\frac{\pi}{2}-i\pi)}{|\sin(\frac{\pi}{2}+i\pi)|}\right]^{'}=\sum_i \delta^{'}\left(\theta-\left(\varphi+\frac{\pi}{2}+i\pi\right)\right)
\end{eqnarray}
$$
$$
\begin{eqnarray}
I_\mathrm{me}&=&2\pi j\sum_i\int_0^\pi\delta'\left(\theta-\left(\varphi+\frac{\pi}{2}+i\pi\right)\right)f(\alpha\cos(\theta-\psi)) \, \mathrm d\theta=\\
&=&-2\pi j\int_0^\pi\delta\left(\theta-\left(\varphi+\frac{\pi}{2}\right)\right)f'(\alpha\cos(\theta-\psi)) \, \mathrm d\theta=\\
&=&-2\pi j f'(\alpha\cos(\varphi+\frac{\pi}{2}-\psi))u(\pi -2 \varphi ) u(2 \varphi +\pi )
\end{eqnarray}
$$
where $u(\cdot)$ is a Heaviside function. And it is actually not $0$.
So where's the catch?
 A: \begin{align}
&{\rm I}\left(\varphi,\psi\right)
\equiv
\int_{0}^{\pi}{\rm d}\theta\ \
{\rm f}\left(\alpha\cos\left(\theta - \psi\right)\right)
\int_{-\infty}^{\infty}{\rm d}x\ \ x\,
{\rm e}^{-{\rm i}x\cos\left(\theta - \varphi\right)}
\\[3mm]&=
\int_{0}^{\pi}{\rm d}\theta\ \
{\rm f}\left(\alpha\cos\left(\theta - \psi\right)\right)\left\lbrack%
{2\pi \over {\rm i}\sin\left(\theta - \psi\right)}\,
{\partial \over \partial\theta}\
\overbrace{\quad%
\int_{-\infty}^{\infty}{{\rm d}x \over 2\pi}\,
{\rm e}^{-{\rm i}x\cos\left(\theta - \varphi\right)}\quad}
^{\delta\left(\cos\left(\theta - \varphi\right)\right)}
\right\rbrack
\\[3mm]&=
2\pi{\rm i}\int_{0}^{\pi}{\rm d}\theta\,
\delta\left(\cos\left(\theta - \varphi\right)\right)\,
{\partial \over \partial\theta}\left\lbrack%
{{\rm f}\left(\alpha\cos\left(\theta - \psi\right)\right)
 \over
 \sin\left(\theta - \psi\right)}
\right\rbrack
=
2\pi{\rm i}\int_{0}^{\pi}\!\!\!{\rm d}\theta\,
\delta\left(\cos\left(\theta - \varphi\right)\right)\,
{\partial{\rm F}\left(\alpha,\theta - \psi\right) \over \partial\theta}
\end{align}
$\displaystyle{%
\mbox{where}\quad {\rm F}\left(\alpha,\phi\right)
\equiv
{{\rm f}\left(\alpha\cos\left(\phi\right)\right)
 \over
 \sin\left(\phi\right)}}
$
\begin{align}
-------&----------------------------------
\\[3mm]
{\rm I}\left(\varphi,\psi\right)
&=
-2\pi{\rm i}\,{\partial \over \partial\psi}
\int_{0}^{\pi}{\rm d}\theta\,
{\rm F}\left(\alpha,\theta - \psi\right)
\delta\left(\cos\left(\theta - \varphi\right)\right)
\\[3mm]&=
-2\pi{\rm i}\,{\partial \over \partial\psi}
\int_{0}^{\pi}{\rm d}\theta\,
{\rm F}\left(\alpha,\theta - \psi\right)
\sum_{\ell = -\infty}^{\infty}
{\delta\left(\theta - \theta_{\ell}\left(\varphi\right)\right)
 \over
 \left\vert
  -\sin\left(\theta_{\ell}\left(\varphi\right) - \varphi\right)
 \right\vert}
\end{align}
where
$$
\theta_{\ell}\left(\varphi\right) \equiv \varphi + \left(2\ell + 1\right)\pi/2.
\quad\mbox{Notice that}\quad
\left\vert%
\begin{array}{rcl}
\sin\left(\theta_{\ell}\left(\varphi\right) - \varphi\right)
& = &
\left(-1\right)^{\ell}
\\
\sin\left(\theta_{\ell}\left(\varphi\right) - \psi\right)
& = &
\left(-1\right)^{\ell}\cos\left(\varphi - \psi\right)
\\
\cos\left(\theta_{\ell}\left(\varphi\right) - \psi\right)
& = &
\left(-1\right)^{\ell + 1}\sin\left(\varphi - \psi\right)
\end{array}\right.
$$
Then
\begin{align}
{\rm I}\left(\varphi,\psi\right)
&=
-2\pi{\rm i}\sum_{\ell = -\infty}^{\infty}
{\partial{\rm F}\left(\alpha,\theta_{\ell}\left(\varphi\right) - \psi\right)
 \over
\partial\psi}
\int_{0}^{\pi}{\rm d}\theta\,
\delta\left(\theta - \theta_{\ell}\left(\varphi\right)\right)
\\[3mm]&=
-2\pi{\rm i}\!\!\!\!\!\!\!\!\!\!
\sum_{%
\ell = -\infty
\atop
{0\ <\ \theta_{\ell}\left(\varphi\right)\ <\ \pi\vphantom{\Huge A^{A}}}}
^{\infty}\!\!\!\!\!\!\!\!\!\!
{\partial{\rm F}\left(\alpha,\theta_{\ell}\left(\varphi\right) - \psi\right)
 \over
\partial\psi}
=
-2\pi{\rm i}\!\!\!\!\!\!\!\!\!\!
\sum_{%
\ell = -\infty
\atop
{\left\vert\ell + \varphi/\pi\right\vert\ <\ 1/2\vphantom{\Huge A}}}
^{\infty}\!\!\!\!\!\!\!\!\!\!
{\partial{\rm F}\left(\alpha,\varphi - \psi + \ell\pi + \pi/2\right)
 \over
\partial\psi}
\end{align}
$$
\left\lbrace%
\begin{array}{rcl}
\cos\left(\phi + \ell\pi + {\pi \over 2}\right)
& = &
-\sin\left(\ell\pi + \phi\right)
=
\left(-1\right)^{\ell + 1}\sin\left(\phi\right)
\\
\sin\left(\phi + \ell\pi + {\pi \over 2}\right)
& = &
\phantom{-}\cos\left(\ell\pi + \phi\right)
=
\left(-1\right)^{\ell\phantom{+1}}\cos\left(\phi\right)
\end{array}\right.
$$
\begin{align}
---&--------------------------------------
\\
{\rm I}\left(\varphi,\psi\right)
&=
\color{#ff0000}{-2\pi{\rm i}\!\!\!\!\!\!\!\!\!\!
\sum_{%
\ell = -\infty
\atop
{\left\vert\ell + \varphi/\pi\right\vert\ <\ 1/2\vphantom{\Huge A}}}
^{\infty}\!\!\!\!\!\!\!\!\!\!\left(-1\right)^{\ell}\,
{\partial \over \partial\psi}\left\lbrack%
{{\rm f}\left(\left(-1\right)^{\ell + 1}\alpha
             \sin\left(\varphi - \psi\right)\right)
 \over
 \cos\left(\varphi - \psi\right)}
\right\rbrack
=
{\rm I}_{1}\left(\phi,\psi\right) + {\rm I}_{2}\left(\phi,\psi\right)}
\\[5mm]
{\rm I}_{1}\left(\varphi,\psi\right)
&=
\color{#ff0000}{-2\pi{\rm i}\alpha\!\!\!\!\!\!\!\!\!\!
\sum_{%
\ell = -\infty
\atop
{\left\vert\ell + \varphi/\pi\right\vert\ <\ 1/2\vphantom{\Huge A}}}
^{\infty}\!\!\!\!\!\!\!\!\!\!
{\rm f}'\left(\vphantom{\LARGE A}\left(-1\right)^{\ell + 1}\alpha
\sin\left(\varphi - \psi\right)\right)\sec\left(\varphi - \psi\right)}
\\[3mm]
{\rm I}_{2}\left(\varphi,\psi\right)
&=
\color{#ff0000}{2\pi{\rm i}\!\!\!\!\!\!\!\!\!\!
\sum_{%
\ell = -\infty
\atop
{\left\vert\ell + \varphi/\pi\right\vert\ <\ 1/2\vphantom{\Huge A}}}
^{\infty}\!\!\!\!\!\!\!\!\!\!\left(-1\right)^{\ell}
{\rm f}\left(\vphantom{\LARGE A}\left(-1\right)^{\ell + 1}\alpha
\sin\left(\varphi - \psi\right)\right)\sec\left(\varphi - \psi\right)
\tan\left(\varphi - \psi\right)}
\end{align}
