-2
$\begingroup$

Wolfram Alpha claims there is no closed form in terms of standard funcions for $\int \lfloor x \rfloor dx$ but we believe we found simple closed form agreeing with experimental data.

Define $i_1(x)=x - \frac12 i \frac{\log{(-e^{-2 i \pi x} )}}{\pi} - \frac12$

For real $x$ we have $\lfloor x \rfloor=i_1(x)$ where $\log$ means the principal branch of the logarithm.

We have $\int \lfloor x \rfloor dx= \int i_1(x) dx=I_1(x)=\frac{1}{2} \, x^{2} - \frac{1}{2} \, x + \frac{\log\left(-e^{\left(-2 i \, \pi x\right)}\right)^{2}}{8 \, \pi^{2}}$

To get rid of complex number, one may use $i_2(x)=x + \frac{\arctan\left(\cot\left(\pi x\right)\right)}{\pi} - \frac{1}{2}$, but sagemath dislikes division by zero, which works fine in mpmath.

Q1 Is this closed form correct, do branches of $\log$ cause problem?

Q2 Why Wolfram Alpha claims there is no closed form?

Added: In answer Carlo Beenakker gave simpler closed form. It is consistent with our result up to a constant of integration.

$\endgroup$
1
  • $\begingroup$ Q2: Alpha does not claim there is no closed form; merely that it did not find one. $\endgroup$ Commented Jan 18, 2023 at 13:29

1 Answer 1

5
$\begingroup$

Q: What is a simple closed form of the integral of the floor function?

The simplest formula I know is

$$\int \lfloor x \rfloor dx=\tfrac{1}{2} \lfloor x\rfloor (2x-\lfloor x\rfloor -1).$$

No need to consider branches of log of a complex number.

$\endgroup$
1
  • $\begingroup$ Thanks. Your result is consistent with ours up to a constant of integration. $\endgroup$
    – joro
    Commented Jan 18, 2023 at 12:56

Not the answer you're looking for? Browse other questions tagged .