4
$\begingroup$

I have been using this formula which I determined for myself for quite some time now for use in everything from the sgn() function to the Kronecker delta to the ceiling and NINT() functions but haven't quite pinned down why it works or what its limitations may be. Can anyone elaborate as to why this works at all (not strictly how to derive it as I've done that myself, but what limitations the expression on the right may have which may prevent this from being a strict equality)? I've found this to be of much practical utility, but wouldn't want to use it if indeed it harbors some unforeseen limitation. Many thanks supposing this gets read. - Matt Miller :)

$$\lfloor x \rfloor = x - (\frac{1}{2}) + (\frac{1}{\pi})\sum_{k=1}^\infty (\frac{1}{k})sin(2k\pi x) = x - (\frac{1}{2}) - (\frac{i}{2\pi})ln(-e^{-i2\pi x}), x \ne [0,1,2…n]$$

And:

$$\lfloor x \rfloor = 1 + x - (\frac{1}{2}) - (\frac{i}{2\pi})ln(-e^{-i2\pi x}), x = [1,2...n]$$


From the comments below, it's been shown that the above fails to work at x=0 and is shifted from x to f(x) = n-1 when x is an exact integer 'n' for which I've heavily edited the original post to correct the formula.


Borrowing from @gammatester and @barakmanos I've devised a simple fix to the above formula, though this work-around doesn't exactly cooperate with all computer implementations (due in large part to the composition of functions involved) it demonstrates the point to my mind:

Given (courtesy @barakmanos):

$$f(x) = x - (\frac{1}{2})((\frac{1}{i\pi})ln(e^{i2\pi(x-(\frac{1}{2})})+1)$$

For:

$$ \lceil x \rceil = - \lfloor - x \rfloor $$

And:

$$ \lceil x \rceil = \lfloor x \rfloor, x \in \mathbb{Z}$$

And:

$$ \lceil x \rceil - \lfloor x \rfloor = 1, x \in \mathbb{R}/\mathbb{Z}$$

One obtains:

$$\bbox[5px,border:2px solid red] {\lfloor x \rfloor = f(x) - f(-f(-x)-f(x)), x \in \mathbb{R}}$$

Note: I think it's important to emphasize one should expect the correct results if the terms inside the brackets are independently evaluated first and then the composition is taken. There is a chance I may have made a mistake I'm unable to see myself, otherwise this is working for me as it's written though I've reformulated it for my own purposes in other applications (be very careful trying to simplify this expression for use in, say, a symbolic programming language).

$\endgroup$
  • $\begingroup$ This is obviously wrong for $x=0:\,$ the sum is zero, so your formula will give complete non-sense: $\lfloor 0 \rfloor = -\frac{1}{2}$ $\endgroup$ – gammatester Jun 3 '16 at 10:53
  • $\begingroup$ I've been using $\lfloor{x}\rfloor=x-\frac12\left(\frac{\ln\left(e^{2\pi i\left(x-\frac12\right)}\right)}{\pi i}+1\right)$, which works because $e^{2\pi i\left(x-\frac12\right)}$ has a period of $1$. $\endgroup$ – barak manos Jun 3 '16 at 10:55
  • $\begingroup$ @gammatester Can that one exception be removed, like in the comment below yours? I suppose I've never had need to use it at x=0. Thanks for pointing that out. $\endgroup$ – Matt Miller Jun 3 '16 at 11:04
  • $\begingroup$ @barakmanos That seems to work just fine, and I can see how I could get from my formula to yours. Very cool! :) $\endgroup$ – Matt Miller Jun 3 '16 at 11:09
  • $\begingroup$ @barak manos: IMO (if Maple and I are correct) your formula would give $\lfloor 0 \rfloor = -1$ or $\lfloor 2 \rfloor = 1$ etc $\endgroup$ – gammatester Jun 3 '16 at 11:10
4
$\begingroup$

The function $g(x):= \lfloor x\rfloor-x$ is a periodic function of period $1$ with a jump discontinuity at the integers, but which is nice, even linear, otherwise.

Therefore $g$ has a Fourier development converging to $g(x)$ at all noninteger points, albeit only conditionally, since the jump discontinuity causes the Fourier coefficients to be of order $O(n^{-1})$.

At the integer points the series converges as well, namely to the arithmetic mean between the one-sided limits of $g$, whatever value you have chosen for $g$ at these points.

The periodic function with a single jump per period, and linear between jumps, is the standard example to study the so called Gibbs' phenomenon.

$\endgroup$
3
$\begingroup$

let $$x \in \mathbb{R} \setminus \mathbb{Z} : \quad f(x) = \lfloor x \rfloor -x +\frac{1}{2},\qquad\qquad\qquad k \in \mathbb{Z} : \quad f(k) = 0 $$ there is the Fourier series representation $$f(x) =\sum_{n=1}^\infty \frac{\sin(2 \pi n x)}{\pi n}$$ so that from the Taylor series of $-\log(1-z)$ around $z = 0$ and Abel's theorem $$f(x) = \text{Im}\left[\sum_{n=1}^\infty \frac{e^{2 i \pi n x}}{ \pi n}\right] = \text{Im}\left[\frac{-\log(1-e^{2 i \pi x})}{\pi }\right]$$ choosing the usual branch of $\log(z)$ : analytic on $\mathbb{C} \setminus [0,-\infty[$ and $\log(1) = 0$.

let $$g(z) = \frac{-\log(1-e^{2 i \pi z})}{ \pi }$$ it is analytic on $Im(z) > 0$ since $|e^{2 i \pi z}| < 1$, and $$f(x) = \lim_{z \to x, Im(z) > 0} \ \ \text{Im}[g(z)]$$

so that with $h(z) = g(z) + z - \frac{1}{2}$ : $$x \in \mathbb{R} \setminus \mathbb{N} : \qquad \qquad \lfloor x \rfloor = \lim_{z \to x, Im(z) > 0} \ \ \text{Im}[h(z)]$$

$\endgroup$

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.