Many thanks. This works brilliantly. Although this is not a problem I currently face, suppose I want to do something similar where PSI[x_] is a step function with finitely many steps. But suppose that these steps are not conveniently organized in such a way that we can use UnitStep[clever function] to do what we want. Is our only option the less-than-optimal Which call?