Given a quasi-periodic trigonometric function $f(x)$, is there a systematic way of 'zeroing out' all values where $f(x)\ne1$?
For example, consider the function
$$\sum_{n=0}^m \frac {1}{2n+1} \sin (n^\frac {1}{\pi}) \pi x$$
The function has period $m$, and becomes aperiodic as $m \rightarrow \infty$. This is the plot for $m=20$:
Ideally what I'd like to do (not just with this function, but in general) is is to add a modifier to any $f(x)$ of this general type to create a new function $g(x)$ that, in the limit, produces
$$ f(x)\begin{cases} =1 \rightarrow g(x)=1\\ \ne1 \rightarrow g(x)=0 \end{cases}$$
A wild long-shot, I suspect. But I'd appreciate any suggestions.
