Maximize a sum of sinusoids with comensurable periods

214 Views Asked by At

I'm writing a program that requires finding $$\text{argmax}_\theta\sum_{k=1}^na_k\cos(k\theta+b_k),$$ where $a_k$ and $b_k$ can be any real numbers. How can I do this efficiently?

1

There are 1 best solutions below

2
On

I've decided to take the FFT, find the maximum element, and use the result as a starting point for local optimization. This gives the right answer as long as the high-frequency elements are relatively small (otherwise I can just increase the resolution of the FFT), and the runtime is $O(n\log n)$.