Grapher on macOS – Plotting Periodic Functions Beyond Trigonometric

graphgraphermacos

That is, something like:

f(x) = f(x+c)

Where c is an arbitrary constant. Examples:

enter image description here

How might I get grapher to chart this or select an appropriate tool to visualize these functions?

Best Answer

Yes, indeed it can:

  • Square wave: try something like y = (-1)^round(x)(but with proper formatting). Something like y = (round(x+0.5) - round(x)) - 0.5 would also work.

  • Sawtooth wave: try something like y = x mod 1 or, more elaborately, y = 2((x-0.5) mod 1) - 1. However, something like y = x - round(x) would also work. If you don't like any of these, try something like y = x - floor(x).

The triangular wave is left as an exercise to the reader ;-)

Of course, you can also use the truncated Fourier series, but that may be too wiggly for your taste.