# perform fourier-type integration using DFT misunderstanding

I need to perform the following integral ($$i^2 = -1$$) (with a fixed value of $$m$$):

$$\int_{\phi=0}^{\phi=2\pi} \psi(\phi) e^{-im \phi} \hspace{0.7mm} d\phi$$

for all values of $$m$$ in $$\{-N_{\theta}, -N_{\theta}+1, ..., 0, 1, ..., N_{\theta}-1, N_{\theta} \}$$, that would be $$2N_{\theta} + 1$$ naive calculations of the above integral (plug $$m$$ into the formula and use Riemann sums, for example), each time with a different value of $$m$$. $$N_{\theta}$$ is an integer $$> 0$$.

I recognize the above as a Fourier Transform from $$\phi$$ to $$m$$.

How could I use the DFT (i.e. scipy's FFT implementation) to help me perform the integral above?

[ I have the function $$\psi$$ evaluated at equidistant points $$\phi_j$$ for $$j \in \{0, 1, ..., 2N_{\theta} \}$$ in memory. ]

My problem is that reading the scipy's documentation, it outputs a result of the form: $$I(m_x) = \sum_{j=0}^{j=M-1} \psi(\phi_j) \hspace{0.8mm} e^{-i \frac{2\pi x}{M} j}$$, with $$x \in \{ 0, 1, ..., M-1 \}$$, thus I cannot get results for $$m_x = - 20$$ or $$m_x = -15$$ or any other negative value of $$m_x$$, because $$x$$ is $$\geq 0$$ in the scipy's implementation. I define $$m_x = \frac{2\pi x}{M\Delta_{\phi}}$$

Am I missing something obvious?

Thank you!

Yes. The FFT implements the DFT (Discrete Fourier Transform) which is periodic in both time and frequency. So we simply have $$X(-k) = X(N-k)$$ or more generally $$X(-k) = X(mN-k), m \in \mathbb{Z}$$, where $$N$$ is the FFT length.
• the more general equality you wrote does not agree with the first equality you wrote, for any m value? probably a typo Aug 18, 2022 at 12:51