Function search: f(x) = 1 if x is real and x is in [2n - 5/2, 2n - 3/2], n an integer; -1 otherwise

That's good. The one I had in mind was a modification of these, which avoid the trig:

A square wave can also be generated using the floor function directly:​
[imath]{\displaystyle x(t)=2\left(2\lfloor ft\rfloor -\lfloor 2ft\rfloor \right)+1}[/imath]​
and indirectly:​
[imath]{\displaystyle x(t)=\left(-1\right)^{\lfloor 2ft\rfloor }.}[/imath]​

But your choice is up to you.
 
Top