-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
1226 lines (1223 loc) · 84.3 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!--Title-->
<title>Understanding Fourier Series</title>
<!--css links-->
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link href="https://use.fontawesome.com/releases/v5.7.0/css/all.css" rel="stylesheet"
integrity='sha384-lZN37f5QGtY3VHgisS14W3ExzMWZxybE1SJSEsQp9S+oqd12jhcu+A56Ebc1zFSJ' crossorigin='anonymous'>
<link href="styles/style.css" rel="stylesheet">
<link href="styles/skeleton.css" rel="stylesheet">
<link href="styles/index_Style.css" rel="stylesheet">
<link href="styles/loadout_Style.css" rel="stylesheet">
<!--Required JS resources-->
<script src="https://unpkg.com/[email protected]/dist/vue.js"></script>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="scripts/debounce_and_throttle.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/numeric/1.2.6/numeric.min.js"
integrity="sha256-t7CAuaRhODo/cv00lxyONppujwTFFwUWGkrhD/UB1qM=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/6.2.2/math.min.js"
integrity="sha256-D/MkugLuxx4Xx0Kb92cUhpxlCMhUvQ0eOtEL8Ol23jM=" crossorigin="anonymous"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js"],
jax: ["input/TeX", "output/HTML-CSS"],
tex2jax: {
inlineMath: [ ['$','$'], ["\\(","\\)"] ],
displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
processEscapes: true
},
"HTML-CSS": { fonts: ["TeX"] }
});
</script>
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/latest.js?config=TeX-MML-AM_CHTML"></script>
<!--Favicon-->
<link rel="shortcut icon" href="images/favicon-blue.png" type="image/x-icon">
</head>
<body>
<div id="app">
<!-- Title of non-current sections to appear on hovering above respective number in navbar -->
<div id="hoverTitleSpace" :style="{left: mouseX +'px'}" v-show="hoverTitle !== false">
{{hoverTitle}}
</div>
<!-- Left Side of Window - containing mainly text -->
<div class="vis-container left" id="left-container">
<!-- Dynamic Navigation Bar and Section Headings -->
<div class="" id="progress-container">
<div id="banner-dummy">
<a href="https://www.imperialvisualisations.com/learn/" title="Return to Homepage">
<img id="vis-logo" src="images/VisualisationsLogoWhite2.png">
</a>
</div>
<!-- Journey Toggle Button -->
<div id="journeyToggle">
<div id="navBlock" :class="[showJourney === false ? 'navBlockActive' : '']"
@click="toggleJourney">
CLICK HERE TO SHOW TEXT AND NAVIGATION
</div>
<div :class="[showJourney === false ? 'rotated' : '', 'innerJourneyToggle']"
@click="toggleJourney" class="chevron-holder" title="Hide/Show Left Panel">
<i class="fas fa-chevron-left"></i>
</div>
</div>
<!-- Dynamic Section Heading Text - overlaid on meters -->
<!-- Also act as buttons to navigate between sections -->
<div class="" id="overlay" @mousemove="hoverTitle !== false ? updateMouseX($event) : ''">
<button :class="[currentTitle === 1 ? 'activeButton' : '', 'overlay-button']" id="sectionTitle1"
key="sectionTitle1" data-no=1 @click="scrollTo($event)"
@mouseover="hoverPosUpdate($event); selectHover();" @mouseout="hoverTitle=false">
{{sectionTitle[0]}}
</button>
<button :class="[currentTitle === 2 ? 'activeButton' : '', 'overlay-button']" id="sectionTitle2"
key="sectionTitle2" data-no=2 @click="scrollTo($event)"
@mouseover="hoverPosUpdate($event); selectHover();" @mouseout="hoverTitle=false">
{{sectionTitle[1]}}
</button>
<button :class="[currentTitle === 3 ? 'activeButton' : '', 'overlay-button']" id="sectionTitle3"
key="sectionTitle3" data-no=3 @click="scrollTo($event)"
@mouseover="hoverPosUpdate($event); selectHover();" @mouseout="hoverTitle=false">
{{sectionTitle[2]}}
</button>
<button :class="[currentTitle === 4 ? 'activeButton' : '', 'overlay-button']" id="sectionTitle4"
key="sectionTitle4" data-no=4 @click="scrollTo($event)"
@mouseover="hoverPosUpdate($event); selectHover();" @mouseout="hoverTitle=false">
{{sectionTitle[3]}}
</button>
<button :class="[currentTitle === 5 ? 'activeButton' : '', 'overlay-button']" id="sectionTitle5"
key="sectionTitle5" data-no=5 @click="scrollTo($event)"
@mouseover="hoverPosUpdate($event); selectHover();" @mouseout="hoverTitle=false">
{{sectionTitle[4]}}
</button>
<button :class="[currentTitle === 6 ? 'activeButton' : '', 'overlay-button']" id="sectionTitle6"
key="sectionTitle6" data-no=6 @click="scrollTo($event)"
@mouseover="hoverPosUpdate($event); selectHover();" @mouseout="hoverTitle=false">
{{sectionTitle[5]}}
</button>
<button :class="[currentTitle === 7 ? 'activeButton' : '', 'overlay-button']" id="sectionTitle7"
key="sectionTitle7" data-no=7 @click="scrollTo($event)"
@mouseover="hoverPosUpdate($event); selectHover();" @mouseout="hoverTitle=false">
{{sectionTitle[6]}}
</button>
</div>
<!-- Dynamic meters indicating progress through each section -->
<meter :class="[currentTitle === 1 ? 'activeMeter' : '']" id="m1" :min="sectionTops[0]"
:max="sectionBottoms[0]" :value="scrollPos"></meter>
<meter :class="[currentTitle === 2 ? 'activeMeter' : '']" id="m2" :min="sectionTops[1]"
:max="sectionBottoms[1]" :value="scrollPos"></meter>
<meter :class="[currentTitle === 3 ? 'activeMeter' : '']" id="m3" :min="sectionTops[2]"
:max="sectionBottoms[2]" :value="scrollPos"></meter>
<meter :class="[currentTitle === 4 ? 'activeMeter' : '']" id="m4" :min="sectionTops[3]"
:max="sectionBottoms[3]" :value="scrollPos"></meter>
<meter :class="[currentTitle === 5 ? 'activeMeter' : '']" id="m5" :min="sectionTops[4]"
:max="sectionBottoms[4]" :value="scrollPos"></meter>
<meter :class="[currentTitle === 6 ? 'activeMeter' : '']" id="m6" :min="sectionTops[5]"
:max="sectionBottoms[5]" :value="scrollPos"></meter>
<meter :class="[currentTitle === 7 ? 'activeMeter' : '']" id="m7" :min="sectionTops[6]"
:max="sectionBottoms[6]" :value="scrollPos"></meter>
</div>
<!-- Container for text content split into sections -->
<div :class="[showJourney === false ? 'hiddenJourney' : '', 'journey']" id="main-journey" @scroll.passive="scrollFunc">
<!-- Section Text Containers -->
<div class="section-container" id="sc1">
<div class="placeholder" id="ph1">
<hr>
<h2 class="text section-head" id="s1">
{{sectionTitleLong[0]}}
</h2>
<hr>
</div>
<div class="text section-body odd" id="p1">
A Fourier Series is an expansion of any reasonable (see Dirichlet conditions) periodic function
<span class="mathJaxInline">$ f(x) $</span> in terms of an infinite sums of sines and cosines,
due to the orthogonality relationships of sines and cosines functions.
Any set of functions that form a complete orthogonal system has a Fourier Series counterpart.
<br><br>
By representing functions in sines and cosines, we have a wide range of tools (differentiation and
integration) for analysis that might not be possible in the original function domain.
<br><br>
In this visualisation, we aim to provide a visual approach to understanding how some
important periodic functions can be composed using sine and cosine functions.
<br><br>
<h3 class="section-sub-head">
Visualisation Guide
</h3>
On the right, we can see a square function, and a summation of sines and cosine functions with a
finite number of terms that represents the square function.
<br><br>
Try changing the number of terms in the Fourier Series.
By increasing this, we can see that the function resembles closer and closer to the square function.
<br><br>
By the end of this suite, you would be able to understand the intuition behind Fourier Series, and
to do it yourself for any reasonable periodic function.
</div>
</div>
<div class="section-container" id="sc2">
<div class="placeholder" id="ph2">
<hr>
<h2 class="text section-head" id="s2">
{{sectionTitleLong[1]}}
</h2>
<hr>
</div>
<div class="text section-body odd" id="p2">
Given the vectors <span class="mathJaxInline">$ \vec{V}_{n} $</span> and <span
class="mathJaxInline">$ \vec{V}_{m}, $</span> we define their
inner product as
<span class="mathJaxDisplay">
$$\vec{V}_{n} \cdot \vec{V}_{m} = \sum_{i}V_{n}^{(i)} V_{m}^{(i)}, $$
</span>
where <span class="mathJaxInline">$ V_{n}^{(i)} $</span> is the <span class="mathJaxInline">$ i^{\text{th}} $</span>
component of the vector
<span class="mathJaxInline">$ \vec{V}_{n}. $</span> If
<span class="mathJaxDisplay">
$$ \vec{V}_{n} \cdot \vec{V}_{m} = 0 \text{ for } m \neq n, $$
</span>
then we say the vectors are <strong>orthogonal</strong>.
<br><br>
If you move in the direction of any vector <span class="mathJaxInline">$ \vec{a}, $</span> you do
not change the position
component in the direction of any vector
orthogonal to <span class="mathJaxInline">$ \vec{a}. $</span> In other words, orthogonal vectors are
perpendicular.
<!--(... talk about definition of orthogonality)-->
<br><br>
If <span class="mathJaxInline">$ \vec{V}_{n} \cdot \vec{V}_{m} = \delta_{nm} $</span> then the
vectors are said to be
<strong>orthonormal</strong>.
<span class="mathJaxDisplay">
$$ \delta_{nm} = \left\{\begin{matrix}0 \quad \text{if } m\neq n
\\ 1 \quad \text{if } m = n
\end{matrix}\right. $$
</span>
This mean the vectors are orthogonal and conveniently normalised.
<br><br>
Use the visualisation to see that when the basis vectors are not parallel they span <span
class="mathJaxInline">$ \mathbb{R}^{2}, $</span>
using these as basis vectors, we can construct any other vector in <span class="mathJaxInline">$ \mathbb{R}^{2}. $</span>
<br><br>
If you can represent any vector in <span class="mathJaxInline">$ \mathbb{R}^{n} $</span> using <span
class="mathJaxInline">$ n $</span> vectors,
then the basis vectors form a <strong>complete set</strong>.
If the set of these vectors are all orthonormal, then we have a <strong>complete orthonormal
set</strong>.
<br><br>
In the same way as before, we will now demonstrate what it means for <strong>functions</strong> to
be complete.
We define the functions <span class="mathJaxInline">$ f_{n},f_{m} $</span> to exist on the domain
<span class="mathJaxInline">$ \left[a,b \right]. $</span>
<br><br>
We define their inner product to be
<span class="mathJaxDisplay">
$$ \langle f_{n} , f_{m} \rangle = \int_{a}^{b} f_{n}\left(x \right)f_{m}^{*}\left(x \right)dx $$
</span>, where * denotes the complex conjugate of the function. This is commutative, just like
the inner product of two vectors.
We say the functions are <strong>orthogonal</strong> if <span class="mathJaxInline">$ \langle f_{n} , f_{m} \rangle = 0 $</span>
for <span class="mathJaxInline">$ m \neq n. $</span>
<br><br>
We then say the functions are <strong>orthonormal</strong> if <span class="mathJaxInline">$ \langle f_{n} , f_{m} \rangle = \delta_{nm}, $</span>
where <span class="mathJaxDisplay">
$$ \delta_{nm} = \left\{\begin{matrix}0 \quad \text{if } m\neq n
\\ 1 \quad \text{if } m = n
\end{matrix}\right. $$
</span>
We now claim that you can construct any square integrable function from a <strong>complete
set</strong> of basis
functions, in the same way vectors could be constructed from a complete set of basis vectors. A
square integrable function <span class="mathJaxInline">$ f $</span> is
a function whose inner product with itself, <span
class="mathJaxInline">$ \langle f,f \rangle $</span> is finite.
</div>
</div>
<div class="section-container" id="sc3">
<div class="placeholder" id="ph3">
<hr>
<h2 class="text section-head" id="s3">
{{sectionTitleLong[2]}}
</h2>
<hr>
</div>
<div class="text section-body odd" id="p3">
<div id="intro" class="divclass">
<button id="ssh1" class="section-sub-head first-sub-head" key="ssh1"
@click="updateSubSection(1); subScrollTo($event)" data-toggle="collapse"
data-target="#introContentContainer"
:style="derivationSubSection === 1 ? 'background-color: #eaf2ff;' : ''">
Basics and Definition <i class='fas fa-chevron-down'></i>
</button>
<div id="introContentContainer" class="collapse show" data-parent="#p3">
<div id="introContent" class="section-sub-content" key="introContent">
Consider a function <span class="mathJaxInline">$ f(x) $</span> which is periodic over
the domain <span class="mathJaxInline">$ -L \leq x < L $</span>
where <span class="mathJaxInline">$ L $</span> is positive. <span class="mathJaxInline">$ f(x) $</span>
can be represented as a sum
of
sines and cosines with varying
frequencies.
<br><br>
These trigonometric functions form orthogonal basis.
<br><br>
The Fourier series of <span class="mathJaxInline">$ f(x) $</span> is
<span class="mathJaxDisplay">
$$ f(x) = \frac{a_0}{2} + \sum_{n=1}^{\infty} \Big[ a_n\cos\Big(\frac{\pi nx}{L}\Big) + b_n\sin\Big(\frac{\pi nx}{L}\Big) \Big] $$
</span>
where
<span class="mathJaxDisplay">
\begin{align}
a_n & = \frac{1}{L}\int_{-L}^{L} f(x) \cos\Big(\frac{\pi nx}{L}\Big) dx, \\
b_n & = \frac{1}{L}\int_{-L}^{L} f(x) \sin\Big(\frac{\pi nx}{L}\Big) dx, \\
\end{align}
</span>
and
<span class="mathJaxDisplay">
$$ n=0,1,2... $$
</span>
<strong> Note:</strong> <span class="mathJaxInline">$ {a_0}/2 $</span> represents the
average value of <span class="mathJaxInline">$ f(x). $</span>
<br><br>
The Fourier series representation of the function <span
class="mathJaxInline">$ f(x) $</span> in exponential
(complex) form is
<span class="mathJaxDisplay">
$$ f(x) =\sum_{n=-\infty}^{\infty} c_n e^{{in \pi x}/L} \qquad $$
</span>
where
<span class="mathJaxDisplay">
$$ c_n = \frac{1}{2L}\int_{-L}^{L} f(x) e^{{-in \pi x}/L} dx, $$
</span>
<strong>Note:</strong> The constants in front of the integral(s) of the coefficient for
the trigonometric and exponential fourier series are different. Also note the limit of
the
summations. Follow through the derivation to understand the difference.
</div>
</div>
</div>
<div id="FSderivation" class="divclass">
<button id="ssh2" class="section-sub-head collapsed" key="ssh2"
@click="updateSubSection(2); subScrollTo($event)" data-toggle="collapse"
data-target="#FSderivationContentContainer"
:style="derivationSubSection === 2 ? 'background-color: #eaf2ff;' : ''">
General Derivation <i class='fas fa-chevron-down'></i>
</button>
<div id="FSderivationContentContainer" class="collapse show" data-parent="#p3">
<div id="FSderivationContent" class="section-sub-content" key="FSderivationContent">
We begin by assuming that <span class="mathJaxInline">$ f(x) $</span> can be represented
as a sum of
exponential terms.
<span class="mathJaxDisplay">
$$ f(x) = \sum_{n=-\infty}^{\infty} c_n e^{{in \pi x}/L} $$
</span>
Multiplying by <span class="mathJaxInline">$ e^{{-im \pi x}/L}, $</span> where <span
class="mathJaxInline">$ m=0,1,2,..., $</span>
and integrating both sides gives the following:
<span class="mathJaxDisplay">
$$ \int_{-L}^{L} f(x) e^{{-im \pi x}/L} dx = \sum_{n=-\infty}^{\infty} c_n \int_{-L}^{L} e^{{i(n-m) \pi x}/L} dx. $$
</span>
Performing the integral on the R.H.S gives
<span class="mathJaxDisplay" style="font-size: 90%">
$$ \int_{-L}^L e^{(i\pi x/L)(n-m)}dx =\left\{ \begin{array}{ll} 2L \qquad \text{(if n=m)} \\
0 \qquad \quad \text{(if n≠m)} \end{array} \right \}=2L\cdot\delta_{nm}. $$
</span>
This is the orthonormality of complex exponentials.
<br><br>
Now since the only non-zero value of the sum is when <span
class="mathJaxInline">$ n=m, $</span>
<span class="mathJaxDisplay">
$$ \int_{-L}^L f(x) e^{-im\pi x/L}dx = 2L \sum_{n=-\infty}^{+\infty}c_n\delta_{mn} = 2L\cdot c_m, $$
</span>
hence
<span class="mathJaxDisplay">
$$ c_m=\frac{1}{2L}\int_{-L}^{+L}f(x) e^{-im\pi x/L}dx. $$
</span>
<strong>Note:</strong> As <span class="mathJaxInline">$ m $</span> is an arbitrary
integer, it can be assigned
as <span class="mathJaxInline">$ n $</span> for simplicity.
<br><br>
Given the previously derived equation, we can derive the trigonometric form of the
Fourier series. By reorganising the sum, we get
<span class="mathJaxDisplay">
$$ f(x)= \underbrace{c_0}_\text{n=0} + \sum_{n=1}^{\infty} \big( \underbrace{c_n e^{in\pi x/L}}_\text{Positive n term} + \underbrace{c_{-n} e^{-in\pi x/L}}_\text{Negative n terms} \big). $$
</span>
We can regroup the terms in the summation in the following way:
<span class="section-extra-head-container">
<button class="section-extra-head" data-toggle="collapse"
@click="hideShowToggle($event)"
data-target="#regroupexplainContainer"> <span>Show</span> Full Calculation </button>
</span>
<div id="regroupexplainContainer" class="collapse show extra-content-container">
<div id="regroupexplain" class="extra-content">
<span class="mathJaxDisplay">
\begin{align}
= \frac{1}{2} \Big[ 2c_n e^{in\pi x/L} + 2c_{-n} e^{-in\pi x/L} & \\
+ \underbrace{c_{-n} e^{in\pi x/L} - c_{-n} e^{in\pi x/L}}_\text{ =0} & \\
+ \underbrace{c_{n} e^{-in\pi x/L} -c_{n} e^{-in\pi x/L}}_\text{ =0} & \Big] \\
\end{align}
<br>
\begin{align}
= \frac{1}{2} \Big[ c_n e^{in\pi x/L} +c_{-n} e^{in\pi x/L} & \\
+ c_n e^{-in\pi x/L} + c_{-n} e^{-in\pi x/L} & \\
+ c_n e^{in\pi x/L} - c_{-n} e^{in\pi x/L} & \\
- c_n e^{-in\pi x/L} + c_{-n} e^{-in\pi x/L} & \Big] \\
\end{align}
</span>
</div>
</div>
<span class="mathJaxDisplay">
\begin{align}
f(x)= c_0 + \sum_{n=1}^{\infty} \Big[ & \frac{c_n + c_{-n}}{2} \big(e^{in\pi x/L} +e^{-in\pi x/L} \big) \\
& \frac{c_n - c_{-n}}{2} \big(e^{in\pi x/L} -e^{-in\pi x/L} \big) \Big]
\end{align}
</span>
Now define <span class="mathJaxInline">$ a_n = c_n + c_{-n} $</span> and
<span class="mathJaxInline">$ b_n = i(c_n - c_{-n}) $</span>
and use that these exponentials can we written as
sines and cosines.
<br><br>
<strong>Note:</strong> <span class="mathJaxInline">$ a_0 = 2c_0 $</span> and <span
class="mathJaxInline">$ b_0=0. $</span>
<br><br>
Hence
<span class="mathJaxDisplay">
$$ f(x) = \frac{a_0}{2} + \sum_{n=1}^{\infty} \Big[ a_n\cos\Big(\frac{\pi nx}{L}\Big) + b_n\sin\Big(\frac{\pi nx}{L}\Big) \Big] $$
</span>
<span class="mathJaxInline">$ a_n $</span> can be derived by using the expression from
<span class="mathJaxInline">$ c_n $</span>
<span class="mathJaxDisplay">
\begin{align}
a_n = c_n + c_{-n} = & \frac{1}{2L}\int_{-L}^{+L}f(x) e^{-in\pi x/L}dx \\
+ & \frac{1}{2L} \int_{-L}^{+L}f(x) e^{in\pi x/L}dx
\end{align}
</span>
Factorise and spot the exponential form of <span class="mathJaxInline">$ \cos. $</span>
<span class="mathJaxDisplay">
\begin{align}
& =\frac{1}{L}\int_{-L}^{+L}f(x) \Big[\frac{e^{in\pi x/L} +e^{-in\pi x/L}}{2}\Big]dx \\
& =\frac{1}{L}\int_{-L}^{L} f(x) \cos\Big(\frac{\pi nx}{L}\Big) dx
\end{align}
</span>
Similarly for <span class="mathJaxInline">$ b_n, $</span>
<span class="mathJaxDisplay">
$$ b_n =\frac{1}{L}\int_{-L}^{L} f(x) \sin\Big(\frac{\pi nx}{L}\Big) dx. $$
</span>
</div>
</div>
</div>
<div id="triangular1" class="divclass">
<button id="ssh3" class="section-sub-head collapsed" key="ssh3"
@click="updateSubSection(3); subScrollTo($event)" data-toggle="collapse"
data-target="#triangular1ContentContainer"
:style="derivationSubSection === 3 ? 'background-color: #eaf2ff;' : ''">
Triangular Function Part 1 <i class='fas fa-chevron-down'></i>
</button>
<div id="triangular1ContentContainer" class="collapse show" data-parent="#p3">
<div id="triangular1Content" class="section-sub-content" key="triangular1Content">
The triangular function is defined by the following:
<span class="mathJaxDisplay">
$$ f(x)=\left\{
\begin{array}{ll}
\frac{-2A}{L} (x+L) \quad (-L \leq x < -L/2) \\
\frac{2A}{L} x \qquad \qquad (-L/2\leq x < L/2) \\
\frac{-2A}{L} (x-L) \quad (L/2\leq x < L)
\end{array}
\right. $$
</span>
First notice that <span class="mathJaxInline">$ f(x) $</span> is odd about <span
class="mathJaxInline">$ x=0, $</span> hence <span
class="mathJaxInline">$ a_n=0 $</span>
for all <span class="mathJaxInline">$ n. $</span> Also, since the <span
class="mathJaxInline">$ b_n $</span> integrand is even about
<span class="mathJaxInline">$ x=0, $</span>
<span class="mathJaxDisplay">
$$ b_n=\frac{2}{L}\int_0^L f(x) \sin \left(\frac{n \pi x}{L}\right)dx. $$
</span>
Notice that for even <span class="mathJaxInline">$ n, $</span> <span
class="mathJaxInline">$ b_n $</span> is odd about
<span class="mathJaxInline">$ x=L/2. $</span>
Hence,
<span class="mathJaxDisplay">
$$ b_n=\frac{2}{L}\int_0^{L} f(x) \sin \left(\frac{n\pi x}{L} \right) dx = 0 \quad \text{for even n}. $$
</span>
The integral from <span class="mathJaxInline">$ 0 $</span> to <span
class="mathJaxInline">$ L/2 $</span> is equal in magnitude but
opposite in sign to the integral from <span class="mathJaxInline">$ L/2 $</span> to
<span class="mathJaxInline">$ L, $</span> for
even <span class="mathJaxInline">$ n. $</span>
<br><br>
For odd <span class="mathJaxInline">$ n, $</span> the function is even around <span
class="mathJaxInline">$ L/2, $</span> so we only
have to integrate from <span class="mathJaxInline">$ 0 $</span> to <span
class="mathJaxInline">$ L/2 $</span> then multiply by
<span class="mathJaxInline">$ 2. $</span> This has made our job much easier.
<span class="mathJaxDisplay">
$$ b_n=2\frac{2}{L}\int_0^{L/2} f(x) \sin \left(\frac{n\pi x}{L} \right) dx \quad \text{for odd n} $$
</span>
Play around with the visualisation to the right to convince yourself this is true.
</div>
</div>
</div>
<div id="triangular2" class="divclass">
<button id="ssh4" class="section-sub-head collapsed" key="ssh4"
@click="updateSubSection(4); subScrollTo($event)" data-toggle="collapse"
data-target="#triangular2ContentContainer"
:style="derivationSubSection === 4 ? 'background-color: #eaf2ff;' : ''">
Triangular Function Part 2 <i class='fas fa-chevron-down'></i>
</button>
<div id="triangular2ContentContainer" class="collapse show" data-parent="#p3">
<div id="triangular2Content" class="section-sub-content" key="triangular2Content">
<span class="mathJaxDisplay">
$$ \text{For 0 < x < L/2:} \quad f(x)=\frac{2Ax}{L} $$
</span>
Remembering that for even <span class="mathJaxInline">$ n, $</span> <span
class="mathJaxInline">$ b_n=0, $</span> therefore only
consider odd <span class="mathJaxInline">$ n. $</span>
<span class="mathJaxDisplay">
$$ b_n = \frac{4}{L} \frac{2A}{L}\int_0^{L/2} x \sin \left(\frac{n\pi x}{L} \right) dx $$
</span>
This integral can be performed by parts.
<span class="section-extra-head-container">
<button class="section-extra-head" data-toggle="collapse"
@click="hideShowToggle($event)"
data-target="#BypartsTriangularContainer"> <span>Show</span> Full Calculation </button>
</span>
<div id="BypartsTriangularContainer" class="collapse show extra-content-container">
<div id="BypartsTriangular" class="extra-content">
<span class="mathJaxDisplay">
$$ u=x \qquad dv= \sin \left(\frac{n\pi x}{L} \right)dx $$
</span>
<span class="mathJaxDisplay">
$$ du=dx \qquad v=\frac{-L}{n\pi} \cos \left(\frac{n\pi x}{L} \right) $$
</span>
<span class="mathJaxDisplay">
\begin{align}
b_n=\frac{8A}{L^2} \Bigg[ \Big[ \frac{-xL}{n\pi} & \cos \Big(\frac{n\pi x}{L}\Big) \Big] \Bigr|_0^{L/2} \\
-\int_0^{L/2}\frac{-L}{n\pi} & \cos \Big(\frac{n\pi x}{L} \Big)dx \Bigg]
\end{align}
</span>
For odd n,
<span class="mathJaxDisplay">
$$ \cos \left(\frac{n\pi}{2} \right)=0 $$
</span>
Therefore,
<span class="mathJaxDisplay">
$$ b_n=\frac{8A}{L^2} \Bigg[0+ \int_0^{L/2}\frac{L}{n\pi} \cos \left(\frac{n\pi x}{L}
\right)dx \Bigg] $$
</span>
</div>
</div>
<span class="mathJaxDisplay">
$$ b_n=\frac{8A}{L^2} \frac{L^2}{(n\pi)^2} \sin \left(\frac{n\pi x}{L} \right) \biggr |_0^{L/2} $$
</span>
Note for odd <span class="mathJaxInline">$ n $</span>:
<span class="mathJaxDisplay">
$$ \sin \left(\frac{n\pi}{2} \right)=(-1)^{\frac{n-1}{2}} $$
</span>
Therefore,
<span class="mathJaxDisplay">
$$ b_n=\frac{8A}{n^2\pi^2}(-1)^{\frac{n-1}{2}} $$
</span>
and,
<span class="mathJaxDisplay">
$$ f(x)=\sum_{n=1,3,5...}^\infty \frac{8A}{n^2\pi^2} (-1)^{\frac{n-1}{2}} \sin \left(\frac{n\pi x}{L} \right) $$
</span>
Finally, using the fact that odd number can be written as <span
class="mathJaxInline">$ 2n +1 $</span> for any integer
<span class="mathJaxInline">$ n, $</span> we have
<span class="mathJaxDisplay" style="font-size: 90%">
$$ f(x)=\sum_{n=1,2,3...}^\infty \frac{8A}{(2n-1)^2\pi^2}(-1)^n \sin \left(\frac{(2n-1)\pi x}{L} \right) $$
</span>
</div>
</div>
</div>
<div id="parabolic" class="divclass">
<button id="ssh5" class="section-sub-head collapsed" key="ssh5"
@click="updateSubSection(5); subScrollTo($event)" data-toggle="collapse"
data-target="#parabolicContentContainer"
:style="derivationSubSection === 5 ? 'background-color: #eaf2ff;' : ''">
Parabolic Function <i class='fas fa-chevron-down'></i>
</button>
<div id="parabolicContentContainer" class="collapse show" data-parent="#p3">
<div id="parabolicContent" class="section-sub-content" key="parabolicContent">
The parabolic function is defined as:
<span class="mathJaxDisplay">
$$ f(x)=Ax^2 \quad \text{for:} -L\leq x< L $$
</span>
and is forced to be periodic. <span class="mathJaxInline">$ A $</span> is a constant.
Therefore, the coefficients <span class="mathJaxInline">$ a_n $</span> and <span
class="mathJaxInline">$ b_n $</span>
are given by
<span class="mathJaxDisplay">
$$ b_n = \frac{1}{L}\int_{-L}^{+L} Ax^2 \sin \left(\frac{n \pi x}{L} \right)dx $$
</span>
<span class="mathJaxDisplay">
$$ a_n= \frac{1}{L}\int_{-L}^{+L} Ax^2 \cos \left(\frac{n \pi x}{L} \right)dx $$
</span>
The <span class="mathJaxInline">$ b_n $</span> integral is odd about <span
class="mathJaxInline">$ x=0, $</span> hence
<span class="mathJaxInline">$ b_n=0 $</span> for all <span
class="mathJaxInline">$ n. $</span> <span class="mathJaxInline">$ f(x) $</span> is
even about
<span class="mathJaxInline">$ x=0. $</span> Thus,
<span class="mathJaxDisplay">
$$ a_n=\frac{2}{L}\int_{0}^{+L} Ax^2 \cos \left(\frac{n \pi x}{L} \right)dx. $$
</span>
For <span class="mathJaxInline">$ n=0 $</span>:
<span class="mathJaxDisplay">
$$ a_0 = \frac{2}{L} \int _{0}^{+L} Ax^2 dx = \frac{2AL^2}{3} $$
</span>
For <span class="mathJaxInline">$ n\neq 0 $</span>:
<span class="mathJaxDisplay">
$$ a_n = \frac{2A}{L}\int_0^L x^2 \cos \left(\frac{n\pi x}{L} \right)dx $$
</span>
This equation can now be solved using integration by parts.
<span class="section-extra-head-container">
<button class="section-extra-head" data-toggle="collapse"
@click="hideShowToggle($event)"
data-target="#ByPartsParabolic1Container"> <span>Show</span> Full Calculation </button>
</span>
<div id="ByPartsParabolic1Container" class="collapse show extra-content-container">
<div id="ByPartsParabolic1" class="extra-content">
<span class="mathJaxDisplay">
$$ du = 2x\cdot dx \qquad v=\frac{L}{n\pi} \sin \left(\frac{n\pi x}{L} \right) $$
</span>
<span class="mathJaxDisplay">
$$ u=x^2 \qquad dv= \cos \left(\frac{n \pi x}{L} \right)dx $$
</span>
<span class="mathJaxDisplay">
\begin{align}
a_n = \frac{2A}{L} \Bigg[ \Big[\frac{Lx^2}{n\pi} & \sin \left(\frac{n\pi x}{L} \right) \Big] \biggr |_0^L \\
-\int_0^L\frac{2xL}{n\pi} & \sin \left(\frac{n \pi x}{L} \right)dx \Bigg]
\end{align}
</span>
<span class="mathJaxDisplay">
$$ = \frac{2A}{L} \Bigg[0 -\int_0^L\frac{2xL}{n\pi} \sin\left(\frac{n \pi x}{L}\right)dx \Bigg] $$
</span>
</div>
</div>
<span class="mathJaxDisplay">
$$ a_n = -\frac{4A}{n\pi}\int_{0}^{L} x \sin \left(\frac{n \pi x}{L} \right)dx $$
</span>
<span class="section-extra-head-container">
<button class="section-extra-head" data-toggle="collapse"
@click="hideShowToggle($event)"
data-target="#ByPartsParabolic2Container"> <span>Show</span> Full Calculation </button>
</span>
<div id="ByPartsParabolic2Container" class="collapse show extra-content-container">
<div id="ByPartsParabolic2" class="extra-content">
<span class="mathJaxDisplay">
$$ u = x \qquad dv = \sin \left(\frac{n\pi x}{L} \right) dx $$
</span>
<span class="mathJaxDisplay">
$$ du = dx \qquad v = -\frac{L}{n\pi} \cos \left(\frac{n\pi x}{L} \right) $$
</span>
<span class="mathJaxDisplay">
\begin{align}
a_n = \frac{-4A}{n\pi} \Bigg[\Big[-\frac{xL}{n\pi} & \cos \left(\frac{n\pi x}{L} \right)\Big] \biggr |_0^L \\
- \int_0^L\frac{-L}{n\pi} & \cos \left(\frac{n\pi x}{L} \right)dx \Bigg]
\end{align}
</span>
</div>
</div>
<span class="mathJaxDisplay">
$$ a_n = \frac{4A}{n\pi} \Bigg[\frac{xL}{n\pi} \cos \left(\frac{n\pi x}{L} \right) \Bigg] \biggr |_0^L $$
</span>
<span class="mathJaxDisplay">
$$ = \frac{4AL^2}{n^2\pi^2}(-1)^n $$
</span>
Therefore, the fourier series can be written as
<span class="mathJaxDisplay">
$$ f(x) = \frac{AL^2}{3} + \sum_{n=1}^\infty \frac{4AL^2}{n^2\pi^2} (-1)^n \cos \left(\frac{n\pi x}{L} \right) $$
</span>
</div>
</div>
</div>
<div id="delta" class="divclass">
<button id="ssh6" class="section-sub-head collapsed" key="ssh6"
@click="updateSubSection(6); subScrollTo($event)" data-toggle="collapse"
data-target="#deltaContentContainer"
:style="derivationSubSection === 6 ? 'background-color: #eaf2ff;' : ''">
Dirac-Delta Function <i class='fas fa-chevron-down'></i>
</button>
<div id="deltaContentContainer" class="collapse show" data-parent="#p3">
<div id="deltaContent" class="section-sub-content" key="deltaContent">
The Dirac-delta function can be thought of as a infinite spike at <span
class="mathJaxInline">$ x=0. $</span>
<span class="mathJaxDisplay">
$$
f(x) = \delta(x)=\left\{
\begin{array}{ll}
+\infty \quad (x=0) \\
0 \qquad (x \neq 0)
\end{array}
\right.
$$
</span>
<span class="mathJaxDisplay">
$$ a_n=\frac{1}{L}\int_{-L}^{+L} \delta (x) \cos \left(\frac{n\pi x}{L} \right)dx $$
</span>
<span class="mathJaxDisplay">
$$ b_n=\frac{1}{L}\int_{-L}^{+L}\delta(x) \sin \left(\frac{n\pi x}{L} \right)dx $$
</span>
<span class="mathJaxInline">$ \delta(x) $</span> is an even function. Hence <span
class="mathJaxInline">$ b_n=0 $</span> and
<span class="mathJaxDisplay">
$$ a_n=\frac{1}{L} $$
</span>
<span class="section-extra-head-container">
<button class="section-extra-head" data-toggle="collapse"
@click="hideShowToggle($event)"
data-target="#ByPartsDiracContainer"> <span>Show</span> Full Calculation </button>
</span>
<div id="ByPartsDiracContainer" class="collapse show extra-content-container">
<div id="ByPartsDirac" class="extra-content">
By considering the shifting property of the Dirac-Delta function,
<span class="mathJaxDisplay">
$$ \int_{\alpha-\epsilon}^{\alpha+\epsilon} g(x) \delta(x-\alpha)dx=g(\alpha) $$
</span>
For us, <span class="mathJaxInline">$ \alpha=0, $</span> <span
class="mathJaxInline">$ \epsilon=L, $</span> and <span
class="mathJaxInline">$ g(x)= \sin \left(n \pi x/L \right). $</span>
<br><br>
Therefore,
<span class="mathJaxDisplay">
$$ a_n=\frac{1}{L}\cos \left(\frac{n\pi \times 0}{L} \right)=\frac{1}{L} $$
</span>
<span class="mathJaxDisplay">
$$ b_n=\frac{1}{L}\sin \left(\frac{n\pi \times 0}{L} \right)=0 $$
</span>
</div>
</div>
Therefore, the fourier series for positive <span class="mathJaxInline">$ L $</span> can
be written as
<span class="mathJaxDisplay">
$$ f(x)=\frac{1}{2L}+\sum_{n=1}^\infty \frac{1}{L} \cos \left(\frac{n\pi x}{L} \right). $$
</span>
</div>
</div>
</div>
<div id="square" class="divclass">
<button id="ssh7" class="section-sub-head collapsed" key="ssh7"
@click="updateSubSection(7); subScrollTo($event)" data-toggle="collapse"
data-target="#squareContentContainer"
:style="derivationSubSection === 7 ? 'background-color: #eaf2ff;' : ''">
Square Wave <i class='fas fa-chevron-down'></i>
</button>
<div id="squareContentContainer" class="collapse show" data-parent="#p3">
<div id="squareContent" class="section-sub-content" key="squareContent">
The square wave is defined as the following:
<span class="mathJaxDisplay">
$$
f(x)=\left\{
\begin{array}{ll}
-A \quad (-L \leq x < 0) \\
A \quad (0\leq x < L)
\end{array}
\right.
$$
</span>
The <span class="mathJaxInline">$ a_{n} $</span> terms can be found be noting that <span
class="mathJaxInline">$ f(x) $</span> is
odd,
so <span class="mathJaxInline">$ a_n $</span> is <span
class="mathJaxInline">$ 0 $</span> for all <span class="mathJaxInline">$ n. $</span>
<br><br>
To find the <span class="mathJaxInline">$ b_n $</span> terms, the integration can be
split into two parts:
<span class="mathJaxInline">$ -L\leq x <0 $</span>
and <span class="mathJaxInline">$ 0\leq x < L. $</span>
<br><br>
This gives the following integration:
<span class="mathJaxDisplay">
\begin{align}
b_n & =\frac{1}{L}\int_{-L}^0 -A \sin \left(\frac{n\pi x}{L} \right)dx \\
& + \frac{1}{L}\int_0^L A \sin \left(\frac{n \pi x}{L} \right)dx
\end{align}
</span>
which can be evaluated to:
<span class="mathJaxDisplay">
$$ b_n=\frac{-2A}{L}\frac{L}{n\pi} \cos \left(\frac{n\pi x}{L} \right)\biggr |_0^L
=\frac{2A}{n\pi}\left[1-\cos\left(n\pi \right) \right] $$
</span>
Note that
<span class="mathJaxDisplay">
$$ \cos \left(n \pi\right)=(-1)^n $$
</span>
Hence
<span class="mathJaxDisplay">
$$ b_n=\frac{2A}{n\pi}(1-(-1)^n) $$
</span>
Therefore the final fourier series is:
<span class="mathJaxDisplay">
$$ f(x)=\sum_{n=1}^{\infty} \frac{2A}{n\pi} (1-(-1)^n)\sin \left(\frac{n\pi x}{L}\right). $$
</span>
</div>
</div>
</div>
<div id="sawtooth" class="divclass">
<button id="ssh8" class="section-sub-head collapsed" key="ssh8"
@click="updateSubSection(8); subScrollTo($event)" data-toggle="collapse"
data-target="#sawtoothContentContainer"
:style="derivationSubSection === 8 ? 'background-color: #eaf2ff;' : ''">
Sawtooth Wave <i class='fas fa-chevron-down'></i>
</button>
<div id="sawtoothContentContainer" class="collapse show" data-parent="#p3">
<div id="sawtoothContent" class="section-sub-content" key="sawtoothContent">
The Sawtooth wave is defined as the following:
<span class="mathJaxDisplay">
$$ f(x)=\frac{Ax}{L} \quad (-L \leq x < L). $$
</span>
<span class="mathJaxInline">$ f(x) $</span> is odd, so <span class="mathJaxInline">$ a_n= 0 $</span>
for all <span class="mathJaxInline">$ n. $</span>
<br><br>
The <span class="mathJaxInline">$ b_n $</span> terms are given by the following
integration:
<span class="mathJaxDisplay">
\begin{align}
b_n & =\frac{1}{L}\int_{-L}^{L} \frac{Ax}{L}\sin \left(\frac{n\pi x}{L} \right)dx \\
& =\frac{2A}{L^{2}}\int_{0}^{L} x \sin \left(\frac{n\pi x}{L} \right)dx.
\end{align}
</span>
Using Integration by parts it can be shown that:
<span class="section-extra-head-container">
<button class="section-extra-head" data-toggle="collapse"
@click="hideShowToggle($event)"
data-target="#ByPartsSawtoothContainer"> <span>Show</span> Full Calculation </button>
</span>
<div id="ByPartsSawtoothContainer" class="collapse show extra-content-container">
<div id="ByPartsSawtooth" class="extra-content">
<span class="mathJaxDisplay">
$$ u=x \quad dv=\sin \left(\frac{n\pi x}{L} \right)dx $$
</span>
<span class="mathJaxDisplay">
$$ du=dx \quad v=\frac{-L}{n\pi}\cos \left(\frac{n\pi x}{L} \right) $$
</span>
<span class="mathJaxDisplay">
\begin{align}
b_n=\frac{2A}{L^{2}} \Bigg[ \frac{-Lx}{n\pi} & \cos \left(\frac{n\pi x}{L} \right)\biggr |_0^L \\
-\int_0^L\frac{-L}{n\pi} & \cos \left(\frac{n\pi x}{L} \right)dx \Bigg]
\end{align}
</span>
Note that the second integrand is zero as it is of cosine over a full
period.
<span class="mathJaxDisplay">
$$ b_n=-\frac{2A}{n\pi} \cos \left(n\pi \right)=-\frac{2A}{n\pi}(-1)^n $$
</span>
</div>
</div>
<span class="mathJaxDisplay">
$$ b_n=\frac{2A}{n\pi}(-1)^{n+1}. $$
</span>
Therefore the final fourier series is:
<span class="mathJaxDisplay">
$$ f(x)=\sum_{n=1}^\infty \frac{2A}{n\pi}(-1)^{n+1} \sin \left(\frac{n\pi x}{L} \right). $$
</span>
</div>
</div>
</div>
<div id="modx" class="divclass">
<button id="ssh9" class="section-sub-head collapsed" key="ssh9"
@click="updateSubSection(9); subScrollTo($event)" data-toggle="collapse"
data-target="#modxContentContainer"
:style="derivationSubSection === 9 ? 'background-color: #eaf2ff;' : ''">
Mod x Function <i class='fas fa-chevron-down'></i>
</button>
<div id="modxContentContainer" class="collapse show" data-parent="#p3">
<div id="modxContent" class="section-sub-content" key="modxContent">
The <span class="mathJaxInline">$ |x| $</span> function is defined as the following:
<span class="mathJaxDisplay">
$$ f(x)=A|x| \quad (-L \leq x < L). $$
</span>
<span class="mathJaxDisplay">
$$ a_n = \frac{1}{L}\int_{-L}^{+L} A|x| \cos \left(\frac{n \pi x}{L} \right)dx $$
</span>
<span class="mathJaxDisplay">
$$ b_n = \frac{1}{L}\int_{-L}^{+L} A|x| \sin \left( \frac{n\pi x}{L}\right) dx $$
</span>
<span class="mathJaxInline">$ f(x) $</span> is even about <span class="mathJaxInline">$ x=0. $</span>
Hence <span class="mathJaxInline">$ b_n=0. $</span>
The <span class="mathJaxInline">$ a_n $</span> integral is even about <span
class="mathJaxInline">$ x=0. $</span> Hence,
<span class="mathJaxDisplay">
$$ a_n = \frac{2}{L}\int_{0}^{+L} Ax \cos \left(\frac{n \pi x}{L}\right)dx. $$
</span>
For <span class="mathJaxInline">$ n=0 $</span>
<span class="mathJaxDisplay">
$$ a_0 = \frac{2A}{L}\int_0^L x dx = \frac{2A}{L}\frac{x^2}{2} \biggr |_0^L = AL. $$
</span>
For <span class="mathJaxInline">$ n \neq 0 $</span>:
<span class="mathJaxDisplay">
$$ a_n = \frac{2A}{L}\int_{0}^{+L} x \cos \left(\frac{n \pi x}{L} \right)dx. $$
</span>
By integrating by parts,
<span class="section-extra-head-container">
<button class="section-extra-head" data-toggle="collapse"
@click="hideShowToggle($event)"
data-target="#ByPartsModxContainer"> <span>Show</span> Full Calculation </button>
</span>
<div id="ByPartsModxContainer" class="collapse show extra-content-container">
<div id="ByPartsModx" class="extra-content">
<span class="mathJaxDisplay">
$$ u=x \qquad dv= \cos\left(\frac{n\pi x}{L}\right)dx $$
</span>
<span class="mathJaxDisplay">
$$ du=dx \qquad v=\frac{L}{n\pi} \sin \left(\frac{n\pi x}{L} \right) $$
</span>
<span class="mathJaxDisplay">
\begin{align}
a_n = \frac{2A}{L} \Bigg[ \Big[\frac{Lx}{n\pi} & \sin \left( \frac{n \pi x}{L} \right) \Big] \Biggr|_0^L \\
-\int_0^{+L} \frac{L}{n\pi} & \sin \left(\frac{n \pi x}{L} \right)dx \Bigg]
\end{align}
</span>
<span class="mathJaxDisplay">
$$ a_n = \frac{2A}{L} \Bigg[ 0 -\int_0^{+L}\frac{L}{n\pi} \sin \left(\frac{n\pi x}{L} \right)dx \Bigg] $$
</span>
</div>
</div>
<span class="mathJaxDisplay">
$$ a_n = \frac{2A}{L}\frac{L^2}{(n\pi)^2} \cos \left( \frac{n\pi x}{L} \right)\biggr |_0^L . $$
</span>
Hence,
<span class="mathJaxDisplay">
$$ a_n = \frac{2A}{L}\frac{L^2}{(n\pi)^2} \left[(-1)^n-1 \right] = \frac{2AL}{(n\pi)^2}\left[(-1)^n-1 \right]. $$
</span>
Therefore the final fourier series is:
<span class="mathJaxDisplay">
$$ f(x)=\frac{AL}{2}+ \sum_{n=1}^\infty \frac{2AL}{(n\pi)^2} \left[(-1)^n-1 \right] \cos \left(\frac{n\pi
x}{L} \right). $$
</span>
</div>
</div>
</div>
</div>
</div>
<div class="section-container" id="sc4">
<div class="placeholder" id="ph4">
<hr>
<h2 class="text section-head" id="s4">
{{sectionTitleLong[3]}}
</h2>
<hr>
</div>
<div class="text section-body odd" id="p4">
The 0<sup>th</sup> term of the series, <span class="mathJaxInline">$ \frac{a_0}{2}, $</span> is the
constant term before the sum.
<br><br>
This is labelled as the 0<sup>th</sup> term so that the series may start indexing its terms from
<span class="mathJaxInline">$ n=1. $</span>
<span class="mathJaxDisplay">
$$ f(x)=\frac{a_0}{2}+\sum_{n=1}^{\infty}a_n \cos\left(\frac{n\pi x}{L}\right)+b_n \sin\left(\frac{n \pi x}{L}\right) $$
</span>
If the function is not periodic, then we may cut the function, forcing it to be periodic over some
<span class="mathJaxInline">$ -L < x < L. $</span> This means that we can prescribe a Fourier series
that is now valid for the function over the selected range. If we take the limit as <span
class="mathJaxInline">$ L \rightarrow \infty, $</span>
then a Fourier transform need be used. This is a different problem entirely!
</div>
</div>
<div class="section-container" id="sc5">
<div class="placeholder" id="ph5">
<hr>
<h2 class="text section-head" id="s5">
{{sectionTitleLong[4]}}
</h2>
<hr>
</div>
<div class="text section-body odd" id="p5">
<h3 class="section-sub-head first-sub-head">
Decomposition of a function into odd and even parts
</h3>
Representing a function in terms of a trigonometric Fourier series is analogous to representing a
vector in
terms of basis vectors. Here sines and cosines are our basis functions, we have a method for finding
the projection
of the function in the direction of each basis function (<span
class="mathJaxInline">$ a_{n} $</span> and
<span class="mathJaxInline">$ b_{n} $</span> are the "projections" of <span class="mathJaxInline">$ f(x) $</span>
onto
<span class="mathJaxInline">$ \sin\left(\frac{n\pi x}{L} \right) $</span> and <span
class="mathJaxInline">$ \cos\left(\frac{n \pi x}{L} \right) $</span>
respectively).
<br><br>
This visualisation shows how the first ten terms are introduced to the series, notice that
usually as the number of terms included in the series increases, new terms become less
significant (their amplitude decreases).
<h3 class="section-sub-head">
Power Spectrum
</h3>
The power spectrum form is a different representation of a continuous signal.
<br><br>
One can think of a signal as a sound wave that is a superposition of different frequencies <span
class="mathJaxInline">$ \omega_n, $</span>
each with amplitude <span class="mathJaxInline">$ \alpha_n, $</span> and relative phases <span
class="mathJaxInline">$ \theta_n. $</span>
Any signal of period <span class="mathJaxInline">$ 2L $</span> can be decomposed in terms of the
amplitude and relative
phase of its discrete frequency modes. Its two parameters <span
class="mathJaxInline">$ \alpha_n $</span> and <span class="mathJaxInline">$ \theta_n, $</span>
enable us to measure the amount of
each frequency <span class="mathJaxInline">$ \omega_n=\frac{n\pi}{L} $</span>contained in the
signal, and the relative
phase difference between the <span class="mathJaxInline">$ n^{th} $</span> frequency and a cosine
wave centered at <span class="mathJaxInline">$ x=0. $</span>
This is simply a different way to represent a signal
rather than decomposing it into its even and odd parts.
<span class="mathJaxDisplay">
$$ f(x) = \frac{a_0}{2} + \sum_{n=1}^{\infty}\alpha_n \cos\bigg(\frac{n\pi x}{L} - \theta_n\bigg) $$
</span>
<span class="mathJaxDisplay">
$$ \alpha_n = \sqrt{a^2_n + b^2_n} $$
</span>
<span class="mathJaxDisplay">
$$ \theta_n = \tan^{-1} \bigg(\frac{b_n}{a_n}\bigg) $$
</span>
For some even functions, when the period transitions from 0 to negative, the value of
<span class="mathJaxInline">$ \theta_n $</span> change from <span class="mathJaxInline">$ 0 $</span>
to <span class="mathJaxInline">$ \pi $</span> or vice versa. Why
do you think
this happens?
<span class="section-extra-head-container">
<button class="section-extra-head" data-toggle="collapse" @click="hideShowToggle($event)"
data-target="#evenThetaAnswerContainer"> <span>Show</span> Answer </button>
</span>
<div id="evenThetaAnswerContainer" class="collapse show extra-content-container">
<div id="evenThetaAnswer" class="extra-content">
This happens because the value of <span class="mathJaxInline">$ a_n $</span> changes sign
(<span class="mathJaxInline">$ b_n $</span> is 0) causing the value of
<span class="mathJaxInline">$ \theta_n $</span> to change. For <span class="mathJaxInline">$ b_n = 0, $</span>
<span class="mathJaxInline">$ \tan^{-1}(\frac{b_n}{a_n}) $</span>
can be both
0 or <span class="mathJaxInline">$ \pi $</span> depending on whether <span
class="mathJaxInline">$ a_n $</span> is positive or
negative. Not all even functions exhibit this.
The parabola for example, has its <span class="mathJaxInline">$ a_n $</span> proportional to