0
$\begingroup$

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.

$\endgroup$
  • 1
    $\begingroup$ The floor of an integer is itself, simple as that. $\endgroup$ – Parcly Taxel Jul 23 '18 at 9:13
  • 1
    $\begingroup$ If $x$ is an integer then $\lceil x \rceil=x$. $\endgroup$ – lulu Jul 23 '18 at 9:14
  • 3
    $\begingroup$ Somewhat heuristically, you cannot compose "nice" functions to make a floor function that works everywhere, because "nice" functions are continuous on their domains, and the floor function is not. (Note that the version of the floor function described above is continuous, because the points where it would be discontinuous are not part of the domain.) $\endgroup$ – Mees de Vries Jul 23 '18 at 9:18
  • $\begingroup$ @MeesdeVries I tried using a dirac-delta to fill in the removable discontinuities (see answer). I'm a simple boy: I see dirac, I use dirac. $\endgroup$ – McMath Jul 24 '18 at 5:36
  • $\begingroup$ @ParclyTaxel the problem is that the function in the question stem becomes undefined at integer values of x. Hope this helps. $\endgroup$ – McMath Jul 24 '18 at 5:37
0
$\begingroup$

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.

$\endgroup$
0
$\begingroup$

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.

$\endgroup$
  • $\begingroup$ there's one minor problem with this approach: the definition of the floor in the question breaks down for integer x. Thus, x+1 is an integer, and the problem persists. $\endgroup$ – McMath Jul 24 '18 at 5:07
  • $\begingroup$ The floor of an integer, is the integer of it self. So if $x \in \mathbb{Z}$, then $x+1 \in \mathbb{Z}$, so $\lfloor x+1 \rfloor := x+1$. Hence, if $x$ is an integer, the interval is $[x,x+1]$, and the average is clearly in it. $\endgroup$ – user518441 Jul 24 '18 at 5:35
  • $\begingroup$ I know the definition of "floor"; it's what Raymond describes. The mess in the question happens to equal the floor when $x \notin \Bbb Z$, but so what? My answer provides a way to compute the thing asked for in the question; it uses the well-known "floor" function. That's not what you asked for in the body of the question, but as I said, there's unlikely to be any solution to the problem as written in the body. $\endgroup$ – John Hughes Jul 24 '18 at 18:30

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.