Evaluating $\int_0^{\infty} \frac{\sin(xt)(1-\cos(at))}{t^2} dt$ The problem is to evaluate the improper integral: 
$I = \int_0^{\infty} \frac{\sin(xt)(1-\cos(at))}{t^2} dt$.
This can be written as follows:
$$I = \int_0^{\infty} dt \frac{\sin(xt)}t \int_0^a \sin(yt)dy = \int_0^{\infty} dt \int_0^a \frac{\sin(xt)\sin(yt)}t dy$$
In a previous problem, I determined:
$$J = \int_0^{\infty} \frac{\sin(xt)\sin(yt)}t dt = \frac12\log\left(\lvert\frac{x-y}{x+y}\rvert\right)$$
which converges uniformly with respect to $y$ as long as $|x| \ne |y|$.  Hence the order of integration can be interchanged for $I$ to get:
$$I = \int_0^a dy \int_0^{\infty} \frac{\sin(xt)\sin(yt)}t dt = \int_0^a \frac12\log\left(\lvert\frac{x-y}{x+y}\rvert\right)dy$$
This result may not be valid if $|a| \ge |x|$ since $J$ becomes unbounded if $|x|=|y|$. If I integrate $J$ with respect to $y$ from $0$ to $a$, $y$ is going to eventually reach $|x|$ or $-|x|$ if $|a| \ge |x|$.
Is it valid to integrate with respect to $y$ over singularities in $J$ provided that $\int_0^a \frac12\log\left(\lvert\frac{x-y}{x+y}\rvert\right)dy$ converges?  Or does $I$ actually diverge if $|a| \ge |x|$?

I think the proper way to do this is as follows.  Assume $a > x > 0$ to simplify the problem.  Then I should integrate as follows:
$$I = \int_0^{\infty} dt \int_0^{x-\epsilon} \frac{\sin(xt)\sin(yt)}t dy + \int_{x-\epsilon}^{x+\epsilon} \frac{\sin(xt)\sin(yt)}t dy + \int_{x+\epsilon}^a \frac{\sin(xt)\sin(yt)}t dy$$
Then I must show that the middle integral approaches $0$ and $\epsilon \rightarrow 0$. But the outside integrals diverge.
 A: This is a solution using differentiation under the integral rather than integration. 
Denote the integrand by $F(a,t) = \frac{\sin(xt)(1-\cos(at))}{t^2} $.  Then $\frac{\partial}{\partial a}F(a,t) = \frac{\sin(xt)sin(at)}t$.  As posted previously, I know that:
$$J = \int_0^{\infty} \frac{\partial}{\partial a}F(a,t) dt = \int_0^{\infty} \frac{\sin(xt)\sin(at)}t dt = \frac12\log\left(\lvert\frac{x-a}{x+a}\rvert\right)$$
converges uniformly on any closed interval of $a$ which does not contain either $x$ or $-x$.  
Denote the integral we are trying to evaluate by
$$f(a) = \int_0^{\infty} F(a,t) dt = \int_0^{\infty}  \frac{\sin(xt)(1-\cos(at))}{t^2} dt$$
Since the convergence of the integral $J$ is uniform:
$$f'(a) = \int_0^{\infty} \frac{\partial}{\partial a}F(a,t) dt = \frac12\log\left(\lvert\frac{x-a}{x+a}\rvert\right)$$
Hence
$$f(a) = \int \frac12\log\left(\lvert\frac{x-a}{x+a}\rvert\right) da + C = \int \frac14\log\left(\frac{(x-a)^2}{(x+a)^2}\right) da + C$$
Integrating by parts, differentiating $\frac14\log\left(\frac{(x-a)^2}{(x+a)^2}\right)$ and integrating $1$, we get:
$$f(a) = \frac a2\log(|\frac{x-a}{x+a}|)-\frac x2\log(|x^2-a^2|) + C$$
Now we need to compute the constant of integration.  Suppose, for simplicity, that $0 \le a < x$.  We know that $f(a)$ is valid on this interval.  We can easily compute $f(0) = 0$ and determine on this interval that $C = \frac x2\log(x^2)$ and hence for the interval $0 \le a < x$:
$$f(a) = \frac a2\log(|\frac{x-a}{x+a}|)-\frac x2\log(|1-\frac{a^2}{x^2}|)$$
If $0 \le x < a$, then we have to determine the appropriate value for the constant for this new interval. But the problem is determine a value of $a$ for which I can easily compute $f$ in this interval.  I think I am going to have to compute $\lim_{a \rightarrow \infty} f(a)$ by taking the limit under the integral.

