note: to simplifynotations all periodic functions of x are expected to

In[1]:=
H*note: to simplifynotations all periodic functions of x are expected to have a period of 2 Pi,
as Ch. 11.1 by KR. If a function has a period "2L" as in his later sections,
one can always switch to a new variable xnew =Pi xL and get the original periodicity*L
In[2]:=
H*first define colors for future graphics*L
In[3]:=
red = RGBColor@1, 0, 0D; green = RGBColor@0, 1, 0D; blue = RGBColor@0, 0, 1D; black = RGBColor@0, 0, 0D;
In[4]:=
fapp@x_, nmax_D := a0 + Sum@a@nD Cos@n xD + b@nD Sin@n xD, 8n, nmax<D
In[5]:=
H*Note, unlike formal expression which have infinityfor the upper limit, we have a finite nmax,
so that an approximationto the original function f is considered - "trigonometric polynomials" HKR. 11.6L. However,
accuracy can be made arbitrary high with increase of nmax. *L
In[6]:=
Clear@a0, a, bD;
In[7]:=
a0 :=
In[8]:=
a@n_D :=
Ù-Π f@xD â x
Π
2Π
Ù-Π f@xD Cos@n xD â x
Π
Π
Ù-Π f@xD Sin@n xD â x
Π
In[9]:=
b@n_D :=
Π
In[10]:=
H*above are Euler formulas; ";" represents the condition "If" *L
In[11]:=
H*Example 1*L
In[12]:=
In[13]:=
Clear@ f D; f @x_D := If@Hx > -Pi && x < 0L, -1, 1D
In[14]:=
In[15]:=
Plot@ f @xD, 8x, -Pi, Pi<D
1.0
0.5
Out[15]=
-3
-2
-1
1
-0.5
-1.0
In[16]:=
a0
Out[16]=
0
In[17]:=
a@nD
Out[17]=
0
2
3
2
688_fourier.nb
In[18]:=
b@nD
2 - 2 Cos@n ΠD
Out[18]=
In[19]:=
nΠ
Table@8n, b@nD<, 8n, 5<D  TableForm
Out[19]//TableForm=
1
€Π4
2 0
3
4
3Π
4 0
5
In[20]:=
4
5Π
f3 = fapp@x, 3D
4 Sin@xD
In[21]:=
4 Sin@3 xD
+
Out[20]=
Π
3Π
f5 = fapp@x, 5D
4 Sin@xD
4 Sin@3 xD
+
Out[21]=
Π
4 Sin@5 xD
+
3Π
5Π
In[22]:=
f15 = fapp@x, 15D;
In[23]:=
Plot@8 f @xD, f3, f5, f15<, 8x, -Pi, Pi<, PlotStyle ® 8black, red, green, blue<D
1.0
0.5
Out[23]=
-3
-2
-1
1
2
3
-0.5
-1.0
In[24]:=
H*note: the sum approaches 0 at + or - Pi - this is an example of Theorem 2, p. 484 in KR.*L
688_fourier.nb
In[25]:=
Plot@8f3, f5, f15<, 8x, -10, 10<, PlotStyle ® 8red, green, blue<D
1.0
0.5
Out[25]=
-10
-5
5
10
-0.5
-1.0
In[26]:=
H*Note: apprixomationsextend the function periodically,
regardless if the original f@xD was defined only on @-Pi,PiD or was indeed periodic and defined for all x *L
In[27]:=
FullSimplify@b@nD, n Î IntegersD
Out[27]=
-
In[28]:=
FullSimplify@%, Hn  2L Î IntegersD H*n even*L
Out[28]=
0
In[29]:=
FullSimplify@b@nD, HHn + 1L  2L Î IntegersDH*n odd*L
2 I-1 + H-1Ln M
nΠ
4
Out[29]=
nΠ
In[30]:=
H*note: we had a@nD=0 since f@xD is an odd function; alternatively for an even function all b@nD would be zero - see 11.3 in KR.*L
In[31]:=
H*ORTHOGONALITY*L
In[32]:=
Clear@ f , m, nD;
In[33]:=
8a@nD, b@nD<
Ù-Π Cos@n xD f@xD â x
Π
Out[33]=
:
In[34]:=
f @x_D = Cos@m xD;
Π
Ù-Π f@xD Sin@n xD â x
Π
,
Π
>
In[35]:=
In[36]:=
In[37]:=
a@nD
Out[37]=
H2 m Cos@n ΠD Sin@m ΠD - 2 n Cos@m ΠD Sin@n ΠDL ‘ IIm2 - n2 M ΠM
In[38]:=
Limit@%, m ® nD
Out[38]=
1+
Sin@2 n ΠD
2nΠ
3
4
688_fourier.nb
In[39]:=
FullSimplify@%, n Î Integers D
Out[39]=
1
In[40]:=
FullSimplify@a@nD, n Î Integers && m Î Integers D
Out[40]=
0
In[41]:=
H*i.e. cosHm xL and cosHn xL are orthogonal for m ¹ n *L
In[42]:=
FullSimplify@b@nD, n Î Integers && m Î Integers D
Out[42]=
0
In[43]:=
H*i.e. cosHm xL and sinHn xL are orthogonal for all m,n*L
In[44]:=
Clear@ f , m, nD;
In[45]:=
f @x_D = Sin@m xD;
In[46]:=
b@nD
Out[46]=
H2 n Cos@n ΠD Sin@m ΠD - 2 m Cos@m ΠD Sin@n ΠDL ‘ IIm2 - n2 M ΠM
In[47]:=
Limit@%, m ® nD
Out[47]=
1-
In[48]:=
FullSimplify@%, n Î Integers D
Out[48]=
1
In[49]:=
FullSimplify@b@nD, n Î Integers && m Î Integers D
Out[49]=
0
In[50]:=
H*i.e. sinHm xL and sinHn xL are orthogonal for m ¹ n *L
Sin@2 n ΠD
In[51]:=
2nΠ
H*COMPLEX FOURIER - 11.4 in KR.*L
In[52]:=
i = I H*to have more familiarnotations*L;
In[53]:=
int := Integrate@ð, 8x, -Pi, Pi<D &
In[54]:=
H*Orthogonality:*L
In[55]:=
int@Exp@i n xD Exp@-i m xDD
2 Sin@Hm - nL ΠD
Out[55]=
m-n
In[56]:=
Limit@%, m ® nD
Out[56]=
2Π
688_fourier.nb
In[57]:=
FullSimplify@%%, n Î Integers && m Î IntegersD
Out[57]=
0
In[58]:=
H*i.e. the exponentials with different m and n are orthogonal. Note that in the integral of 2 functions
one is taken as complex conjugate*L
In[59]:=
Clear@ f , cD; c@n_D := int@ f @xD Exp@-i n xDD  H2 PiL
In[60]:=
fcomp@x_, nmax_D := Sum@c@nD Exp@i n xD, 8n, -nmax, nmax<D
In[61]:=
Clear@ f D; f @x_D := If@Hx > -Pi && x < 0L, -1, 1DH*old example*L
In[62]:=
c@nD
ä H-1 + Cos@n ΠDL
Out[62]=
nΠ
In[63]:=
c@nD Exp@i n xD + c@-nD Exp@-i n xD
Out[63]=
-
In[64]:=
FullSimplify@%, n Î IntegersD
ä ã-ä n x H-1 + Cos@n ΠDL
+
ä ãä n x H-1 + Cos@n ΠDL
nΠ
nΠ
ä I-1 + H-1Ln M ã-ä n x I-1 + ã2 ä n x M
Out[64]=
nΠ
In[65]:=
FullSimplify@%, n  2 Î IntegersD
Out[65]=
0
In[66]:=
FullSimplify@%%, Hn + 1L  2 Î IntegersD
4 Sin@n xD
Out[66]=
nΠ
In[67]:=
H*i.e. return to the original real-value series*L
In[68]:=
H*example 1 from p. 498 in KR.*L
In[69]:=
Clear@ f D; f @x_D = Exp@xD;
In[70]:=
c@nD
ä Sinh@Π - ä n ΠD
Out[70]=
In[71]:=
Hä + nL Π
FullSimplify@%, n Î IntegersD
ä H-1Ln Sinh@ΠD
Out[71]=
Hä + nL Π
In[72]:=
H*which is equivalent to KR.*L
In[73]:=
f2 = fcomp@x, 2D
-ã-Π + ãΠ
Out[73]=
2Π
I €12 - €ä2 M ã-ä x Sinh@ΠD
Π
-
I €12 + €ä2 M ãä x Sinh@ΠD
Π
+
I €15 -
2ä
M
5
ã-2 ä x Sinh@ΠD
+
Π
I €15 +
2ä
M
5
ã2 ä x Sinh@ΠD
Π
5
6
688_fourier.nb
In[74]:=
FullSimplify@%, x Î RealsD
1
Out[74]=
5Π
H5 + 2 Cos@2 xD + 5 Sin@xD - Cos@xD H5 + 8 Sin@xDLL Sinh@ΠD
In[75]:=
H*i.e a trigonometric polynomial*L
In[76]:=
f8 = fcomp@x, 8D; f32 = fcomp@x, 32D;
In[77]:=
Plot@8 f @xD, f2, f8, f32<, 8x, -Pi, Pi<, PlotStyle ® 8black, red, green, blue<D
20
15
Out[77]=
10
5
-3
-2
-1
1
2
3
In[78]:=
In[79]:=
Plot@8f2, f32<, 8x, -3 Pi, 3 Pi<, PlotStyle ® 8red, blue<, PlotRange ® 80, E ^Pi<D
20
15
Out[79]=
10
5
-5
In[80]:=
0
5
H*again, note that the function is periodicallyextended*L
In[81]:=
H*FOURIER INTEGRAL*L
688_fourier.nb
In[82]:=
? *Fourier*
System`
Fourier
FourierCosTransform
FourierDCT
FourierDST
FourierParameters
FourierSinTransform
FourierTransform
InverseFourier
InverseFourierCosTransform
InverseFourierSinTransform
InverseFourierTransform
In[83]:=
H*
Ù-¥ f HtL eiΩt ât*- FourierTransform*L
¥
1
2Π
In[84]:=
H*
€Π Ù0 f HtL cosHΩtLât*- FourierCosTransform; *L
In[85]:=
H*
€Π Ù0 f HtL sinHΩtLât - FourierSinTransform; *L
In[86]:=
H*similarlyfor inverse see also p. 519 in KR*L
In[87]:=
2
2
¥
¥
H*Example 1, p.515 a=k=1*L
In[88]:=
Clear@ f D; f @x_D = H1 + Sign@1 - xDL  2;
In[89]:=
Plot@ f @xD, 8x, 0, 2<D
1.0
0.8
0.6
Out[89]=
0.4
0.2
0.5
1.0
1.5
2.0
7
8
688_fourier.nb
In[90]:=
FourierCosTransform@ f @xD, x, omD  FullSimplify
€Π2 Sin@omD
Out[90]=
om
In[91]:=
H*some difficultyfor Mathematica since a discontinuousf@xD; however DiracDelta's cancel and get the following:*L
2
€Π Sin@omD
In[92]:=
fcos =
In[93]:=
fsin = FourierSinTransform@ f @xD, x, omD
;
om
4 - 4 Cos@omD
Out[93]=
2Π
2 om
In[94]:=
Plot@8fcos, fsin<, 8om, -12, 12<, PlotStyle ® 8red, blue<D
0.8
0.6
0.4
0.2
Out[94]=
-10
-5
5
10
-0.2
-0.4
-0.6
In[95]:=
fexp = FourierTransform@ f @xD, x, omD
Out[95]=
-
ä ãä om
Π
+
om
2Π
DiracDelta@omD
2
In[96]:=
H*again, DiracDelta is an artifact*L
In[97]:=
InverseFourierTransform@fexp, om, xDH*ok*L
1
Out[97]=
2
H1 - Sign@-1 + xDL
In[98]:=
H*Example 2*L
In[99]:=
FourierCosTransform@E ^-x, x, omD
€Π2
Out[99]=
In[100]:=
1 + om2
FourierSinTransform@E ^-x, x, omD
om
Out[100]=
In[101]:=
€Π2
1 + om2
H*Fourier Transform of Derivatives - theorem 1 on p.516 and example 3 on p.517*L
688_fourier.nb
In[102]:=
Out[102]=
In[103]:=
Out[103]=
In[104]:=
Out[104]=
In[105]:=
Clear@ f D; f @x_D = E ^-x
ã-x
FourierCosTransform@D@ f @xD, xD, x, omD - om * FourierSinTransform@ f @xD, x, omD + Sqrt@2D f @0D  Sqrt@PiD  Simplify
0
FourierSinTransform@D@ f @xD, xD, x, omD + om * FourierCosTransform@ f @xD, x, omD  Simplify
0
Clear@ f D; f @x_D = Exp@-x ^2D
2
Out[105]=
ã-x
In[106]:=
In[107]:=
FourierTransform@D@ f @xD, xD, x, omD + i om * FourierTransform@ f @xD, x, omD  Simplify
Out[107]=
0
In[108]:=
H*above is theorem 3 and example 3 from p. 521; in more detail:*L
In[109]:=
FourierTransform@E ^H-x ^2L, x, omD
ã-
om 2
4
Out[109]=
2
In[110]:=
D@E ^H-x ^2L, xD
2
Out[110]=
-2 ã-x x
In[111]:=
FourierTransform@%, x, omD  H-i omL
ã-
om 2
4
Out[111]=
2
In[112]:=
H*same thing*L
In[113]:=
In[114]:=
In[115]:=
ft := FourierTransform@ð, x, omD &
In[116]:=
ift := InverseFourierTransform@ð, om, xD &
In[117]:=
Clear@ f D; f @x_D = 1  2 HSign@1 + xD - Sign@x - 1DL;
9
10
688_fourier.nb
In[118]:=
Plot@ f @xD, 8x, -2, 2<D
1.0
0.8
0.6
Out[118]=
0.4
0.2
-2
In[119]:=
-1
1
2
ft@ f @xDD
€Π2 Sin@omD
Out[119]=
om
In[120]:=
FullSimplify@%, om Î RealsD H*see p. 531 in KR*L
€Π2 Sin@omD
Out[120]=
om
In[121]:=
f @x_D = 1  2 HSign@x + bD - Sign@x - bDL;
In[122]:=
Out[123]=
$Aborted
In[124]:=
In[125]:=
In[126]:=
In[127]:=
Out[127]=
H*EXTRACTING FREQUENCIES FROM A COMPLICATED SIGNAL*L
f @x_D = [email protected] xD * HSin@3 xD + .9 Sin@2 Pi xDL
ã-0.001 x HSin@3 xD + 0.9 Sin@2 Π xDL
688_fourier.nb
In[128]:=
Plot@ f @xD, 8x, 0, 15<D
1.5
1.0
0.5
Out[128]=
2
4
6
8
10
12
14
-0.5
-1.0
-1.5
In[129]:=
ftt = FourierCosTransform@ f @xD, x, omD  Chop
446.49-11.3097 om2
1558.55-78.9568 om2 +1. om4
-
6. H-3.+omL H3.+omL
81.-18. om2 +1. om4
Out[129]=
2Π
In[130]:=
Plot@Abs@fttD, 8om, 2, 7<D
4
3
Out[130]= 2
1
3
4
5
In[131]:=
myft := Integrate@ð Cos@om xD, 8x, 0, L<D &
In[135]:=
L = 20; myftt = myft@ f @xDD  Chop;
6
7
11
12
688_fourier.nb
In[136]:=
Plot@Abs@myfttD, 8om, 2, 7<, PlotRange ® 80, 10<D
10
8
6
Out[136]=
4
2
2
3
4
5
In[137]:=
L = 100; myftt = myft@ f @xDD  Chop;
In[138]:=
Plot@Abs@myfttD, 8om, 2, 7<, PlotRange ® 80, 20<D
6
7
6
7
20
15
Out[138]= 10
5
2
3
4
5