Find the closed-form solution to a integral with the floor function
Assignment:
Find a closed-form solution to the following integral:
$$\mathscr{S}_\epsilon:=\int_0^1\epsilon^{\left\lfloor\frac{1}{x}\right\rfloor}\space\text{d}x\tag1$$
Where $\left\lfloor x\right\rfloor$ is the Floor function.
Well, first let $\text{s}:=\frac{1}{x}$ this implies that:
$$\mathscr{S}_\epsilon=-\int_\infty^1\frac{\epsilon^{\left\lfloor\text{s}\right\rfloor}}{\text{s}^2}\space\text{ds}=\int_1^\infty\frac{\epsilon^{\left\lfloor\text{s}\right\rfloor}}{\text{s}^2}\space\text{ds}\tag2$$
It is now not hard to see (because $\lfloor\text{s}\rfloor$ is constant on all the sub-intervals that we are integrating over) that we can write:
$$\mathscr{S}_\epsilon=\sum_{\text{n}\ge1}\int_\text{n}^{\text{n}+1}\frac{\epsilon^{\left\lfloor\text{s}\right\rfloor}}{\text{s}^2}\space\text{ds}=\sum_{\text{n}\ge1}\int_\text{n}^{\text{n}+1}\frac{\epsilon^\text{n}}{\text{s}^2}\space\text{ds}=\sum_{\text{n}\ge1}\epsilon^\text{n}\int_\text{n}^{\text{n}+1}\frac{1}{\text{s}^2}\space\text{ds}=$$ $$\sum_{\text{n}\ge1}\epsilon^\text{n}\cdot\left[-\frac{1}{\text{s}}\right]_\text{n}^{\text{n}+1}=\sum_{\text{n}\ge1}\epsilon^\text{n}\cdot\left[\frac{1}{\text{s}}\right]_{\text{n}+1}^\text{n}=\sum_{\text{n}\ge1}\epsilon^\text{n}\cdot\left(\frac{1}{\text{n}}-\frac{1}{\text{n}+1}\right)\tag3$$
Because if $\text{n}\le\text{s}<\text{n}+1$ we have $\lfloor\text{s}\rfloor=\text{n}$.
Now, I let you prove that when $\left|\epsilon\right|\le1$ the equality following holds:
$$\sum_{\text{n}\ge1}\epsilon^\text{n}\cdot\left(\frac{1}{\text{n}}-\frac{1}{\text{n}+1}\right)=\frac{\epsilon+\ln\left(1-\epsilon\right)-\epsilon\ln\left(1-\epsilon\right)}{\epsilon}\tag4$$
And you can do that using Taylor- or/and Maclaurin series.
Suppose $ \left|k\right|<1 $, then substituting $ \left\lbrace\begin{matrix}y=\frac{1}{x}\ \ \ \\ \mathrm{d}x =-\frac{\mathrm{d}y}{y^{2}}\end{matrix}\right. $, we get :
\begin{aligned} \int_{0}^{1}{k^{\left\lfloor\frac{1}{x}\right\rfloor}\,\mathrm{d}x}&=\int_{1}^{+\infty}{\frac{k^{\left\lfloor y\right\rfloor}}{y^{2}}\,\mathrm{d}y}\\ &=\sum_{n=1}^{+\infty}{\int_{n}^{n+1}{\frac{k^{\left\lfloor x\right\rfloor}}{x^{2}}\,\mathrm{d}x}}\\ &=\sum_{n=1}^{+\infty}{\int_{n}^{n+1}{\frac{k^{n}}{x^{2}}\,\mathrm{d}x}}\\ &=\sum_{n=1}^{+\infty}{k^{n}\left(\frac{1}{n}-\frac{1}{n+1}\right)}\\ &=\sum_{n=1}^{+\infty}{\left(\frac{k^{n-1}}{n}-\frac{k^{n}}{n+1}\right)}+\left(1-\frac{1}{k}\right)\sum_{n=1}^{+\infty}{\frac{k^{n}}{n}}\\ \int_{0}^{1}{k^{\left\lfloor\frac{1}{x}\right\rfloor}\,\mathrm{d}x}&=1-\left(1-\frac{1}{k}\right)\ln{\left(1-k\right)} \end{aligned}
We were able to split the sum in the fifth line, because we know that $ \sum\limits_{n\geq 1}{\left(\frac{k^{n-1}}{n}-\frac{k^{n}}{n+1}\right)} $ converges (telescopic series), and that $ \sum\limits_{n\geq 1}{\frac{k^{n}}{n}} $ does also converge (taylor series of the function $ f:\left(-1,1\right)\rightarrow\mathbb{R},\ x\mapsto -\ln{\left(1-x\right)} $ at $ x=k $).