Ask Your Question

# Revision history [back]

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]