How to find $\int_1^3 x^2[x] \ d(x[x])$ How to find $\int_1^3  x^2[x] \ d(x[x])$ where $[\cdot ]$ is the  floor function.
It is obvious that
\begin{align}
\int_1^3  x^2[x] \ d(x[x])&=\int_1^2  x^2[x] \ d(x[x])+\int_2^3  x^2[x] \ d(x[x]) \\
&=
\int_1^2  x^2 \ d(x[x])+\int_2^3   2x^2 \ d(x[x]).
\end{align}
But how to calculate $\int_1^2  x^2 \ d(x[x])$? I think i should calculate lower and upper integrals. 
I saw this in a booklet. The main title is calculating $E(g(X))=\int g(x) dF_X(x)$ where $F_X(x)$ is a CDF function of random variable $X$. The First  is an example :
$$\int_0^5 x d[x]=\text{The surface area is limited to the  function x and the x-axis under evaluated by the  function [x]}$$
$$=1+2+3+4+5$$
Then two  practices wrote
$\int_0^5 x dx[x]$ and
$\int_0^5 x[x] dx[x]$
with no answer.(Sorry not native English)
Thanks in advance for any help you are able to provide.
 A: We will use the fact that the derivative of the floor function is the Dirac comb function:
$$\frac{d(\lfloor x \rfloor)}{dx} = Ш(x) =  \sum_{n = -\infty}^{\infty}\delta(x-n)$$
You can find a proof of this equality in this book (p104): Generalized Functions: Theory and Applications. Integrating against the comb function is the same as adding up the values of your function at integer positions, as you will see below.
Let's also be a bit more precise about the area of integration. Does $\int_a^b$ include $a$ and $b$ or not? In this case it matters. Judging by your example, I assume that we are integrating over the half open interval $]a,b]$. We can then check the result of the example as follows:
$$
\begin{aligned}
\int_{]0,5]}xd(\lfloor x\rfloor) &= \int_{]0,5]}x\frac{d(\lfloor x\rfloor)}{dx}dx\\
&= \int_{]0,5]}x Ш(x) dx\\
&= \int_{]0,5]}x \sum_{n = -\infty}^{\infty}\delta(x-n) dx \\
&= \int_{]0,5]}x \sum_{n = 1}^{5}\delta(x-n) dx \\
&= \sum_{n = 1}^{5} \int_{]0,5]}x\delta(x-n) dx \\
&= \sum_{n = 1}^{5} n \\
&= 1+2+3+4+5 \\
\end{aligned}
$$
We can apply the same method to your question, but we first need to apply the product rule to get the $d(\lfloor x \rfloor)$ by itself.
$$
\begin{aligned}
\int_{]1,3]}x^2\lfloor x \rfloor d(x \lfloor x \rfloor) &= \int_{]1,3]}x^2\lfloor x \rfloor \frac{d(x \lfloor x \rfloor)}{dx}dx\\
&=\int_{]1,3]}x^2\lfloor x \rfloor \left(\lfloor x\rfloor+x\frac{d(\lfloor x \rfloor)}{dx}\right)dx\\
&=\int_1^3(x\lfloor x \rfloor)^2dx + \int_{]1,3]}x^3\lfloor x \rfloor Ш(x) dx\\
&= \frac{83}{3} + \int_{]1,3]}x^3\lfloor x \rfloor Ш(x) dx
\end{aligned}
$$
Computing $\int_1^3(x\lfloor x \rfloor)^2dx = \frac{83}{3}$ should be easy, so I will compute the other term:
$$
\begin{aligned}
\int_{]1,3]}x^3 Ш(x)\lfloor x \rfloor dx &= \int_{]1,3]}x^3\lfloor x \rfloor \sum_{n = -\infty}^{\infty}\delta(x-n) dx\\
&= \int_{]1,3]}x^3\lfloor x \rfloor \sum_{n = 2}^{3}\delta(x-n) dx\\
&= \sum_{n = 2}^{3}\int_{]1,3]}x^3\lfloor x \rfloor\delta(x-n) dx\\
&= \sum_{n = 2}^{3} n^3\lfloor n \rfloor\\
&= \sum_{n = 2}^{3} n^4\\
&= 97
\end{aligned}
$$
So the final answer is $97+\frac{83}{3}$.
A: This is not so simple, because of that troubling discontinuity in $d(x\lfloor x\rfloor)$. You can't just add up the integrals over $[1,2)$ and $(2,3]$, because $df$ effectively becomes infinite at the point $x=2$, so this point contributes a finite amount all by itself. To see this, we can approximate the function $x\lfloor x\rfloor$ in the interval $(2-\varepsilon,2+\varepsilon)$ by the function
$$\frac{x}{2}\left(5+\frac{x-2}{\varepsilon}\right)$$
This gives us a continuous function $f(x)$ which we can use instead of $x\lfloor x\rfloor$ on the whole of $[1,3]$. But on the interval $(2-\varepsilon,2+\varepsilon)$, we have
$$df=\left(\frac52+\frac{x-1}{\varepsilon}\right)dx$$
and so the integral of $x^2df$ on this interval is...something complicated that doesn't tend to zero as $\varepsilon$ tends to zero. (When I have more time I might try to evaluate it exactly.)
