J
Jim Thompson
Try thinking of it as an analogue opamp problem,
with a Vin and a Vout.
Offset Vin by -0.5, full wave rectify it, correct
for the offset.
Vout = 0.5 - ABS(Vin - 0.5).
Vin Vout
0.1 0.1
0.2 0.2
0.3 0.3
0.4 0.4
0.5 0.5
0.6 0.4
0.7 0.3
0.8 0.2
0.9 0.1
1.0 0.0
That might be the answer, BUT with NEARLY ideal diodes.
My expression, N - Round(N), works by itself, but the sharp
discontinuities cause insurmountable convergence issues.
...Jim Thompson