| 1 | initial version |
As another option, you can define side as follows:
side(u) = 2*unit_step(u) - 1
Hence
sage: [side(a) for a in range(-2,3)]
[-1, -1, 1, 1, 1]
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.