Sum of cosines as squashed as possible I have 10 cosine waves of the form $\cos(2\pi(x f_n+\varphi_n))$, where $f_n$, the frequency, is an integer from 1 to 10 and $\varphi_i$, the phase, is a number from 0 to 1:

$$s(x) = \sum\limits_{n=1}^{10} \cos\left(2\pi (x n+ \varphi_n)\right),
\quad \varphi_i \in [0,1]$$

If I set all the phases to 0, $m = \max\limits_x \lvert s(x)\rvert$ peaks as high as 10. All phases at 0.25 peaks at 7.596. Setting the phase to any linear function of freq just moves the waveform, keeping the peak the same. But making the phases random can sometimes get the peaks below 5!

Is there a more systematic way (other than picking random phases and hoping for the best) to minimize the peak of these cosines?

Edit:
I think the peak has to be bigger than $\sqrt{5}$ (amplitude of square wave with same RMS as signal above). Also, after 3 million attempts of brute force guessing, the lowest peak was 3.576. The phases still don't have any sort of pattern to them, though.
You can get pretty good results with an approximate linear chirp spread out over the period:

$$s(x) = \sum\limits_{n=1}^{N} \cos\left(2\pi \left(x n+ \frac{n^2}{2\times N}\right)\right), \quad N=10$$

$$m \approx 4.28$$



Group delay is the derivative of the phase with respect to frequency. For a linear (frequency as function of time) chirp, the phase should be a quadratic function of frequency. With discrete frequencies we don't get exactly that, but all frequencies seem to roughly find their slot in time if we sample the phase function. I wonder if a ping pong chirp would be possible here and if it would give a flatter envelope.