Solving Differential Equations With The Fast Fourier Transform
Your Daily Dose of Scientific Python
In the last article, we have seen that using Fourier techniques, one can replace differentiation with multiplication. This fact can be exploited to solve partial differential equations numerically in a simple way. That’s what we are going to discuss today.
The Idea
Suppose you want to solve the differential equation
for a function 𝑓 on some domain 𝑥∈[−𝑎,𝑎]. And let’s impose the boundary conditions 𝑓(±𝑎)=0. Ok, this is not a partial differential equation but an ordinary one. But the idea to solve it using Fourier techniques immediately translates to the multidimensional case.
Writing
and similarly for 𝜌(𝑥), the differential equation becomes
Complex exponentials constitute an orthogonal basis for function space, so we can simply compare coefficients:
We can solve for the Fourier component of 𝑓: