finding $ \int^{4}_{0}(x^2+1)d(\lfloor x \rfloor),$ given $\lfloor x \rfloor $ is a floor function of $x$ finding $\displaystyle \int^{4}_{0}(x^2+1)d(\lfloor x \rfloor),$ given $\lfloor x \rfloor $ is a floor function of $x$
Assume  $\displaystyle I = (x^2+1)\lfloor x \rfloor \bigg|^{4}_{0}-2\int^{4}_{0}x\lfloor x \rfloor dx$ ( integration by parts )
i have a doubt about limit part , did not understand whether the limit corresponding to $x$
or corrosponding to $\lfloor x \rfloor$
because when we take $\displaystyle \int^{b}_{a}f(x)dx,$ then limits are corrosponding to $x$
but when we take  $\displaystyle \int^{b}_{a}f(x)d(\lfloor x \rfloor ),$ then limit corrosonding to $\lfloor x \rfloor$
please clearfy my doubt and also explain me whats wrong with my method above , thanks 
 A: About your attempt to integrate by parts: instead of doubting about the legitimacy of the change of the "corresponding limits", I advise you take the following steps:
1). Try to understand the basic theory of Riemann Stieljes integration.
2). Find a proof of integration by parts for R-S integrals, be careful about the assumptions, and then try to fully understand the proof. (A quick search on this site gives many, for example.)

A helpful answer would have to be based on the definition you adopt for this integral. Here I give two treatments, which should lead to the same result.

1). From a measure theoretic perspective, we have to find the measure $\mu$ on $\Bbb R$ induced by $g(x)=\lfloor x\rfloor$, in a way such that $\mu((c,d])=g(d)-g(c)$ for $c<d$. Clearly, we can find that $\mu$ is an atomic measure which assigns mass $1$ to each integral point in $\Bbb R$ and $0$ elsewhere, which basically says that you need only to care about integral points, to which you should assign mass $1$, over your integration domain, i.e.
$$\int_A f(x)\mathrm dg(x)=\sum_{i\in \Bbb Z\cap A} f(i).$$
2) Yet another simpler to understand treatment is the Riemann-Stieljes integral. For details of the computation, they bear much resemblance to computing a Riemann integral by definition, the only change being replace $\Delta x_i$ by $\Delta g_i$. For a fuller explanation, you should be able to check the definitions and relevant properties online (where resources should be plenty) by yourself.
A: you can rewrite the integral as $$\int_0^4 x^2+1 \frac{d[x]}{dx}dx$$ where $[x]$ is greatest integer function.Now apply IBP taking $\frac{d[x]}{dx} $ as function to be first integrated.
$$ (x^2+1) \int (\frac{d[x]}{dx} dx)\text{from x=0 to x=4}-\int_0^4 2x ( \int \frac{d[x]}{dx} dx)dx=0$$
