# Numerical computation of continuous Fourier transforms

**URL:** <https://discourse.julialang.org/t/numerical-computation-of-continuous-fourier-transforms/77999>\
**Category:** Numerics\
**Tags:** question, package, integral\
**Created:** [March 16, 2022, 11:13pm UTC](https://discourse.julialang.org/t/numerical-computation-of-continuous-fourier-transforms/77999 "2022-03-16T23:13:07Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![DanielVandH](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/danielvandh/32/31134_2.png) [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Post date:** [March 16, 2022, 11:13pm UTC](https://discourse.julialang.org/t/numerical-computation-of-continuous-fourier-transforms/77999/1 "2022-03-16T23:13:07Z")

</div>

Are there any packages available for computation of Fourier transforms of the form F(x\_k) = \int\_{-\infty}^\infty f(t)\mathrm{e}^{-\mathrm{i}tx\_k}\,\mathrm{d}t? e.g. the method developed by DBailey and Swarztrauber ([The Society for Industrial and Applied Mathematics](https://doi.org/10.1137/0915067)). The function f(t) is rapidly decaying.

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [March 17, 2022, 12:50am UTC](https://discourse.julialang.org/t/numerical-computation-of-continuous-fourier-transforms/77999/2 "2022-03-17T00:50:16Z")

</div>

> [@DanielVandH](#):
>
> Are there any packages available for computation of Fourier transforms

You could always use a generic quadrature routine, though that will have suboptimal efficiency if you have many frequencies x\_k at which you want to compute F(x\_k).

> [@DanielVandH](#):
>
> e.g. the method developed by DBailey and Swarztrauber ([The Society for Industrial and Applied Mathematics](https://doi.org/10.1137/0915067)). The function f(t) is rapidly decaying.

Technically, that paper describes a Bluestein’s (1968) algorithm for the “Zoom FFT”, generalized to the [chirp-z transform](https://en.wikipedia.org/wiki/Chirp_Z-transform) by Rabiner and Schafer (1969), which is _not_ the same as the continuous Fourier transform (note: Bailey and Swarztrauber’s terminology was not widely adopted, because a [fractional Fourier transform](https://en.wikipedia.org/wiki/Fractional_Fourier_transform) already meant something else). (It computes a _sum_, not an integral.)

You can use this sum to approximate a continuous Fourier transform of a rapidly decaying function if you sample finely enough and normalize correctly, of course.

I don’t know of a Julia package for this offhand, but it’s pretty easily to implement given an `fft` function (e.g. from the FFTW.jl package), since it’s just a convolution that can be written in a few lines of code.

More generally, if your frequencies are not equally spaced, you could use a nonuniform FFT, e.g. [FINUFFT.jl](https://github.com/ludvigak/FINUFFT.jl) or [FastTransforms.jl](https://github.com/JuliaApproximation/FastTransforms.jl).

---

<div class="post-metadata">

**Author:** ![tknopp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tknopp/32/3569_2.png) [@tknopp](https://discourse.julialang.org/u/tknopp)\
**Post date:** [March 17, 2022, 7:22am UTC](https://discourse.julialang.org/t/numerical-computation-of-continuous-fourier-transforms/77999/3 "2022-03-17T07:22:19Z")

</div>

> [@stevengj](#):
>
> More generally, if your frequencies are not equally spaced, you could use a nonuniform FFT, e.g. [FINUFFT.jl](https://github.com/ludvigak/FINUFFT.jl) or [FastTransforms.jl](https://github.com/JuliaApproximation/FastTransforms.jl).

For non-equidistant NFFTs please have a look at [GitHub - JuliaMath/NFFT.jl: Julia implementation of the Non-equidistant Fast Fourier Transform (NFFT)](https://github.com/JuliaMath/NFFT.jl), which is nowadays a package family around NFFTs. One can use `AbstractNFFTs` as the base package and then we have different implementations (Julia based, Julia/Cuda based, NFFT3, FINUFFT). Performance-wise the Julia implementation is one of the fastest: [Performance · NFFT](https://juliamath.github.io/NFFT.jl/dev/performance/#Performance)

---

<div class="post-metadata">

**Author:** ![dlfivefifty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlfivefifty/32/1959_2.png) [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Post date:** [March 17, 2022, 10:05am UTC](https://discourse.julialang.org/t/numerical-computation-of-continuous-fourier-transforms/77999/4 "2022-03-17T10:05:45Z")

</div>

You may find

[https://github.com/JuliaApproximation/OscillatoryIntegrals.jl](https://github.com/JuliaApproximation/OscillatoryIntegrals.jl)

useful. It gives a method whose computational cost is independent of the frequency.
