-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unwanted sine modes appearing in convolution using FFT #313
Comments
You aren't computing a Fourier transform. You're computing a discrete Fourier transform, which has (a) discretization and (b) periodic boundaries. Invariably, one of these two facts explains the differences that people see compared to analytical Fourier transforms and integral convolutions. |
Thanks for your reply @stevengj. Just to clarify a few things:
I guess my only question is: is this issue just inherent to doing a discrete fourier transform and, as such, can never be eliminated? |
What I can tell you is that the FFT calculation is correct; it has been tested for decades now, and nothing in your issue leads me to believe that there's anything new here. If you have a bug in your math it is elsewhere, but it's not something I have time to help you with. |
Hi All, I don't know if this is an issue with FFTW.jl specifically or something that I've done, but any guidance that could be provide will be appreciated. I've also posted this issue in FastTransforms.jl in case the issue originates from their package: JuliaApproximation/FastTransforms.jl#257
To give a little bit of background, I'm trying to perform the following convolution (nV, r and r' are vectors):
Where rho(r) is a profile which looks like (I've made sure it's periodic):
I have obtained an analytical expression for the fourier transform of the last two terms in the integral as:
If I use just regular Float64, the resulting nV profile looks fine:
Except when I zoom in:
While these values are small, in a later part of my code, I need to divide this profile by a small number which makes this 'noise' blow up and affects calculations downstream.
I tried using FastTransforms.jl since it would let me go to higher precision. However, even when I use BigFloat, although it removes the noise, some unphysical oscillations remain:
Im no longer certain that these remaining oscillations are due to floating point errors. I also call these oscillations unphysical as, aside from the nature of this convolution integral, if I perform this convolution integral manually, the oscillations disappear completely (and I'm able to obtain the integral to higher precision).
Am I doing something wrong in the way I'm performing the convolution integral? Thanks!
I've attached an MWE below:
The text was updated successfully, but these errors were encountered: