Changing a piecewise function into a periodic function [duplicate]

This question already has an answer here:

How to plot periodic function’s graphic?

5 answers

I have:

f[x_] := Piecewise[{{x, 0 <= x < 1}, {2 - x, 1 <= x < 3}, {x - 4, 3 <= x < 4}}] Plot[f[x], {x, 0, 4}] Which produces this plot: I'm looking for a simple way to convert this into a periodic function so that this image repeats itself every 4 units, in either the positive or negative direction along the x-axis. Anybody have an idea? ================= ================= 1 Answer 1 ================= f1[y_] := f[Mod[y, 4]] Plot[f1[x], {x, -8, 8}]      Is that a Plot1 there instead of a Plot? And, after I changed it to a Plot, I got your plot, by mine had breaks in it. I can post it if you want. – David Feb 9 at 4:43      @David Sorry, finger misplaced. You may get those blanks disappearing by increasing the PlotPoints Option – Dr. belisarius Feb 9 at 5:00