Integral of a piecewise continuous function – is this correct

improper-integralsintegrationreal-analysisriemann-integrationstieltjes-integral

I recently learned about the Riemann-Stieltjes integral, and I tried playing around a bit with it. I realized that you can turn sums into integrals using the floor function, and that's what led to the following:

Let $\int_1^n\left \lfloor x \right \rfloor r^x \ dx = I.$ Then, doing some basic algebra we get:
$$-\ln r\int_1^n\left \lfloor x \right \rfloor r^x \ dx=-I\ln r$$
$$-\int_1^n\left \lfloor x \right \rfloor \frac{\mathrm{d} }{\mathrm{d} x}(r^x) \ dx=-I\ln r$$
$r^x$ increases monotonically and $\frac{\mathrm{d} }{\mathrm{d} x}(r^x)$ is Riemann integrable on $[1,n]$. $\left \lfloor x \right \rfloor$ is bounded on $[1,x]$, and since $\left \lfloor x \right \rfloor \frac{\mathrm{d} }{\mathrm{d} x}(r^x)$ is also bounded on the compact set $[1,n]$ and has finitely many discontinuities, $\left \lfloor x \right \rfloor \frac{\mathrm{d} }{\mathrm{d} x}(r^x)$ is Riemann integrable on $[1,n]$. This then implies that $\left \lfloor x \right \rfloor$ is Riemann-Stieltjes integrable with respect to $r^x$ on $[1,n]$, and so the following holds:
$$-\int_1^n\left \lfloor x \right \rfloor \ d(r^x)=-I\ln r$$
Continuing with the algebra we have:
$$\left \lfloor n \right \rfloor r^n-\left \lfloor 1 \right \rfloor r^1-\int_1^n\left \lfloor x \right \rfloor \ d(r^x)=nr^n-r-I\ln r$$
$$ \left [ \left \lfloor x \right \rfloor r^x\right ]_1^n-\int_1^n\left \lfloor x \right \rfloor \ d(r^x)=nr^n-r-I\ln r $$
By the integration by parts formula for Riemann-Stieltjes integrals,
$$\int_1^nr^x\ d\left \lfloor x \right \rfloor = nr^n-r-I\ln r$$
and so,
$$ \sum _{k=2} ^n r^k = nr^n-r-I\ln r$$
$$ \sum _{k=0} ^n r^k = 1+nr^n-I\ln r.$$
Next, using the formula for the partial sums of a geometric series, we can write,
$$\frac{r^{n+1}-1}{r-1} = 1+nr^n-I\ln r$$
solving for I in which gives
$$I=\int_1^n\left \lfloor x \right \rfloor r^x \ dx = \frac{1}{\ln r}+\frac{nr^n}{\ln r}-\frac{r^{n+1}-1}{(r-1)\ln r}.\ \ \ \ \ \ (1)$$
Now, this formula only holds for integer $n$, however we can extend it to any $n\in \mathbb{R}$ by realizing that
$$ \int _1 ^x \left \lfloor t \right \rfloor r^t \ dt = \int _{\left \lfloor x \right \rfloor} ^x \left \lfloor x \right \rfloor r^t \ dt + \sum _{k=0} ^{\left \lfloor x \right \rfloor – 1} \int _k ^{k+1} k r^t \ dt ,$$
where $ \int _{\left \lfloor x \right \rfloor} ^x \left \lfloor x \right \rfloor r^t \ dt $ is the part of the integral given by the fractional part of $x$, and $ \sum _{k=0} ^{\left \lfloor x \right \rfloor – 1} \int _k ^{k+1} k r^t \ dt $ is the part of the integral given by the integer part of $x$. Consequently, we can replace the sum by the identity derived earlier, yielding
$$ \int _1 ^x \left \lfloor t \right \rfloor r^t \ dt = \int _{\left \lfloor x \right \rfloor} ^x \left \lfloor x \right \rfloor r^t \ dt + \frac{1}{\ln r}+\frac{\left \lfloor x \right \rfloor r^{\left \lfloor x \right \rfloor}}{\ln r}-\frac{r^{\left \lfloor x \right \rfloor +1}-1}{(r-1)\ln r}. $$
Finally, if we compute the remaining integral, we get
$$ \int _1 ^x \left \lfloor t \right \rfloor r^t \ dt = \frac{\left \lfloor x \right \rfloor}{\ln r} (r^x – r^{\left \lfloor x \right \rfloor}) + \frac{1}{\ln r}+\frac{\left \lfloor x \right \rfloor r^{\left \lfloor x \right \rfloor}}{\ln r}-\frac{r^{\left \lfloor x \right \rfloor +1}-1}{(r-1)\ln r}. \ \ \ \ \ \ (2) $$
Lastly, we will compute the improper integral $\int _1 ^\infty \left \lfloor x \right \rfloor r^x \ dx,$ convergent for $\left | r \right | < 1.$
$$ \int _1 ^\infty \left \lfloor x \right \rfloor r^x \ dx = \lim _{x \to \infty} \left ( \frac{\left \lfloor x \right \rfloor}{\ln r} (r^x – r^{\left \lfloor x \right \rfloor}) + \frac{1}{\ln r}+\frac{\left \lfloor x \right \rfloor r^{\left \lfloor x \right \rfloor}}{\ln r}-\frac{r^{\left \lfloor x \right \rfloor +1}-1}{(r-1)\ln r} \right ) $$
$$ \int _1 ^\infty \left \lfloor x \right \rfloor r^x \ dx = \frac{1}{\ln r} + \frac{1}{(r-1) \ln r}. \ \ \ \ \ \ (3) $$

Overall, I feel fairly certain that (1) and (2) are correct, but (3) seems to be incorrect based on numerical approximations done in Mathematica and Desmos.
Does anyone know where I went wrong here?

Best Answer

For $r \in (0,1)$, $N\in \{2,3,4,...\}$: $$\begin{aligned}\lim_{N\to \infty}\int_1^N \lfloor x \rfloor r^xdx&=\lim_{N\to \infty}\sum_{n <N}n\int_{n}^{n+1}r^xdx\\ &=\lim_{N\to \infty}\frac{r-1}{\ln(r)}\sum_{n <N}nr^n\\ &=\frac{r-1}{\ln(r)}\sum_{n\in \mathbb{N}}nr^n\\ &=\frac{r}{\ln(r)(r-1)} \end{aligned}$$