# Revision history [back]

### Alternative to piecewise functions?

If I only need indicator functions (the function is 1 in an interval [a, b], 0 outside of it). Is there an alternative to piecewise functions (with all their issues like plotting), which I can use? Thank you!

### Alternative to piecewise functions?

If I only need indicator functions (the function is 1 in an interval [a, b], 0 outside of it). Is there an alternative to piecewise functions (with all their issues like plotting), which I can use? Thank you!

EDIT: Ok, I had an idea:

indicator(x,a,b)=(sign(x-a)-sign(x-b))/2


That does pretty much what I want.