Establish a trigonometry-based $floor$ function

427 Views Asked by At

I have established the following function for calculating $floor$:

$$f(x)=x-\frac{1}{2}-\frac{\arcsin(\sin(\pi(x-\frac{1}{2})))}{\pi}$$

It works correctly for all real values in the range $[2N+0,2N+1)$, for every integer $N$.

It works incorrectly for almost all real values in the range $[2N+1,2N+2)$, for every integer $N$.

I believe that I can work it out by changing the domain of $x$, though I can't quite figure out how...

Any ideas?


Please see a few examples below:

  • $f(2.0)=2.0 = \lfloor 2.0 \rfloor$
  • $f(2.1)=2.0 = \lfloor 2.1 \rfloor$
  • $f(2.2)=2.0 = \lfloor 2.2 \rfloor$
  • $f(2.3)=2.0 = \lfloor 2.3 \rfloor$
  • $f(2.4)=2.0 = \lfloor 2.4 \rfloor$
  • $f(2.5)=2.0 = \lfloor 2.5 \rfloor$
  • $f(2.6)=2.0 = \lfloor 2.6 \rfloor$
  • $f(2.7)=2.0 = \lfloor 2.7 \rfloor$
  • $f(2.8)=2.0 = \lfloor 2.8 \rfloor$
  • $f(2.9)=2.0 = \lfloor 2.9 \rfloor$
  • $f(3.0)=2.0 \neq \lfloor 3.0 \rfloor$
  • $f(3.1)=2.2 \neq \lfloor 3.1 \rfloor$
  • $f(3.2)=2.4 \neq \lfloor 3.2 \rfloor$
  • $f(3.3)=2.6 \neq \lfloor 3.3 \rfloor$
  • $f(3.4)=2.8 \neq \lfloor 3.4 \rfloor$
  • $f(3.5)=3.0 = \lfloor 3.5 \rfloor$
  • $f(3.6)=3.2 \neq \lfloor 3.6 \rfloor$
  • $f(3.7)=3.4 \neq \lfloor 3.7 \rfloor$
  • $f(3.8)=3.6 \neq \lfloor 3.8 \rfloor$
  • $f(3.9)=3.8 \neq \lfloor 3.9 \rfloor$
  • $f(4.0)=4.0 = \lfloor 4.0 \rfloor$
2

There are 2 best solutions below

32
On

The problem with sine is that it is not monotone on its period. I would therefore use tangent instead. Try $x-\arctan(\tan(x))$. This should be locally flat. By rescaling the variables you should be able to get the floor. Of course, there are points where this is undefined, but it works for almost all points :-)

8
On

You will not be able to do this successfully without making some pretty major changes.

Reason: polynomials, sine and inverse sine are all continuous at all points of their domain. So any sums, differences, products, quotients and compositions of these functions will also be continuous. The sort of expression you are currently looking at, therefore, even if you make some minor adjustments, will never equal the floor function.