Computing the following integral I get:
$$\int\ x^2\sin(a·x)\ dx = -\frac{x^2\cos(a·x)}{a} + \frac{2x\sin(a·x)}{a^2} + \frac{2\cos(a·x)}{a^3} \tag1$$
So, if I have to do this integral with the lower limit equals to 0 and the upper equals to $+\infty$, could I assert that the limit for $+\infty$ gives zero taking into account that $a \leq L \neq \infty$?
If we assume that $n$ is a positive whole number, in general, we can use integration by parts to find the integral $$I_n(x)=\int x^n\sin ax\,dx$$ $$dv=\sin ax\ dx\\v=-\frac1a\cos ax$$ $$u=x^n\\du=nx^{n-1}dx$$ $$I_n(x)=uv-\int vdu\\I_n(x)=-\frac1ax^n\cos ax+\frac1an\int x^{n-1}\cos ax\ dx$$ Integration by parts again gives $$I_n(x)=-\frac1ax^n\cos ax-\frac n{a^2}x^{n-1}\sin ax+\frac{n(n-1)}{a^3}\int x^{n-2}\sin ax\ dx$$ $$I_n(x)=-\frac1ax^n\cos ax-\frac n{a^2}x^{n-1}\sin ax+\frac{n(n-1)}{a^3}I_{n-2}(x)$$ Which we can work with: $$I_n(x)=-\frac1ax^n\cos ax-\frac n{a^2}x^{n-1}\sin ax+\frac{n(n-1)}{a^3}\biggr(-\frac1ax^{n-2}\cos ax-\frac{n-2}{a^2}x^{n-3}\sin ax+\frac{(n-2)(n-3)}{a^3}I_{n-4}(x)\biggr)$$ $$I_n(x)=-\frac1ax^n\cos ax-\frac n{a^2}x^{n-1}\sin ax-\frac{n(n-1)}{a^3}x^{n-2}\cos ax-\frac{n(n-1)(n-2)}{a^4}x^{n-3}\sin ax-\frac{n(n-1)(n-2)(n-3)}{a^5}I_{n-4}(x)$$ Which eventually gives $$I_n(x)=-\sum_{k=0}^n\frac{(n)_k^-}{a^{k+1}}x^{n-k}D^{\operatorname{mod}(k+1,2)}\sin t\big|_{t=ax}$$ Where $$(n)_k^-=n(n-1)(n-2)\cdots(n-k+1)$$ and $$D^mf(x)\bigg|_{x=v}=\frac{d^m}{dx^m}f(x)\bigg|_{x=v}=f^{(m)}(v)$$ Yeah it's kind of ugly, but it works.