summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPurusharth Saxena2020-07-09 01:48:09 +0530
committerGitHub2020-07-09 01:48:09 +0530
commit02503a96d86a6304977d6791de17913d391dcb98 (patch)
tree74ecbefad839ced838f1d7db50aa43c7d027cfc7
parent5e45b00baa667ee6b8abed79b6e6c6c6757d1d0f (diff)
parentceb2dce60bb334f2c5f59362308ed68786de7824 (diff)
downloadFSF-mathematics-python-code-archive-02503a96d86a6304977d6791de17913d391dcb98.tar.gz
FSF-mathematics-python-code-archive-02503a96d86a6304977d6791de17913d391dcb98.tar.bz2
FSF-mathematics-python-code-archive-02503a96d86a6304977d6791de17913d391dcb98.zip
Merge pull request #53 from GSri30/master
Applied the changes
-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
-rw-r--r--FSF-2020/calculus/series-and-transformations/Power Series/README.md2
-rw-r--r--FSF-2020/calculus/series-and-transformations/Power Series/gifs/file4a_UniformConvergence.gifbin0 -> 476231 bytes
-rw-r--r--FSF-2020/calculus/series-and-transformations/Taylor Series/README.md2
-rw-r--r--FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file2_TaylorExpansionGeneralForm.gifbin308980 -> 640160 bytes
-rw-r--r--FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file2a_TaylorExpansionGeneralForm.gifbin0 -> 640160 bytes
-rw-r--r--FSF-2020/calculus/series-and-transformations/Taylor Series/video2_TaylorExpansionGeneralForm.py98
12 files changed, 99 insertions, 46 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)
diff --git a/FSF-2020/calculus/series-and-transformations/Power Series/README.md b/FSF-2020/calculus/series-and-transformations/Power Series/README.md
index 6885837..2fd400d 100644
--- a/FSF-2020/calculus/series-and-transformations/Power Series/README.md
+++ b/FSF-2020/calculus/series-and-transformations/Power Series/README.md
@@ -11,4 +11,4 @@
![GIF3](gifs/file3_radius_and_intervalOfConvergence.gif)
#### Uniform Convergence
-![GIF4](gifs/file4_UniformConvergence.gif)
+![GIF4](gifs/file4a_UniformConvergence.gif)
diff --git a/FSF-2020/calculus/series-and-transformations/Power Series/gifs/file4a_UniformConvergence.gif b/FSF-2020/calculus/series-and-transformations/Power Series/gifs/file4a_UniformConvergence.gif
new file mode 100644
index 0000000..e284b83
--- /dev/null
+++ b/FSF-2020/calculus/series-and-transformations/Power Series/gifs/file4a_UniformConvergence.gif
Binary files differ
diff --git a/FSF-2020/calculus/series-and-transformations/Taylor Series/README.md b/FSF-2020/calculus/series-and-transformations/Taylor Series/README.md
index ce3b088..88eb772 100644
--- a/FSF-2020/calculus/series-and-transformations/Taylor Series/README.md
+++ b/FSF-2020/calculus/series-and-transformations/Taylor Series/README.md
@@ -2,7 +2,7 @@
![GIF1](gifs/file1_Example_TaylorExpansion.gif)
#### Taylor Series GeneralForm
-![GIF2](gifs/file2_TaylorExpansionGeneralForm.gif)
+![GIF2](gifs/file2a_TaylorExpansionGeneralForm.gif)
#### Radius Of Convergence
![GIF3](gifs/file3_radiusOfConvergence.gif)
diff --git a/FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file2_TaylorExpansionGeneralForm.gif b/FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file2_TaylorExpansionGeneralForm.gif
index e6d9171..33dfa81 100644
--- a/FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file2_TaylorExpansionGeneralForm.gif
+++ b/FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file2_TaylorExpansionGeneralForm.gif
Binary files differ
diff --git a/FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file2a_TaylorExpansionGeneralForm.gif b/FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file2a_TaylorExpansionGeneralForm.gif
new file mode 100644
index 0000000..33dfa81
--- /dev/null
+++ b/FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file2a_TaylorExpansionGeneralForm.gif
Binary files differ
diff --git a/FSF-2020/calculus/series-and-transformations/Taylor Series/video2_TaylorExpansionGeneralForm.py b/FSF-2020/calculus/series-and-transformations/Taylor Series/video2_TaylorExpansionGeneralForm.py
index c177ab4..75f200d 100644
--- a/FSF-2020/calculus/series-and-transformations/Taylor Series/video2_TaylorExpansionGeneralForm.py
+++ b/FSF-2020/calculus/series-and-transformations/Taylor Series/video2_TaylorExpansionGeneralForm.py
@@ -7,7 +7,7 @@ class intro(Scene):
equation=TextMobject("$f(x)=$","${ e }^{ -x^{ 2 } }$")
equation.scale(2)
equation.set_color_by_tex_to_color_map({"${ e }^{ -x^{ 2 } }$":RED})
- text=TextMobject("at $a=1$")
+ text=TextMobject("about $x=1$")
text.scale(0.7)
text.shift(DOWN)
@@ -41,7 +41,7 @@ def formFormula(coeff_list,variable_list):
return expansion,coeff_list
-class graphScene(GraphScene):
+class graphScene(GraphScene,MovingCameraScene):
CONFIG = {
"x_min": -8,
"x_max": 8,
@@ -55,6 +55,9 @@ class graphScene(GraphScene):
"exclude_zero_label": True,
"x_labeled_nums": range(-8, 8, 1),
}
+ def setup(self):
+ GraphScene.setup(self)
+ MovingCameraScene.setup(self)
def construct(self):
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)
@@ -62,7 +65,7 @@ class graphScene(GraphScene):
equation=TextMobject("$f(x)=$","${ e }^{ -x^{ 2 } }$")
equation.scale(0.55)
equation.set_color_by_tex_to_color_map({"${ e }^{ -x^{ 2 } }$":RED})
- text=TextMobject("$a=1$")
+ text=TextMobject("about $x=1$")
text.scale(0.55)
equation.shift(3.39*UP+5*LEFT)
text.shift(3*UP+5*LEFT)
@@ -80,7 +83,7 @@ class graphScene(GraphScene):
trTextGrup.scale(0.5)
trTextGrup.to_corner(UP+RIGHT)
self.play(Write(trTextGrup))
- self.setup_axes(animate=True)
+ self.setup_axes(animate=True,scalee=1)
fx=TextMobject("${ e }^{ -x^{ 2 } }$")
fx.scale(0.5)
@@ -91,29 +94,29 @@ class graphScene(GraphScene):
self.wait(1.4)
coeff=[TextMobject("$e^{-1}$"),TextMobject("$f'(x)$"),TextMobject("$\\frac { f''(x) }{ 2! } $")]
- coeff[0].shift(3.33*UP+3.65*RIGHT)
- coeff[0].scale(0.45)
- coeff[1].shift(3.33*UP+4.13*RIGHT)
- coeff[1].scale(0.275)
- coeff[2].shift(3.33*UP+5.36*RIGHT)
- coeff[2].scale(0.28)
+ coeff[0].shift(4.1*y_each_unit*UP+5.15*RIGHT*x_each_unit)
+ coeff[0].scale(0.3)
+ coeff[1].shift(4*y_each_unit*UP+5.7*RIGHT*x_each_unit)
+ coeff[1].scale(0.2)
+ coeff[2].shift(4*y_each_unit*UP+7.3*RIGHT*x_each_unit)
+ coeff[2].scale(0.18)
for obj in coeff:
obj.set_color(GOLD_A)
- firstApprox=[self.get_graph(lambda x:math.exp(-1),color=BLUE,x_min=-5.5,x_max=5.5)]
- secondApprox=[self.get_graph(lambda x:math.exp(-1)-2*(x-1)*math.exp(-1),color=BLUE,x_min=-5.5,x_max=5.5),
- self.get_graph(lambda x:math.exp(-1)+3*(x-1)*math.exp(-1),color=BLUE,x_min=-5.5,x_max=5.5),
- self.get_graph(lambda x:math.exp(-1)-4*(x-1)*math.exp(-1),color=BLUE,x_min=-5.5,x_max=5.5)]
- thirdApprox=[self.get_graph(lambda x:math.exp(-1)-2*(x-1)*math.exp(-1)-2*math.exp(-1)*(x-1)**2,color=BLUE,x_max=5.5,x_min=-5.5),
- self.get_graph(lambda x:math.exp(-1)-2*(x-1)*math.exp(-1)-0.1*math.exp(-1)*(x-1)**2,color=BLUE,x_max=5.5,x_min=-5.5),
- self.get_graph(lambda x:math.exp(-1)-2*(x-1)*math.exp(-1),color=BLUE,x_max=5.5,x_min=-5.5),
- self.get_graph(lambda x:math.exp(-1)-2*(x-1)*math.exp(-1)+0.5*math.exp(-1)*(x-1)**2,color=BLUE,x_max=5.5,x_min=-5.5),
- self.get_graph(lambda x:math.exp(-1)-2*(x-1)*math.exp(-1)+2*math.exp(-1)*(x-1)**2,color=BLUE,x_max=5.5,x_min=-5.5)]
+ firstApprox=[self.get_graph(lambda x:math.exp(-1),color=BLUE,x_min=-3,x_max=4)]
+ secondApprox=[self.get_graph(lambda x:math.exp(-1)-2*(x-1)*math.exp(-1),color=BLUE,x_min=-3,x_max=4),
+ self.get_graph(lambda x:math.exp(-1)+3*(x-1)*math.exp(-1),color=BLUE,x_min=-3,x_max=4),
+ self.get_graph(lambda x:math.exp(-1)-4*(x-1)*math.exp(-1),color=BLUE,x_min=-3,x_max=4)]
+ thirdApprox=[self.get_graph(lambda x:math.exp(-1)-2*(x-1)*math.exp(-1)-2*math.exp(-1)*(x-1)**2,color=BLUE,x_max=4,x_min=-3),
+ self.get_graph(lambda x:math.exp(-1)-2*(x-1)*math.exp(-1)-0.1*math.exp(-1)*(x-1)**2,color=BLUE,x_max=4,x_min=-3),
+ self.get_graph(lambda x:math.exp(-1)-2*(x-1)*math.exp(-1),color=BLUE,x_max=4,x_min=-3),
+ self.get_graph(lambda x:math.exp(-1)-2*(x-1)*math.exp(-1)+0.5*math.exp(-1)*(x-1)**2,color=BLUE,x_max=4,x_min=-3),
+ self.get_graph(lambda x:math.exp(-1)-2*(x-1)*math.exp(-1)+2*math.exp(-1)*(x-1)**2,color=BLUE,x_max=4,x_min=-3)]
- firstGraph=self.get_graph(lambda x:math.exp(-1),color=BLUE,x_min=-5.5,x_max=5.5)
- secondGraph=self.get_graph(lambda x:math.exp(-1)-2*(x-1)*math.exp(-1),color=BLUE,x_min=-5.5,x_max=5.5)
- thirdGraph=self.get_graph(lambda x:math.exp(-1)-2*(x-1)*math.exp(-1)+math.exp(-1)*(x-1)**2,color=BLUE,x_max=5.5,x_min=-5.5)
+ firstGraph=self.get_graph(lambda x:math.exp(-1),color=BLUE,x_min=-3,x_max=4)
+ secondGraph=self.get_graph(lambda x:math.exp(-1)-2*(x-1)*math.exp(-1),color=BLUE,x_min=-3,x_max=4)
+ thirdGraph=self.get_graph(lambda x:math.exp(-1)-2*(x-1)*math.exp(-1)+math.exp(-1)*(x-1)**2,color=BLUE,x_max=4,x_min=-3)
bottomText1=TextMobject("Apply","$f(1)=T_{n}(1)$")
bottomText2=TextMobject("This gives","$a_{ 0 }=e^{-1}$")
@@ -147,16 +150,42 @@ class graphScene(GraphScene):
bottomText8.scale(0.5)
bottomText1.shift(4.5*RIGHT+2.5*DOWN)
- bottomText2.shift(4.5*RIGHT+2.5*DOWN)
- bottomText3.shift(4.5*RIGHT+2.5*DOWN)
- bottomText4.shift(4.5*RIGHT+2.5*DOWN)
- bottomText5.shift(4.5*RIGHT+2.5*DOWN)
- bottomText6.shift(4.5*RIGHT+2.5*DOWN)
- bottomText7.shift(4.5*RIGHT+2.5*DOWN)
- bottomText8.shift(4.5*RIGHT+2.5*DOWN)
+ # bottomText2.shift(4.5*RIGHT+2.5*DOWN)
+ # bottomText3.shift(4.5*RIGHT+2.5*DOWN)
+ # bottomText4.shift(4.5*RIGHT+2.5*DOWN)
+ # bottomText5.shift(4.5*RIGHT+2.5*DOWN)
+ # bottomText6.shift(4.5*RIGHT+2.5*DOWN)
+ # bottomText7.shift(4.5*RIGHT+2.5*DOWN)
+ # bottomText8.shift(4.5*RIGHT+2.5*DOWN)
+ bottomText2.shift(5*RIGHT*x_each_unit+2.5*DOWN*y_each_unit)
+ bottomText3.shift(5*RIGHT*x_each_unit+2.5*DOWN*y_each_unit)
+ bottomText4.shift(5*RIGHT*x_each_unit+2.5*DOWN*y_each_unit)
+ bottomText5.shift(5*RIGHT*x_each_unit+2.5*DOWN*y_each_unit)
+ bottomText6.shift(5.7*RIGHT*x_each_unit+2.5*DOWN*y_each_unit)
+ bottomText7.shift(5.7*RIGHT*x_each_unit+2.5*DOWN*y_each_unit)
+ bottomText8.shift(5.7*RIGHT*x_each_unit+2.5*DOWN*y_each_unit)
+
+ bottomText2.scale(0.7)
+ bottomText3.scale(0.7)
+ bottomText4.scale(0.7)
+ bottomText5.scale(0.7)
+ bottomText6.scale(0.7)
+ bottomText7.scale(0.7)
+ bottomText8.scale(0.7)
self.play(Write(bottomText1))
- self.wait(1)
+ self.wait(0.8)
+ self.camera_frame.save_state()
+ self.play(self.camera_frame.set_width, 8,
+ self.camera_frame.move_to, x_each_unit*UP+x_each_unit*2*RIGHT,
+ ApplyMethod(trTextGrup.move_to,4*y_each_unit*UP+6.1*RIGHT*x_each_unit),
+ ApplyMethod(bottomText1.move_to,5.4*RIGHT*x_each_unit+2.5*DOWN*y_each_unit),
+ ApplyMethod(equation.shift,1.39*DOWN+2*RIGHT+RIGHT*x_each_unit*2),
+ ApplyMethod(text.shift,1.39*DOWN+2*RIGHT+RIGHT*x_each_unit*2),)
+ self.play(ApplyMethod(text.scale,0.5),ApplyMethod(equation.scale,0.5),ApplyMethod(bottomText1.scale,0.6),ApplyMethod(trTextGrup.scale,0.7))
+ self.play(ApplyMethod(text.shift,0.25*UP))
+ self.wait(0.6)
+
self.play(ShowCreation(firstApprox[0]),ReplacementTransform(bottomText1,bottomText2))
#change coeff in tn(x)
self.play(ReplacementTransform(generalized_eq_coeff[0],coeff[0]))
@@ -193,10 +222,13 @@ class graphScene(GraphScene):
self.wait(2)
textFinal=TextMobject("And so on..!")
- textFinal.scale(0.7)
- textFinal.shift(4.5*RIGHT+2.5*DOWN)
+ textFinal.scale(0.35)
+ textFinal.shift(5.7*RIGHT*x_each_unit+2.5*DOWN*y_each_unit)
self.play(ReplacementTransform(bottomText8,textFinal))
- self.wait(2.5)
+ self.wait(1)
+ self.play(FadeOut(equation),FadeOut(text))
+ self.play(self.camera_frame.set_width, 15,
+ self.camera_frame.move_to, 0)
finalFormula=TextMobject("Hence","$T_{ n }(x)$","=","$f(1)+f'(1)(x-1)+\\frac { f''(1) }{ 2! }(x-1)^2+..+\\frac { { f }^{ n }(1) }{ n! } { (x-1) }^{ n }$")
finalFormula.scale(0.8)