Integral with Dirac delta (me or wolfram mathematica?) I asked the question on math.stackexchange but didn't get an answer so I came here.
I tried to compute with Wolfram Mathematica the following integral
$$I=\int_0^\pi\int_{-\infty}^\infty x e^{-\mathrm jx\cos(\theta-\varphi)}f(\alpha\cos(\theta-\psi))\mathrm \, \mathrm dx\mathrm \, \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 \mathrm j\int_0^\pi\delta'(\cos(\theta-\varphi))f(\alpha\cos(\theta-\psi)) \, \mathrm \, \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}
\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 \mathrm 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 \mathrm j \sum_i f'(\alpha\cos(\varphi+\frac{\pi}{2}+i\pi-\psi))u(\pi -2 \varphi ) u(2 \varphi +\pi )
\end{eqnarray}
$$
where $u(\cdot)$ is a Heaviside function. Here I used the fact that $$\int f(x)\delta'(x-a)\mathrm dx=-\int f'(x)\delta(x-a)\mathrm dx=-f'(a)$$
And $I_\mathrm{me}$ is actually not $0$.
So where's the catch?
 A: the answer is indeed nonzero, and Mathematica does just fine; here is a screenshot of the output I got:

this answer is not quite what you have written in your post, but in any case nonzero.

UPDATE: with some more experimentation, I think I know why Mathematica might have failed you; as you can see from the code I gave above, I'm evaluating the integral for one value of $\phi$ at the time; an attempt to get an answer with $\phi$ as a symbolic variable returns zero; no idea why, but fortunately there is a workaround, as shown above.
A: Since the solutions to this query and its twin on MSE are riddled with errors, I have decided to bite the bullet and give a rigorous treatment.  Perhaps I can begin with the the general remark that most of the inquiries about distributions here and on its two siblings are about the Dirac distribution and its derivatives, usually in connection with their composition with a smooth function.  As far as I can tell, none of the treatments that one finds employ a rigorous definition of this concept
(although this has been known for over 50 years) but rely on formal manipulations under the motto---if it works for smooth functions, then it will work for distributions.  While this might be acceptable,even desirable, for a theoretical physicist, one expects more from a forum for research mathematicians.  And it can lead to disaster, as the present case shows.
And so to the definitions.  Here there is another pitfall.  There are two such, one
as in Schwartz which uses duality and does not correspond to the usage of physicists---it generalises the notion of composition for measures.
The one we give here is simpler and does correspond to that of the physicists.  It uses the fact that a distribution $T$ has the form $D^n F$ for some continuous function $F$.  (This is true locally for every distribution and globally for the ones in question here).  One then defines $T\circ \phi$ to be $(\frac 1{\phi'} D)^n F\circ \phi$ for suitable smooth functions $\phi$---more on this later. We remark that there is an issue here---one has to show that this is independent of the partular representation of the distribution as a (higher) derivative of a continous function.  This is covered in the reference below.
If one applies this to $\delta'$, which is, up to a factor, the third derivative of $|x|$, one gets the formula 
$$\delta'\circ \phi=\pm \frac 1{\phi'(0)^2}\delta',$$
the sign being that of $\phi'(0)$.
This is valid for smooth diffeomorphisms with zero at the origin and whose derivative there is non zero.  One can extend this to functions such as are required here (the cosine function) using standard partition of unity methods (called "recollement des morceaux" by Schwartz).  The basic idea is to cover the real line with open intervals on each of which $\phi$is a diffeomorphism whose derivative is non-zero at any zero and then to sum the corresponding expressions over the zeros.
The integral in the OP can then be obtained in one line and takes on a simple and elegant form as an infinite sum over the zeros of the cosine terms---since I am typing this on my iPad I would rather leave the details to the poser.
Final remark: The above method is due to J. Sebastião e Silva and a detailed treatment can be found in "An Introduction to the Theory of Distributions" by J. Campos Ferreira, which is based on lectures given by the former in Lisbon in the late 60's.
