Integration of box function I have really forgotten how to do this kind of calculation; would any one please tell me?


*

*$\int_0^{\pi/4} \lfloor3 \tan^2x\rfloor, dx$

*$\int_{-100}^{100} \lfloor t^3\rfloor,dt$

 A: Question 1: Let $f(x)=\lfloor 3\tan^2 x\rfloor$. Look first at those $x$ such that $0\le 3\tan^2 x<1$. There $f(x)=0$. Note that $\arctan(1/\sqrt{3})=\pi/6$, so $f(x)=0$ for $0\le x<\pi/6$.
In the same way, if $1\le 3\tan^2 x <2$, then $f(x)=1$, and if $2\le 3\tan^2 x<3$ then $f(x)=2$.
So $f(x)=1$ for $\pi/6\le x<\arctan(\sqrt{2}/\sqrt{3})$, and $f(x)=2$ for $\arctan(\sqrt{2}/\sqrt{3})\le x<\pi/4$.
Unfortunately, $\arctan(\sqrt{2}/\sqrt{3})$ is I believe nothing familiar. Call it $a$. The calculator says that $a$ is approximately $0.6847192$.
Then our integral is $(\pi/6-0)(0)+(a-\pi/6)(1)+(\pi/4-a)(2)$. One could simplify this expression to $\pi/3-a$, and then compute.
Question 2: We use a trick to cut down on the work. Note that if $y$ is positive and is not an integer, then $\lfloor -y\rfloor=-\lfloor y\rfloor-1$.  (This is just the observation that, for example, $\lfloor \pi \rfloor=3$ while $\lfloor -\pi\rfloor =-4$.) 
For the integral from $-100$ to $0$, let $u=-x$.  We have then
$$\int_{-100}^0 \lfloor x^3\rfloor \,dx=\int_{100}^0 \lfloor -u^3\rfloor (-du).$$
For integration, changing the value of a function at a finite number of places makes no difference. When $u^3$ is not an integer, $\lfloor -u^3\rfloor=-\lfloor u^3\rfloor-1$, and therefore 
$$\int_{100}^0 \lfloor -u^3\rfloor (-du)=\int_0^{100} (-\lfloor u^3\rfloor-1)du.$$
So the full integral is equal to 
$$\int_0^{100}\lfloor x^3\rfloor\,dx+ \int_0^{100} (-\lfloor u^3\rfloor-1)\,du.$$
In the second integral, change the dummy variable of integration to $x$. There is very nice cancellation, and we end up with 
$$\int_0^{100} (-1)\,dx.$$
Remark:  Question $2$ turns out to be easy. (Note that finding the integral from $0$ to $100$ is far more unpleasant.)  But I should confess that I first did it by breaking up the region (at first wrongly and then correctly) into intervals, and observing the almost cancellations. Writing up that version would be a nuisance, hence the simpler version.  It is, however, not a bad idea to begin to do it the grungy way. 
A: Let's start with 1. If $0\le x\le\pi/4$, then $0\le3\,\tan^2x\le3$.
$$
\lfloor3\,\tan^2x\rfloor=\begin{cases}
0 & \text{if } 0\le\,\tan^2x<1/3,\\
1 & \text{if } 1/3\le\tan^2x<2/3,\\
2 & \text{if } 2/3\le\tan^2x<1,\\
3 & \text{if } \tan^2x=1.
\end{cases}
$$
Let
$$
x_1=\arctan\sqrt{\frac{1}{3}},\quad x_2=\arctan\sqrt{\frac{2}{3}},\quad x_3=\arctan1.
$$
Then
$$
\int_0^{\pi/4}\lfloor3\,\tan^2x\rfloor\,dx=0\cdot\int_0^{x_1}dx+1\cdot\int_{x_1}^{x_2}dx+2\cdot\int_{x_2}^{x_3}dx=2\,x_3-x_2-x_1.
$$
I leave to you to find explicit values for $x_k$, $1\le k\le3$, and the extension of this method to problem 2.
