I'd like to write a smooth ($C^{\infty}$), periodic function $f(x)$ with a fundamental cycle that looks like this:
I include no scale because I'm only interested in the signs of $f(x)$, $f'(x)$, and $f''(x)$, that is, I'd like the signs of the value, slope, and concavity of $f(x)$ to match those from the picture at each $x$ throughout the fundamental domain. One non-smooth answer that achieves this is
$$f(x)=\begin{cases}1-\cos(x)&0\le x\text{ mod }4\pi \le2\pi\\-1+\cos(x)&2\pi\le x\text{ mod }4\pi \le4\pi\end{cases}$$
This is not smooth at multiples of $2\pi$. I imagine Fourier series may be helpful, though I'm not well-versed in them. Maybe there is some simple (finite) linear combination of sines and cosines that achieves the desired effect, and I just can't see it. Thanks!
