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:​
x(t)=2(2ft2ft)+1{\displaystyle x(t)=2\left(2\lfloor ft\rfloor -\lfloor 2ft\rfloor \right)+1}
and indirectly:​
x(t)=(1)2ft.{\displaystyle x(t)=\left(-1\right)^{\lfloor 2ft\rfloor }.}

But your choice is up to you.
 
Top