I wrote this function NFourierTransform, which takes a function $f(k)$ and numerically calculates the fourier transform integral for discrete values of $k \in [k_{\text{min}},k_{\text{max}}]$, finally returning an InterpolatingFunction object.
NFourierTransform[f_Function, {kmin_, kmax_}] := Interpolation@ Table[{k, Chop@NIntegrate[f@x E^(-I k x), {x, -Infinity, Infinity}]}, {k, kmin, kmax, (kmax - kmin)/100}] In my application (calculating the time propagation of wave functions) I need to evaluate NFourierTransform for a function $\psi(k,t)$, where $t$ assumes discrete values in some interval $[t_{\text{min}},t_{\text{max}}]$. So effectively I create a table of NFourierTransform.
TimePropagate[f_Function, kl : {kmin_, kmax_}, {tl__}] := Quiet@Table[ NFourierTransform[f[#] Exp[-(#^2/2) t] &, kl], {t, tl}] Calculating a very simple example with only 2 time values, e.g. TimePropagate[Exp[-Abs@#] &, {-3, 3}, {0, 0.1, 0.1}] takes about 20 seconds to evaluate.
Is there any way to use Compile to speed up the calculations? As far as I know that's only possible for numeric function arguments. What are, in your experience, suitable setings for NIntegrate options such as MaxRecursion or AccuracyGoal, and how do they effect evaluation time?
t. Each value fortis inserted, and the integration is over some variablex, wherekranges fromkmintokmax. $\endgroup$Fourier). I'm much more comfortable with continuous FT. $\endgroup$Fourieris surely a fast way. Meaning, a maximum frequency in which the function has a not too small fourier transform, and a maximum time in which the function is not too small. $\endgroup$