I’m trying to create a function which will replace elements of a list with their values modulo 1, i.e.
Mod[x,1], but only if
Abs[x]>1. So, for example, the function would yield:
I’m trying to do this in an elegant way. For example, I have a function for a related purpose:
C1[v_] := v /. _?Negative -> 0;.
This replaces negative elements of a list with 0, and it’s very clean.
I’d like to do something similar. My efforts so far have included breaking it into two functions:
CLim[x_] := Mod[x, 1] /; Abs[x] > 1;
C2[v_] := CQubitLim /@ v; But then, when I apply
C2 to a list, it only seems to apply on some elements, for example
My other idea was to use a conditional rule
But this doesn’t seem to evaluate when I put a vector through it.
Any ideas much appreciated.