Let $b\in(0,\pi)$, and let $k\in\mathbb{Z}$.
Find a function $f:\mathbb{R}\to[0,1]$ with:
- The set of zeros $f_0=\{x:x=2k\pi\pm b\}$
- The set of ones $f_1=\{x:x=2k\pi\}$
- The set of negative ones $f_{-1}=\{x:x=(2k+1)\pi\}$
In other words, what I'm looking for is some kind of wave function with the zeros adjusted to be closer to one peak or the other, without changing the amplitude. Here's a visual example:
In this case, $b$ would be somewhere around $2$ or so.
Can you help me figure out what this function $f$ is?


On the interval $[-\pi, \pi]$ you get such a wave by putting $$f(x) = \cos(\pi \cdot (|x|/\pi)^{\log_{b/\pi}0.5}).$$
Now copy the period $[-\pi,\pi]$ by a piecewise definition, which one could probably hide by using the floor/remainder functions or something like that.
Note however that for $b<\pi/2$, this function is not differentiable at $0$. To remedy that, one might use one of the infinitely differentiable bump functions inside there, instead of my crude powers of an absolute value, to go smoothly from $0$ to $1$ and crossing the value $1/2$ exactly at $b$.
Update: With the mollifier functions
$$h_r(x) = e^r \cdot \exp\left(\dfrac{-r}{1-(\frac{x}{\pi}-1)^2}\right)$$
the functions
$$f_r(x) = \cos(\pi\cdot h_r(|x|)$$
do the job smoothly, where you just have to compute the right $r\in (0, \infty)$ to match your $b$. Actually, since you want $h_r(b) = \frac12$, you must set
$$r := \dfrac{-\log(2)\cdot(\frac{b^2}{\pi^2}-\frac{2b}{\pi})}{1+\frac{b^2}{\pi^2}-\frac{2b}{\pi}}$$