What is this renormalization/continuation trick called and why does it work?

Consider the integral $$I_n = \int_0^\infty x^n \sin(x) dx$$ for $$n\in\mathbb R$$. The integral exists and is finite for $$-2 < n <0$$, giving the value $$I_n = \Gamma(n+1)\cos\left(\frac{n\pi}{2}\right)$$. Compare this with the related integral $$\tilde I_n(t) = \int_0^\infty x^n \sin(x) e^{-t x} dx$$ for $$t>0$$. The integral exists and is finite for $$n > -2$$, taking the value $$\tilde I_n(t) = \left(\frac{1}{1 + t^2}\right)^{\frac{n+1}{2}} \Gamma(n+1) \sin\left[(n+1)\arctan(1/t)\right].$$ which, in the limit as $$t\to 0^+$$ becomes $$\lim_{t\to 0^+} \tilde I_n(t) = \Gamma(n+1)\cos\left(\frac{n\pi}{2}\right)$$ This looks like $$I_n$$, but it is valid for $$n \ge 0$$ as well. Thus it appears that with some slight-of-hand, I have a prescription for extending $$I_n$$ to $$n>0$$.

Is there a name for this move? Why does it work? The basic idea of the trick makes sense: for any positive $$t$$, $$e^{-tx}$$ decays to $$0$$ more rapidly than any positive power of $$x$$, so $$\tilde I_n$$ is finite for $$n>0$$. But there's something abut this process that feels a bit... dirty?

Edit: removed second half of the question based on repeated integration. It was half-baked and contained several errors.

• Note that, e.g, $\int_0^t x \sin(x) = \sin(t) - t\cos(t)$ which does not converge for $t\rightarrow\infty$. – Thomas Oct 12 '18 at 6:56
• Right, thus my interest what is fundamentally different about, e.g., $\lim_{\epsilon\to 0}\int_0^\infty x\sin(x) e^{-\epsilon x}dx$. – Endulum Oct 12 '18 at 14:37
• Introducing $e^{-\epsilon x}$ and taking the limit you are basically considering the Laplace/Fourier transform ($\mathcal{L}[x^n \sin(x)](s=0)$ or $\mathcal{F}[x^n\sin(x)u(x)](k=0)$). Even though the integral defining $I_n$ does not exist in the traditional sense (it's a divergent Riemann integral) for $n\geq 0$ it has have a meaning in a distributional sense (e.g. the Fourier transform of $x^n$ is a well-defined distribution, see en.wikipedia.org/wiki/…). – Winther Oct 12 '18 at 14:58

Why does it work? Here you have to be careful. Yes it's true that $$\lim_{t\to 0^+}\tilde{I}_n(t)$$ is finite, but it does not equal $$I_n = \tilde{I}_n(0)$$ (the function is not continuous at $$t=0$$). The latter integral $$I_n$$ is still divergent and your calculations doesn't change that basic fact. One might argue that if $$I_n$$ were to be given a finite value then it should be $$\lim_{t\to0^+}\tilde{I}_n(t)$$. Doing this, to extract/assign some finite value from an otherwise divergent integral or sum, is called regularization.
Consider for example the Fourier transform $$\mathcal{F}[f(x)](k) = \int f(x)e^{ikx}{\rm d}x$$. It strictly only exits for functions $$f(x)$$ that decay fast enough at infinity, however it can be extended to a larger class of objects called distributions, the most famous being the Dirac delta function $$\delta(x) = \frac{1}{2\pi}\int e^{ikx}{\rm d}x$$ which is a divergent Riemann integral, but a well-defined distribution. Most of the usefulness of the Fourier transform in applications relies on us being able to work with distributions.
One way of assigning meaning to your result is to note that it can be interpreted as the Fourier transform of $$x^n\sin(x)u(x)$$ evaluated at $$k=0$$ (this is well-defined even for $$n\geq 0$$). Equivalently you can look at it as the Laplace transform of $$x^n\sin(x)$$ at $$s=0$$.
There are also applications in physics where divergent integrals can be regularized to give physically meaningful results, like in the Casimir effect for example. Another related question you might find useful: Why does $$1+2+3+\cdots = -\frac{1}{12}$$? (how some divergent sums can be given a finite value and the meaning of this value).