Mathematica seems to agree with me in general with saying that $\displaystyle\int \lfloor x \rfloor dx = \frac{\lfloor x\rfloor (\lfloor x\rfloor-1)}{2}+\lfloor x\rfloor \{ x \}+C = \frac{\lfloor x\rfloor(2 x-\lfloor x\rfloor-1)}{2}+C$; that is, letting $I(x) = \frac{\lfloor x\rfloor(2 x-\lfloor x\rfloor-1)}{2}$ and checking whether $\displaystyle\int_a^b \lfloor x \rfloor dx = I(b)-I(a)$ returned true for all counts, decimals included.

What exactly is preventing this from being true in general? Is the reason there is no indefinite integral due to the discontinuity in the floor function, even though Mathematica defines the definite integral along any interval?

  • $\begingroup$ What makes you say there is no indefinite integral? $\endgroup$ – Gerry Myerson Apr 17 '11 at 23:56
  • $\begingroup$ Well that integral is wrong. It's discontinuous which is a red flag for any non-diverging indefinite integral. $\endgroup$ – The Great Duck Apr 24 '16 at 7:02

The floor function is a piecewise constant function with a finite number of discontinuities, so it is (Riemann) integrable on any interval $[0,x]$. Indefinite integrals $\int f(x)dx$ can be regarded as equivalent classes represented by $\displaystyle \int_0^x f(t)dt$. So the floor function does have an indefinite integral, which can be computed by adding area of a few rectangles: \begin{eqnarray} \int \lfloor x \rfloor dx &=& \int_0^x \lfloor t \rfloor dt +C\\ &=& 1+2+\cdots+(\lfloor x \rfloor-1)+ \{x\}\lfloor x\rfloor+C \\ &=&\frac{\lfloor x\rfloor (\lfloor x\rfloor-1)}{2}+\lfloor x\rfloor \{ x \}+C. \end{eqnarray}


Do you think your formula is true in general over complex numbers? That is usually what Mathematica is thinking about.

  • $\begingroup$ To add: sometimes one has to use things like Assuming[] in Mathematica if you're sure you only need results over the reals. $\endgroup$ – J. M. is a poor mathematician Apr 18 '11 at 0:09
  • $\begingroup$ @J. M. thank you! it does not work in this case but that is a useful thing to know. @Matt, what do you mean? How exactly would the floor function even be applied to complex numbers? $\endgroup$ – Eugene Bulkin Apr 18 '11 at 22:01
  • $\begingroup$ "How exactly would the floor function even be applied to complex numbers?" - componentwise. $\endgroup$ – J. M. is a poor mathematician Apr 18 '11 at 22:03

The right term is better written as $x[x]$, fyi. As for the left term, it is slightly off. The greatest integer function acts almost entirely as a constant during within calculus. However, during integration, a series randomly appears representing the jumps created by the regular integral using it as a constant. For $x[x]$, the series is the repeated sum of all integers from $0$ to $[x]$. The series (in this case) will reduce to $\frac {n(n+1)}{2}$. Mathematica is slightly wrong or your interpretation is incorrect. The integral reduces to:

$$ x[x] - \frac {[x]([x]+1)}{2} $$

My only conclusion is that you got your integration formula slightly off.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.