In a previous question, link, I asked about how I could most effectively do a Fourier Transform of a radial function given at certain values and which we knew the asymptotical behaviour of. The Fourier transform reading
$$\frac{4\pi}{q}\int^{\infty}_0 dr\, r \sin(qr) f(r).$$
I tried several ways and ended up choosing FFT, which approximates it by calculating the DFT over the interval $[0,\Delta r]$ with $N$ points. (I used more particularly the NAG subroutine C06FAF
)
I still get some issue around $q=0$. Indeed, as can be seen on the figure , I have some weird peak at very low frequencies. The black curve that is flat in q=0
is the analytical result while other curves are FFT calculations with increasing $\Delta r$. ($\color{blue}{\Delta r} >\color{red}{\Delta r} > {\bf \color{black}{\Delta r}} > \color{magenta}{\Delta r} $ and the dashed one being the highest $\Delta r$). As can be seen, this peak is narrower when $\Delta r$ gets larger.
The question is from where this peak does come ? And how could I get rid of it ? I already tried to take the mean of the function and substract it to the function but it does not change anything.
One subsidiary question is also the following : the subroutine calculates the integral. I then have to divide by $q$ to get this $4\pi/q$ factor. Though, at $q=0$, this can't be done for obvious reasons. So, what can be done instead ?
EDIT : the problem of the wide peak was simply due to the fact that I was doing a bad conversion between $q$ and the frequency from the routine. As far as the problem of the division by $q=0$ is concerned, I'm happy with Endulum
's answer.