Evaluate $\int_0^\infty \sum^{\lfloor x\rfloor}_{n=1}\frac{\sin nx\pi}{x^n}dx$ Evaluate $$\int_1^\infty \sum^{\lfloor x\rfloor}_{n=1}\frac{\sin nx\pi}{x^n}dx$$ where $\lfloor \cdot \rfloor$ is the floor function.
Okay so this is a problem that really stumbled me. I've had quite a few attempts/thoughts at it though. Tried expanding first to get a sense on what is going on: $$\int_1^\infty\left(\frac{\sin x\pi}{x}+\frac{\sin 2x\pi}{x^2}+\frac{\sin 3x\pi}{x^3}+\dots+\frac{\sin(\lfloor x\rfloor x\pi)}{x^{\lfloor x\rfloor}}\right)dx$$ then I thought I could try individualizing the integral into each? Not sure if that's even possible. And then realised that the solutions to those integrals isn't elementary, they use the $Si$ function. But yeah I'm pretty stuck and unsure if what I've done is even possible.
 A: The upper evaluation limit $\lfloor x\rfloor$ in the OP's original finite sum can be written more simply as $x$ as illustrated in formula (1a) below. The sum can also be written as an infinite sum as defined in formula (1b) below where $\theta(x)$ is the Heaviside step function. There are different conventions for the value of $\theta(0)$ including $\theta(0)=0$, $\theta(0)=\frac{1}{2}$, $\theta(0)=1$, and even leaving $\theta(0)$ undefined, but this answer assumes the definition $\theta(0)=1$. This is only important when evaluating the function $f(x)$, and makes no difference in the evaluation of the integral of $f(x)$.

