# Where is Fourier()

**URL:** <https://discourse.julialang.org/t/where-is-fourier/94512>\
**Category:** General Usage\
**Created:** [February 12, 2023, 1:09pm UTC](https://discourse.julialang.org/t/where-is-fourier/94512 "2023-02-12T13:09:13Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Post date:** [February 12, 2023, 1:09pm UTC](https://discourse.julialang.org/t/where-is-fourier/94512/1 "2023-02-12T13:09:13Z")

</div>

In the demo on spectral methods found at  
[https://docs.sciml.ai/SciMLBenchmarksOutput/stable/MOLPDE/burgers\_spectral\_wpd/](https://docs.sciml.ai/SciMLBenchmarksOutput/stable/MOLPDE/burgers_spectral_wpd/)  
there is a call to `Fourier()`. I cannot figure out which `module` it is in. Could somebody please let me know? Also, what is the best way to find that module that contains a particular method is the module is not yet `added via the package manager.

Here is my own pseudo spectral code to solve Burger’s equation using `Euler` method, although I can obviously upgrade to any temporal solver for higher order results:

```julia
using Plots
using FFTW

# Solve Burger's equation via pseudospectral method. 
# Use periodic boundary conditons
# u_t + u u_x = ν u_xx
# Let uhat = F(u) be the Fourier transform of u
# In Fourier space, Burgers equation becomes
# uhat_t + i k uhat = ν k^2 uhat
# Given uhat, its spatial derivative is given by
# uhat_x = i k uhat

# Define the domain
Lx = 2π
Nx = 512
# Periodic x domain
x = range(0, Lx, length=Nx+1)[1:end-1]
dx = x[2] - x[1]
T = 1.0
Nt = 400
dt = T / Nt
μ = 0.01

u0 = sin.(3 .* x)
frequ = fftfreq(129)*129 |> collect

# Functions to simoplify Collocation method
function derivs(u, freq)
    uhat = rfft(u)
    uhatk = im .* freq .* uhat
    uhatkk = -freq.^2 .* uhat
    ux = irfft(uhatk, length(u))
    uxx = irfft(uhatkk, length(u))
    return ux, uxx
end

u0 = sin.(1 .* x)
Nh = div(Nx, 2) + 1
frequ = fftfreq(Nh)*Nh |> collect
ux, uxx = derivs(u0, frequ)

plot(u0)
plot!(ux)
plot!(uxx / 9.)

# Euler
# Save solution ever step iterations for plotitng
nstep = 1
# usave: list of solution
usave = []
sol = zeros(Float64, Nx, Nt)
sol[:, 1] = u0
push!(usave, copy(u0));
u = copy(u0)
for i in 2:Nt
    ux, uxx = derivs(u, frequ)
    u .= u + dt .* (μ * uxx - u .* ux)
    if i % nstep == 0
        sol[:,i] = copy(u)
        push!(usave, copy(u))
    end
end

plot(x, usave[1])
for i in 2:20:400
    p = plot!(x, usave[i], c=:red, alpha=i/400)
    display(p)
end

```

Any improvements to this code are welcome. It runs extremely fast.

---

<div class="post-metadata">

**Author:** ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Post date:** [February 12, 2023, 1:16pm UTC](https://discourse.julialang.org/t/where-is-fourier/94512/2 "2023-02-12T13:16:24Z")

</div>

Where is Fourier?  
At Père Lachaise in Paris.

---

<div class="post-metadata">

**Author:** ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Post date:** [February 12, 2023, 1:32pm UTC](https://discourse.julialang.org/t/where-is-fourier/94512/3 "2023-02-12T13:32:31Z")

</div>

I knew that! Note the brackets though. 🙂

---

<div class="post-metadata">

**Author:** ![isaacsas](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@isaacsas](https://discourse.julialang.org/u/isaacsas)\
**Post date:** [February 12, 2023, 1:54pm UTC](https://discourse.julialang.org/t/where-is-fourier/94512/4 "2023-02-12T13:54:10Z")

</div>

It’s an approximation space from ApproxFun: [Spaces · ApproxFun.jl](https://juliaapproximation.github.io/ApproxFun.jl/latest/usage/spaces/#Fourier-and-Laurent-spaces)

---

<div class="post-metadata">

**Author:** ![cormullion](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cormullion/32/49131_2.png) [@cormullion](https://discourse.julialang.org/u/cormullion)\
**Post date:** [February 12, 2023, 2:03pm UTC](https://discourse.julialang.org/t/where-is-fourier/94512/5 "2023-02-12T14:03:14Z")

</div>

Try `@which` or `@less` perhaps.

```julia
julia-1.9> @which Fourier()
(ApproxFunBase.SumSpace{Tuple{CosSpace{DD, RR}, SinSpace{DD, RR}}, DD, RR} where {DD, RR})()
     @ ApproxFunFourier ~/.julia/packages/ApproxFunFourier/qgHBD/src/ApproxFunFourier.jl:423

```

---

<div class="post-metadata">

**Author:** ![erlebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/erlebach/32/12973_2.png) [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Post date:** [February 12, 2023, 2:09pm UTC](https://discourse.julialang.org/t/where-is-fourier/94512/6 "2023-02-12T14:09:53Z")

</div>

Thank you both! I had checked all the functions in all the packages manually, but did not find the method. I obviously missed because it is indeed there! I did not think of `@which`. My bad. Thanks.
