Complex.java defines a public class for complex
variables.
javac Complex.java SlowFourierTransform.java
Make
yourself familiar with the discrete Fourier series described in the background material and the lecture
This
is normally, in computing, called the discrete Fourier transform, but it is actually
a special case of the Fourier series you are covering in Physical Mathematics.
This
is NOT the true Fourier transform used in Mathematics and Physics (which is a
bit more complicated).
I
will at times follow the “computing” convention and abuse “transform” because the
“FFT” is the world famous “Fast Fourier Transform”, even if it should be “FFS”.
The
discrete Fourier series in one dimension of Fx with N
points x=0… N-1 is defined as:
fk = 1/sqrt(N) Σx=0..N-1 e i
2 π k x / N Fx
The
discrete Fourier series in two dimensions of Fx,y with N2
points x=0… N-1 ; y=0…N-1 is defined as:
fk,j = 1/N Σx=0..N-1 Σy=0..N-1 e i
(2
π k x / N) e i (2 π j y / N) Fx,y
The
inverse is
Fx,y
= 1/N Σk=0..N-1 Σj=0..N-1 e -i (2 π k x / N) e-i (2 π j y / N) fk,j
Or
Fx,y
= 1/N Σk=0..N-1 Σj=0..N-1 e -i ω.x fk,j
Where
ω = (ωk, ωj)
ωk = 2 π k / N
and
x= (x,y)
Observe
▽2 Fx,y = (d2/dx2
+ d2/dy2) Fx,y
= - 1/N Σk=0..N-1 Σj=0..N-1
(ωk2+ ωj2 ) e -i ω.x fk,j
= - 1/N Σk=0..N-1 Σj=0..N-1
|ω|2 e -i ω.x fk,j
Now,
Poisson’s equation relates the electrostatic potential to the electrostatic
charge density
E = - ▽ V
▽. E = ρ / ε0
▽2V = - ρ / ε 0
Supposing
we represent Vx,y and ρ x,y via
their Fourier series. This differential equation becomes
true
for each Fourier component.
- |ω|2Vk,j
= - ρk,j / ε 0
Thus,
Vk,j = ρk,j
/ (|ω|2 ε 0)
Taking
ε0=1, if we know ρ(x,y) we can compute V(x,y) by applying the derivative to the
Fourier series, and then inverting this:
Vx,y
= 1/N Σk=0..N-1 Σj=0..N-1 e -i ω.x
ρk,j /|ω|2
· Note, the charge density is set up in method coulomb()
to be a single point charge
it
is equivalent to a infinite line of charge in 3d.
Couldn’t think of a better name though…
We
could easily do 3d but it is harder to visualize.
As
we’re in 2d the field spreads out as the circumference of a circle – 1/r (not
the area of a sphere 1/r2)
This
means the potential looks like log r.
· gnuplot
· set contour
·
Harder: Add a new method void capacitor()
END
·
Congratulations – you can now solve any electrostatics problem using Fourier
series!
·
This includes the edge effects around capacitors, and no
Gaussian pill boxes in sight!