Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

$f(x) = \cos(x^2)$ and $g(k) = \sqrt\pi \cos((\pi k)^2 - \pi/4)$ are a Fourier pair.

I want to reproduce $g(k)$ by Fourier integrating $f(x)$ using FFT, i.e.

approximating Integrate[ f(x) * exp(2 pi * ikx), {x, -inf, inf} ]

with Sum[ fn * exp(2 pi * ik x_n), {n, 0, N-1} ] * Delta_x

However the result agrees with $g(k)$ only on very small $k$ ranges if it agrees at all (the same code works well for smooth Fourier pairs e.g. the Gaussian functions). I guess the problem is choosing appropriate values for N and Delta_x. Are there any established rules for how to choose them? Where can I find related topics in literature (I've read Numerical Recipe section 13.9 but it does not seem to solve my problem)?

share|improve this question
What is a 'Fourier pair'? –  copper.hat May 9 '12 at 16:32
@copper: one's a Fourier transform of the other, apparently... –  J. M. May 9 '12 at 16:36
add comment

1 Answer

up vote 1 down vote accepted

I'd be surprised if you can make this work well. The smooth pairs are not only smooth; the smoothness of one function implies the rapid decay of the other, whereas these functions don't decay at all. You need a bit of sophisticated theory to even make these Fourier transforms well-defined because the naive integrals don't converge, so it's unlikely that you can approximate them well by a finite sum.

share|improve this answer
I am still wondering that, since these Fourier transforms are still "well defined" in some sense, shouldn't a dense sampling of N>>1 cycles of f(x) give a good approximation of g(k) for k<klim, with klim determined by the density of the sampling? Naively I expect klim ~ 1/delta_x, but in reality klim is much smaller than that... You are right that the actual klim should have to do with the converging property of the Fourier integral. Is there perhaps a way to quantify this? –  user1342516 May 10 '12 at 11:51
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.