$$f(x)=\sum\limits_{n=1}^x\frac{\sin(\pi n x)}{x^n}\tag{1a}$$
$$f(x)=\underset{N\to\infty}{\text{lim}}\left(\sum\limits_{n=1}^N\frac{\sin(\pi n x)}{x^n}\ \theta(x-n)\right),\quad\theta(x)=\left\{\begin{array}{cc}
 0 & x<0 \\
 1 & x\geq 0 \\
\end{array}\right.\tag{1b}$$

Formula (3) below is based on term-wise integration where formula (2) below provides the result of the term integral which was evaluated using Mathematica. The $E_n(x)$ terms in formulas (2) and (3) below refer to the generalized exponential integral function.

$$\int\limits_0^\infty\frac{\sin(\pi n x)}{x^n}\ \theta(x-n)\,dx=\int\limits_n^\infty\frac{\sin(\pi n x)}{x^n}\,dx=\frac{i}{2} n^{1-n} \left(E_n\left(i n^2 \pi \right)-E_n\left(-i n^2 \pi \right)\right)\tag{2}$$
$$C=\int\limits_0^\infty f(x)\,dx=\underset{N\to \infty }{\text{lim}}\left(\frac{i}{2}\sum\limits_{n=1}^N n^{1-n} \left(E_n\left(i n^2 \pi \right)-E_n\left(-i n^2 \pi \right)\right)\right)\tag{3}$$

The following table illustrates the value of the integral $C$ defined in formula (3) above for several values of the upper evaluation limit $N$. Note the infinite sum associated with the integral $C$ seems to converge fairly rapidly.

$$\begin{array}{cc}
 N & C \\
 1 & -0.281141+0. i \\
 10 & -0.246292+0. i \\
 20 & -0.246292+0. i \\
 40 & -0.246292+0. i \\
\end{array}$$

Another way to evaluate the integral of $f(x)$ is illustrated in formulas (4) and (5) below in which case the constant $C$ defined in formula (3) above is evaluated as defined in formula (6) below.

$$\int\limits_n^x\frac{\sin(\pi n t)}{t^n}\,dt=\frac{i}{2}\left(n^{1-n} \left(E_n\left(i n^2 \pi \right)-E_n\left(-i n^2 \pi \right)\right)-x^{1-n} (E_n(i n \pi x)-E_n(-i n \pi x))\right)\tag{4}$$
$$\int\limits_0^x f(t)\,dt=\frac{i}{2}\sum\limits_{n=1}^x\left(n^{1-n}\left(E_n\left(i n^2 \pi \right)-E_n\left(-i n^2 \pi \right)\right)-x^{1-n} (E_n(i n \pi x)-E_n(-i n \pi x))\right)\tag{5}$$
$$C=\underset{x\to\infty}{\text{lim}}\left(\int\limits_0^x f(t)\,dt\right)\tag{6}$$

Figure (1) below illustrates formula (1a) for $f(x)$ in blue and formula (5) for $\int\limits_0^x f(t)\,dt$ in orange. The dashed-gray horizontal reference line is at $y=0.246292$ consistent with the evaluation of formula (3) for $C$ in the table above.


Figure (1): Illustration of formula (1a) for $f(x)$ (blue) and formula (5) for $\int\limits_0^x f(t)\,dt$ (orange)
A: Let  $\#$ be the counting measure on $(\mathbb{N},\mathcal{P}(\mathbb{N}))$, and $\lambda$ the Lebesgue measure on $([1,\infty),\mathscr{B}([1,\infty))$. The integral in the OP can me expressed as
$$\begin{align}
\int^\infty_1\Big(\sum^{\lfloor x\rfloor}_{n=1}\frac{\sin \pi xn}{x^n}\Big)\,dx&=\int^\infty_1\Big(\int^\infty_1\frac{\sin \pi nx}{x^n}\mathbb{1}_{[1,x]}(n)\,\#(dn)\Big)\,dx\\
&=\int^\infty_1\Big(\int_{[1,2)}+\int_{[2,\infty)}\frac{\sin \pi nx}{x^n}\mathbb{1}_{[1,x]}(n)\,\#(dn)\Big)\,dx\\
&=\int^\infty_1\frac{\sin \pi x}{x}\,dx +\int^\infty_1\Big(\int_{[2,\infty)}\frac{\sin \pi nx}{x^n}\mathbb{1}_{[1,x]}(n)\,\#(dn)\Big)\,dx\\
&=\int^\infty_1\frac{\sin \pi x}{x}\,dx +\int^\infty_2\Big(\int_{[2,\infty)}\frac{\sin \pi nx}{x^n}\mathbb{1}_{[2,x]}(n)\,\#(dn)\Big)\,dx
\end{align}
$$
Define  $g:[2,\infty)\times\mathbb{N}\rightarrow\mathbb{R}$ as
$$g(x,n)=\frac{\sin \pi nx}{x^n}\mathbb{1}_{[2,x]}(n)$$
Then
$$\int^\infty_2\Big(\int^\infty_2|g(x,n)|\,dx\Big)\,\#(dn)\leq\int^\infty_2 \Big(\int^\infty_n\frac{dx}{x^n}\Big)\,\#(dn)=\sum^\infty_{n=2}\frac{n}{n-1}\frac{1}{n^n}<\infty$$
By Fubini's theorem  $g\in L_1([2,\infty)\times[2,\infty),\lambda\otimes\#)$ and so,
$$\int^\infty_2\Big(\sum^{\lfloor x\rfloor}_{n=2}\frac{\sin \pi nx}{x^n}\Big)\,dx=\sum^\infty_{n=2}\int^\infty_n\frac{\sin n\pi x}{x^n}\,dx
$$
converges absolutely. It follows that the integral of the OP is
$$\begin{align}
\int^\infty_1\Big(\sum^{[x]}_{n=1}\frac{\sin \pi xn}{x^n}\Big)\,dx&=
\int^\infty_1\frac{\sin \pi x}{x}\,dx+\sum^\infty_{n=2}\int^\infty_n\frac{\sin n\pi x}{x^n}\,dx\tag{1}\label{op}\\
&=\frac{\pi}{2}-\int^{\pi}_0\frac{\sin x}{x}\,dx + \sum^\infty_{n=2}\int^\infty_n\frac{\sin n\pi x}{x^n}\,dx
\end{align}$$
The first term in the right-hand-side of \eqref{op} is convergent as Riemann improper integral.
I ignore if there is a compact expression in terms of special functions; however, as the series in the right-hand-side of \eqref{op} converges very fast, and the integral $\int^1_0\frac{\sin \pi x}{x}\,dx$ can be estimated numerically quite efficiently, one may obtain descent numerical estimates by considering just a few (say 10) terms in series.
Here a simple implementation in R:
Nterms <- 10  # number of terms for the series
Sn <- sapply(2:Nterms, 
       function(n){integrate(function(x){sin(x*pi*n)/x^n},n,Inf,
       subdivisions=1e5)$value})  # truncated series
# Value of integral
0.5*pi - integrate(function(x){sin(x)/x,0,pi)$value + sum(Sn)

This gives the approximated value: $-0.2462374\ldots$. With good numerical integrators, the error of truncating the series at $N$ terms is, as one commentator pointed out, is of the order $O((N+1)^{-(N+1)})$.
