Integration of some floor functions
A related problem. I'll do number $(3)$. Note that for $n \in \mathbb{N} $ we have
$$ n \leq x < n+1 $$
$$ \implies n^2 \leq x^2 < (n+1)^2 $$
$$ \implies n^2+n-1 \leq x^2+x-1 < (n+1)^2 +(n+1)-1 $$
which yields
$$ \lfloor{ x^2+x-1} \rfloor = n^2+n-1, \quad n \leq x < n + 1 .$$
Now, we go back to the integral
$$ I = \int_{0}^{1}(-1) dx + \int_{1}^{2}(1) dx = 0. $$
Note: I believe You can generalize the above process for any polynomial $p(x)$.
I will show you how to perform the integral given by $3)$ on a slightly rough way.
We know that $p(x) = x^2 + x-1$ lies between $(-1,5)$ when $x \in (0,2)$ and, furthermore, $p$ is monotone increasing in this interval.
When applied to $p(x)$, the floor function gives us the greatest integer less than or equal to $x$, so it makes a good idea to compute for what values of $x$, $p(x)$ reach an integer value $p \in (-1,5)$. We have: \begin{array}{|c|c|} \hline p(x) & x \\ \hline -1 & 0 \\ 0 & \frac{1}{2} \left(-1+\sqrt{5}\right) \\ 1 & 1 \\ 2 & \frac{1}{2} \left(-1+\sqrt{13}\right) \\ 3 & 1/2 (-1 + \sqrt{17}) \\ 4 & 1/2 (-1 + \sqrt{21}) \\ 5 & 2 \\ \hline \end{array} where we have solved $p(x) = p^* = -1,0,\ldots,5,$ on each table entry.
Now, we can see that: $$\color{blue}{\int^2_0 \lfloor p(x) \rfloor \, \mathrm{d}x = \sum_{i=0}^5 (x^*_{i+1} -x^*_i) p^*_i}, $$ where $x^*_i $ are the corresponding values satisfying $p(x^*) = p^*$. I hope this gives you some ideas of what's going on.
Cheers!
I'm sure a plot of both $p(x)$ and $\lfloor p(x) \rfloor$ makes things clearer:
The floor function turns continuous integration problems in to discrete problems, meaning that while you are still "looking for the area under a curve" all of the curves become rectangles. In general, the process you are going to want to take will go something like this:
Consider the function (before taking the floor of it), and look at where the output is an integer. For instance, in your first example $f(x)=x$, $f(x)$ equals an integer when an integer is put in. The next step is to look at what happens between these points. Again considering your first example, for $1 \leq x < 2$, the floor function maps everything to 1, so you end up with a rectangle of width 1 and height 1. It is the areas of these rectangles you need to add to find the value of the integral (being careful to understand that rectangles below the x-axis have "negative areas").
In the case of the indefinite integrals you will end up with some summation since you don't know the bounds, on the others you should be able to find exact numerical answers.