I would like a function of t, where t is an integer increasing over time, that an average person could compute in their head that results in a sequential, oscillating sequence of integers. For example:
0, 1, 2, 3, 4, 5, 6, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3...
I have a function that almost computes what I want using sine (it doubles up on the peaks and valleys), but given a value for t, most humans cannot compute sine in their head.
x = floor(4*sin(t/4 + 5.5) + 1
I've been playing around with mod operation. Mod nicely builds a cycle, obviously, but I haven't been able to figure out a modification to avoid the discontinuity -- basically, I want to reverse every odd sequence of the mod cycle.
Is there a function that satisfies my requirements? Duplicating the peaks and valleys is acceptable, but I'd prefer to avoid that. Bonus points if you can express the function in terms of min and max, the top and bottom integers of the cycle!