chapter 2 supplymentary notes
TRANSCRIPT
-
7/26/2019 Chapter 2 Supplymentary Notes
1/8
Chapter 2 Supplymentary Materials
Fourier transform
Fourier Transform for solving heat equationConsider
PDE: u
t(x, t) =
2u
x2(x, t), >0, < x < , x >0
I.C.: u(x, 0) = (x)
Taking Fourier transform of both PDE and I.C. (w.r.t. x)
tu(k, t) + k2u(k, t) = 0 and (1)
u(k, 0) = (k) (2)
Here, u and are Fourier transform ofu and . Also, we used the fact:
ut(k, t) =
tu(k, t) and
uxx(k, t) = (ik)2u(k, t)Multiply both side of (1) by the integrating factor ek
2x, we get:
t
ek
2tu(k, t)
= 0 (3)
Integrate (3), we get:
ek2tu(k, t) = f(k)
u(k, t) = f(k)ek2t
Now,
u(k, 0) = (k) u(k, t) = (k)ek2t
In order to find u(x, t), we need to do inverse Fourier transform ofu(k, t).
Now, inverse Fourier transform ofek2t :
S(x, t) = 1
2
ek2teikxdk=
14t
e 14tx
2
Now, recall that:Ifu = S , then u= S Now,
u(k, t) = e
k2
t(k, t) = S(k, t)(k, t)
Hence,
u(x, t) = S(x, t) (x, t)=
S(x y, t)(y, t)dy
= 1
4t
e(xy)2
4t (y)dy
1
-
7/26/2019 Chapter 2 Supplymentary Notes
2/8
Fourier transform to solve the wave equationConsider:
PDE : 2ut2(x, t) = c
22ux2 (x, t), < x < , t >0, c = 0
I.C. : u(x, 0) = H(x); ut(x, 0) = 0
Taking the Fourier transform of the PDE (w.r.t. x)2
t2u(k, t) = c2k2u(k, t)
From Homework 1, we know that:
u(k, t) = F(k)eikct + G(k)eikct
Recakk that for u(t) + c2k2u(t) = 0, we assume that u(t) = ert. Then
u(t) + c2k2u(t) =
r2 + c2k2
ert = 0
if and only ifr = ick.
u(t) = d1
eickt + d2
eickt
Now,
u(x, t) = 1
2
u(k, t)eikxdk
= 1
2
F(k)eikct + G(k)eikct
eikxdk
= 1
2
F(k)eik(xct)dk+ 1
2
G(k)eik(x+ct)dk
= F(x ct) + G(x + ct)This is called the DAlembert formula for the solution of the wave equation.
Now,
0 = ut(x, 0) = cF(x) + cG(x) F(x) = G(x) F(x) = G(x) + D (4)
And
u(x, 0) = H(x)
F(x) + G(x) = H(x) (5)Combining (4) and (5), we get:
2G(x) + D = H(x) G(x) = H(x) D
2 ; F(x) =
H(x) + D
2
Hence:
u(x, t) = H(x ct) + D
2 +
H(x + ct)D2
= 1
2[H(x ct) + H(x + ct)]
2
-
7/26/2019 Chapter 2 Supplymentary Notes
3/8
Discrete Fourier transform
Goal: Approximate Fourier coefficients in complex form.
Algorithm for Fourier Series computation:
Input : f(x) for x [0, 2] (infinite data)Output : Fourier coefficients : c0, c1, c2,...,ck,... (infinite data)
Discrete case : approximation :
Input : Given n input data : f0 = f(x0), f1 = f(x1), ..., fn1 = f(xn1)Output : c0, c1, c2,...,cn1 (discrete Fourier coefficients)
In this case, we want to find a transformation T such that
T
f0f1
...fn1
=
c0c1
...cn1
Simple example ( 4 input data points )
Input : f0 = f(0) = 2, f1 = f(x1 = 2 ) = 4, f2 = f(x2 = ) = 6, f3 = f(x3 =
32 ) = 8.
Goal : Approximate f byF4(x) = c0+ c1eix + c2e
2ix + c3e3ix such that
F4(xi) = fi = f(xi)
Then we have
F4(x0) = f0 = 2
c0+ c1+ c2+ c3 = 2
F4(x1) = f1 = 4 c0+ c1ei2 + c2ei + c3e 3i2 = 4F4(x2) = f2 = 6 c0+ c1ei + c2e2i + c3e3i = 6
F4(x3) = f3 = 8 c0+ c1e 3i2 + c2e3i + c3e 9i2 = 8
(6)
(6) can be written as :
A
c0c1c2c3
=
f0f1f2f3
=
2468
where
A=
1 1 1 1
1 e2i ei e
3i2
1 ei e2i e3i1 e
3i2 e3i e
9i2
= 1 1 1 11 i i2 i3
1 i2 i4 i61 i3 i6 i9
Recall
T
f0f1f2f3
=
c0c1c2c3
T=A1
3
-
7/26/2019 Chapter 2 Supplymentary Notes
4/8
Consider
A=
1 1 1 11 i (i)2 (i)31 (i)2 (i)4 (i)61 (i)3 (i)6 (i)9
We can check that
AA= AA= 4I
Then we have
T=A1 =A
4
Thus c0c1c2c3
= A4
f0f1f2f3
=14
1 1 1 11 i 1 i1 1 1 11 i 1 i
2468
=
51 + i1
1 i
Remark: c0, c1, c2, c3 is an approximation of Fourier coefficients f(k).
Discrete Fourier transform for n inputs
Let f(x)defined on [0, 2]. Approximate f(x)by
Fn(x) =n1k=0
ckeikx, x [0, 2]
such that Fn(xj) = f(xj) = fj and xj = j2n
, j = 0, 1, 2,...,n 1
Then we have:
Fn(x0) = c0+ c1+ + cn1 = f0Fn(x1) = c0+ c1e
ix1 +
+ cn1e
(n1)ix1 =f1
Fn(x2) = c0+ c1eix2 + + cn1e(n1)ix2 =f2...
Fn(xn1) = c0+ c1eixn1 + + cn1e(n1)ixn1 =fn1
(7)
Let = e2in =eix1 , then
2 =e4in =eix2 ; 3 =eix3 ; etc.
Thus, (7) is reduced to:
1 1 1 11 2 n11 2 4 2(n1)...
.
.....
.. .
...
1 n1 2(n1) (n1)2
c0c1c2...
cn1
=
f0f1f2...
fn1
Now,
1 + + 2 + + n1 =1 n
1 = 0
n =en2n i = 1
4
-
7/26/2019 Chapter 2 Supplymentary Notes
5/8
and
1 1 + jk + 2j2k + + (n1)j(n1)k= 1 + e
2i(jk)n + e
4i(jk)n + e 2i(n1)(jk)n
= n ifj = k1e2i(jk)1e
2i(jk)n
= 0 forj=k
=
AAjk
Therefore we haveAA= AA= nI
and so
c0c1c2...
cn
1
=T
f0f1f2...
fn
1
=A1
f0f1f2...
fn
1
=A
n
f0f1f2...
fn
1
then
ck = 1
n
f0+
kf1+ 2kf2+ + (n1)kfn1
=
1
n
f0+ e
2in kf1+ e
4in kf2+ + e
2i(n1)kn fn1
That is
ck = 1
n
n1j=0
fjei( 2jkn ), k = 0, 1, 2,...,n 1
Fast Fourier transform
Consider the discrete Fourier transform matrix:
Fn=
1 1 1 11 2 n11 2 4 2(n1)...
......
. . . ...
1 n1 2(n1) (n1)2
, where n= ei2n
The computation of the inverse Fourier transform (hence discrete Fourier transform)
= computation ofFn
x1x2...
x4
for a given
x1x2...
x4
.Computational cost ofFnx= n
2 multiplication.
Goal: Improve computational cost from n2 to n2 log2 n. (FFT)
5
-
7/26/2019 Chapter 2 Supplymentary Notes
6/8
Remark: Say n = 210. Then, n log2 n = 210 10 < 214. But n2 = 220 = 26 214. So FFT is 26 times
faster !!
Let y= Fn
x. Say y=
y0y1
...yn1
x=
x0x1
...xn1
. Let n = 2m. Then we have
yj =
n1k=0
kjn xk =
2m1k=0
kjn xk
Divide k = 0, 1, 2, , 2m 1 into 2 parts:
Part 1: 0, 2, 4, , 2(m 1);
Part 2: 1, 3, 5, , 2m 1;
Then
yj =m1k=0
2kjn x2k+m1k=0
(2k+1)jn x2k+1
Part 1 Part 2
wherem= e
i 2m =ei
4n =2n
Thus,
yj = (Fmx)j =
jn(Fmx)j, j = 0, 1, 2, m 1
= (y)j+ jn(y)j, j = 0, 1, 2, m 1
How about yj for j = m, m + 1, 2m 1??Replacej byj + m, j = 0, 1, 2, m 1, we have:
yj+m =
m1k=0
2k(j+m)n x2k+
m1k=0
(2k+1)(j+m)n x2k+1
=m1k=0
kj+kmm x
k+ j+mn
m1k=0
k(j+m)m xk
But
kmm =
ei
2m
km
=ei2k = 1
mn = ei 2n m =ei = 1Therefore
yj+m =m1k=0
kjm x
k jnm1k=0
kjm xk
= (Fmx)j jn(Fmx)j
= yj jnyj
6
-
7/26/2019 Chapter 2 Supplymentary Notes
7/8
To summarize, y= (y1, y2, y2m1)T can be computed :
Step 1: Split xinto
x = x0, x2, , x2(m1)T
x = (x1, x3, , x2m1)T
Step 2: Compute y =Fmx and y = Fmx, where Fm is an
n2 matrix.
Step 3: Compute the components ofy = Fnx by:
yj = y
j+ jnyj
yj+m = y
j jnyj, (j = 0, 1, 2, , m 1)
Also, in Step 2, Fmx can be reduced to multiplication ofFm/2 and eventually to F1 (assuming n = 2
l).
This process is called the Fast Fourier transform (FFT).
Computation cost of FFT:
Let Cm=computations ofFm. Clearly, C1 = 1.Claim: C2m= 2Cm+ 3m.
Proof:Recall: y =Fmx; y = Fmxin Step 2.
RecallStep 3,
yj =y
j + jnyj
yj+m= y
j jnyj1 multiplcation and 2 additions =
Total 3m
ThereforeC2m= 2Cm+ 3m
Let n = 2l. Then:
C2l = 2C2l1+ 3 2l1
2lC2l = 2l+1C2l1+3
2
= 2l+2C2l2+ 2
3
2
=
= 20C20+ l32= 1 +
3
2l
Therefore
C2l = 2l +
3
2l 2l =n +3
2n log2 n= O(
n
2log2 n)
7
-
7/26/2019 Chapter 2 Supplymentary Notes
8/8
Exanple of FFT (F4)
Goal: Find
y0y1
y2y3
=F4
x0x1
x2x3
Step 1: Split x into:
x =
x0x2
; x =
x1x3
Step 2: Compute
y =
y0y1
=F2
x0x2
; y =
y0y1
=F2
x1x3
Fory =
y0y1
=F2
x0x2
, we do one more sub-step :
Sub-step 1: Split x0x2 into x0; x2.Sub-step 2: Compute:
ys = F1x0 = x0
ys = F1x2 = x2
Sub-step 3:
y0 = y
s+ 02ys
= x0+ x2
y1 = ys 02ys= x0 x2
Similarly, for y =
y0y1
=F2
x1x3
, we have
y0 = x1+ x3
y1 = x1 x3Step 3:
y0 = y
0+ 04y0 = (x0+ x2) + (x1+ x3)
y1 = y
1
+ 0
4
y1 = (x0
x2) + i(x1
x3)
y2 = y
0 04y0 = (x0+ x2) (x1+ x3)y3 = y
1 04y1 = (x0 x2) i(x1 x3)
8