summaryrefslogtreecommitdiff
path: root/FSF-2020/calculus/series-and-transformations/Fourier Transform
diff options
context:
space:
mode:
Diffstat (limited to 'FSF-2020/calculus/series-and-transformations/Fourier Transform')
-rw-r--r--FSF-2020/calculus/series-and-transformations/Fourier Transform/README.md5
-rw-r--r--FSF-2020/calculus/series-and-transformations/Fourier Transform/gifs/file3.gifbin558677 -> 955375 bytes
-rw-r--r--FSF-2020/calculus/series-and-transformations/Fourier Transform/gifs/file6.gifbin0 -> 955375 bytes
-rw-r--r--FSF-2020/calculus/series-and-transformations/Fourier Transform/gifs/file7.gifbin0 -> 793582 bytes
-rw-r--r--FSF-2020/calculus/series-and-transformations/Fourier Transform/video3_seriesVSTransform.py25
-rw-r--r--FSF-2020/calculus/series-and-transformations/Fourier Transform/video4_FourierSeriesOfSquarePulse.py13
6 files changed, 32 insertions, 11 deletions
diff --git a/FSF-2020/calculus/series-and-transformations/Fourier Transform/README.md b/FSF-2020/calculus/series-and-transformations/Fourier Transform/README.md
index c5d8389..2fa4e04 100644
--- a/FSF-2020/calculus/series-and-transformations/Fourier Transform/README.md
+++ b/FSF-2020/calculus/series-and-transformations/Fourier Transform/README.md
@@ -7,9 +7,12 @@
### Applying the same on Graphs
![GIF3](gifs/file2b.gif)
-### Fourier series for non-periodic functions
+### Fourier series for non-periodic functions-a
![GIF4](gifs/file3.gif)
+### Fourier series for non-periodic functions-b
+![GIF4a](gifs/file7.gif)
+
### Fourier Series of Square pulse
![GIF5](gifs/file4.gif)
diff --git a/FSF-2020/calculus/series-and-transformations/Fourier Transform/gifs/file3.gif b/FSF-2020/calculus/series-and-transformations/Fourier Transform/gifs/file3.gif
index 533368b..de94810 100644
--- a/FSF-2020/calculus/series-and-transformations/Fourier Transform/gifs/file3.gif
+++ b/FSF-2020/calculus/series-and-transformations/Fourier Transform/gifs/file3.gif
Binary files differ
diff --git a/FSF-2020/calculus/series-and-transformations/Fourier Transform/gifs/file6.gif b/FSF-2020/calculus/series-and-transformations/Fourier Transform/gifs/file6.gif
new file mode 100644
index 0000000..de94810
--- /dev/null
+++ b/FSF-2020/calculus/series-and-transformations/Fourier Transform/gifs/file6.gif
Binary files differ
diff --git a/FSF-2020/calculus/series-and-transformations/Fourier Transform/gifs/file7.gif b/FSF-2020/calculus/series-and-transformations/Fourier Transform/gifs/file7.gif
new file mode 100644
index 0000000..ab4eed8
--- /dev/null
+++ b/FSF-2020/calculus/series-and-transformations/Fourier Transform/gifs/file7.gif
Binary files differ
diff --git a/FSF-2020/calculus/series-and-transformations/Fourier Transform/video3_seriesVSTransform.py b/FSF-2020/calculus/series-and-transformations/Fourier Transform/video3_seriesVSTransform.py
index f23e54f..07f884a 100644
--- a/FSF-2020/calculus/series-and-transformations/Fourier Transform/video3_seriesVSTransform.py
+++ b/FSF-2020/calculus/series-and-transformations/Fourier Transform/video3_seriesVSTransform.py
@@ -1,7 +1,7 @@
from manimlib.imports import *
import numpy as np
-class compare(GraphScene):
+class compare(GraphScene,MovingCameraScene):
CONFIG = {
"x_min": -3,
"x_max": 3,
@@ -14,6 +14,9 @@ class compare(GraphScene):
"exclude_zero_label": True,
"x_labeled_nums": range(-2, 3, 1),
}
+ def setup(self):
+ GraphScene.setup(self)
+ MovingCameraScene.setup(self)
def returnPairLines(self,left,right,y_each_unit):
lineLeft=DashedLine(start=(0,5*y_each_unit,0),end=(0,-5*y_each_unit,0)).shift(left)
lineRight=DashedLine(start=(0,5*y_each_unit,0),end=(0,-5*y_each_unit,0)).shift(right)
@@ -58,7 +61,7 @@ class compare(GraphScene):
self.graph_origin=3.5*RIGHT
self.y_axis_label="$\\frac { { l }^{ 2 } }{ 6 } +\sum _{ n=1 }^{ \infty }{ \\frac { 2{ (-1) }^{ n }{ l }^{ 2 }cos(\\frac { n\pi x }{ l } ) }{ { \pi }^{ 2 }{ n }^{ 2 } } }$"
self.setup_axes(animate=True,scalee=1)
- axes.append(self.axes)
+ axes.append(self.axes)
coeffResult=[
TextMobject("$\\frac { { 1 }^{ 2 } }{ 6 } +\sum _{ n=1 }^{ 1 }{ \\frac { 2{ (-1) }^{ n }{ 1 }^{ 2 }cos(\\frac { n\pi x }{ 1 } ) }{ { \pi }^{ 2 }{ n }^{ 2 } } } $").scale(0.3).shift(4.5*RIGHT+UP).set_color(YELLOW),
TextMobject("$\\frac { { 1 }^{ 2 } }{ 6 } +\sum _{ n=1 }^{ 3 }{ \\frac { 2{ (-1) }^{ n }{ 1 }^{ 2 }cos(\\frac { n\pi x }{ 1 } ) }{ { \pi }^{ 2 }{ n }^{ 2 } } } $").scale(0.3).shift(4.5*RIGHT+UP).set_color(YELLOW),
@@ -77,7 +80,13 @@ class compare(GraphScene):
result1g=self.returnPartResult(1,13)
self.play(ApplyMethod(partFunction1.shift,0.2*UP))
self.wait(0.5)
+
self.play(ReplacementTransform(partFunction1,result1a),Write(coeffResult[0]))
+ self.play(FadeOut(axes[0]),FadeOut(left),FadeOut(right),FadeOut(function))
+ self.camera_frame.save_state()
+ self.play(self.camera_frame.set_width, 5,self.camera_frame.move_to, 3.5*RIGHT)
+
+
self.play(ReplacementTransform(result1a,result1b),ReplacementTransform(coeffResult[0],coeffResult[1]))
self.play(ReplacementTransform(result1b,result1c),ReplacementTransform(coeffResult[1],coeffResult[2]))
self.play(ReplacementTransform(result1c,result1d),ReplacementTransform(coeffResult[2],coeffResult[3]))
@@ -85,6 +94,9 @@ class compare(GraphScene):
self.play(ReplacementTransform(result1e,result1f),ReplacementTransform(coeffResult[4],coeffResult[5]))
self.play(ReplacementTransform(result1f,result1g),ReplacementTransform(coeffResult[5],coeffResult[6]))
+ self.wait(0.5)
+ self.play(self.camera_frame.set_width, 14,self.camera_frame.move_to, 0)
+
text4=TextMobject("Here the","obtained function","will always be","periodic","with period equal to the chosen interval").scale(0.4).shift(3.3*DOWN).set_color_by_tex_to_color_map({"obtained function":YELLOW,"periodic":RED})
self.play(Write(text4))
@@ -93,6 +105,7 @@ class compare(GraphScene):
self.play(FadeOut(text4))
text5=TextMobject("As we","increase","the","interval of $x$,").scale(0.5).shift(3*DOWN).set_color_by_tex_to_color_map({"increase":RED,"interval of $x$,":YELLOW})
text6=TextMobject("We get","approximation","for","higher intervals!").scale(0.5).shift(3.5*DOWN).set_color_by_tex_to_color_map({"approximation":GREEN,"higher intervals!":YELLOW})
+ self.play(FadeIn(axes[0]),FadeIn(left),FadeIn(right),FadeIn(function))
self.play(Write(text5))
self.play(Write(text6))
result2=self.returnPartResult(1.5,20)
@@ -101,10 +114,10 @@ class compare(GraphScene):
result5=self.returnPartResult(3,20)
finalCoeff=coeffResult[6]
coeffResult=[
- TextMobject("$\\frac { { 1.5 }^{ 2 } }{ 6 } +\sum _{ n=1 }^{ 20 }{ \\frac { 2{ (-1) }^{ n }{ 1.5 }^{ 2 }cos(\\frac { n\pi x }{ 2 } ) }{ { \pi }^{ 2 }{ n }^{ 2 } } }$").scale(0.3).shift(4.5*RIGHT+1.5*UP).set_color(YELLOW),
- TextMobject("$\\frac { { 2 }^{ 2 } }{ 6 } +\sum _{ n=1 }^{ 20 }{ \\frac { 2{ (-1) }^{ n }{ 2 }^{ 2 }cos(\\frac { n\pi x }{ 2 } ) }{ { \pi }^{ 2 }{ n }^{ 2 } } } $").scale(0.3).shift(4.5*RIGHT+1.5*UP).set_color(YELLOW),
- TextMobject("$\\frac { { 2.5 }^{ 2 } }{ 6 } +\sum _{ n=1 }^{ 20 }{ \\frac { 2{ (-1) }^{ n }{ 2.5 }^{ 2 }cos(\\frac { n\pi x }{ 2 } ) }{ { \pi }^{ 2 }{ n }^{ 2 } } } $").scale(0.3).shift(4.5*RIGHT+1.5*UP).set_color(YELLOW),
- TextMobject("$\\frac { { 3 }^{ 2 } }{ 6 } +\sum _{ n=1 }^{ 20 }{ \\frac { 2{ (-1) }^{ n }{ 3 }^{ 2 }cos(\\frac { n\pi x }{ 2 } ) }{ { \pi }^{ 2 }{ n }^{ 2 } } } $").scale(0.3).shift(4.5*RIGHT+1.5*UP).set_color(YELLOW),
+ TextMobject("$\\frac { { 1.5 }^{ 2 } }{ 6 } +\sum _{ n=1 }^{ 20 }{ \\frac { 2{ (-1) }^{ n }{ 1.5 }^{ 2 }cos(\\frac { n\pi x }{ 2 } ) }{ { \pi }^{ 2 }{ n }^{ 2 } } }$").scale(0.4).shift(5*RIGHT+1.5*UP).set_color(YELLOW),
+ TextMobject("$\\frac { { 2 }^{ 2 } }{ 6 } +\sum _{ n=1 }^{ 20 }{ \\frac { 2{ (-1) }^{ n }{ 2 }^{ 2 }cos(\\frac { n\pi x }{ 2 } ) }{ { \pi }^{ 2 }{ n }^{ 2 } } } $").scale(0.4).shift(5*RIGHT+1.5*UP).set_color(YELLOW),
+ TextMobject("$\\frac { { 2.5 }^{ 2 } }{ 6 } +\sum _{ n=1 }^{ 20 }{ \\frac { 2{ (-1) }^{ n }{ 2.5 }^{ 2 }cos(\\frac { n\pi x }{ 2 } ) }{ { \pi }^{ 2 }{ n }^{ 2 } } } $").scale(0.4).shift(5*RIGHT+2.2*UP).set_color(YELLOW),
+ TextMobject("$\\frac { { 3 }^{ 2 } }{ 6 } +\sum _{ n=1 }^{ 20 }{ \\frac { 2{ (-1) }^{ n }{ 3 }^{ 2 }cos(\\frac { n\pi x }{ 2 } ) }{ { \pi }^{ 2 }{ n }^{ 2 } } } $").scale(0.4).shift(5*RIGHT+2.2*UP).set_color(YELLOW),
]
self.play(ApplyMethod(left.shift,LEFT*x_each_unit*0.5),ApplyMethod(right.shift,RIGHT*x_each_unit*0.5),ReplacementTransform(result1g,result2),ReplacementTransform(finalCoeff,coeffResult[0]))
self.play(ApplyMethod(left.shift,LEFT*x_each_unit*0.5),ApplyMethod(right.shift,RIGHT*x_each_unit*0.5),ReplacementTransform(result2,result3),ReplacementTransform(coeffResult[0],coeffResult[1]))
diff --git a/FSF-2020/calculus/series-and-transformations/Fourier Transform/video4_FourierSeriesOfSquarePulse.py b/FSF-2020/calculus/series-and-transformations/Fourier Transform/video4_FourierSeriesOfSquarePulse.py
index 5d33fbe..fdf4bb3 100644
--- a/FSF-2020/calculus/series-and-transformations/Fourier Transform/video4_FourierSeriesOfSquarePulse.py
+++ b/FSF-2020/calculus/series-and-transformations/Fourier Transform/video4_FourierSeriesOfSquarePulse.py
@@ -33,9 +33,9 @@ class fourierSeries(GraphScene,MovingCameraScene):
x_each_unit = self.x_axis_width / (self.x_max - self.x_min)
y_each_unit = self.y_axis_height / (self.y_max - self.y_min)
- equation=TextMobject("$f(x)=\\frac { 4 }{ \pi } \sum _{ k=1,3,5.. }^{ \infty }{ \\frac { 1 }{ k } \sin { 2\pi kx } }$").shift(5*RIGHT+3*UP).set_color(RED).scale(0.4)
+ equation=TextMobject("$f(x)=\\frac { 4 }{ \pi } \sum _{ k=1,3,5.. }^{ \infty }{ \\frac { 1 }{ k } \sin { 2\pi kx } }$").shift(5*RIGHT+3*UP).set_color(RED).scale(0.5)
self.add(equation)
- self.setup_axes(animate=True)
+ self.setup_axes(animate=True,scalee=1)
line1=Line(start=(-x_each_unit,y_each_unit,0),end=(-(1/2)*x_each_unit,y_each_unit,0),color=RED)
line2=Line(start=(-(1/2)*x_each_unit,y_each_unit,0),end=(-(1/2)*x_each_unit,-y_each_unit,0),color=RED)
line3=Line(start=(-(1/2)*x_each_unit,-y_each_unit,0),end=(0,-y_each_unit,0),color=RED)
@@ -87,6 +87,11 @@ class fourierSeries(GraphScene,MovingCameraScene):
self.wait(1)
self.camera_frame.save_state()
self.play(self.camera_frame.set_width, 2.25,self.camera_frame.move_to, y_each_unit*UP+RIGHT*x_each_unit*0.3)
- self.wait(1)
- self.play(self.camera_frame.set_width,14,self.camera_frame.move_to,0)
+ circleMark=Circle(radius=0.1,color=GREEN).shift(x_each_unit*RIGHT*0.47+UP*y_each_unit*1.1)
+ text=TextMobject("Gibbs","phenomenon").set_color_by_tex_to_color_map({"Gibbs":BLUE,"phenomenon":YELLOW}).scale(0.1).shift(RIGHT*x_each_unit*0.65+UP*y_each_unit*1.1)
+ self.wait(0.7)
+ self.play(ShowCreation(circleMark))
+ self.play(Write(text))
+ self.wait(0.5)
+ self.play(self.camera_frame.set_width,14,self.camera_frame.move_to,0,FadeOut(circleMark),FadeOut(text))
self.wait(2)