I am trying to solve a difference equation using RecurrenceTable as follows.
xhat0 = {0.00000001, 256};
boxedx[x_] := Piecewise[{{-2, x < -2}, {2, 2 < x}}, x]
SetAttributes[boxedx, Listable];
test = RecurrenceTable[{xhat[n] == boxedx[xhat[n - 1]],xhat[0] == xhat0}, {xhat}, {n, 1, 4}]
If I remove the boxedx function acting on the right hand side, or replace it by a built-in function such as Sqrt, the code works. I tried the definition
boxedx[x_List] := Map[Piecewise[{{-2, # < -2}, {2, 2 < #}}, #] &, x]
which also resulted in a numerical exception. And if I write the equality as
xhat[n] == xhat[n - 1] + {1, 1}
a numerical exception happens again. I would appreciate any help!