Given some $x ∈ ℝ$, find some $y ∈ ℝ: x < y < \left \lfloor {x+1} \right \rfloor $

78 Views Asked by At

Motivation:

This Wolfram webpage suggests that you can represent a floor function analytically as:

$$\left \lfloor x \right \rfloor := x + \frac{\tan^{-1}(\ \cot(\pi x) \ )}{\pi} - \frac{1}{2} \ \\ \forall x ∈ ℝ \backslash ℤ $$

which is valid whenever x is not an integer.

Yes, it works (and I'm amazed).


However, I'd like to safely use the function even when x is an integer, hence the question. It's not hard per-se, my brain just doesn't like me right now.


I appreciate any guidance you have to offer.

2

There are 2 best solutions below

3
On

A simple solution to the problem stated in the question title, rather than in the paragraph below, is $$ y = \frac{x + \lfloor x+1 \rfloor}{2}. $$

Mees de Vries's comment explains nicely why you're not likely to find a "pretty" answer in terms of known continuous functions.

0
On

The function:$$\left \lfloor x \right \rfloor := x + \frac{\tan^{-1}(\ \cot(\pi x) \ )}{\pi} - \frac{1}{2} \ \\ \forall x ∈ ℝ \backslash ℤ $$

breaks down for x ∈ ℤ because $\cot(\pi x) $ does not exist.

A potential fix is to add a function $\phi(x)$ that only turns on when x is an integer.

Thus:

$$\left \lfloor x \right \rfloor := \phi(x) + x + \frac{\tan^{-1}(\ \cot(\pi (\phi(x)+x)) \ )}{\pi} - \frac{1}{2} $$

where

$$ \phi(x):=\frac{1}{4}\int_{-1}^{\cos(2\pi x)-1}{\delta(\tau)\ d\tau} \ + \ \frac{1}{4}\int_{1-\cos(2\pi x)}^{1}{\delta(\tau)\ d\tau}\ $$

and $x∈ℝ$, which gets the job done.

You could probably write $\phi(x)$ using unit step functions.


The dirac-delta functional is technically a distribution, so maybe I cheated a little.

Best.