1

I need a function $f(x)$ that gives either $-1$ or $1$ based on $x$.

eg.

  • when $x = 26$ it should give me $1$,
  • when $x = 27$ it should give me $-1$,
  • when $x = 28$ it should give me $1$,

and so on.

I know it had something to do with modulas(reminders of division), but i can't get it.

user
  • 154,566

1 Answers1

1

What about this one (plot)

$$f(x) = 1-2\lfloor x \rfloor+4\lfloor x/2 \rfloor$$

enter image description here

user
  • 154,566