In a physics problem I am confronted with a divergent integral
$$ \int_{-\infty}^\infty x \sin x \, dx = \sin x - x \cos x \bigg|_{-\infty}^\infty \approx 0$$
How to regularize it?
in order to regularize this sum I would argue this is zero. another possibility is
$$ \int_{-L}^L x \sin x \, dx = \sin x - x \cos x \bigg|_{-L}^L = 2( \sin L - L\cos L)$$
which is oscillating. if $L \in 2 \pi \mathbb{ Z }$ the integral is $\int = \pm L$ if $L \in \pi/2+ 2 \pi \mathbb{ Z }$ then $\int = \pm 2$.
so even if this integral is oscillatory maybe theory of distributions can save us.
Since the integrand is even, consider $\int_0^\infty x \sin x \, dx $. For this integral there's a convenient regularization: multiply the integrand by $e^{-cx}$ where $c>0$. This integrates without much work (write $\sin x = (e^{ix}-e^{-ix})/(2i)$, then integrate $xe^{ax}$ by parts, and simplify). The antiderivative is $$ - \frac{e^{-cx}}{\left(c^{2} + 1\right)^{2}} \left((c^{3} x+cx+c^2-1) \sin x + (c^{2} x +x + 2 c)\cos x \right) $$
so the integral from $0$ to $\infty $ is $$\frac{2c}{(c^2+1)^2}$$ and this tends to $0$ as $c\to 0$.