I have a very long expression involving a sum of exponentials, say:
Sum[(RandomReal[] + RandomReal[] a) Exp[2 I ii x Pi], {ii, -10, 10}]
I want the fastest way to get the list of Fourier coefficients. The Naive ways are pretty time-consuming:
Table[FourierCoefficient[f, x, ii], {ii, -10, 10}]; // Timing (*3.49906 *)
Table[1/(2 Pi) Integrate[f Exp[-ii I x], {x, -Pi, Pi}], {ii, -10,
10}]; // Timing (*7.3649*)
Is there a way to make it faster?