I have a problem with the following integral: $$ \int_{1}^{\infty}\frac{\sin\left(\frac{\pi}{2}\{x\}\right)^{[x]}}{[x]}\cos\left(\frac{\pi}{2}\{x\}\right)\,dx $$ where $[x]$ is the floor function and $\{x\}:=x-[x]$. I tried to solve it using the following idea.
\begin{align} \int_{1}^{\infty}\frac{\sin\left(\frac{\pi}{2}\{x\}\right)^{[x]}}{[x]}\cos\left(\frac{\pi}{2}\{x\}\right)\,dx &= \int_{1}^{\infty}\frac{\sin\left(\frac{\pi}{2}(x-[x])\right)^{[x]}}{[x]}\cos\left(\frac{\pi}{2}(x-[x])\right)\,dx\\ &=\sum_{k=1}^{\infty}\int_{k}^{k+1}\frac{\sin\left(\frac{\pi}{2}(x-k)\right)^{k}}{k}\cos\left(\frac{\pi}{2}(x-k)\right)\,dx\\ &=\sum_{k=1}^{\infty}\frac{1}{k}\int_{0}^{1}\sin\left(\frac{\pi}{2}x\right)^{k}\cos\left(\frac{\pi}{2}x\right)\,dx\\ &=\frac{2}{\pi}\sum_{k=1}^{\infty}\frac{1}{k}\int_{0}^{\pi/2}\sin(x)^k\,\cos(x)\,dx\\ &=\frac{2}{\pi}\sum_{k=1}^{\infty}\frac{1}{k}\left(\frac{\sin(x)^{k+1}}{k+1}\right|_{0}^{\pi/2}\\ &=\frac{2}{\pi}\sum_{k=1}^{\infty}\frac{1}{k\,(k+1)}=\frac{2}{\pi}. \end{align}
Now, I looked it up on Desmos and it tells me that this is wrong. In fact, as you can see in the image, the integral and my result are different.
Did I do something wrong? Thanks for any help.



from scipy.integrate import quad; quad(lambda x: np.sin(np.pi/2*(x-np.floor(x)))**np.floor(x)/np.floor(x) * np.cos(np.pi/2*(x-np.floor(x))), 1, np.inf, limit=5000)gives about 0.63813 and a convergence warning. I don't think these numerical algorithms are too fond of the infinitely many jumps, probaby would benefit from choosing support points manually. Anyway, $2/\pi$ is within the estimated error. – Noctis Aug 28 '24 at 18:13