I would like to generate (i.e. repeatedly compute via a computer) a random periodic function $f(x)$ with period $T$ such that $|f(x)| \leq M$ and the kth Fourier coefficient $|A_k| \leq g(k)$ for a given $g(k)$.
I realize this is kind of open-ended (I'm not giving any information about probability distributions), but is there any way to go about doing this in a way that makes sense?
Here's an example using IPython to plot $$f(\theta)=\cos \theta+\tfrac{1}{2}\cos(3\theta+0.23)+\tfrac{1}{2}\cos(5\theta-0.4)+\tfrac{1}{2}\cos(7\theta+2.09)+\tfrac{1}{2}\cos(9\theta-3)$$
th = np.arange(0,1,0.001)
f = lambda th: np.cos(th*2*np.pi)
plt.plot(th,f(th)+0.5*f(3*th+0.23)
+0.5*f(5*th-0.4)+0.5*f(7*th-2.09)+0.5*f(9*th-3))
plt.ylim([-3, 3])
plt.grid('on')
You'll note that $\sum |A_k| = 3$, which implies that $|f(\theta)|<3$, but here the maximum amplitude is around 2.5, because the harmonics never completely add constructively.
So suppose I just want to choose a function $f(\theta)$ such that $|f(\theta)| \leq M = 1.5$ with $|A_1| = 1$, $A_k \leq \frac{1}{2}$ for odd $3 \leq k \leq 21$, and $A_k = 0$ for all other k.
The bound for M is much smaller than the sum of the upper bound of the amplitudes (6.0), and I don't want to turn a random generation problem into a heuristic rejection algorithm.