I think for the interval $0 \le x < a$, we do the same thing as we did for the other interval to compute $C$.  If we let $x=0$, then the integral $I= 0$ and we get:
$$f(a) = \frac a2\log(|\frac{-a}{a}|) + C = 0$$
or $C = 0$.  Thus
$$f(a) = \frac a2\log(|\frac{x-a}{x+a}|)-\frac x2\log(|x^2-a^2|)$$
It would probably have been better if I wrote $f(a,x)$ rather than $f(a)$.
I have discovered that this second solution is not correct.  The first solution holds for all $x$ and $a$.  In the limit, the first derivation for $f(a)$ approaches $0$ and $x$ approaches $0$.

The following is the correct solution for the interval $0 \le x < a$.  The function 
$$f(a) = \int_0^{\infty} \frac{\sin(xt)(1-\cos(at))}{t^2} dt $$
converges uniformly for all $a$ and $x$.  Hence $f(a)$ is a continuous function for $a$ in any interval.  Previously, we determined that in the interval $0 \le x < a$
$$f(a) = -\frac a2\log(|\frac{x-a}{x+a}|)+\frac x2\log(|x^2-a^2|) + C$$
(after correcting for the missing minus sign), and we were trying to determine the constant of integration $C$.  Since $f(a)$ is continuous, we must have that $\lim_{a \rightarrow x^-} f(a) = \lim_{a \rightarrow x^+} f(a)$.  Using the solution computed on $0 \le a < x$ on the left side, and the one above on the right, we have
$$\lim_{a \rightarrow x^-} f(a) = x\log(2) = x\log(2) + x\log(|x|) + C = \lim_{a \rightarrow x^+} f(a)$$
and we get $C = -x\log(|x|)$, which is what we computed for the first interval $0 \le a < x$ (again after correcting for the missing minus sign).  This result should not be very surprising, since the constant of integration has to be the same on both intervals if the function is to be continuous.  So we have for all $a \ne x$:
$$f(a) = -\frac a2\log(|\frac{x-a}{x+a}|)+\frac x2\log(|1-\frac{a^2}{x^2}|)$$
and $f(x)= x\log(2)$.
The reason we had to go through all the trouble of computing solutions on two intervals is because the function $f(a)$ is not differentiable at $a = x$.
A: The log has an integrable singularity at zero argument.  Thus there should be no problem in integrating with respect to $y$ no matter what $a$ is.
A: This is probably not an answer but it is too long for a comment.
May be, you could consider
$$\sin(xt)\big(1-\cos(at)\big)=\sin(xt)-\frac 12 \Big(\sin\big((x+a)t\big)+\sin\big((x-a)t\big)\Big)$$ which makes the integral a combination of three integrals looking like$$I_\alpha=\int\frac {\sin(\alpha t)}{t^2}\,dt=\alpha\int\frac{  \sin (u)}{u^2}\,du=\alpha  \left(\text{Ci}(u)-\frac{\sin (u)}{u}\right)$$ where appears the cosine integral. For sure, each of these integrals does not converge on $(0,\infty)$ but the combination of the three does.
Hoping no mistake in my calculations, I arrived at
$$\int_0^{\infty} \frac{\sin(xt)(1-\cos(at))}{t^2} dt=\frac{1}{4} \left((x-a) \log \left((a-x)^2\right)+(x+a) \log \left((a+x)^2\right)+x
   \log \left(\frac{1}{x^4}\right)\right)$$
