# Fourier integral/ Fourier transformation of an oscillatory function with FFT

$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)?

-
What is a 'Fourier pair'? –  copper.hat May 9 '12 at 16:32
@copper: one's a Fourier transform of the other, apparently... –  Ｊ. Ｍ. May 9 '12 at 16:36