From 3cbdadc15fd43741da0593dc28c793f5bc4f4605 Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 13:37:12 +0530 Subject: Create README.md --- FSF-2020/calculus/series-and-transformations/Power Series/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 FSF-2020/calculus/series-and-transformations/Power Series/README.md (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Power Series/README.md b/FSF-2020/calculus/series-and-transformations/Power Series/README.md new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/FSF-2020/calculus/series-and-transformations/Power Series/README.md @@ -0,0 +1 @@ + -- cgit From d6ca601016946a89ac1075e6053a34238a7e7747 Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 13:38:49 +0530 Subject: Add files via upload --- .../Power Series/gifs/file2_convergence_Intuition.gif | Bin 0 -> 98910 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus/series-and-transformations/Power Series/gifs/file2_convergence_Intuition.gif (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Power Series/gifs/file2_convergence_Intuition.gif b/FSF-2020/calculus/series-and-transformations/Power Series/gifs/file2_convergence_Intuition.gif new file mode 100644 index 0000000..9463ac2 Binary files /dev/null and b/FSF-2020/calculus/series-and-transformations/Power Series/gifs/file2_convergence_Intuition.gif differ -- cgit From 2f42a032081080b48b621f5e5dd2d8501ff742f4 Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 13:40:14 +0530 Subject: Update README.md --- FSF-2020/calculus/series-and-transformations/Power Series/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'FSF-2020/calculus/series-and-transformations') 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 8b13789..ff82d8a 100644 --- a/FSF-2020/calculus/series-and-transformations/Power Series/README.md +++ b/FSF-2020/calculus/series-and-transformations/Power Series/README.md @@ -1 +1 @@ - +![GIF1](\gifs\file2_convergence_Intuition.gif) -- cgit From 428291edcb643526c6b3b23d27004457c9cb074a Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 13:40:40 +0530 Subject: Update README.md --- FSF-2020/calculus/series-and-transformations/Power Series/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'FSF-2020/calculus/series-and-transformations') 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 ff82d8a..17fd0a8 100644 --- a/FSF-2020/calculus/series-and-transformations/Power Series/README.md +++ b/FSF-2020/calculus/series-and-transformations/Power Series/README.md @@ -1 +1 @@ -![GIF1](\gifs\file2_convergence_Intuition.gif) +![GIF1](gifs\file2_convergence_Intuition.gif) -- cgit From d9996901cc7d1039f45c4163792d77066223811c Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 13:40:57 +0530 Subject: Update README.md --- FSF-2020/calculus/series-and-transformations/Power Series/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'FSF-2020/calculus/series-and-transformations') 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 17fd0a8..daf65fe 100644 --- a/FSF-2020/calculus/series-and-transformations/Power Series/README.md +++ b/FSF-2020/calculus/series-and-transformations/Power Series/README.md @@ -1 +1 @@ -![GIF1](gifs\file2_convergence_Intuition.gif) +![GIF1](file2_convergence_Intuition.gif) -- cgit From 37506a553accfe614fc6d84b6f37c1ed4d2193b6 Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 13:43:09 +0530 Subject: Update README.md --- FSF-2020/calculus/series-and-transformations/Power Series/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'FSF-2020/calculus/series-and-transformations') 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 daf65fe..d06a3a5 100644 --- a/FSF-2020/calculus/series-and-transformations/Power Series/README.md +++ b/FSF-2020/calculus/series-and-transformations/Power Series/README.md @@ -1 +1 @@ -![GIF1](file2_convergence_Intuition.gif) +![GIF1](gifs/file2_convergence_Intuition.gif) -- cgit From ed2614068a6f37ea7913d48e38356ef84ed22729 Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 13:56:54 +0530 Subject: Add files via upload --- .../gifs/file3_convergence_of_a_function.gif | Bin 0 -> 415313 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus/series-and-transformations/Power Series/gifs/file3_convergence_of_a_function.gif (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Power Series/gifs/file3_convergence_of_a_function.gif b/FSF-2020/calculus/series-and-transformations/Power Series/gifs/file3_convergence_of_a_function.gif new file mode 100644 index 0000000..836e044 Binary files /dev/null and b/FSF-2020/calculus/series-and-transformations/Power Series/gifs/file3_convergence_of_a_function.gif differ -- cgit From ef8ccf090a9a02a82ea1551dcd633dc4900358a1 Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 13:57:38 +0530 Subject: Update README.md --- FSF-2020/calculus/series-and-transformations/Power Series/README.md | 2 ++ 1 file changed, 2 insertions(+) (limited to 'FSF-2020/calculus/series-and-transformations') 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 d06a3a5..acf07b7 100644 --- a/FSF-2020/calculus/series-and-transformations/Power Series/README.md +++ b/FSF-2020/calculus/series-and-transformations/Power Series/README.md @@ -1 +1,3 @@ ![GIF1](gifs/file2_convergence_Intuition.gif) + +![GIF2](gifs/file3_convergence_of_a_function.gif) -- cgit From f1aae8412472c2039dd3323427ea416f7092db7b Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 14:32:23 +0530 Subject: Add files via upload --- .../Power Series/PowerSeriesQuestions.pdf | Bin 112622 -> 118730 bytes 1 file changed, 0 insertions(+), 0 deletions(-) (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Power Series/PowerSeriesQuestions.pdf b/FSF-2020/calculus/series-and-transformations/Power Series/PowerSeriesQuestions.pdf index 04ed6d5..9fc409b 100644 Binary files a/FSF-2020/calculus/series-and-transformations/Power Series/PowerSeriesQuestions.pdf and b/FSF-2020/calculus/series-and-transformations/Power Series/PowerSeriesQuestions.pdf differ -- cgit From 5a2423fa9b3b66f109336f003b087bbcc57e9598 Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 14:33:06 +0530 Subject: Delete script1.py --- .../Power Series/script1.py | 128 --------------------- 1 file changed, 128 deletions(-) delete mode 100644 FSF-2020/calculus/series-and-transformations/Power Series/script1.py (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Power Series/script1.py b/FSF-2020/calculus/series-and-transformations/Power Series/script1.py deleted file mode 100644 index 28eb07c..0000000 --- a/FSF-2020/calculus/series-and-transformations/Power Series/script1.py +++ /dev/null @@ -1,128 +0,0 @@ -from manimlib.imports import * - - -def formFormula(coeff_list,variable_list): - coeff_list=[TextMobject("${ a }_{ 0 }$"),TextMobject("${ a }_{ 1 }$"),TextMobject("${ a }_{ 2 }$")] - variable_list=[TextMobject("+"),TextMobject("${ x }$+"),TextMobject("${ x }^{ 2 }$")] - coeff_list[0].shift(2.2*UP+1.6*LEFT) - for i in range(0,3): - coeff_list[i].set_color(GOLD_A) - variable_list[i].next_to(coeff_list[i],buff=0.1) - if i!=2: - coeff_list[i+1].next_to(variable_list[i],buff=0.1) - dots=TextMobject("...") - dots.next_to(variable_list[2]) - expansion=VGroup(coeff_list[0],coeff_list[1],coeff_list[2],variable_list[0],variable_list[1],variable_list[2],dots) - expansion.scale(0.7) - return expansion - -class pieChart(Scene): - def construct(self): - circle1=Circle(radius=3,color=BLUE) - powerText=TextMobject("Power Series") - powerText.scale(0.8) - self.play(FadeIn(powerText)) - self.play(ShowCreation(circle1)) - self.wait(1) - - powerGroup=VGroup(circle1,powerText) - - self.play(ApplyMethod(powerGroup.scale,0.5)) - self.play(ApplyMethod(powerGroup.move_to,2.2*UP)) - self.wait(0.5) - expansion_power_coeff=[] - variables_power=[] - expansion_power=formFormula(expansion_power_coeff,variables_power) - self.play(ReplacementTransform(powerText,expansion_power)) - self.wait(1) - - circle2=Circle(radius=1.5) - circle2.shift(2.2*UP) - expansion_geo_coeff=[0]*3 - variables_geo=[0]*3 - arrow1_2=Line(start=0.7*UP,end=2.5*LEFT) - expansion_geo_coeff=[TextMobject("${ a }_{ 0 }$"),TextMobject("${ a }_{ 1 }$"),TextMobject("${ a }_{ 2 }$")] - for i in range(0,3): - expansion_geo_coeff[i].set_color(GOLD_A) - variables_geo=[TextMobject("+"),TextMobject("${ x }$+"),TextMobject("${ x }^{ 2 }$")] - expansion_geo_coeff[0].shift(2.2*UP+1.6*LEFT) - for i in range(0,3): - variables_geo[i].next_to(expansion_geo_coeff[i],buff=0.1) - if i!=2: - expansion_geo_coeff[i+1].next_to(variables_geo[i],buff=0.1) - dots=TextMobject("...") - dots.next_to(variables_geo[2]) - expansion_geo=VGroup(expansion_geo_coeff[0],expansion_geo_coeff[1],expansion_geo_coeff[2],variables_geo[0],variables_geo[1],variables_geo[2],dots) - expansion_geo.scale(0.7) - - self.play(ApplyMethod(circle2.shift,4*LEFT+2.5*DOWN),ApplyMethod(expansion_geo.shift,4*LEFT+2.5*DOWN)) - self.add(arrow1_2) - self.wait(1) - - ones=[TextMobject("1"),TextMobject("1"),TextMobject("1")] - for i in range(0,3): - ones[i].set_color(GOLD_A) - ones[0].shift(0.3*DOWN,5*LEFT) - ones[1].next_to(ones[0],buff=0.5) - ones[2].next_to(ones[1],buff=0.7) - self.play(ReplacementTransform(expansion_geo_coeff[0],ones[0]),ReplacementTransform(expansion_geo_coeff[1],ones[1]),ReplacementTransform(expansion_geo_coeff[2],ones[2])) - self.wait(1) - expansion_geo=VGroup(ones[0],ones[1],ones[2],variables_geo[0],variables_geo[1],variables_geo[2],dots) - - expansion_geo_final=TextMobject("$1+x+{ x }^{ 2 }..$") - expansion_geo_final.scale(0.8) - expansion_geo_final.shift(0.3*DOWN+4*LEFT) - self.play(ReplacementTransform(expansion_geo,expansion_geo_final)) - self.wait(1) - - circle3=Circle(radius=1.5,color=GREEN) - circle3.shift(2.2*UP) - expansion_taylor_coeff=[0]*3 - variables_taylor=[0]*3 - arrow1_3=Line(start=0.7*UP,end=DOWN*0.3) - expansion_taylor_coeff=[TextMobject("${ a }_{ 0 }$"),TextMobject("${ a }_{ 1 }$"),TextMobject("${ a }_{ 2 }$")] - for i in range(0,3): - expansion_taylor_coeff[i].set_color(GOLD_A) - variables_taylor=[TextMobject("+"),TextMobject("${ x }$+"),TextMobject("${ x }^{ 2 }$")] - expansion_taylor_coeff[0].shift(2.2*UP+1.6*LEFT) - for i in range(0,3): - variables_taylor[i].next_to(expansion_taylor_coeff[i],buff=0.1) - if i!=2: - expansion_taylor_coeff[i+1].next_to(variables_taylor[i],buff=0.1) - dots=TextMobject("...") - dots.next_to(variables_taylor[2]) - expansion_taylor=VGroup(expansion_taylor_coeff[0],expansion_taylor_coeff[1],expansion_taylor_coeff[2],variables_taylor[0],variables_taylor[1],variables_taylor[2],dots) - expansion_taylor.scale(0.7) - - self.play(ApplyMethod(circle3.shift,4*DOWN),ApplyMethod(expansion_taylor.shift,4*DOWN)) - self.add(arrow1_3) - self.wait(1) - - differentials=[TextMobject("$f(0)$"),TextMobject("${ f'\left( 0 \\right) }$"),TextMobject("$\\frac { f''\left( 0 \\right) }{ 2! }$")] - for i in range(0,3): - differentials[i].set_color(GOLD_A) - differentials[0].shift(1.8*DOWN+1.15*LEFT) - differentials[1].shift(1.8*DOWN+0.45*LEFT) - differentials[2].shift(1.8*DOWN+0.45*RIGHT) - differentials[0].scale(0.35) - differentials[1].scale(0.35) - differentials[2].scale(0.35) - self.play(ReplacementTransform(expansion_taylor_coeff[0],differentials[0]),ReplacementTransform(expansion_taylor_coeff[1],differentials[1]),ReplacementTransform(expansion_taylor_coeff[2],differentials[2])) - self.wait(2) - expansion_taylor_final=VGroup(differentials[0],differentials[1],differentials[2],variables_taylor[0],variables_taylor[1],variables_taylor[2],dots) - - self.play(FadeOut(expansion_geo_final),FadeOut(expansion_taylor_final)) - geoText=TextMobject("Geometric Series") - geoText.scale(0.7) - geoText.shift(4*LEFT+0.3*DOWN) - taylorText=TextMobject("Taylor Series") - taylorText.scale(0.7) - taylorText.shift(1.8*DOWN) - self.play(FadeIn(geoText),FadeIn(taylorText)) - self.wait(1) - - soOntext=TextMobject("So on..!") - soOntext.shift(4*RIGHT) - soOntext.scale(0.8) - self.play(FadeIn(soOntext)) - self.wait(2) -- cgit From 3a3da8845f29e8bf3b1f6ea9d2938eadd80cb1f6 Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 14:33:14 +0530 Subject: Delete script2.py --- .../Power Series/script2.py | 94 ---------------------- 1 file changed, 94 deletions(-) delete mode 100644 FSF-2020/calculus/series-and-transformations/Power Series/script2.py (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Power Series/script2.py b/FSF-2020/calculus/series-and-transformations/Power Series/script2.py deleted file mode 100644 index 72356c6..0000000 --- a/FSF-2020/calculus/series-and-transformations/Power Series/script2.py +++ /dev/null @@ -1,94 +0,0 @@ -from manimlib.imports import * -import numpy as np - - -class convergence(Scene): - def construct(self): - originalFormula=TextMobject("$\sum _{ n=0 }^{ \infty }{ { a }_{ n }{ x }^{ n } }$") - originalFormula.set_color(RED) - self.play(Write(originalFormula)) - self.wait(1) - self.play(ApplyMethod(originalFormula.shift,2.7*UP)) - self.wait(1) - - terms=["$a_{ 0 }$","$a_{ 1 }x$","$a_{ 2 }x^{ 2 }$","$a_{ 3 }x^{ 3 }$","$a_{ 4 }x^{ 4 }$","$a_{ 5 }x^{ 5 }$","$a_{ 6 }x^{ 6 }$","$a_{ 7 }x^{ 7 }$","$a_{ 8 }x^{ 8 }$","$a_{ 9 }x^{ 9 }$","$a_{ 10 }x^{ 10 }$","$a_{ 11 }x^{ 11 }$"] - termsTogetherString="+".join(terms) - termsTogether=TextMobject(termsTogetherString+"...") - termsTogether.scale(0.8) - termsTogether.shift(2.7*UP) - self.play(ReplacementTransform(originalFormula,termsTogether)) - self.wait(1) - - termMobjectRect=[0]*12 - termMobject=TextMobject(terms[0]) - termMobject.shift(2.7*UP+6.2*LEFT) - for i in range(1,13): - termMobjectOld=termMobject - termMobjectOld.scale(0.8) - if(i<12): - termMobject=TextMobject(terms[i]) - termMobject.next_to(termMobjectOld) - if(i==1): - rectDefine=TextMobject("Here","each rectangle","represents the","value of the term") - rectDefine.set_color_by_tex_to_color_map({"each rectangle":BLUE,"value of the term":YELLOW}) - rectDefine.scale(0.7) - rectDefine.shift(3.2*DOWN) - self.play(Write(rectDefine)) - self.wait(1) - if(i==2): - ratio=TextMobject("If $\\frac { a_{ n+1 } }{ { a }_{ n } } < 1$") - ratio.set_color(RED) - ratio.scale(0.7) - ratio.move_to(3.2*DOWN) - inequality=TextMobject("$a_{ n+1 } < a_{ n }$") - inequality.set_color(RED) - inequality.scale(0.7) - inequality.move_to(3.2*DOWN) - self.play(FadeOut(rectDefine)) - self.play(Write(ratio)) - self.wait(1) - self.play(ReplacementTransform(ratio,inequality)) - self.wait(1) - #self.play(ApplyMethod(termMobjectOld.move_to,(2-0.3*i)*DOWN+RIGHT*0.2*i)) - termMobjectRect[i-1]=Rectangle(height=0.1,width=(5-0.4*i)) - termMobjectRect[i-1].move_to((2-0.2*i)*DOWN+RIGHT*0.2*i) - #rectangles[p] = termMobjectRect - #p+=1 - self.play(ReplacementTransform(termMobjectOld,termMobjectRect[i-1])) - - uparrow=TextMobject("$\\uparrow$") - uparrow.set_color(GREEN) - uparrow.scale(6) - uparrow.shift(4*RIGHT+0.5*DOWN) - self.play(ShowCreation(uparrow)) - self.wait(1) - - converges=TextMobject("Converges!") - converges.set_color(RED) - converges.scale(0.6) - converges.next_to(uparrow) - self.play(FadeIn(converges)) - self.wait(2) - - self.play(FadeOut(converges),FadeOut(uparrow),FadeOut(inequality)) - self.wait(0.5) - rect=VGroup(termMobjectRect[0],termMobjectRect[1],termMobjectRect[2],termMobjectRect[3],termMobjectRect[4],termMobjectRect[5],termMobjectRect[6],termMobjectRect[7],termMobjectRect[8],termMobjectRect[9],termMobjectRect[10],termMobjectRect[11]) - self.play(ApplyMethod(rect.scale,0.2)) - for i in range(0,12): - self.play(ApplyMethod(termMobjectRect[i].shift,i*0.04*DOWN+(11-(3-0.11*i)*i)*LEFT*0.3)) - func=TextMobject("$\\approx$","$f(x)$") - func.set_color_by_tex_to_color_map({"$f(x)$":RED}) - func.scale(0.8) - func.shift(DOWN+4.5*RIGHT+0.1*UP) - self.play(FadeIn(func)) - - rightarrow=TextMobject("$\\rightarrow$") - rightarrow.set_color(GREEN) - rightarrow.scale(4) - rightarrow.shift(2*DOWN) - converges=TextMobject("Hence even the","sum converges!") - converges.set_color_by_tex_to_color_map({"sum converges!":RED}) - converges.move_to(3*DOWN) - converges.scale(0.7) - self.play(Write(rightarrow),FadeIn(converges)) - self.wait(2) -- cgit From 6e570da33384e47c5c6533f50f06342be29e4e4d Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 14:33:30 +0530 Subject: Add files via upload --- .../Power Series/video1_pieChart.py | 128 +++++++++++++++++++++ .../Power Series/video2_convergence_Intuition.py | 94 +++++++++++++++ 2 files changed, 222 insertions(+) create mode 100644 FSF-2020/calculus/series-and-transformations/Power Series/video1_pieChart.py create mode 100644 FSF-2020/calculus/series-and-transformations/Power Series/video2_convergence_Intuition.py (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Power Series/video1_pieChart.py b/FSF-2020/calculus/series-and-transformations/Power Series/video1_pieChart.py new file mode 100644 index 0000000..28eb07c --- /dev/null +++ b/FSF-2020/calculus/series-and-transformations/Power Series/video1_pieChart.py @@ -0,0 +1,128 @@ +from manimlib.imports import * + + +def formFormula(coeff_list,variable_list): + coeff_list=[TextMobject("${ a }_{ 0 }$"),TextMobject("${ a }_{ 1 }$"),TextMobject("${ a }_{ 2 }$")] + variable_list=[TextMobject("+"),TextMobject("${ x }$+"),TextMobject("${ x }^{ 2 }$")] + coeff_list[0].shift(2.2*UP+1.6*LEFT) + for i in range(0,3): + coeff_list[i].set_color(GOLD_A) + variable_list[i].next_to(coeff_list[i],buff=0.1) + if i!=2: + coeff_list[i+1].next_to(variable_list[i],buff=0.1) + dots=TextMobject("...") + dots.next_to(variable_list[2]) + expansion=VGroup(coeff_list[0],coeff_list[1],coeff_list[2],variable_list[0],variable_list[1],variable_list[2],dots) + expansion.scale(0.7) + return expansion + +class pieChart(Scene): + def construct(self): + circle1=Circle(radius=3,color=BLUE) + powerText=TextMobject("Power Series") + powerText.scale(0.8) + self.play(FadeIn(powerText)) + self.play(ShowCreation(circle1)) + self.wait(1) + + powerGroup=VGroup(circle1,powerText) + + self.play(ApplyMethod(powerGroup.scale,0.5)) + self.play(ApplyMethod(powerGroup.move_to,2.2*UP)) + self.wait(0.5) + expansion_power_coeff=[] + variables_power=[] + expansion_power=formFormula(expansion_power_coeff,variables_power) + self.play(ReplacementTransform(powerText,expansion_power)) + self.wait(1) + + circle2=Circle(radius=1.5) + circle2.shift(2.2*UP) + expansion_geo_coeff=[0]*3 + variables_geo=[0]*3 + arrow1_2=Line(start=0.7*UP,end=2.5*LEFT) + expansion_geo_coeff=[TextMobject("${ a }_{ 0 }$"),TextMobject("${ a }_{ 1 }$"),TextMobject("${ a }_{ 2 }$")] + for i in range(0,3): + expansion_geo_coeff[i].set_color(GOLD_A) + variables_geo=[TextMobject("+"),TextMobject("${ x }$+"),TextMobject("${ x }^{ 2 }$")] + expansion_geo_coeff[0].shift(2.2*UP+1.6*LEFT) + for i in range(0,3): + variables_geo[i].next_to(expansion_geo_coeff[i],buff=0.1) + if i!=2: + expansion_geo_coeff[i+1].next_to(variables_geo[i],buff=0.1) + dots=TextMobject("...") + dots.next_to(variables_geo[2]) + expansion_geo=VGroup(expansion_geo_coeff[0],expansion_geo_coeff[1],expansion_geo_coeff[2],variables_geo[0],variables_geo[1],variables_geo[2],dots) + expansion_geo.scale(0.7) + + self.play(ApplyMethod(circle2.shift,4*LEFT+2.5*DOWN),ApplyMethod(expansion_geo.shift,4*LEFT+2.5*DOWN)) + self.add(arrow1_2) + self.wait(1) + + ones=[TextMobject("1"),TextMobject("1"),TextMobject("1")] + for i in range(0,3): + ones[i].set_color(GOLD_A) + ones[0].shift(0.3*DOWN,5*LEFT) + ones[1].next_to(ones[0],buff=0.5) + ones[2].next_to(ones[1],buff=0.7) + self.play(ReplacementTransform(expansion_geo_coeff[0],ones[0]),ReplacementTransform(expansion_geo_coeff[1],ones[1]),ReplacementTransform(expansion_geo_coeff[2],ones[2])) + self.wait(1) + expansion_geo=VGroup(ones[0],ones[1],ones[2],variables_geo[0],variables_geo[1],variables_geo[2],dots) + + expansion_geo_final=TextMobject("$1+x+{ x }^{ 2 }..$") + expansion_geo_final.scale(0.8) + expansion_geo_final.shift(0.3*DOWN+4*LEFT) + self.play(ReplacementTransform(expansion_geo,expansion_geo_final)) + self.wait(1) + + circle3=Circle(radius=1.5,color=GREEN) + circle3.shift(2.2*UP) + expansion_taylor_coeff=[0]*3 + variables_taylor=[0]*3 + arrow1_3=Line(start=0.7*UP,end=DOWN*0.3) + expansion_taylor_coeff=[TextMobject("${ a }_{ 0 }$"),TextMobject("${ a }_{ 1 }$"),TextMobject("${ a }_{ 2 }$")] + for i in range(0,3): + expansion_taylor_coeff[i].set_color(GOLD_A) + variables_taylor=[TextMobject("+"),TextMobject("${ x }$+"),TextMobject("${ x }^{ 2 }$")] + expansion_taylor_coeff[0].shift(2.2*UP+1.6*LEFT) + for i in range(0,3): + variables_taylor[i].next_to(expansion_taylor_coeff[i],buff=0.1) + if i!=2: + expansion_taylor_coeff[i+1].next_to(variables_taylor[i],buff=0.1) + dots=TextMobject("...") + dots.next_to(variables_taylor[2]) + expansion_taylor=VGroup(expansion_taylor_coeff[0],expansion_taylor_coeff[1],expansion_taylor_coeff[2],variables_taylor[0],variables_taylor[1],variables_taylor[2],dots) + expansion_taylor.scale(0.7) + + self.play(ApplyMethod(circle3.shift,4*DOWN),ApplyMethod(expansion_taylor.shift,4*DOWN)) + self.add(arrow1_3) + self.wait(1) + + differentials=[TextMobject("$f(0)$"),TextMobject("${ f'\left( 0 \\right) }$"),TextMobject("$\\frac { f''\left( 0 \\right) }{ 2! }$")] + for i in range(0,3): + differentials[i].set_color(GOLD_A) + differentials[0].shift(1.8*DOWN+1.15*LEFT) + differentials[1].shift(1.8*DOWN+0.45*LEFT) + differentials[2].shift(1.8*DOWN+0.45*RIGHT) + differentials[0].scale(0.35) + differentials[1].scale(0.35) + differentials[2].scale(0.35) + self.play(ReplacementTransform(expansion_taylor_coeff[0],differentials[0]),ReplacementTransform(expansion_taylor_coeff[1],differentials[1]),ReplacementTransform(expansion_taylor_coeff[2],differentials[2])) + self.wait(2) + expansion_taylor_final=VGroup(differentials[0],differentials[1],differentials[2],variables_taylor[0],variables_taylor[1],variables_taylor[2],dots) + + self.play(FadeOut(expansion_geo_final),FadeOut(expansion_taylor_final)) + geoText=TextMobject("Geometric Series") + geoText.scale(0.7) + geoText.shift(4*LEFT+0.3*DOWN) + taylorText=TextMobject("Taylor Series") + taylorText.scale(0.7) + taylorText.shift(1.8*DOWN) + self.play(FadeIn(geoText),FadeIn(taylorText)) + self.wait(1) + + soOntext=TextMobject("So on..!") + soOntext.shift(4*RIGHT) + soOntext.scale(0.8) + self.play(FadeIn(soOntext)) + self.wait(2) diff --git a/FSF-2020/calculus/series-and-transformations/Power Series/video2_convergence_Intuition.py b/FSF-2020/calculus/series-and-transformations/Power Series/video2_convergence_Intuition.py new file mode 100644 index 0000000..72356c6 --- /dev/null +++ b/FSF-2020/calculus/series-and-transformations/Power Series/video2_convergence_Intuition.py @@ -0,0 +1,94 @@ +from manimlib.imports import * +import numpy as np + + +class convergence(Scene): + def construct(self): + originalFormula=TextMobject("$\sum _{ n=0 }^{ \infty }{ { a }_{ n }{ x }^{ n } }$") + originalFormula.set_color(RED) + self.play(Write(originalFormula)) + self.wait(1) + self.play(ApplyMethod(originalFormula.shift,2.7*UP)) + self.wait(1) + + terms=["$a_{ 0 }$","$a_{ 1 }x$","$a_{ 2 }x^{ 2 }$","$a_{ 3 }x^{ 3 }$","$a_{ 4 }x^{ 4 }$","$a_{ 5 }x^{ 5 }$","$a_{ 6 }x^{ 6 }$","$a_{ 7 }x^{ 7 }$","$a_{ 8 }x^{ 8 }$","$a_{ 9 }x^{ 9 }$","$a_{ 10 }x^{ 10 }$","$a_{ 11 }x^{ 11 }$"] + termsTogetherString="+".join(terms) + termsTogether=TextMobject(termsTogetherString+"...") + termsTogether.scale(0.8) + termsTogether.shift(2.7*UP) + self.play(ReplacementTransform(originalFormula,termsTogether)) + self.wait(1) + + termMobjectRect=[0]*12 + termMobject=TextMobject(terms[0]) + termMobject.shift(2.7*UP+6.2*LEFT) + for i in range(1,13): + termMobjectOld=termMobject + termMobjectOld.scale(0.8) + if(i<12): + termMobject=TextMobject(terms[i]) + termMobject.next_to(termMobjectOld) + if(i==1): + rectDefine=TextMobject("Here","each rectangle","represents the","value of the term") + rectDefine.set_color_by_tex_to_color_map({"each rectangle":BLUE,"value of the term":YELLOW}) + rectDefine.scale(0.7) + rectDefine.shift(3.2*DOWN) + self.play(Write(rectDefine)) + self.wait(1) + if(i==2): + ratio=TextMobject("If $\\frac { a_{ n+1 } }{ { a }_{ n } } < 1$") + ratio.set_color(RED) + ratio.scale(0.7) + ratio.move_to(3.2*DOWN) + inequality=TextMobject("$a_{ n+1 } < a_{ n }$") + inequality.set_color(RED) + inequality.scale(0.7) + inequality.move_to(3.2*DOWN) + self.play(FadeOut(rectDefine)) + self.play(Write(ratio)) + self.wait(1) + self.play(ReplacementTransform(ratio,inequality)) + self.wait(1) + #self.play(ApplyMethod(termMobjectOld.move_to,(2-0.3*i)*DOWN+RIGHT*0.2*i)) + termMobjectRect[i-1]=Rectangle(height=0.1,width=(5-0.4*i)) + termMobjectRect[i-1].move_to((2-0.2*i)*DOWN+RIGHT*0.2*i) + #rectangles[p] = termMobjectRect + #p+=1 + self.play(ReplacementTransform(termMobjectOld,termMobjectRect[i-1])) + + uparrow=TextMobject("$\\uparrow$") + uparrow.set_color(GREEN) + uparrow.scale(6) + uparrow.shift(4*RIGHT+0.5*DOWN) + self.play(ShowCreation(uparrow)) + self.wait(1) + + converges=TextMobject("Converges!") + converges.set_color(RED) + converges.scale(0.6) + converges.next_to(uparrow) + self.play(FadeIn(converges)) + self.wait(2) + + self.play(FadeOut(converges),FadeOut(uparrow),FadeOut(inequality)) + self.wait(0.5) + rect=VGroup(termMobjectRect[0],termMobjectRect[1],termMobjectRect[2],termMobjectRect[3],termMobjectRect[4],termMobjectRect[5],termMobjectRect[6],termMobjectRect[7],termMobjectRect[8],termMobjectRect[9],termMobjectRect[10],termMobjectRect[11]) + self.play(ApplyMethod(rect.scale,0.2)) + for i in range(0,12): + self.play(ApplyMethod(termMobjectRect[i].shift,i*0.04*DOWN+(11-(3-0.11*i)*i)*LEFT*0.3)) + func=TextMobject("$\\approx$","$f(x)$") + func.set_color_by_tex_to_color_map({"$f(x)$":RED}) + func.scale(0.8) + func.shift(DOWN+4.5*RIGHT+0.1*UP) + self.play(FadeIn(func)) + + rightarrow=TextMobject("$\\rightarrow$") + rightarrow.set_color(GREEN) + rightarrow.scale(4) + rightarrow.shift(2*DOWN) + converges=TextMobject("Hence even the","sum converges!") + converges.set_color_by_tex_to_color_map({"sum converges!":RED}) + converges.move_to(3*DOWN) + converges.scale(0.7) + self.play(Write(rightarrow),FadeIn(converges)) + self.wait(2) -- cgit From 0f6097a427663085ac4d373d77e9c7c9aca4c5a7 Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 14:34:22 +0530 Subject: Rename script3.py to video3_convergence_of_a_function.py --- .../Power Series/script3.py | 156 --------------------- .../video3_convergence_of_a_function.py | 156 +++++++++++++++++++++ 2 files changed, 156 insertions(+), 156 deletions(-) delete mode 100644 FSF-2020/calculus/series-and-transformations/Power Series/script3.py create mode 100644 FSF-2020/calculus/series-and-transformations/Power Series/video3_convergence_of_a_function.py (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Power Series/script3.py b/FSF-2020/calculus/series-and-transformations/Power Series/script3.py deleted file mode 100644 index f710f42..0000000 --- a/FSF-2020/calculus/series-and-transformations/Power Series/script3.py +++ /dev/null @@ -1,156 +0,0 @@ -from manimlib.imports import* -import math - -class intro(Scene): - def construct(self): - introText1=TextMobject("Let's analyse") - introText2=TextMobject("for") - function_main=TextMobject("$\sum { { (-1) }^{ n }{ x }^{ 2n } }$") - function_main.set_color(GREEN) - introText1.scale(1.2) - introText1.shift(2*UP) - introText2.scale(0.7) - introText2.shift(UP) - function_main.scale(2) - function_main.shift(DOWN) - function_expan=TextMobject("$1-{ x }^{ 2 }+{ x }^{ 4 }-{ x }^{ 6 }+{ x }^{ 8 }+..$") - function_expan.set_color(RED) - function_expan.scale(1.2) - function_expan.shift(2*UP) - - self.play(Write(introText1)) - self.play(FadeIn(introText2)) - self.wait(0.5) - self.play(Write(function_main)) - self.wait(1) - - self.play(FadeOut(introText1),FadeOut(introText2)) - self.play(ApplyMethod(function_main.shift,3*UP)) - self.wait(0.5) - self.play(ReplacementTransform(function_main,function_expan)) - self.wait(1) - self.play(ApplyMethod(function_expan.scale,0.5)) - function_expan.to_edge(UP+RIGHT) - self.play(ReplacementTransform(function_expan,function_expan)) - self.wait(1) - - -class graphScene(GraphScene): - CONFIG = { - "x_min": -8, - "x_max": 8, - "y_min": -8, - "y_max": 8, - "graph_origin": ORIGIN, - "function_color": RED, - "axes_color": GREEN, - "x_axis_label": "$x$", - "y_axis_label": "$y$", - "exclude_zero_label": True, - "x_labeled_nums": range(-1, 2, 1), - "y_labeled_nums": range(0,2,1) - } - - 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) - - function_expan=TextMobject("$1-{ x }^{ 2 }+{ x }^{ 4 }-{ x }^{ 6 }+{ x }^{ 8 }+..$") - function_expan.set_color(RED) - function_expan.scale(0.6) - function_expan.to_edge(UP+RIGHT) - self.add(function_expan) - - self.setup_axes(animate=True) - - eqText=[TextMobject("$1$"),TextMobject("$1-{ x }^{ 2 }$"),TextMobject("$1-{ x }^{ 2 }+{ x }^{ 4 }$"),TextMobject("$1-{ x }^{ 2 }+{ x }^{ 4 }-{ x }^{ 6 }$")] - for i in range(0,len(eqText)): - eqText[i].scale(0.6) - eqText[i].set_color(BLUE) - eqText[i].shift(ORIGIN+UP*2*y_each_unit+RIGHT*3.3*x_each_unit) - eqTextTerm=TextMobject("And so on..!") - eqTextTerm.set_color(BLUE) - eqTextTerm.scale(0.6) - eqTextTerm.shift(ORIGIN+UP*2*y_each_unit+3*RIGHT*x_each_unit) - equation1 = self.get_graph(lambda x : 1,color = RED,x_min = -8,x_max=8) - equation2 = self.get_graph(lambda x : 1-math.pow(x,2),color = RED,x_min = -1.7,x_max=1.7) - equation3 = self.get_graph(lambda x : 1-math.pow(x,2)+math.pow(x,4),color = RED,x_min = -1.6,x_max=1.6) - equation4 = self.get_graph(lambda x : 1-math.pow(x,2)+math.pow(x,4)-math.pow(x,6),color = RED,x_min = -1.45,x_max=1.45) - equation5 = self.get_graph(lambda x : 1-math.pow(x,2)+math.pow(x,4)-math.pow(x,6)+math.pow(x,8),color = RED,x_min = -1.35,x_max=1.35) - equation6 = self.get_graph(lambda x : 1-math.pow(x,2)+math.pow(x,4)-math.pow(x,6)+math.pow(x,8)-math.pow(x,10),color = RED,x_min = -1.3,x_max=1.3) - equation7 = self.get_graph(lambda x : 1-math.pow(x,2)+math.pow(x,4)-math.pow(x,6)+math.pow(x,8)-math.pow(x,10)+math.pow(x,12),color = RED,x_min = -1.25,x_max=1.25) - equation8 = self.get_graph(lambda x : 1-math.pow(x,2)+math.pow(x,4)-math.pow(x,6)+math.pow(x,8)-math.pow(x,10)+math.pow(x,12)-math.pow(x,14),color = RED,x_min = -1.2,x_max=1.2) - equation9 = self.get_graph(lambda x : 1-math.pow(x,2)+math.pow(x,4)-math.pow(x,6)+math.pow(x,8)-math.pow(x,10)+math.pow(x,12)-math.pow(x,14)+math.pow(x,16),color = RED,x_min = -1.15,x_max=1.15) - equation10 = self.get_graph(lambda x : 1-math.pow(x,2)+math.pow(x,4)-math.pow(x,6)+math.pow(x,8)-math.pow(x,10)+math.pow(x,12)-math.pow(x,14)+math.pow(x,16)-math.pow(x,18),color = RED,x_min = -1.15,x_max=1.15) - - textBtwAnim1=TextMobject("Here the graph just","oscilates") - textBtwAnim1.set_color_by_tex_to_color_map({"oscilates":BLUE}) - textBtwAnim2=TextMobject("after","the","point","(as we add higher order terms)") - textBtwAnim2.set_color_by_tex_to_color_map({"after":BLUE,"point":YELLOW}) - textBtwAnim3=TextMobject("$x=1$") - textBtwAnim1.scale(0.4) - textBtwAnim2.scale(0.4) - textBtwAnim3.scale(1.2) - textBtwAnim1.shift(2.1*DOWN+4.3*RIGHT) - textBtwAnim2.shift(2.4*DOWN+4.1*RIGHT) - textBtwAnim3.shift(2.9*DOWN+4.3*RIGHT) - - self.play(ShowCreation(equation1),run_time=0.8) - self.add(eqText[0]) - self.wait(1) - self.play(ReplacementTransform(equation1,equation2),ReplacementTransform(eqText[0],eqText[1])) - self.wait(0.5) - self.play(ReplacementTransform(equation2,equation3),ReplacementTransform(eqText[1],eqText[2])) - self.wait(0.4) - self.play(ReplacementTransform(equation3,equation4),ReplacementTransform(eqText[2],eqText[3])) - self.wait(0.3) - self.play(FadeOut(eqText[3])) - self.play(FadeIn(eqTextTerm)) - self.play(Write(textBtwAnim1),Write(textBtwAnim2)) - self.play(FadeIn(textBtwAnim3)) - self.play(ReplacementTransform(equation4,equation5)) - self.wait(0.2) - self.play(ReplacementTransform(equation5,equation6)) - self.wait(0.2) - self.play(ReplacementTransform(equation6,equation7)) - self.wait(0.2) - self.play(ReplacementTransform(equation7,equation8)) - self.wait(0.2) - self.play(ReplacementTransform(equation8,equation9)) - self.wait(0.2) - self.play(ReplacementTransform(equation9,equation10)) - self.wait(1) - - self.play(FadeOut(textBtwAnim1),FadeOut(textBtwAnim2),FadeOut(textBtwAnim3),FadeOut(equation10),FadeOut(eqTextTerm)) - self.wait(1) - - convergeLine=Line(start=ORIGIN+x_each_unit*LEFT,end=ORIGIN+x_each_unit*RIGHT,color=WHITE) - divergeLineLeft=Line(start=ORIGIN+x_each_unit*LEFT,end=ORIGIN+x_each_unit*LEFT*8,color=RED) - divergeLineRight=Line(start=ORIGIN+x_each_unit*RIGHT,end=ORIGIN+x_each_unit*8*RIGHT,color=RED) - circle1=Circle(radius=0.01,color=PURPLE_E) - circle2=Circle(radius=0.01,color=PURPLE_E) - circle1.shift(ORIGIN+LEFT*x_each_unit) - circle2.shift(ORIGIN+RIGHT*x_each_unit) - convergeText=TextMobject("Converges") - divergeText1=TextMobject("Diverges") - divergeText2=TextMobject("Diverges") - convergeText.set_color(GREEN) - divergeText1.set_color(RED) - divergeText2.set_color(RED) - convergeText.scale(0.5) - divergeText1.scale(0.5) - divergeText2.scale(0.5) - convergeText.shift(1.6*UP) - divergeText1.shift(0.3*UP+1.5*LEFT) - divergeText2.shift(0.3*UP+1.5*RIGHT) - self.play(Write(divergeLineLeft),Write(divergeLineRight)) - self.play(FadeIn(convergeLine)) - self.wait(0.5) - self.play(FadeOut(self.axes)) - self.play(Write(circle1),Write(circle2)) - self.wait(0.5) - self.play(ApplyMethod(convergeLine.shift,1.3*UP),ApplyMethod(function_expan.shift,5*LEFT+DOWN)) - self.play(FadeIn(convergeText),FadeIn(divergeText1),FadeIn(divergeText2)) - self.wait(2) - diff --git a/FSF-2020/calculus/series-and-transformations/Power Series/video3_convergence_of_a_function.py b/FSF-2020/calculus/series-and-transformations/Power Series/video3_convergence_of_a_function.py new file mode 100644 index 0000000..f710f42 --- /dev/null +++ b/FSF-2020/calculus/series-and-transformations/Power Series/video3_convergence_of_a_function.py @@ -0,0 +1,156 @@ +from manimlib.imports import* +import math + +class intro(Scene): + def construct(self): + introText1=TextMobject("Let's analyse") + introText2=TextMobject("for") + function_main=TextMobject("$\sum { { (-1) }^{ n }{ x }^{ 2n } }$") + function_main.set_color(GREEN) + introText1.scale(1.2) + introText1.shift(2*UP) + introText2.scale(0.7) + introText2.shift(UP) + function_main.scale(2) + function_main.shift(DOWN) + function_expan=TextMobject("$1-{ x }^{ 2 }+{ x }^{ 4 }-{ x }^{ 6 }+{ x }^{ 8 }+..$") + function_expan.set_color(RED) + function_expan.scale(1.2) + function_expan.shift(2*UP) + + self.play(Write(introText1)) + self.play(FadeIn(introText2)) + self.wait(0.5) + self.play(Write(function_main)) + self.wait(1) + + self.play(FadeOut(introText1),FadeOut(introText2)) + self.play(ApplyMethod(function_main.shift,3*UP)) + self.wait(0.5) + self.play(ReplacementTransform(function_main,function_expan)) + self.wait(1) + self.play(ApplyMethod(function_expan.scale,0.5)) + function_expan.to_edge(UP+RIGHT) + self.play(ReplacementTransform(function_expan,function_expan)) + self.wait(1) + + +class graphScene(GraphScene): + CONFIG = { + "x_min": -8, + "x_max": 8, + "y_min": -8, + "y_max": 8, + "graph_origin": ORIGIN, + "function_color": RED, + "axes_color": GREEN, + "x_axis_label": "$x$", + "y_axis_label": "$y$", + "exclude_zero_label": True, + "x_labeled_nums": range(-1, 2, 1), + "y_labeled_nums": range(0,2,1) + } + + 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) + + function_expan=TextMobject("$1-{ x }^{ 2 }+{ x }^{ 4 }-{ x }^{ 6 }+{ x }^{ 8 }+..$") + function_expan.set_color(RED) + function_expan.scale(0.6) + function_expan.to_edge(UP+RIGHT) + self.add(function_expan) + + self.setup_axes(animate=True) + + eqText=[TextMobject("$1$"),TextMobject("$1-{ x }^{ 2 }$"),TextMobject("$1-{ x }^{ 2 }+{ x }^{ 4 }$"),TextMobject("$1-{ x }^{ 2 }+{ x }^{ 4 }-{ x }^{ 6 }$")] + for i in range(0,len(eqText)): + eqText[i].scale(0.6) + eqText[i].set_color(BLUE) + eqText[i].shift(ORIGIN+UP*2*y_each_unit+RIGHT*3.3*x_each_unit) + eqTextTerm=TextMobject("And so on..!") + eqTextTerm.set_color(BLUE) + eqTextTerm.scale(0.6) + eqTextTerm.shift(ORIGIN+UP*2*y_each_unit+3*RIGHT*x_each_unit) + equation1 = self.get_graph(lambda x : 1,color = RED,x_min = -8,x_max=8) + equation2 = self.get_graph(lambda x : 1-math.pow(x,2),color = RED,x_min = -1.7,x_max=1.7) + equation3 = self.get_graph(lambda x : 1-math.pow(x,2)+math.pow(x,4),color = RED,x_min = -1.6,x_max=1.6) + equation4 = self.get_graph(lambda x : 1-math.pow(x,2)+math.pow(x,4)-math.pow(x,6),color = RED,x_min = -1.45,x_max=1.45) + equation5 = self.get_graph(lambda x : 1-math.pow(x,2)+math.pow(x,4)-math.pow(x,6)+math.pow(x,8),color = RED,x_min = -1.35,x_max=1.35) + equation6 = self.get_graph(lambda x : 1-math.pow(x,2)+math.pow(x,4)-math.pow(x,6)+math.pow(x,8)-math.pow(x,10),color = RED,x_min = -1.3,x_max=1.3) + equation7 = self.get_graph(lambda x : 1-math.pow(x,2)+math.pow(x,4)-math.pow(x,6)+math.pow(x,8)-math.pow(x,10)+math.pow(x,12),color = RED,x_min = -1.25,x_max=1.25) + equation8 = self.get_graph(lambda x : 1-math.pow(x,2)+math.pow(x,4)-math.pow(x,6)+math.pow(x,8)-math.pow(x,10)+math.pow(x,12)-math.pow(x,14),color = RED,x_min = -1.2,x_max=1.2) + equation9 = self.get_graph(lambda x : 1-math.pow(x,2)+math.pow(x,4)-math.pow(x,6)+math.pow(x,8)-math.pow(x,10)+math.pow(x,12)-math.pow(x,14)+math.pow(x,16),color = RED,x_min = -1.15,x_max=1.15) + equation10 = self.get_graph(lambda x : 1-math.pow(x,2)+math.pow(x,4)-math.pow(x,6)+math.pow(x,8)-math.pow(x,10)+math.pow(x,12)-math.pow(x,14)+math.pow(x,16)-math.pow(x,18),color = RED,x_min = -1.15,x_max=1.15) + + textBtwAnim1=TextMobject("Here the graph just","oscilates") + textBtwAnim1.set_color_by_tex_to_color_map({"oscilates":BLUE}) + textBtwAnim2=TextMobject("after","the","point","(as we add higher order terms)") + textBtwAnim2.set_color_by_tex_to_color_map({"after":BLUE,"point":YELLOW}) + textBtwAnim3=TextMobject("$x=1$") + textBtwAnim1.scale(0.4) + textBtwAnim2.scale(0.4) + textBtwAnim3.scale(1.2) + textBtwAnim1.shift(2.1*DOWN+4.3*RIGHT) + textBtwAnim2.shift(2.4*DOWN+4.1*RIGHT) + textBtwAnim3.shift(2.9*DOWN+4.3*RIGHT) + + self.play(ShowCreation(equation1),run_time=0.8) + self.add(eqText[0]) + self.wait(1) + self.play(ReplacementTransform(equation1,equation2),ReplacementTransform(eqText[0],eqText[1])) + self.wait(0.5) + self.play(ReplacementTransform(equation2,equation3),ReplacementTransform(eqText[1],eqText[2])) + self.wait(0.4) + self.play(ReplacementTransform(equation3,equation4),ReplacementTransform(eqText[2],eqText[3])) + self.wait(0.3) + self.play(FadeOut(eqText[3])) + self.play(FadeIn(eqTextTerm)) + self.play(Write(textBtwAnim1),Write(textBtwAnim2)) + self.play(FadeIn(textBtwAnim3)) + self.play(ReplacementTransform(equation4,equation5)) + self.wait(0.2) + self.play(ReplacementTransform(equation5,equation6)) + self.wait(0.2) + self.play(ReplacementTransform(equation6,equation7)) + self.wait(0.2) + self.play(ReplacementTransform(equation7,equation8)) + self.wait(0.2) + self.play(ReplacementTransform(equation8,equation9)) + self.wait(0.2) + self.play(ReplacementTransform(equation9,equation10)) + self.wait(1) + + self.play(FadeOut(textBtwAnim1),FadeOut(textBtwAnim2),FadeOut(textBtwAnim3),FadeOut(equation10),FadeOut(eqTextTerm)) + self.wait(1) + + convergeLine=Line(start=ORIGIN+x_each_unit*LEFT,end=ORIGIN+x_each_unit*RIGHT,color=WHITE) + divergeLineLeft=Line(start=ORIGIN+x_each_unit*LEFT,end=ORIGIN+x_each_unit*LEFT*8,color=RED) + divergeLineRight=Line(start=ORIGIN+x_each_unit*RIGHT,end=ORIGIN+x_each_unit*8*RIGHT,color=RED) + circle1=Circle(radius=0.01,color=PURPLE_E) + circle2=Circle(radius=0.01,color=PURPLE_E) + circle1.shift(ORIGIN+LEFT*x_each_unit) + circle2.shift(ORIGIN+RIGHT*x_each_unit) + convergeText=TextMobject("Converges") + divergeText1=TextMobject("Diverges") + divergeText2=TextMobject("Diverges") + convergeText.set_color(GREEN) + divergeText1.set_color(RED) + divergeText2.set_color(RED) + convergeText.scale(0.5) + divergeText1.scale(0.5) + divergeText2.scale(0.5) + convergeText.shift(1.6*UP) + divergeText1.shift(0.3*UP+1.5*LEFT) + divergeText2.shift(0.3*UP+1.5*RIGHT) + self.play(Write(divergeLineLeft),Write(divergeLineRight)) + self.play(FadeIn(convergeLine)) + self.wait(0.5) + self.play(FadeOut(self.axes)) + self.play(Write(circle1),Write(circle2)) + self.wait(0.5) + self.play(ApplyMethod(convergeLine.shift,1.3*UP),ApplyMethod(function_expan.shift,5*LEFT+DOWN)) + self.play(FadeIn(convergeText),FadeIn(divergeText1),FadeIn(divergeText2)) + self.wait(2) + -- cgit From 121c40ed2c33708e6c633ce69654526671af0147 Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 14:34:49 +0530 Subject: Rename script4.py to video4_radius_and_intervalOfConvergence.py --- .../Power Series/script4.py | 108 --------------------- .../video4_radius_and_intervalOfConvergence.py | 108 +++++++++++++++++++++ 2 files changed, 108 insertions(+), 108 deletions(-) delete mode 100644 FSF-2020/calculus/series-and-transformations/Power Series/script4.py create mode 100644 FSF-2020/calculus/series-and-transformations/Power Series/video4_radius_and_intervalOfConvergence.py (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Power Series/script4.py b/FSF-2020/calculus/series-and-transformations/Power Series/script4.py deleted file mode 100644 index 412d20c..0000000 --- a/FSF-2020/calculus/series-and-transformations/Power Series/script4.py +++ /dev/null @@ -1,108 +0,0 @@ -from manimlib.imports import * -import math - -class intro(Scene): - def construct(self): - introText1=TextMobject("Consider the","above","example..") - introText1.scale(0.8) - introText1.set_color_by_tex_to_color_map({"above":YELLOW}) - self.play(Write(introText1)) - self.wait(1) - -class graphScene(GraphScene,MovingCameraScene): - CONFIG = { - "x_min": -5, - "x_max": 5, - "y_min": -5, - "y_max": 5, - "graph_origin": ORIGIN, - "function_color": RED, - "axes_color": GREEN, - "x_axis_label": "$x$", - "y_axis_label": "$y$", - "exclude_zero_label": True, - "x_labeled_nums": range(-1, 2, 1), - "y_labeled_nums": range(0,2,1), - "y_axis_height":7, - "x_axis_width":7 - } - - 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) - - function_expan=TextMobject("$1-{ x }^{ 2 }+{ x }^{ 4 }-{ x }^{ 6 }+{ x }^{ 8 }+..$") - function_expan.scale(0.6) - function_expan.set_color(RED) - function_expan.to_edge(UP+RIGHT) - self.add(function_expan) - - self.setup_axes() - - equation = self.get_graph(lambda x : 1-math.pow(x,2)+math.pow(x,4)-math.pow(x,6)+math.pow(x,8)-math.pow(x,10)+math.pow(x,12)-math.pow(x,14)+math.pow(x,16)-math.pow(x,18),color = RED,x_min = -1.1,x_max=1.1) - self.play(ShowCreation(equation)) - self.wait(1) - - dashLineLeft=DashedLine(start=ORIGIN+y_each_unit*5*UP,end=ORIGIN+y_each_unit*5*DOWN) - dashLineRight=DashedLine(start=ORIGIN+y_each_unit*5*UP,end=ORIGIN+y_each_unit*5*DOWN) - dashLineLeft.shift(ORIGIN+LEFT*x_each_unit) - dashLineRight.shift(ORIGIN+RIGHT*x_each_unit) - radiusLine=Line(start=ORIGIN,end=ORIGIN+RIGHT*x_each_unit) - rangeLine=Line(start=ORIGIN+LEFT*x_each_unit,end=ORIGIN+RIGHT*x_each_unit) - circle=Circle(radius=x_each_unit) - movingPoint=Circle(radius=0.025) - movingPoint.shift(ORIGIN+RIGHT*x_each_unit) - circleEq1=self.get_graph(lambda x:math.sqrt(1-x**2),color=BLUE,x_max=-1,x_min=1) - circleEq2=self.get_graph(lambda x:-math.sqrt(1-x**2),color=BLUE,x_max=1,x_min=-1) - - self.play(Write(dashLineLeft),Write(dashLineRight)) - self.wait(1) - - equation_updated=self.get_graph(lambda x : 1-math.pow(x,2)+math.pow(x,4)-math.pow(x,6)+math.pow(x,8)-math.pow(x,10)+math.pow(x,12)-math.pow(x,14)+math.pow(x,16)-math.pow(x,18),color = GREEN,x_min = -1,x_max=1) - self.play(FadeOut(self.axes),ReplacementTransform(equation,equation_updated)) - self.wait(0.5) - self.play(Write(radiusLine)) - self.play(MoveAlongPath(movingPoint,circleEq1)) - self.play(MoveAlongPath(movingPoint,circleEq2)) - self.play(FadeIn(circle)) - self.wait(1) - - radiusText=TextMobject("Radius of convergence") - radiusText.scale(0.14) - radiusText.shift(ORIGIN+RIGHT*x_each_unit*0.45+DOWN*y_each_unit*0.2) - - self.play(Write(radiusText)) - self.wait(0.6) - - self.camera_frame.save_state() - self.camera_frame.set_width(5.5) - self.play(self.camera_frame.move_to, ORIGIN) - self.wait(1) - self.camera_frame.set_width(14) - self.wait(1.3) - - self.play(FadeOut(radiusText),FadeOut(circle),FadeOut(movingPoint)) - extendLine=Line(start=ORIGIN,end=ORIGIN+x_each_unit*LEFT) - self.play(Write(extendLine)) - doubleArrow=TextMobject("$\longleftrightarrow$") - doubleArrow.scale(1.6) - doubleArrow.set_color(BLUE) - doubleArrow.shift(ORIGIN+DOWN*y_each_unit*0.5) - self.play(FadeIn(doubleArrow)) - self.wait(1) - rangeText=TextMobject("Interval of convergence") - rangeText.scale(0.15) - rangeText.shift(ORIGIN+y_each_unit*DOWN) - self.play(Write(rangeText)) - self.wait(0.6) - - self.camera_frame.save_state() - self.camera_frame.set_width(5.5) - self.play(self.camera_frame.move_to, ORIGIN) - self.wait(1) - self.camera_frame.set_width(14) - self.wait(1.5) diff --git a/FSF-2020/calculus/series-and-transformations/Power Series/video4_radius_and_intervalOfConvergence.py b/FSF-2020/calculus/series-and-transformations/Power Series/video4_radius_and_intervalOfConvergence.py new file mode 100644 index 0000000..412d20c --- /dev/null +++ b/FSF-2020/calculus/series-and-transformations/Power Series/video4_radius_and_intervalOfConvergence.py @@ -0,0 +1,108 @@ +from manimlib.imports import * +import math + +class intro(Scene): + def construct(self): + introText1=TextMobject("Consider the","above","example..") + introText1.scale(0.8) + introText1.set_color_by_tex_to_color_map({"above":YELLOW}) + self.play(Write(introText1)) + self.wait(1) + +class graphScene(GraphScene,MovingCameraScene): + CONFIG = { + "x_min": -5, + "x_max": 5, + "y_min": -5, + "y_max": 5, + "graph_origin": ORIGIN, + "function_color": RED, + "axes_color": GREEN, + "x_axis_label": "$x$", + "y_axis_label": "$y$", + "exclude_zero_label": True, + "x_labeled_nums": range(-1, 2, 1), + "y_labeled_nums": range(0,2,1), + "y_axis_height":7, + "x_axis_width":7 + } + + 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) + + function_expan=TextMobject("$1-{ x }^{ 2 }+{ x }^{ 4 }-{ x }^{ 6 }+{ x }^{ 8 }+..$") + function_expan.scale(0.6) + function_expan.set_color(RED) + function_expan.to_edge(UP+RIGHT) + self.add(function_expan) + + self.setup_axes() + + equation = self.get_graph(lambda x : 1-math.pow(x,2)+math.pow(x,4)-math.pow(x,6)+math.pow(x,8)-math.pow(x,10)+math.pow(x,12)-math.pow(x,14)+math.pow(x,16)-math.pow(x,18),color = RED,x_min = -1.1,x_max=1.1) + self.play(ShowCreation(equation)) + self.wait(1) + + dashLineLeft=DashedLine(start=ORIGIN+y_each_unit*5*UP,end=ORIGIN+y_each_unit*5*DOWN) + dashLineRight=DashedLine(start=ORIGIN+y_each_unit*5*UP,end=ORIGIN+y_each_unit*5*DOWN) + dashLineLeft.shift(ORIGIN+LEFT*x_each_unit) + dashLineRight.shift(ORIGIN+RIGHT*x_each_unit) + radiusLine=Line(start=ORIGIN,end=ORIGIN+RIGHT*x_each_unit) + rangeLine=Line(start=ORIGIN+LEFT*x_each_unit,end=ORIGIN+RIGHT*x_each_unit) + circle=Circle(radius=x_each_unit) + movingPoint=Circle(radius=0.025) + movingPoint.shift(ORIGIN+RIGHT*x_each_unit) + circleEq1=self.get_graph(lambda x:math.sqrt(1-x**2),color=BLUE,x_max=-1,x_min=1) + circleEq2=self.get_graph(lambda x:-math.sqrt(1-x**2),color=BLUE,x_max=1,x_min=-1) + + self.play(Write(dashLineLeft),Write(dashLineRight)) + self.wait(1) + + equation_updated=self.get_graph(lambda x : 1-math.pow(x,2)+math.pow(x,4)-math.pow(x,6)+math.pow(x,8)-math.pow(x,10)+math.pow(x,12)-math.pow(x,14)+math.pow(x,16)-math.pow(x,18),color = GREEN,x_min = -1,x_max=1) + self.play(FadeOut(self.axes),ReplacementTransform(equation,equation_updated)) + self.wait(0.5) + self.play(Write(radiusLine)) + self.play(MoveAlongPath(movingPoint,circleEq1)) + self.play(MoveAlongPath(movingPoint,circleEq2)) + self.play(FadeIn(circle)) + self.wait(1) + + radiusText=TextMobject("Radius of convergence") + radiusText.scale(0.14) + radiusText.shift(ORIGIN+RIGHT*x_each_unit*0.45+DOWN*y_each_unit*0.2) + + self.play(Write(radiusText)) + self.wait(0.6) + + self.camera_frame.save_state() + self.camera_frame.set_width(5.5) + self.play(self.camera_frame.move_to, ORIGIN) + self.wait(1) + self.camera_frame.set_width(14) + self.wait(1.3) + + self.play(FadeOut(radiusText),FadeOut(circle),FadeOut(movingPoint)) + extendLine=Line(start=ORIGIN,end=ORIGIN+x_each_unit*LEFT) + self.play(Write(extendLine)) + doubleArrow=TextMobject("$\longleftrightarrow$") + doubleArrow.scale(1.6) + doubleArrow.set_color(BLUE) + doubleArrow.shift(ORIGIN+DOWN*y_each_unit*0.5) + self.play(FadeIn(doubleArrow)) + self.wait(1) + rangeText=TextMobject("Interval of convergence") + rangeText.scale(0.15) + rangeText.shift(ORIGIN+y_each_unit*DOWN) + self.play(Write(rangeText)) + self.wait(0.6) + + self.camera_frame.save_state() + self.camera_frame.set_width(5.5) + self.play(self.camera_frame.move_to, ORIGIN) + self.wait(1) + self.camera_frame.set_width(14) + self.wait(1.5) -- cgit From b7d0db731712d3603f5c18cffbf19cc1e81f9a42 Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 14:35:15 +0530 Subject: Rename script5.py to video5_UniformConvergence.py --- .../Power Series/script5.py | 136 --------------------- .../Power Series/video5_UniformConvergence.py | 136 +++++++++++++++++++++ 2 files changed, 136 insertions(+), 136 deletions(-) delete mode 100644 FSF-2020/calculus/series-and-transformations/Power Series/script5.py create mode 100644 FSF-2020/calculus/series-and-transformations/Power Series/video5_UniformConvergence.py (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Power Series/script5.py b/FSF-2020/calculus/series-and-transformations/Power Series/script5.py deleted file mode 100644 index e9681aa..0000000 --- a/FSF-2020/calculus/series-and-transformations/Power Series/script5.py +++ /dev/null @@ -1,136 +0,0 @@ -from manimlib.imports import * -import math - -class uniformlyConvergent(Scene): - def construct(self): - introText1=TextMobject("Again consider the","above","example") - introText2=TextMobject("Let","$g(x)=\\frac { 1 }{ 1+{ x }^{ 2 } }$","and","x=0.5 $\in$(-1,1)") - introText3=TextMobject("Lets analyse..","!") - introText1.scale(0.8) - introText2.scale(0.7) - introText3.scale(0.9) - introText3.shift(DOWN) - introText1.set_color_by_tex_to_color_map({"above":YELLOW}) - introText2.set_color_by_tex_to_color_map({"$g(x)=\\frac { 1 }{ 1+{ x }^{ 2 } }$":BLUE,"x=0.5 $\in$(-1,1)":YELLOW}) - introText3.set_color_by_tex_to_color_map({"!":GREEN}) - self.play(Write(introText1)) - self.wait(0.5) - self.play(FadeOut(introText1)) - self.play(Write(introText2)) - self.play(FadeIn(introText3)) - self.wait(2) - - -def gety(x,n): - ans=0 - for i in range(0,n+1): - if(i%2==0): - ans+=(math.pow(x,2*i)) - else: - ans-=(math.pow(x,2*i)) - return ans - -def makeSeries(x,points,x_each_unit,y_each_unit): - p=0 - for point in points: - y=gety(x,p) - point.shift(ORIGIN+RIGHT*x_each_unit*p+UP*y_each_unit*y) - p+=1 - -def makeLines(x,numPoints,x_each_unit,y_each_unit): - lines=[0]*numPoints - for i in range(0,numPoints-1): - y=gety(x,i) - y_next=gety(x,i+1) - lines[i]=Line(start=ORIGIN+RIGHT*x_each_unit*i+UP*y_each_unit*y,end=ORIGIN+RIGHT*x_each_unit*(i+1)+UP*y_each_unit*y_next,color=RED) - return lines - -class graphScene(GraphScene,MovingCameraScene): - CONFIG = { - "x_min": -6, - "x_max": 6, - "y_min": -5, - "y_max": 5, - "graph_origin": ORIGIN, - "function_color": RED, - "axes_color": GREEN, - "x_axis_label": "$k$", - "y_axis_label": "$f(\\frac{1}{2})_k$", - "exclude_zero_label": True, - "x_axis_width":7, - "y_axis_height":7 - } - - 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) - sequence=TextMobject("$1$ , $1-(0.5)^2$ , $1-(0.5)^2+(0.5)^4..$") - sequence.set_color(RED) - sequence.scale(0.35) - sequence.to_edge(UP+RIGHT) - formula=TextMobject("$f(x)_{ k }=\sum _{ i=0 }^{ k }{ (-1)^{ i }(x)^{ 2i } } $") - formula.set_color(PURPLE_C) - formula.scale(0.4) - formula.shift(5.3*RIGHT+3*UP) - fLine=Line(start=ORIGIN+x_each_unit*6*LEFT,end=ORIGIN+x_each_unit*6*RIGHT) - fLine.shift(ORIGIN+(4/5)*y_each_unit*UP) - fLineText=TextMobject("$g(0.5)=\\frac { 4 }{ 5 } $") - fLineText.set_color(RED) - fLineText.scale(0.3) - fLineText.shift(UP*1.2*y_each_unit+RIGHT*x_each_unit+4*LEFT) - points=[Dot(radius=0.03,color=BLUE) for i in range(0,6)] - makeSeries(0.5,points,x_each_unit,y_each_unit) - lines=makeLines(0.5,6,x_each_unit,y_each_unit) - - - self.add(sequence) - self.add(formula) - self.setup_axes(animate=True) - self.play(Write(fLine)) - self.add(fLineText) - for p in points: - self.add(p) - for p in range(0,5): - self.play(Write(lines[p])) - self.wait(0.5) - self.camera_frame.save_state() - self.camera_frame.set_width(0.6) - self.play(self.camera_frame.move_to, points[0]) - self.wait(0.4) - self.play(self.camera_frame.move_to, points[1]) - self.wait(0.4) - self.play(self.camera_frame.move_to, points[2]) - self.wait(0.3) - self.play(self.camera_frame.move_to, points[3]) - self.wait(1) - self.play(self.camera_frame.move_to,ORIGIN) - self.camera_frame.set_width(14) - self.wait(1) - - explanation1=TextMobject("Since the series","converges","to") - explanation1.set_color_by_tex_to_color_map({"converges":YELLOW}) - explanation2=TextMobject("$\\frac {4}{5}$") - explanation2.set_color(BLUE) - explanation3=TextMobject("Hence","$\\forall \epsilon>0$,","$\exists k$","such that,") - explanation3.set_color_by_tex_to_color_map({"$\\forall \epsilon>0$":BLUE,"$\exists k$":YELLOW}) - explanation4=TextMobject("$\left| { f\left( \\frac { 1 }{ 2 } \\right) }_{ k }-\\frac { 4 }{ 5 } \\right| <$","$\epsilon$") - explanation4.set_color_by_tex_to_color_map({"$\epsilon$":RED}) - explanation1.scale(0.5) - explanation3.scale(0.5) - explanation1.shift(1.8*DOWN+3.5*RIGHT) - explanation2.shift(2.4*DOWN+3.5*RIGHT) - explanation3.shift(1.8*DOWN+3.5*RIGHT) - explanation4.shift(2.4*DOWN+3.5*RIGHT) - - self.play(Write(explanation1)) - self.play(FadeIn(explanation2)) - self.wait(1) - self.play(FadeOut(explanation1),FadeOut(explanation2)) - self.play(Write(explanation3)) - self.play(Write(explanation4)) - self.wait(2) diff --git a/FSF-2020/calculus/series-and-transformations/Power Series/video5_UniformConvergence.py b/FSF-2020/calculus/series-and-transformations/Power Series/video5_UniformConvergence.py new file mode 100644 index 0000000..e9681aa --- /dev/null +++ b/FSF-2020/calculus/series-and-transformations/Power Series/video5_UniformConvergence.py @@ -0,0 +1,136 @@ +from manimlib.imports import * +import math + +class uniformlyConvergent(Scene): + def construct(self): + introText1=TextMobject("Again consider the","above","example") + introText2=TextMobject("Let","$g(x)=\\frac { 1 }{ 1+{ x }^{ 2 } }$","and","x=0.5 $\in$(-1,1)") + introText3=TextMobject("Lets analyse..","!") + introText1.scale(0.8) + introText2.scale(0.7) + introText3.scale(0.9) + introText3.shift(DOWN) + introText1.set_color_by_tex_to_color_map({"above":YELLOW}) + introText2.set_color_by_tex_to_color_map({"$g(x)=\\frac { 1 }{ 1+{ x }^{ 2 } }$":BLUE,"x=0.5 $\in$(-1,1)":YELLOW}) + introText3.set_color_by_tex_to_color_map({"!":GREEN}) + self.play(Write(introText1)) + self.wait(0.5) + self.play(FadeOut(introText1)) + self.play(Write(introText2)) + self.play(FadeIn(introText3)) + self.wait(2) + + +def gety(x,n): + ans=0 + for i in range(0,n+1): + if(i%2==0): + ans+=(math.pow(x,2*i)) + else: + ans-=(math.pow(x,2*i)) + return ans + +def makeSeries(x,points,x_each_unit,y_each_unit): + p=0 + for point in points: + y=gety(x,p) + point.shift(ORIGIN+RIGHT*x_each_unit*p+UP*y_each_unit*y) + p+=1 + +def makeLines(x,numPoints,x_each_unit,y_each_unit): + lines=[0]*numPoints + for i in range(0,numPoints-1): + y=gety(x,i) + y_next=gety(x,i+1) + lines[i]=Line(start=ORIGIN+RIGHT*x_each_unit*i+UP*y_each_unit*y,end=ORIGIN+RIGHT*x_each_unit*(i+1)+UP*y_each_unit*y_next,color=RED) + return lines + +class graphScene(GraphScene,MovingCameraScene): + CONFIG = { + "x_min": -6, + "x_max": 6, + "y_min": -5, + "y_max": 5, + "graph_origin": ORIGIN, + "function_color": RED, + "axes_color": GREEN, + "x_axis_label": "$k$", + "y_axis_label": "$f(\\frac{1}{2})_k$", + "exclude_zero_label": True, + "x_axis_width":7, + "y_axis_height":7 + } + + 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) + sequence=TextMobject("$1$ , $1-(0.5)^2$ , $1-(0.5)^2+(0.5)^4..$") + sequence.set_color(RED) + sequence.scale(0.35) + sequence.to_edge(UP+RIGHT) + formula=TextMobject("$f(x)_{ k }=\sum _{ i=0 }^{ k }{ (-1)^{ i }(x)^{ 2i } } $") + formula.set_color(PURPLE_C) + formula.scale(0.4) + formula.shift(5.3*RIGHT+3*UP) + fLine=Line(start=ORIGIN+x_each_unit*6*LEFT,end=ORIGIN+x_each_unit*6*RIGHT) + fLine.shift(ORIGIN+(4/5)*y_each_unit*UP) + fLineText=TextMobject("$g(0.5)=\\frac { 4 }{ 5 } $") + fLineText.set_color(RED) + fLineText.scale(0.3) + fLineText.shift(UP*1.2*y_each_unit+RIGHT*x_each_unit+4*LEFT) + points=[Dot(radius=0.03,color=BLUE) for i in range(0,6)] + makeSeries(0.5,points,x_each_unit,y_each_unit) + lines=makeLines(0.5,6,x_each_unit,y_each_unit) + + + self.add(sequence) + self.add(formula) + self.setup_axes(animate=True) + self.play(Write(fLine)) + self.add(fLineText) + for p in points: + self.add(p) + for p in range(0,5): + self.play(Write(lines[p])) + self.wait(0.5) + self.camera_frame.save_state() + self.camera_frame.set_width(0.6) + self.play(self.camera_frame.move_to, points[0]) + self.wait(0.4) + self.play(self.camera_frame.move_to, points[1]) + self.wait(0.4) + self.play(self.camera_frame.move_to, points[2]) + self.wait(0.3) + self.play(self.camera_frame.move_to, points[3]) + self.wait(1) + self.play(self.camera_frame.move_to,ORIGIN) + self.camera_frame.set_width(14) + self.wait(1) + + explanation1=TextMobject("Since the series","converges","to") + explanation1.set_color_by_tex_to_color_map({"converges":YELLOW}) + explanation2=TextMobject("$\\frac {4}{5}$") + explanation2.set_color(BLUE) + explanation3=TextMobject("Hence","$\\forall \epsilon>0$,","$\exists k$","such that,") + explanation3.set_color_by_tex_to_color_map({"$\\forall \epsilon>0$":BLUE,"$\exists k$":YELLOW}) + explanation4=TextMobject("$\left| { f\left( \\frac { 1 }{ 2 } \\right) }_{ k }-\\frac { 4 }{ 5 } \\right| <$","$\epsilon$") + explanation4.set_color_by_tex_to_color_map({"$\epsilon$":RED}) + explanation1.scale(0.5) + explanation3.scale(0.5) + explanation1.shift(1.8*DOWN+3.5*RIGHT) + explanation2.shift(2.4*DOWN+3.5*RIGHT) + explanation3.shift(1.8*DOWN+3.5*RIGHT) + explanation4.shift(2.4*DOWN+3.5*RIGHT) + + self.play(Write(explanation1)) + self.play(FadeIn(explanation2)) + self.wait(1) + self.play(FadeOut(explanation1),FadeOut(explanation2)) + self.play(Write(explanation3)) + self.play(Write(explanation4)) + self.wait(2) -- cgit From 90171632dcfdeadb90c680c94d1a9cb803837d91 Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 14:35:48 +0530 Subject: Add files via upload --- .../Power Series/gifs/file1_pieChart.gif | Bin 0 -> 347111 bytes .../gifs/file4_radius_and_intervalOfConvergence.gif | Bin 0 -> 213252 bytes .../Power Series/gifs/file5_UniformConvergence.gif | Bin 0 -> 276475 bytes 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus/series-and-transformations/Power Series/gifs/file1_pieChart.gif create mode 100644 FSF-2020/calculus/series-and-transformations/Power Series/gifs/file4_radius_and_intervalOfConvergence.gif create mode 100644 FSF-2020/calculus/series-and-transformations/Power Series/gifs/file5_UniformConvergence.gif (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Power Series/gifs/file1_pieChart.gif b/FSF-2020/calculus/series-and-transformations/Power Series/gifs/file1_pieChart.gif new file mode 100644 index 0000000..f102f6d Binary files /dev/null and b/FSF-2020/calculus/series-and-transformations/Power Series/gifs/file1_pieChart.gif differ diff --git a/FSF-2020/calculus/series-and-transformations/Power Series/gifs/file4_radius_and_intervalOfConvergence.gif b/FSF-2020/calculus/series-and-transformations/Power Series/gifs/file4_radius_and_intervalOfConvergence.gif new file mode 100644 index 0000000..e8dbff4 Binary files /dev/null and b/FSF-2020/calculus/series-and-transformations/Power Series/gifs/file4_radius_and_intervalOfConvergence.gif differ diff --git a/FSF-2020/calculus/series-and-transformations/Power Series/gifs/file5_UniformConvergence.gif b/FSF-2020/calculus/series-and-transformations/Power Series/gifs/file5_UniformConvergence.gif new file mode 100644 index 0000000..44cd78b Binary files /dev/null and b/FSF-2020/calculus/series-and-transformations/Power Series/gifs/file5_UniformConvergence.gif differ -- cgit From 7b27056aa7977bdb5cd1d1a20721c5536c59b5e7 Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 14:40:50 +0530 Subject: added gifs --- .../series-and-transformations/Power Series/README.md | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'FSF-2020/calculus/series-and-transformations') 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 acf07b7..85c6fc4 100644 --- a/FSF-2020/calculus/series-and-transformations/Power Series/README.md +++ b/FSF-2020/calculus/series-and-transformations/Power Series/README.md @@ -1,3 +1,14 @@ -![GIF1](gifs/file2_convergence_Intuition.gif) +#### PieChart +![GIF1](gifs/file1_pieChart.gif) -![GIF2](gifs/file3_convergence_of_a_function.gif) +#### Convergence Intuition +![GIF2](gifs/file2_convergence_Intuition.gif) + +#### Convergence of a function +![GIF3](gifs/file3_convergence_of_a_function.gif) + +#### Radius and IntervalOfConvergence +![GIF4](gifs/file4_radius_and_intervalOfConvergence.gif) + +#### Uniform Convergence +![GIF5](gifs/file5_UniformConvergence.gif) -- cgit From cea91d6c736439885819a4d44f62221a591d77b7 Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 14:42:48 +0530 Subject: updated question set --- .../Taylor Series/TaylorSeriesQuestions.pdf | Bin 119804 -> 125254 bytes 1 file changed, 0 insertions(+), 0 deletions(-) (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Taylor Series/TaylorSeriesQuestions.pdf b/FSF-2020/calculus/series-and-transformations/Taylor Series/TaylorSeriesQuestions.pdf index 2096f52..46d46e1 100644 Binary files a/FSF-2020/calculus/series-and-transformations/Taylor Series/TaylorSeriesQuestions.pdf and b/FSF-2020/calculus/series-and-transformations/Taylor Series/TaylorSeriesQuestions.pdf differ -- cgit From 9b2de268f4be489a4a67c89be1b17d08ed76c25e Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 14:43:17 +0530 Subject: added gifs --- .../gifs/file1_Example_TaylorExpansion.gif | Bin 0 -> 446111 bytes .../gifs/file2_TaylorExpansionGeneralForm.gif | Bin 0 -> 308980 bytes .../Taylor Series/gifs/file3_radiusOfConvergence.gif | Bin 0 -> 391510 bytes .../Taylor Series/gifs/file4_DivergentRemainder.gif | Bin 0 -> 160149 bytes 4 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file1_Example_TaylorExpansion.gif create mode 100644 FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file2_TaylorExpansionGeneralForm.gif create mode 100644 FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file3_radiusOfConvergence.gif create mode 100644 FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file4_DivergentRemainder.gif (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file1_Example_TaylorExpansion.gif b/FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file1_Example_TaylorExpansion.gif new file mode 100644 index 0000000..ecd3272 Binary files /dev/null and b/FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file1_Example_TaylorExpansion.gif differ 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 new file mode 100644 index 0000000..e6d9171 Binary files /dev/null and b/FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file2_TaylorExpansionGeneralForm.gif differ diff --git a/FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file3_radiusOfConvergence.gif b/FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file3_radiusOfConvergence.gif new file mode 100644 index 0000000..6b22d8d Binary files /dev/null and b/FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file3_radiusOfConvergence.gif differ diff --git a/FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file4_DivergentRemainder.gif b/FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file4_DivergentRemainder.gif new file mode 100644 index 0000000..2bb5185 Binary files /dev/null and b/FSF-2020/calculus/series-and-transformations/Taylor Series/gifs/file4_DivergentRemainder.gif differ -- cgit From b1bdfc21dfac1abf82fb10733eb21d098f9532b4 Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 14:43:50 +0530 Subject: Rename script1.py to video1_Example_TaylorExpansion.py.py --- .../Taylor Series/script1.py | 198 --------------------- .../video1_Example_TaylorExpansion.py.py | 198 +++++++++++++++++++++ 2 files changed, 198 insertions(+), 198 deletions(-) delete mode 100644 FSF-2020/calculus/series-and-transformations/Taylor Series/script1.py create mode 100644 FSF-2020/calculus/series-and-transformations/Taylor Series/video1_Example_TaylorExpansion.py.py (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Taylor Series/script1.py b/FSF-2020/calculus/series-and-transformations/Taylor Series/script1.py deleted file mode 100644 index e83eff8..0000000 --- a/FSF-2020/calculus/series-and-transformations/Taylor Series/script1.py +++ /dev/null @@ -1,198 +0,0 @@ -from manimlib.imports import* -import math - -def formFormula(coeff_list,variable_list): - coeff_list=[TextMobject("${ a }_{ 0 }$"),TextMobject("${ a }_{ 1 }$"),TextMobject("${ a }_{ 2 }$")] - variable_list=[TextMobject("+"),TextMobject("${ x }$+"),TextMobject("${ x }^{ 2 }$")] - coeff_list[0].shift(2.2*UP+1.6*LEFT) - for i in range(0,3): - coeff_list[i].set_color(GOLD_A) - variable_list[i].next_to(coeff_list[i],buff=0.1) - if i!=2: - coeff_list[i+1].next_to(variable_list[i],buff=0.1) - dots=TextMobject("...") - dots.next_to(variable_list[2]) - expansion=VGroup(coeff_list[0],coeff_list[1],coeff_list[2],variable_list[0],variable_list[1],variable_list[2],dots) - #expansion.scale(0.7) - return expansion,coeff_list - -class intro(Scene): - def construct(self): - equation=TextMobject("$f(x)=$","${ e }^{ -x^{ 2 } }$") - equation.scale(2) - equation.set_color_by_tex_to_color_map({"${ e }^{ -x^{ 2 } }$":RED}) - text=TextMobject("let $a=0$") - text.scale(0.7) - text.shift(DOWN) - - self.play(Write(equation)) - self.wait(0.5) - self.play(FadeIn(text)) - self.wait(0.7) - self.play(FadeOut(equation),FadeOut(text)) - -class graphScene(GraphScene): - CONFIG = { - "x_min": -8, - "x_max": 8, - "y_min": -8, - "y_max": 8, - "graph_origin": ORIGIN, - "function_color": RED, - "axes_color": GREEN, - "x_axis_label": "$x$", - "y_axis_label": "$y$", - "exclude_zero_label": True, - "x_labeled_nums": range(-8, 8, 1), - } - 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) - - generalized_eq_coeff=[] - variables_eq=[] - eq,generalized_eq_coeff=formFormula(generalized_eq_coeff,variables_eq) - trText1=TextMobject("let $T_{ n }(x)$:=") - eq.next_to(trText1) - trTextGrup=VGroup(trText1,eq) - trTextGrup.scale(0.5) - trTextGrup.to_corner(UP+RIGHT) - self.play(Write(trTextGrup)) - self.setup_axes(animate=True) - - fx=TextMobject("${ e }^{ -x^{ 2 } }$") - fx.scale(0.5) - fx.shift(ORIGIN+x_each_unit*7.5*RIGHT+y_each_unit*0.5*UP) - mainfunction=self.get_graph(lambda x:math.exp(-1*pow(x,2)),color=RED,x_min=-8,x_max=8) - self.play(ShowCreation(mainfunction)) - self.play(FadeIn(fx)) - self.wait(1.4) - - coeff=[TextMobject("$1$"),TextMobject("$f'(x)$"),TextMobject("$\\frac { f''(x) }{ 2! } $")] - coeff[0].shift(3.39*UP+4.88*RIGHT) - coeff[0].scale(0.5) - coeff[1].shift(3.39*UP+5.3*RIGHT) - coeff[1].scale(0.275) - coeff[2].shift(3.39*UP+5.98*RIGHT) - coeff[2].scale(0.28) - - for obj in coeff: - obj.set_color(GOLD_A) - - firstApprox=[self.get_graph(lambda x:1,color=BLUE)] - secondApprox=[self.get_graph(lambda x:1,color=BLUE), - self.get_graph(lambda x:x+1,color=BLUE), - self.get_graph(lambda x:-x+1,color=BLUE)] - thirdApprox=[self.get_graph(lambda x:1-2*math.pow(x,2),color=BLUE), - self.get_graph(lambda x:1-0.1*math.pow(x,2),color=BLUE), - self.get_graph(lambda x:1,color=BLUE), - self.get_graph(lambda x:1+0.1*math.pow(x,2),color=BLUE), - self.get_graph(lambda x:1+math.pow(x,2),color=BLUE)] - - firstGraph=self.get_graph(lambda x:1,color=BLUE) - secondGraph=self.get_graph(lambda x:1-math.pow(x,2),color=BLUE) - - bottomText1=TextMobject("The polynomial should","satisfy","the function at $x=0$") - bottomText2=TextMobject("This gives","$a_{ 0 }=1$") - bottomText3=TextMobject("Now it could be of","any slope!") - #show graphs of second approx - bottomText4=TextMobject("Hence the","slopes","should","even match") - #final graph - bottomText5=TextMobject("This gives","$a_{ 1 }=0$") - bottomText6=TextMobject("Since the rate of change of this slope","could vary") - #show third approx graphs - bottomText7=TextMobject("Hence the","rate of change of these slopes","should also be","same!") - #final graph - bottomText8=TextMobject("This gives","$a_{ 2 }=-1$") - - bottomText1.set_color_by_tex_to_color_map({"satisfy":YELLOW}) - bottomText2.set_color_by_tex_to_color_map({"$a_{ 0 }=1$":BLUE}) - bottomText3.set_color_by_tex_to_color_map({"any slope!":YELLOW}) - bottomText4.set_color_by_tex_to_color_map({"slopes":BLUE,"even match":YELLOW}) - bottomText5.set_color_by_tex_to_color_map({"$a_{ 1 }=0$":BLUE}) - bottomText6.set_color_by_tex_to_color_map({"could vary":YELLOW}) - bottomText7.set_color_by_tex_to_color_map({"rate of change of these slopes":BLUE,"same!":YELLOW}) - bottomText8.set_color_by_tex_to_color_map({"$a_{ 2 }=-1$":BLUE}) - - bottomText1.scale(0.4) - bottomText2.scale(0.5) - bottomText3.scale(0.4) - bottomText4.scale(0.4) - bottomText5.scale(0.5) - bottomText6.scale(0.4) - bottomText7.scale(0.4) - 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) - - self.play(Write(bottomText1)) - self.wait(1) - self.play(ShowCreation(firstApprox[0]),ReplacementTransform(bottomText1,bottomText2)) - #change coeff in tn(x) - self.play(ReplacementTransform(generalized_eq_coeff[0],coeff[0])) - self.wait(1.5) - self.play(ReplacementTransform(bottomText2,bottomText3)) - self.wait(0.5) - self.play(ReplacementTransform(firstApprox[0],secondApprox[1])) - self.wait(0.5) - self.play(ReplacementTransform(secondApprox[1],secondApprox[0])) - self.wait(0.5) - self.play(ReplacementTransform(secondApprox[0],secondApprox[2])) - self.wait(1) - self.play(ReplacementTransform(bottomText3,bottomText4),FadeOut(secondApprox[2])) - self.wait(1) - self.play(Write(firstGraph),ReplacementTransform(bottomText4,bottomText5)) - #change a1 coeff - self.play(ReplacementTransform(generalized_eq_coeff[1],coeff[1])) - self.wait(1.5) - self.play(ReplacementTransform(bottomText5,bottomText6)) - self.play(ReplacementTransform(firstGraph,thirdApprox[0])) - self.wait(0.6) - self.play(ReplacementTransform(thirdApprox[0],thirdApprox[1])) - self.wait(0.6) - self.play(ReplacementTransform(thirdApprox[1],thirdApprox[2])) - self.wait(0.6) - self.play(ReplacementTransform(thirdApprox[2],thirdApprox[3])) - self.wait(0.6) - self.play(ReplacementTransform(thirdApprox[3],thirdApprox[4])) - self.wait(1.5) - self.play(ReplacementTransform(bottomText6,bottomText7)) - self.wait(1.5) - self.play(ReplacementTransform(bottomText7,bottomText8),ReplacementTransform(thirdApprox[4],secondGraph)) - self.play(ReplacementTransform(generalized_eq_coeff[2],coeff[2])) - self.wait(2) - - textFinal=TextMobject("And so on..!") - textFinal.scale(0.7) - textFinal.shift(4.5*RIGHT+2.5*DOWN) - self.play(ReplacementTransform(bottomText8,textFinal)) - self.wait(2.5) - - finalFormula=TextMobject("Hence","$T_{ n }(x)$","=","$f(0)+f'(0)x+\\frac { f''(0) }{ 2! }x^2+..+\\frac { { f }^{ n }(0) }{ n! } { x }^{ n }$") - finalFormula.scale(0.8) - finalFormula.set_color_by_tex_to_color_map({"$T_{ n }(x)$":GREEN,"$f(0)+f'(0)x+\\frac { f''(0) }{ 2! }x^2+..+\\frac { { f }^{ n }(0) }{ n! } { x }^{ n }$":RED}) - - self.play(FadeOut(self.axes),FadeOut(textFinal),FadeOut(secondGraph),FadeOut(trTextGrup),FadeOut(mainfunction),FadeOut(fx),FadeOut(coeff[0]),FadeOut(coeff[1]),FadeOut(coeff[2])) - self.play(Write(finalFormula)) - self.wait(2) - # self.play(ReplacementTransform(secondApprox[2],secondApprox[3])) - # self.wait(0.5) - # self.play(ReplacementTransform(secondApprox[3],secondApprox[4])) - # self.wait(0.5) - # self.play(ReplacementTransform(secondApprox[4],secondApprox[5])) - # self.wait(0.5) - # self.play(ReplacementTransform(secondApprox[0],secondApprox[0])) - # self.wait(0.5) - # self.play(ReplacementTransform(secondApprox[0],secondApprox[0])) - # self.wait(0.5) - - - - diff --git a/FSF-2020/calculus/series-and-transformations/Taylor Series/video1_Example_TaylorExpansion.py.py b/FSF-2020/calculus/series-and-transformations/Taylor Series/video1_Example_TaylorExpansion.py.py new file mode 100644 index 0000000..e83eff8 --- /dev/null +++ b/FSF-2020/calculus/series-and-transformations/Taylor Series/video1_Example_TaylorExpansion.py.py @@ -0,0 +1,198 @@ +from manimlib.imports import* +import math + +def formFormula(coeff_list,variable_list): + coeff_list=[TextMobject("${ a }_{ 0 }$"),TextMobject("${ a }_{ 1 }$"),TextMobject("${ a }_{ 2 }$")] + variable_list=[TextMobject("+"),TextMobject("${ x }$+"),TextMobject("${ x }^{ 2 }$")] + coeff_list[0].shift(2.2*UP+1.6*LEFT) + for i in range(0,3): + coeff_list[i].set_color(GOLD_A) + variable_list[i].next_to(coeff_list[i],buff=0.1) + if i!=2: + coeff_list[i+1].next_to(variable_list[i],buff=0.1) + dots=TextMobject("...") + dots.next_to(variable_list[2]) + expansion=VGroup(coeff_list[0],coeff_list[1],coeff_list[2],variable_list[0],variable_list[1],variable_list[2],dots) + #expansion.scale(0.7) + return expansion,coeff_list + +class intro(Scene): + def construct(self): + equation=TextMobject("$f(x)=$","${ e }^{ -x^{ 2 } }$") + equation.scale(2) + equation.set_color_by_tex_to_color_map({"${ e }^{ -x^{ 2 } }$":RED}) + text=TextMobject("let $a=0$") + text.scale(0.7) + text.shift(DOWN) + + self.play(Write(equation)) + self.wait(0.5) + self.play(FadeIn(text)) + self.wait(0.7) + self.play(FadeOut(equation),FadeOut(text)) + +class graphScene(GraphScene): + CONFIG = { + "x_min": -8, + "x_max": 8, + "y_min": -8, + "y_max": 8, + "graph_origin": ORIGIN, + "function_color": RED, + "axes_color": GREEN, + "x_axis_label": "$x$", + "y_axis_label": "$y$", + "exclude_zero_label": True, + "x_labeled_nums": range(-8, 8, 1), + } + 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) + + generalized_eq_coeff=[] + variables_eq=[] + eq,generalized_eq_coeff=formFormula(generalized_eq_coeff,variables_eq) + trText1=TextMobject("let $T_{ n }(x)$:=") + eq.next_to(trText1) + trTextGrup=VGroup(trText1,eq) + trTextGrup.scale(0.5) + trTextGrup.to_corner(UP+RIGHT) + self.play(Write(trTextGrup)) + self.setup_axes(animate=True) + + fx=TextMobject("${ e }^{ -x^{ 2 } }$") + fx.scale(0.5) + fx.shift(ORIGIN+x_each_unit*7.5*RIGHT+y_each_unit*0.5*UP) + mainfunction=self.get_graph(lambda x:math.exp(-1*pow(x,2)),color=RED,x_min=-8,x_max=8) + self.play(ShowCreation(mainfunction)) + self.play(FadeIn(fx)) + self.wait(1.4) + + coeff=[TextMobject("$1$"),TextMobject("$f'(x)$"),TextMobject("$\\frac { f''(x) }{ 2! } $")] + coeff[0].shift(3.39*UP+4.88*RIGHT) + coeff[0].scale(0.5) + coeff[1].shift(3.39*UP+5.3*RIGHT) + coeff[1].scale(0.275) + coeff[2].shift(3.39*UP+5.98*RIGHT) + coeff[2].scale(0.28) + + for obj in coeff: + obj.set_color(GOLD_A) + + firstApprox=[self.get_graph(lambda x:1,color=BLUE)] + secondApprox=[self.get_graph(lambda x:1,color=BLUE), + self.get_graph(lambda x:x+1,color=BLUE), + self.get_graph(lambda x:-x+1,color=BLUE)] + thirdApprox=[self.get_graph(lambda x:1-2*math.pow(x,2),color=BLUE), + self.get_graph(lambda x:1-0.1*math.pow(x,2),color=BLUE), + self.get_graph(lambda x:1,color=BLUE), + self.get_graph(lambda x:1+0.1*math.pow(x,2),color=BLUE), + self.get_graph(lambda x:1+math.pow(x,2),color=BLUE)] + + firstGraph=self.get_graph(lambda x:1,color=BLUE) + secondGraph=self.get_graph(lambda x:1-math.pow(x,2),color=BLUE) + + bottomText1=TextMobject("The polynomial should","satisfy","the function at $x=0$") + bottomText2=TextMobject("This gives","$a_{ 0 }=1$") + bottomText3=TextMobject("Now it could be of","any slope!") + #show graphs of second approx + bottomText4=TextMobject("Hence the","slopes","should","even match") + #final graph + bottomText5=TextMobject("This gives","$a_{ 1 }=0$") + bottomText6=TextMobject("Since the rate of change of this slope","could vary") + #show third approx graphs + bottomText7=TextMobject("Hence the","rate of change of these slopes","should also be","same!") + #final graph + bottomText8=TextMobject("This gives","$a_{ 2 }=-1$") + + bottomText1.set_color_by_tex_to_color_map({"satisfy":YELLOW}) + bottomText2.set_color_by_tex_to_color_map({"$a_{ 0 }=1$":BLUE}) + bottomText3.set_color_by_tex_to_color_map({"any slope!":YELLOW}) + bottomText4.set_color_by_tex_to_color_map({"slopes":BLUE,"even match":YELLOW}) + bottomText5.set_color_by_tex_to_color_map({"$a_{ 1 }=0$":BLUE}) + bottomText6.set_color_by_tex_to_color_map({"could vary":YELLOW}) + bottomText7.set_color_by_tex_to_color_map({"rate of change of these slopes":BLUE,"same!":YELLOW}) + bottomText8.set_color_by_tex_to_color_map({"$a_{ 2 }=-1$":BLUE}) + + bottomText1.scale(0.4) + bottomText2.scale(0.5) + bottomText3.scale(0.4) + bottomText4.scale(0.4) + bottomText5.scale(0.5) + bottomText6.scale(0.4) + bottomText7.scale(0.4) + 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) + + self.play(Write(bottomText1)) + self.wait(1) + self.play(ShowCreation(firstApprox[0]),ReplacementTransform(bottomText1,bottomText2)) + #change coeff in tn(x) + self.play(ReplacementTransform(generalized_eq_coeff[0],coeff[0])) + self.wait(1.5) + self.play(ReplacementTransform(bottomText2,bottomText3)) + self.wait(0.5) + self.play(ReplacementTransform(firstApprox[0],secondApprox[1])) + self.wait(0.5) + self.play(ReplacementTransform(secondApprox[1],secondApprox[0])) + self.wait(0.5) + self.play(ReplacementTransform(secondApprox[0],secondApprox[2])) + self.wait(1) + self.play(ReplacementTransform(bottomText3,bottomText4),FadeOut(secondApprox[2])) + self.wait(1) + self.play(Write(firstGraph),ReplacementTransform(bottomText4,bottomText5)) + #change a1 coeff + self.play(ReplacementTransform(generalized_eq_coeff[1],coeff[1])) + self.wait(1.5) + self.play(ReplacementTransform(bottomText5,bottomText6)) + self.play(ReplacementTransform(firstGraph,thirdApprox[0])) + self.wait(0.6) + self.play(ReplacementTransform(thirdApprox[0],thirdApprox[1])) + self.wait(0.6) + self.play(ReplacementTransform(thirdApprox[1],thirdApprox[2])) + self.wait(0.6) + self.play(ReplacementTransform(thirdApprox[2],thirdApprox[3])) + self.wait(0.6) + self.play(ReplacementTransform(thirdApprox[3],thirdApprox[4])) + self.wait(1.5) + self.play(ReplacementTransform(bottomText6,bottomText7)) + self.wait(1.5) + self.play(ReplacementTransform(bottomText7,bottomText8),ReplacementTransform(thirdApprox[4],secondGraph)) + self.play(ReplacementTransform(generalized_eq_coeff[2],coeff[2])) + self.wait(2) + + textFinal=TextMobject("And so on..!") + textFinal.scale(0.7) + textFinal.shift(4.5*RIGHT+2.5*DOWN) + self.play(ReplacementTransform(bottomText8,textFinal)) + self.wait(2.5) + + finalFormula=TextMobject("Hence","$T_{ n }(x)$","=","$f(0)+f'(0)x+\\frac { f''(0) }{ 2! }x^2+..+\\frac { { f }^{ n }(0) }{ n! } { x }^{ n }$") + finalFormula.scale(0.8) + finalFormula.set_color_by_tex_to_color_map({"$T_{ n }(x)$":GREEN,"$f(0)+f'(0)x+\\frac { f''(0) }{ 2! }x^2+..+\\frac { { f }^{ n }(0) }{ n! } { x }^{ n }$":RED}) + + self.play(FadeOut(self.axes),FadeOut(textFinal),FadeOut(secondGraph),FadeOut(trTextGrup),FadeOut(mainfunction),FadeOut(fx),FadeOut(coeff[0]),FadeOut(coeff[1]),FadeOut(coeff[2])) + self.play(Write(finalFormula)) + self.wait(2) + # self.play(ReplacementTransform(secondApprox[2],secondApprox[3])) + # self.wait(0.5) + # self.play(ReplacementTransform(secondApprox[3],secondApprox[4])) + # self.wait(0.5) + # self.play(ReplacementTransform(secondApprox[4],secondApprox[5])) + # self.wait(0.5) + # self.play(ReplacementTransform(secondApprox[0],secondApprox[0])) + # self.wait(0.5) + # self.play(ReplacementTransform(secondApprox[0],secondApprox[0])) + # self.wait(0.5) + + + + -- cgit From 87e674818b1035402d3b5dd3a2f55f1df25eb9e4 Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 14:44:22 +0530 Subject: Rename script2.py to video2_TaylorExpansionGeneralForm.py.py --- .../Taylor Series/script2.py | 195 --------------------- .../video2_TaylorExpansionGeneralForm.py.py | 195 +++++++++++++++++++++ 2 files changed, 195 insertions(+), 195 deletions(-) delete mode 100644 FSF-2020/calculus/series-and-transformations/Taylor Series/script2.py create mode 100644 FSF-2020/calculus/series-and-transformations/Taylor Series/video2_TaylorExpansionGeneralForm.py.py (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Taylor Series/script2.py b/FSF-2020/calculus/series-and-transformations/Taylor Series/script2.py deleted file mode 100644 index b5d0a53..0000000 --- a/FSF-2020/calculus/series-and-transformations/Taylor Series/script2.py +++ /dev/null @@ -1,195 +0,0 @@ -from manimlib.imports import* -import math - - -class intro(Scene): - def construct(self): - 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.scale(0.7) - text.shift(DOWN) - - shiftText=TextMobject("(Here we shift the origin to the point $x=1$)") - shiftText.scale(0.6) - shiftText.shift(2.4*DOWN) - - - self.play(Write(equation)) - self.wait(0.5) - self.play(FadeIn(text)) - self.wait(0.7) - self.play(Write(shiftText)) - self.wait(0.7) - self.play(FadeOut(equation),FadeOut(text),FadeOut(shiftText)) - - -def formFormula(coeff_list,variable_list): - coeff_list=[TextMobject("${ a }_{ 0 }$"),TextMobject("${ a }_{ 1 }$"),TextMobject("${ a }_{ 2 }$")] - variable_list=[TextMobject("+"),TextMobject("${ (x-1) }$+"),TextMobject("${ (x-1) }^{ 2 }$")] - coeff_list[0].shift(2.2*UP+1.6*LEFT) - for i in range(0,3): - coeff_list[i].set_color(GOLD_A) - variable_list[i].next_to(coeff_list[i],buff=0.1) - if i!=2: - coeff_list[i+1].next_to(variable_list[i],buff=0.1) - dots=TextMobject("...") - dots.next_to(variable_list[2]) - expansion=VGroup(coeff_list[0],coeff_list[1],coeff_list[2],variable_list[0],variable_list[1],variable_list[2],dots) - #expansion.scale(0.7) - return expansion,coeff_list - - -class graphScene(GraphScene): - CONFIG = { - "x_min": -8, - "x_max": 8, - "y_min": -8, - "y_max": 8, - "graph_origin": ORIGIN, - "function_color": RED, - "axes_color": GREEN, - "x_axis_label": "$x$", - "y_axis_label": "$y$", - "exclude_zero_label": True, - "x_labeled_nums": range(-8, 8, 1), - } - 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) - - generalized_eq_coeff=[] - variables_eq=[] - eq,generalized_eq_coeff=formFormula(generalized_eq_coeff,variables_eq) - trText1=TextMobject("let $T_{ n }(x)$:=") - eq.next_to(trText1) - trTextGrup=VGroup(trText1,eq) - trTextGrup.scale(0.5) - trTextGrup.to_corner(UP+RIGHT) - self.play(Write(trTextGrup)) - self.setup_axes(animate=True) - - fx=TextMobject("${ e }^{ -x^{ 2 } }$") - fx.scale(0.5) - fx.shift(ORIGIN+x_each_unit*7.5*RIGHT+y_each_unit*0.5*UP) - mainfunction=self.get_graph(lambda x:math.exp(-1*pow(x,2)),color=RED,x_min=-8,x_max=8) - self.play(ShowCreation(mainfunction)) - self.play(FadeIn(fx)) - 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) - - 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)] - - 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) - - bottomText1=TextMobject("Apply","$f(1)=T_{n}(1)$") - bottomText2=TextMobject("This gives","$a_{ 0 }=e^{-1}$") - bottomText3=TextMobject("Now it could be of","any slope!") - #show graphs of second approx - bottomText4=TextMobject("Hence","apply","$f'(1)=T_{n}'(1)$") - #final graph - bottomText5=TextMobject("This gives","$a_{ 1 }=-2e^{-1}$") - bottomText6=TextMobject("Since the rate of change of this slope","could vary") - #show third approx graphs - bottomText7=TextMobject("Hence also","apply","$f''(1)=T_{ n }''(1)$") - #final graph - bottomText8=TextMobject("This gives","$a_{ 2 }=e^{-1}$") - - bottomText1.set_color_by_tex_to_color_map({"Apply":YELLOW}) - bottomText2.set_color_by_tex_to_color_map({"$a_{ 0 }=e^{-1}$":BLUE}) - bottomText3.set_color_by_tex_to_color_map({"any slope!":YELLOW}) - bottomText4.set_color_by_tex_to_color_map({"apply":YELLOW}) - bottomText5.set_color_by_tex_to_color_map({"$a_{ 1 }=-2e^{-1}$":BLUE}) - bottomText6.set_color_by_tex_to_color_map({"could vary":YELLOW}) - bottomText7.set_color_by_tex_to_color_map({"apply":YELLOW}) - bottomText8.set_color_by_tex_to_color_map({"$a_{ 2 }=e^{-1}$":BLUE}) - - bottomText1.scale(0.4) - bottomText2.scale(0.5) - bottomText3.scale(0.4) - bottomText4.scale(0.4) - bottomText5.scale(0.5) - bottomText6.scale(0.4) - bottomText7.scale(0.4) - 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) - - self.play(Write(bottomText1)) - self.wait(1) - self.play(ShowCreation(firstApprox[0]),ReplacementTransform(bottomText1,bottomText2)) - #change coeff in tn(x) - self.play(ReplacementTransform(generalized_eq_coeff[0],coeff[0])) - self.wait(1.5) - self.play(ReplacementTransform(bottomText2,bottomText3)) - self.wait(0.5) - self.play(ReplacementTransform(firstApprox[0],secondApprox[1])) - self.wait(0.5) - self.play(ReplacementTransform(secondApprox[1],secondApprox[2])) - # self.wait(0.5) - # self.play(ReplacementTransform(secondApprox[2],secondApprox[0])) - self.wait(1) - self.play(ReplacementTransform(bottomText3,bottomText4),FadeOut(secondApprox[2])) - self.wait(1) - self.play(Write(secondGraph),ReplacementTransform(bottomText4,bottomText5)) - #change a1 coeff - self.play(ReplacementTransform(generalized_eq_coeff[1],coeff[1])) - self.wait(1.5) - self.play(ReplacementTransform(bottomText5,bottomText6)) - self.play(ReplacementTransform(secondGraph,thirdApprox[0])) - self.wait(0.6) - self.play(ReplacementTransform(thirdApprox[0],thirdApprox[1])) - # self.wait(0.6) - # self.play(ReplacementTransform(thirdApprox[1],thirdApprox[2])) - self.wait(0.6) - self.play(ReplacementTransform(thirdApprox[1],thirdApprox[3])) - self.wait(0.6) - self.play(ReplacementTransform(thirdApprox[3],thirdApprox[4])) - self.wait(1.5) - self.play(ReplacementTransform(bottomText6,bottomText7)) - self.wait(1.5) - self.play(ReplacementTransform(bottomText7,bottomText8),ReplacementTransform(thirdApprox[4],thirdGraph)) - self.play(ReplacementTransform(generalized_eq_coeff[2],coeff[2])) - self.wait(2) - - textFinal=TextMobject("And so on..!") - textFinal.scale(0.7) - textFinal.shift(4.5*RIGHT+2.5*DOWN) - self.play(ReplacementTransform(bottomText8,textFinal)) - self.wait(2.5) - - 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) - finalFormula.set_color_by_tex_to_color_map({"$T_{ n }(x)$":GREEN,"$f(1)+f'(1)(x-1)+\\frac { f''(1) }{ 2! }(x-1)^2+..+\\frac { { f }^{ n }(1) }{ n! } { (x-1) }^{ n }$":RED}) - - self.play(FadeOut(self.axes),FadeOut(textFinal),FadeOut(thirdGraph),FadeOut(trTextGrup),FadeOut(mainfunction),FadeOut(fx),FadeOut(coeff[0]),FadeOut(coeff[1]),FadeOut(coeff[2])) - self.play(Write(finalFormula)) - self.wait(2) \ No newline at end of file diff --git a/FSF-2020/calculus/series-and-transformations/Taylor Series/video2_TaylorExpansionGeneralForm.py.py b/FSF-2020/calculus/series-and-transformations/Taylor Series/video2_TaylorExpansionGeneralForm.py.py new file mode 100644 index 0000000..f84cfe9 --- /dev/null +++ b/FSF-2020/calculus/series-and-transformations/Taylor Series/video2_TaylorExpansionGeneralForm.py.py @@ -0,0 +1,195 @@ +from manimlib.imports import* +import math + + +class intro(Scene): + def construct(self): + 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.scale(0.7) + text.shift(DOWN) + + shiftText=TextMobject("(Here we shift the origin to the point $x=1$)") + shiftText.scale(0.6) + shiftText.shift(2.4*DOWN) + + + self.play(Write(equation)) + self.wait(0.5) + self.play(FadeIn(text)) + self.wait(0.7) + self.play(Write(shiftText)) + self.wait(0.7) + self.play(FadeOut(equation),FadeOut(text),FadeOut(shiftText)) + + +def formFormula(coeff_list,variable_list): + coeff_list=[TextMobject("${ a }_{ 0 }$"),TextMobject("${ a }_{ 1 }$"),TextMobject("${ a }_{ 2 }$")] + variable_list=[TextMobject("+"),TextMobject("${ (x-1) }$+"),TextMobject("${ (x-1) }^{ 2 }$")] + coeff_list[0].shift(2.2*UP+1.6*LEFT) + for i in range(0,3): + coeff_list[i].set_color(GOLD_A) + variable_list[i].next_to(coeff_list[i],buff=0.1) + if i!=2: + coeff_list[i+1].next_to(variable_list[i],buff=0.1) + dots=TextMobject("...") + dots.next_to(variable_list[2]) + expansion=VGroup(coeff_list[0],coeff_list[1],coeff_list[2],variable_list[0],variable_list[1],variable_list[2],dots) + #expansion.scale(0.7) + return expansion,coeff_list + + +class graphScene(GraphScene): + CONFIG = { + "x_min": -8, + "x_max": 8, + "y_min": -8, + "y_max": 8, + "graph_origin": ORIGIN, + "function_color": RED, + "axes_color": GREEN, + "x_axis_label": "$x$", + "y_axis_label": "$y$", + "exclude_zero_label": True, + "x_labeled_nums": range(-8, 8, 1), + } + 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) + + generalized_eq_coeff=[] + variables_eq=[] + eq,generalized_eq_coeff=formFormula(generalized_eq_coeff,variables_eq) + trText1=TextMobject("let $T_{ n }(x)$:=") + eq.next_to(trText1) + trTextGrup=VGroup(trText1,eq) + trTextGrup.scale(0.5) + trTextGrup.to_corner(UP+RIGHT) + self.play(Write(trTextGrup)) + self.setup_axes(animate=True) + + fx=TextMobject("${ e }^{ -x^{ 2 } }$") + fx.scale(0.5) + fx.shift(ORIGIN+x_each_unit*7.5*RIGHT+y_each_unit*0.5*UP) + mainfunction=self.get_graph(lambda x:math.exp(-1*pow(x,2)),color=RED,x_min=-8,x_max=8) + self.play(ShowCreation(mainfunction)) + self.play(FadeIn(fx)) + 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) + + 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)] + + 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) + + bottomText1=TextMobject("Apply","$f(1)=T_{n}(1)$") + bottomText2=TextMobject("This gives","$a_{ 0 }=e^{-1}$") + bottomText3=TextMobject("Now it could be of","any slope!") + #show graphs of second approx + bottomText4=TextMobject("Hence","apply","$f'(1)=T_{n}'(1)$") + #final graph + bottomText5=TextMobject("This gives","$a_{ 1 }=-2e^{-1}$") + bottomText6=TextMobject("Since the rate of change of this slope","could vary") + #show third approx graphs + bottomText7=TextMobject("Hence also","apply","$f''(1)=T_{ n }''(1)$") + #final graph + bottomText8=TextMobject("This gives","$a_{ 2 }=e^{-1}$") + + bottomText1.set_color_by_tex_to_color_map({"Apply":YELLOW}) + bottomText2.set_color_by_tex_to_color_map({"$a_{ 0 }=e^{-1}$":BLUE}) + bottomText3.set_color_by_tex_to_color_map({"any slope!":YELLOW}) + bottomText4.set_color_by_tex_to_color_map({"apply":YELLOW}) + bottomText5.set_color_by_tex_to_color_map({"$a_{ 1 }=-2e^{-1}$":BLUE}) + bottomText6.set_color_by_tex_to_color_map({"could vary":YELLOW}) + bottomText7.set_color_by_tex_to_color_map({"apply":YELLOW}) + bottomText8.set_color_by_tex_to_color_map({"$a_{ 2 }=e^{-1}$":BLUE}) + + bottomText1.scale(0.4) + bottomText2.scale(0.5) + bottomText3.scale(0.4) + bottomText4.scale(0.4) + bottomText5.scale(0.5) + bottomText6.scale(0.4) + bottomText7.scale(0.4) + 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) + + self.play(Write(bottomText1)) + self.wait(1) + self.play(ShowCreation(firstApprox[0]),ReplacementTransform(bottomText1,bottomText2)) + #change coeff in tn(x) + self.play(ReplacementTransform(generalized_eq_coeff[0],coeff[0])) + self.wait(1.5) + self.play(ReplacementTransform(bottomText2,bottomText3)) + self.wait(0.5) + self.play(ReplacementTransform(firstApprox[0],secondApprox[1])) + self.wait(0.5) + self.play(ReplacementTransform(secondApprox[1],secondApprox[2])) + # self.wait(0.5) + # self.play(ReplacementTransform(secondApprox[2],secondApprox[0])) + self.wait(1) + self.play(ReplacementTransform(bottomText3,bottomText4),FadeOut(secondApprox[2])) + self.wait(1) + self.play(Write(secondGraph),ReplacementTransform(bottomText4,bottomText5)) + #change a1 coeff + self.play(ReplacementTransform(generalized_eq_coeff[1],coeff[1])) + self.wait(1.5) + self.play(ReplacementTransform(bottomText5,bottomText6)) + self.play(ReplacementTransform(secondGraph,thirdApprox[0])) + self.wait(0.6) + self.play(ReplacementTransform(thirdApprox[0],thirdApprox[1])) + # self.wait(0.6) + # self.play(ReplacementTransform(thirdApprox[1],thirdApprox[2])) + self.wait(0.6) + self.play(ReplacementTransform(thirdApprox[1],thirdApprox[3])) + self.wait(0.6) + self.play(ReplacementTransform(thirdApprox[3],thirdApprox[4])) + self.wait(1.5) + self.play(ReplacementTransform(bottomText6,bottomText7)) + self.wait(1.5) + self.play(ReplacementTransform(bottomText7,bottomText8),ReplacementTransform(thirdApprox[4],thirdGraph)) + self.play(ReplacementTransform(generalized_eq_coeff[2],coeff[2])) + self.wait(2) + + textFinal=TextMobject("And so on..!") + textFinal.scale(0.7) + textFinal.shift(4.5*RIGHT+2.5*DOWN) + self.play(ReplacementTransform(bottomText8,textFinal)) + self.wait(2.5) + + 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) + finalFormula.set_color_by_tex_to_color_map({"$T_{ n }(x)$":GREEN,"$f(1)+f'(1)(x-1)+\\frac { f''(1) }{ 2! }(x-1)^2+..+\\frac { { f }^{ n }(1) }{ n! } { (x-1) }^{ n }$":RED}) + + self.play(FadeOut(self.axes),FadeOut(textFinal),FadeOut(thirdGraph),FadeOut(trTextGrup),FadeOut(mainfunction),FadeOut(fx),FadeOut(coeff[0]),FadeOut(coeff[1]),FadeOut(coeff[2])) + self.play(Write(finalFormula)) + self.wait(2) -- cgit From 1fb63bccdf7d35a6f5c277b836a2477289baa282 Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 14:44:41 +0530 Subject: Rename video1_Example_TaylorExpansion.py.py to video1_Example_TaylorExpansion.py --- .../video1_Example_TaylorExpansion.py | 198 +++++++++++++++++++++ .../video1_Example_TaylorExpansion.py.py | 198 --------------------- 2 files changed, 198 insertions(+), 198 deletions(-) create mode 100644 FSF-2020/calculus/series-and-transformations/Taylor Series/video1_Example_TaylorExpansion.py delete mode 100644 FSF-2020/calculus/series-and-transformations/Taylor Series/video1_Example_TaylorExpansion.py.py (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Taylor Series/video1_Example_TaylorExpansion.py b/FSF-2020/calculus/series-and-transformations/Taylor Series/video1_Example_TaylorExpansion.py new file mode 100644 index 0000000..e83eff8 --- /dev/null +++ b/FSF-2020/calculus/series-and-transformations/Taylor Series/video1_Example_TaylorExpansion.py @@ -0,0 +1,198 @@ +from manimlib.imports import* +import math + +def formFormula(coeff_list,variable_list): + coeff_list=[TextMobject("${ a }_{ 0 }$"),TextMobject("${ a }_{ 1 }$"),TextMobject("${ a }_{ 2 }$")] + variable_list=[TextMobject("+"),TextMobject("${ x }$+"),TextMobject("${ x }^{ 2 }$")] + coeff_list[0].shift(2.2*UP+1.6*LEFT) + for i in range(0,3): + coeff_list[i].set_color(GOLD_A) + variable_list[i].next_to(coeff_list[i],buff=0.1) + if i!=2: + coeff_list[i+1].next_to(variable_list[i],buff=0.1) + dots=TextMobject("...") + dots.next_to(variable_list[2]) + expansion=VGroup(coeff_list[0],coeff_list[1],coeff_list[2],variable_list[0],variable_list[1],variable_list[2],dots) + #expansion.scale(0.7) + return expansion,coeff_list + +class intro(Scene): + def construct(self): + equation=TextMobject("$f(x)=$","${ e }^{ -x^{ 2 } }$") + equation.scale(2) + equation.set_color_by_tex_to_color_map({"${ e }^{ -x^{ 2 } }$":RED}) + text=TextMobject("let $a=0$") + text.scale(0.7) + text.shift(DOWN) + + self.play(Write(equation)) + self.wait(0.5) + self.play(FadeIn(text)) + self.wait(0.7) + self.play(FadeOut(equation),FadeOut(text)) + +class graphScene(GraphScene): + CONFIG = { + "x_min": -8, + "x_max": 8, + "y_min": -8, + "y_max": 8, + "graph_origin": ORIGIN, + "function_color": RED, + "axes_color": GREEN, + "x_axis_label": "$x$", + "y_axis_label": "$y$", + "exclude_zero_label": True, + "x_labeled_nums": range(-8, 8, 1), + } + 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) + + generalized_eq_coeff=[] + variables_eq=[] + eq,generalized_eq_coeff=formFormula(generalized_eq_coeff,variables_eq) + trText1=TextMobject("let $T_{ n }(x)$:=") + eq.next_to(trText1) + trTextGrup=VGroup(trText1,eq) + trTextGrup.scale(0.5) + trTextGrup.to_corner(UP+RIGHT) + self.play(Write(trTextGrup)) + self.setup_axes(animate=True) + + fx=TextMobject("${ e }^{ -x^{ 2 } }$") + fx.scale(0.5) + fx.shift(ORIGIN+x_each_unit*7.5*RIGHT+y_each_unit*0.5*UP) + mainfunction=self.get_graph(lambda x:math.exp(-1*pow(x,2)),color=RED,x_min=-8,x_max=8) + self.play(ShowCreation(mainfunction)) + self.play(FadeIn(fx)) + self.wait(1.4) + + coeff=[TextMobject("$1$"),TextMobject("$f'(x)$"),TextMobject("$\\frac { f''(x) }{ 2! } $")] + coeff[0].shift(3.39*UP+4.88*RIGHT) + coeff[0].scale(0.5) + coeff[1].shift(3.39*UP+5.3*RIGHT) + coeff[1].scale(0.275) + coeff[2].shift(3.39*UP+5.98*RIGHT) + coeff[2].scale(0.28) + + for obj in coeff: + obj.set_color(GOLD_A) + + firstApprox=[self.get_graph(lambda x:1,color=BLUE)] + secondApprox=[self.get_graph(lambda x:1,color=BLUE), + self.get_graph(lambda x:x+1,color=BLUE), + self.get_graph(lambda x:-x+1,color=BLUE)] + thirdApprox=[self.get_graph(lambda x:1-2*math.pow(x,2),color=BLUE), + self.get_graph(lambda x:1-0.1*math.pow(x,2),color=BLUE), + self.get_graph(lambda x:1,color=BLUE), + self.get_graph(lambda x:1+0.1*math.pow(x,2),color=BLUE), + self.get_graph(lambda x:1+math.pow(x,2),color=BLUE)] + + firstGraph=self.get_graph(lambda x:1,color=BLUE) + secondGraph=self.get_graph(lambda x:1-math.pow(x,2),color=BLUE) + + bottomText1=TextMobject("The polynomial should","satisfy","the function at $x=0$") + bottomText2=TextMobject("This gives","$a_{ 0 }=1$") + bottomText3=TextMobject("Now it could be of","any slope!") + #show graphs of second approx + bottomText4=TextMobject("Hence the","slopes","should","even match") + #final graph + bottomText5=TextMobject("This gives","$a_{ 1 }=0$") + bottomText6=TextMobject("Since the rate of change of this slope","could vary") + #show third approx graphs + bottomText7=TextMobject("Hence the","rate of change of these slopes","should also be","same!") + #final graph + bottomText8=TextMobject("This gives","$a_{ 2 }=-1$") + + bottomText1.set_color_by_tex_to_color_map({"satisfy":YELLOW}) + bottomText2.set_color_by_tex_to_color_map({"$a_{ 0 }=1$":BLUE}) + bottomText3.set_color_by_tex_to_color_map({"any slope!":YELLOW}) + bottomText4.set_color_by_tex_to_color_map({"slopes":BLUE,"even match":YELLOW}) + bottomText5.set_color_by_tex_to_color_map({"$a_{ 1 }=0$":BLUE}) + bottomText6.set_color_by_tex_to_color_map({"could vary":YELLOW}) + bottomText7.set_color_by_tex_to_color_map({"rate of change of these slopes":BLUE,"same!":YELLOW}) + bottomText8.set_color_by_tex_to_color_map({"$a_{ 2 }=-1$":BLUE}) + + bottomText1.scale(0.4) + bottomText2.scale(0.5) + bottomText3.scale(0.4) + bottomText4.scale(0.4) + bottomText5.scale(0.5) + bottomText6.scale(0.4) + bottomText7.scale(0.4) + 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) + + self.play(Write(bottomText1)) + self.wait(1) + self.play(ShowCreation(firstApprox[0]),ReplacementTransform(bottomText1,bottomText2)) + #change coeff in tn(x) + self.play(ReplacementTransform(generalized_eq_coeff[0],coeff[0])) + self.wait(1.5) + self.play(ReplacementTransform(bottomText2,bottomText3)) + self.wait(0.5) + self.play(ReplacementTransform(firstApprox[0],secondApprox[1])) + self.wait(0.5) + self.play(ReplacementTransform(secondApprox[1],secondApprox[0])) + self.wait(0.5) + self.play(ReplacementTransform(secondApprox[0],secondApprox[2])) + self.wait(1) + self.play(ReplacementTransform(bottomText3,bottomText4),FadeOut(secondApprox[2])) + self.wait(1) + self.play(Write(firstGraph),ReplacementTransform(bottomText4,bottomText5)) + #change a1 coeff + self.play(ReplacementTransform(generalized_eq_coeff[1],coeff[1])) + self.wait(1.5) + self.play(ReplacementTransform(bottomText5,bottomText6)) + self.play(ReplacementTransform(firstGraph,thirdApprox[0])) + self.wait(0.6) + self.play(ReplacementTransform(thirdApprox[0],thirdApprox[1])) + self.wait(0.6) + self.play(ReplacementTransform(thirdApprox[1],thirdApprox[2])) + self.wait(0.6) + self.play(ReplacementTransform(thirdApprox[2],thirdApprox[3])) + self.wait(0.6) + self.play(ReplacementTransform(thirdApprox[3],thirdApprox[4])) + self.wait(1.5) + self.play(ReplacementTransform(bottomText6,bottomText7)) + self.wait(1.5) + self.play(ReplacementTransform(bottomText7,bottomText8),ReplacementTransform(thirdApprox[4],secondGraph)) + self.play(ReplacementTransform(generalized_eq_coeff[2],coeff[2])) + self.wait(2) + + textFinal=TextMobject("And so on..!") + textFinal.scale(0.7) + textFinal.shift(4.5*RIGHT+2.5*DOWN) + self.play(ReplacementTransform(bottomText8,textFinal)) + self.wait(2.5) + + finalFormula=TextMobject("Hence","$T_{ n }(x)$","=","$f(0)+f'(0)x+\\frac { f''(0) }{ 2! }x^2+..+\\frac { { f }^{ n }(0) }{ n! } { x }^{ n }$") + finalFormula.scale(0.8) + finalFormula.set_color_by_tex_to_color_map({"$T_{ n }(x)$":GREEN,"$f(0)+f'(0)x+\\frac { f''(0) }{ 2! }x^2+..+\\frac { { f }^{ n }(0) }{ n! } { x }^{ n }$":RED}) + + self.play(FadeOut(self.axes),FadeOut(textFinal),FadeOut(secondGraph),FadeOut(trTextGrup),FadeOut(mainfunction),FadeOut(fx),FadeOut(coeff[0]),FadeOut(coeff[1]),FadeOut(coeff[2])) + self.play(Write(finalFormula)) + self.wait(2) + # self.play(ReplacementTransform(secondApprox[2],secondApprox[3])) + # self.wait(0.5) + # self.play(ReplacementTransform(secondApprox[3],secondApprox[4])) + # self.wait(0.5) + # self.play(ReplacementTransform(secondApprox[4],secondApprox[5])) + # self.wait(0.5) + # self.play(ReplacementTransform(secondApprox[0],secondApprox[0])) + # self.wait(0.5) + # self.play(ReplacementTransform(secondApprox[0],secondApprox[0])) + # self.wait(0.5) + + + + diff --git a/FSF-2020/calculus/series-and-transformations/Taylor Series/video1_Example_TaylorExpansion.py.py b/FSF-2020/calculus/series-and-transformations/Taylor Series/video1_Example_TaylorExpansion.py.py deleted file mode 100644 index e83eff8..0000000 --- a/FSF-2020/calculus/series-and-transformations/Taylor Series/video1_Example_TaylorExpansion.py.py +++ /dev/null @@ -1,198 +0,0 @@ -from manimlib.imports import* -import math - -def formFormula(coeff_list,variable_list): - coeff_list=[TextMobject("${ a }_{ 0 }$"),TextMobject("${ a }_{ 1 }$"),TextMobject("${ a }_{ 2 }$")] - variable_list=[TextMobject("+"),TextMobject("${ x }$+"),TextMobject("${ x }^{ 2 }$")] - coeff_list[0].shift(2.2*UP+1.6*LEFT) - for i in range(0,3): - coeff_list[i].set_color(GOLD_A) - variable_list[i].next_to(coeff_list[i],buff=0.1) - if i!=2: - coeff_list[i+1].next_to(variable_list[i],buff=0.1) - dots=TextMobject("...") - dots.next_to(variable_list[2]) - expansion=VGroup(coeff_list[0],coeff_list[1],coeff_list[2],variable_list[0],variable_list[1],variable_list[2],dots) - #expansion.scale(0.7) - return expansion,coeff_list - -class intro(Scene): - def construct(self): - equation=TextMobject("$f(x)=$","${ e }^{ -x^{ 2 } }$") - equation.scale(2) - equation.set_color_by_tex_to_color_map({"${ e }^{ -x^{ 2 } }$":RED}) - text=TextMobject("let $a=0$") - text.scale(0.7) - text.shift(DOWN) - - self.play(Write(equation)) - self.wait(0.5) - self.play(FadeIn(text)) - self.wait(0.7) - self.play(FadeOut(equation),FadeOut(text)) - -class graphScene(GraphScene): - CONFIG = { - "x_min": -8, - "x_max": 8, - "y_min": -8, - "y_max": 8, - "graph_origin": ORIGIN, - "function_color": RED, - "axes_color": GREEN, - "x_axis_label": "$x$", - "y_axis_label": "$y$", - "exclude_zero_label": True, - "x_labeled_nums": range(-8, 8, 1), - } - 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) - - generalized_eq_coeff=[] - variables_eq=[] - eq,generalized_eq_coeff=formFormula(generalized_eq_coeff,variables_eq) - trText1=TextMobject("let $T_{ n }(x)$:=") - eq.next_to(trText1) - trTextGrup=VGroup(trText1,eq) - trTextGrup.scale(0.5) - trTextGrup.to_corner(UP+RIGHT) - self.play(Write(trTextGrup)) - self.setup_axes(animate=True) - - fx=TextMobject("${ e }^{ -x^{ 2 } }$") - fx.scale(0.5) - fx.shift(ORIGIN+x_each_unit*7.5*RIGHT+y_each_unit*0.5*UP) - mainfunction=self.get_graph(lambda x:math.exp(-1*pow(x,2)),color=RED,x_min=-8,x_max=8) - self.play(ShowCreation(mainfunction)) - self.play(FadeIn(fx)) - self.wait(1.4) - - coeff=[TextMobject("$1$"),TextMobject("$f'(x)$"),TextMobject("$\\frac { f''(x) }{ 2! } $")] - coeff[0].shift(3.39*UP+4.88*RIGHT) - coeff[0].scale(0.5) - coeff[1].shift(3.39*UP+5.3*RIGHT) - coeff[1].scale(0.275) - coeff[2].shift(3.39*UP+5.98*RIGHT) - coeff[2].scale(0.28) - - for obj in coeff: - obj.set_color(GOLD_A) - - firstApprox=[self.get_graph(lambda x:1,color=BLUE)] - secondApprox=[self.get_graph(lambda x:1,color=BLUE), - self.get_graph(lambda x:x+1,color=BLUE), - self.get_graph(lambda x:-x+1,color=BLUE)] - thirdApprox=[self.get_graph(lambda x:1-2*math.pow(x,2),color=BLUE), - self.get_graph(lambda x:1-0.1*math.pow(x,2),color=BLUE), - self.get_graph(lambda x:1,color=BLUE), - self.get_graph(lambda x:1+0.1*math.pow(x,2),color=BLUE), - self.get_graph(lambda x:1+math.pow(x,2),color=BLUE)] - - firstGraph=self.get_graph(lambda x:1,color=BLUE) - secondGraph=self.get_graph(lambda x:1-math.pow(x,2),color=BLUE) - - bottomText1=TextMobject("The polynomial should","satisfy","the function at $x=0$") - bottomText2=TextMobject("This gives","$a_{ 0 }=1$") - bottomText3=TextMobject("Now it could be of","any slope!") - #show graphs of second approx - bottomText4=TextMobject("Hence the","slopes","should","even match") - #final graph - bottomText5=TextMobject("This gives","$a_{ 1 }=0$") - bottomText6=TextMobject("Since the rate of change of this slope","could vary") - #show third approx graphs - bottomText7=TextMobject("Hence the","rate of change of these slopes","should also be","same!") - #final graph - bottomText8=TextMobject("This gives","$a_{ 2 }=-1$") - - bottomText1.set_color_by_tex_to_color_map({"satisfy":YELLOW}) - bottomText2.set_color_by_tex_to_color_map({"$a_{ 0 }=1$":BLUE}) - bottomText3.set_color_by_tex_to_color_map({"any slope!":YELLOW}) - bottomText4.set_color_by_tex_to_color_map({"slopes":BLUE,"even match":YELLOW}) - bottomText5.set_color_by_tex_to_color_map({"$a_{ 1 }=0$":BLUE}) - bottomText6.set_color_by_tex_to_color_map({"could vary":YELLOW}) - bottomText7.set_color_by_tex_to_color_map({"rate of change of these slopes":BLUE,"same!":YELLOW}) - bottomText8.set_color_by_tex_to_color_map({"$a_{ 2 }=-1$":BLUE}) - - bottomText1.scale(0.4) - bottomText2.scale(0.5) - bottomText3.scale(0.4) - bottomText4.scale(0.4) - bottomText5.scale(0.5) - bottomText6.scale(0.4) - bottomText7.scale(0.4) - 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) - - self.play(Write(bottomText1)) - self.wait(1) - self.play(ShowCreation(firstApprox[0]),ReplacementTransform(bottomText1,bottomText2)) - #change coeff in tn(x) - self.play(ReplacementTransform(generalized_eq_coeff[0],coeff[0])) - self.wait(1.5) - self.play(ReplacementTransform(bottomText2,bottomText3)) - self.wait(0.5) - self.play(ReplacementTransform(firstApprox[0],secondApprox[1])) - self.wait(0.5) - self.play(ReplacementTransform(secondApprox[1],secondApprox[0])) - self.wait(0.5) - self.play(ReplacementTransform(secondApprox[0],secondApprox[2])) - self.wait(1) - self.play(ReplacementTransform(bottomText3,bottomText4),FadeOut(secondApprox[2])) - self.wait(1) - self.play(Write(firstGraph),ReplacementTransform(bottomText4,bottomText5)) - #change a1 coeff - self.play(ReplacementTransform(generalized_eq_coeff[1],coeff[1])) - self.wait(1.5) - self.play(ReplacementTransform(bottomText5,bottomText6)) - self.play(ReplacementTransform(firstGraph,thirdApprox[0])) - self.wait(0.6) - self.play(ReplacementTransform(thirdApprox[0],thirdApprox[1])) - self.wait(0.6) - self.play(ReplacementTransform(thirdApprox[1],thirdApprox[2])) - self.wait(0.6) - self.play(ReplacementTransform(thirdApprox[2],thirdApprox[3])) - self.wait(0.6) - self.play(ReplacementTransform(thirdApprox[3],thirdApprox[4])) - self.wait(1.5) - self.play(ReplacementTransform(bottomText6,bottomText7)) - self.wait(1.5) - self.play(ReplacementTransform(bottomText7,bottomText8),ReplacementTransform(thirdApprox[4],secondGraph)) - self.play(ReplacementTransform(generalized_eq_coeff[2],coeff[2])) - self.wait(2) - - textFinal=TextMobject("And so on..!") - textFinal.scale(0.7) - textFinal.shift(4.5*RIGHT+2.5*DOWN) - self.play(ReplacementTransform(bottomText8,textFinal)) - self.wait(2.5) - - finalFormula=TextMobject("Hence","$T_{ n }(x)$","=","$f(0)+f'(0)x+\\frac { f''(0) }{ 2! }x^2+..+\\frac { { f }^{ n }(0) }{ n! } { x }^{ n }$") - finalFormula.scale(0.8) - finalFormula.set_color_by_tex_to_color_map({"$T_{ n }(x)$":GREEN,"$f(0)+f'(0)x+\\frac { f''(0) }{ 2! }x^2+..+\\frac { { f }^{ n }(0) }{ n! } { x }^{ n }$":RED}) - - self.play(FadeOut(self.axes),FadeOut(textFinal),FadeOut(secondGraph),FadeOut(trTextGrup),FadeOut(mainfunction),FadeOut(fx),FadeOut(coeff[0]),FadeOut(coeff[1]),FadeOut(coeff[2])) - self.play(Write(finalFormula)) - self.wait(2) - # self.play(ReplacementTransform(secondApprox[2],secondApprox[3])) - # self.wait(0.5) - # self.play(ReplacementTransform(secondApprox[3],secondApprox[4])) - # self.wait(0.5) - # self.play(ReplacementTransform(secondApprox[4],secondApprox[5])) - # self.wait(0.5) - # self.play(ReplacementTransform(secondApprox[0],secondApprox[0])) - # self.wait(0.5) - # self.play(ReplacementTransform(secondApprox[0],secondApprox[0])) - # self.wait(0.5) - - - - -- cgit From 70572f4639b5576090a1b6bf1494803b28611d59 Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 14:45:03 +0530 Subject: Rename video2_TaylorExpansionGeneralForm.py.py to video2_TaylorExpansionGeneralForm.py --- .../video2_TaylorExpansionGeneralForm.py | 195 +++++++++++++++++++++ .../video2_TaylorExpansionGeneralForm.py.py | 195 --------------------- 2 files changed, 195 insertions(+), 195 deletions(-) create mode 100644 FSF-2020/calculus/series-and-transformations/Taylor Series/video2_TaylorExpansionGeneralForm.py delete mode 100644 FSF-2020/calculus/series-and-transformations/Taylor Series/video2_TaylorExpansionGeneralForm.py.py (limited to 'FSF-2020/calculus/series-and-transformations') 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 new file mode 100644 index 0000000..f84cfe9 --- /dev/null +++ b/FSF-2020/calculus/series-and-transformations/Taylor Series/video2_TaylorExpansionGeneralForm.py @@ -0,0 +1,195 @@ +from manimlib.imports import* +import math + + +class intro(Scene): + def construct(self): + 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.scale(0.7) + text.shift(DOWN) + + shiftText=TextMobject("(Here we shift the origin to the point $x=1$)") + shiftText.scale(0.6) + shiftText.shift(2.4*DOWN) + + + self.play(Write(equation)) + self.wait(0.5) + self.play(FadeIn(text)) + self.wait(0.7) + self.play(Write(shiftText)) + self.wait(0.7) + self.play(FadeOut(equation),FadeOut(text),FadeOut(shiftText)) + + +def formFormula(coeff_list,variable_list): + coeff_list=[TextMobject("${ a }_{ 0 }$"),TextMobject("${ a }_{ 1 }$"),TextMobject("${ a }_{ 2 }$")] + variable_list=[TextMobject("+"),TextMobject("${ (x-1) }$+"),TextMobject("${ (x-1) }^{ 2 }$")] + coeff_list[0].shift(2.2*UP+1.6*LEFT) + for i in range(0,3): + coeff_list[i].set_color(GOLD_A) + variable_list[i].next_to(coeff_list[i],buff=0.1) + if i!=2: + coeff_list[i+1].next_to(variable_list[i],buff=0.1) + dots=TextMobject("...") + dots.next_to(variable_list[2]) + expansion=VGroup(coeff_list[0],coeff_list[1],coeff_list[2],variable_list[0],variable_list[1],variable_list[2],dots) + #expansion.scale(0.7) + return expansion,coeff_list + + +class graphScene(GraphScene): + CONFIG = { + "x_min": -8, + "x_max": 8, + "y_min": -8, + "y_max": 8, + "graph_origin": ORIGIN, + "function_color": RED, + "axes_color": GREEN, + "x_axis_label": "$x$", + "y_axis_label": "$y$", + "exclude_zero_label": True, + "x_labeled_nums": range(-8, 8, 1), + } + 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) + + generalized_eq_coeff=[] + variables_eq=[] + eq,generalized_eq_coeff=formFormula(generalized_eq_coeff,variables_eq) + trText1=TextMobject("let $T_{ n }(x)$:=") + eq.next_to(trText1) + trTextGrup=VGroup(trText1,eq) + trTextGrup.scale(0.5) + trTextGrup.to_corner(UP+RIGHT) + self.play(Write(trTextGrup)) + self.setup_axes(animate=True) + + fx=TextMobject("${ e }^{ -x^{ 2 } }$") + fx.scale(0.5) + fx.shift(ORIGIN+x_each_unit*7.5*RIGHT+y_each_unit*0.5*UP) + mainfunction=self.get_graph(lambda x:math.exp(-1*pow(x,2)),color=RED,x_min=-8,x_max=8) + self.play(ShowCreation(mainfunction)) + self.play(FadeIn(fx)) + 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) + + 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)] + + 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) + + bottomText1=TextMobject("Apply","$f(1)=T_{n}(1)$") + bottomText2=TextMobject("This gives","$a_{ 0 }=e^{-1}$") + bottomText3=TextMobject("Now it could be of","any slope!") + #show graphs of second approx + bottomText4=TextMobject("Hence","apply","$f'(1)=T_{n}'(1)$") + #final graph + bottomText5=TextMobject("This gives","$a_{ 1 }=-2e^{-1}$") + bottomText6=TextMobject("Since the rate of change of this slope","could vary") + #show third approx graphs + bottomText7=TextMobject("Hence also","apply","$f''(1)=T_{ n }''(1)$") + #final graph + bottomText8=TextMobject("This gives","$a_{ 2 }=e^{-1}$") + + bottomText1.set_color_by_tex_to_color_map({"Apply":YELLOW}) + bottomText2.set_color_by_tex_to_color_map({"$a_{ 0 }=e^{-1}$":BLUE}) + bottomText3.set_color_by_tex_to_color_map({"any slope!":YELLOW}) + bottomText4.set_color_by_tex_to_color_map({"apply":YELLOW}) + bottomText5.set_color_by_tex_to_color_map({"$a_{ 1 }=-2e^{-1}$":BLUE}) + bottomText6.set_color_by_tex_to_color_map({"could vary":YELLOW}) + bottomText7.set_color_by_tex_to_color_map({"apply":YELLOW}) + bottomText8.set_color_by_tex_to_color_map({"$a_{ 2 }=e^{-1}$":BLUE}) + + bottomText1.scale(0.4) + bottomText2.scale(0.5) + bottomText3.scale(0.4) + bottomText4.scale(0.4) + bottomText5.scale(0.5) + bottomText6.scale(0.4) + bottomText7.scale(0.4) + 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) + + self.play(Write(bottomText1)) + self.wait(1) + self.play(ShowCreation(firstApprox[0]),ReplacementTransform(bottomText1,bottomText2)) + #change coeff in tn(x) + self.play(ReplacementTransform(generalized_eq_coeff[0],coeff[0])) + self.wait(1.5) + self.play(ReplacementTransform(bottomText2,bottomText3)) + self.wait(0.5) + self.play(ReplacementTransform(firstApprox[0],secondApprox[1])) + self.wait(0.5) + self.play(ReplacementTransform(secondApprox[1],secondApprox[2])) + # self.wait(0.5) + # self.play(ReplacementTransform(secondApprox[2],secondApprox[0])) + self.wait(1) + self.play(ReplacementTransform(bottomText3,bottomText4),FadeOut(secondApprox[2])) + self.wait(1) + self.play(Write(secondGraph),ReplacementTransform(bottomText4,bottomText5)) + #change a1 coeff + self.play(ReplacementTransform(generalized_eq_coeff[1],coeff[1])) + self.wait(1.5) + self.play(ReplacementTransform(bottomText5,bottomText6)) + self.play(ReplacementTransform(secondGraph,thirdApprox[0])) + self.wait(0.6) + self.play(ReplacementTransform(thirdApprox[0],thirdApprox[1])) + # self.wait(0.6) + # self.play(ReplacementTransform(thirdApprox[1],thirdApprox[2])) + self.wait(0.6) + self.play(ReplacementTransform(thirdApprox[1],thirdApprox[3])) + self.wait(0.6) + self.play(ReplacementTransform(thirdApprox[3],thirdApprox[4])) + self.wait(1.5) + self.play(ReplacementTransform(bottomText6,bottomText7)) + self.wait(1.5) + self.play(ReplacementTransform(bottomText7,bottomText8),ReplacementTransform(thirdApprox[4],thirdGraph)) + self.play(ReplacementTransform(generalized_eq_coeff[2],coeff[2])) + self.wait(2) + + textFinal=TextMobject("And so on..!") + textFinal.scale(0.7) + textFinal.shift(4.5*RIGHT+2.5*DOWN) + self.play(ReplacementTransform(bottomText8,textFinal)) + self.wait(2.5) + + 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) + finalFormula.set_color_by_tex_to_color_map({"$T_{ n }(x)$":GREEN,"$f(1)+f'(1)(x-1)+\\frac { f''(1) }{ 2! }(x-1)^2+..+\\frac { { f }^{ n }(1) }{ n! } { (x-1) }^{ n }$":RED}) + + self.play(FadeOut(self.axes),FadeOut(textFinal),FadeOut(thirdGraph),FadeOut(trTextGrup),FadeOut(mainfunction),FadeOut(fx),FadeOut(coeff[0]),FadeOut(coeff[1]),FadeOut(coeff[2])) + self.play(Write(finalFormula)) + self.wait(2) diff --git a/FSF-2020/calculus/series-and-transformations/Taylor Series/video2_TaylorExpansionGeneralForm.py.py b/FSF-2020/calculus/series-and-transformations/Taylor Series/video2_TaylorExpansionGeneralForm.py.py deleted file mode 100644 index f84cfe9..0000000 --- a/FSF-2020/calculus/series-and-transformations/Taylor Series/video2_TaylorExpansionGeneralForm.py.py +++ /dev/null @@ -1,195 +0,0 @@ -from manimlib.imports import* -import math - - -class intro(Scene): - def construct(self): - 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.scale(0.7) - text.shift(DOWN) - - shiftText=TextMobject("(Here we shift the origin to the point $x=1$)") - shiftText.scale(0.6) - shiftText.shift(2.4*DOWN) - - - self.play(Write(equation)) - self.wait(0.5) - self.play(FadeIn(text)) - self.wait(0.7) - self.play(Write(shiftText)) - self.wait(0.7) - self.play(FadeOut(equation),FadeOut(text),FadeOut(shiftText)) - - -def formFormula(coeff_list,variable_list): - coeff_list=[TextMobject("${ a }_{ 0 }$"),TextMobject("${ a }_{ 1 }$"),TextMobject("${ a }_{ 2 }$")] - variable_list=[TextMobject("+"),TextMobject("${ (x-1) }$+"),TextMobject("${ (x-1) }^{ 2 }$")] - coeff_list[0].shift(2.2*UP+1.6*LEFT) - for i in range(0,3): - coeff_list[i].set_color(GOLD_A) - variable_list[i].next_to(coeff_list[i],buff=0.1) - if i!=2: - coeff_list[i+1].next_to(variable_list[i],buff=0.1) - dots=TextMobject("...") - dots.next_to(variable_list[2]) - expansion=VGroup(coeff_list[0],coeff_list[1],coeff_list[2],variable_list[0],variable_list[1],variable_list[2],dots) - #expansion.scale(0.7) - return expansion,coeff_list - - -class graphScene(GraphScene): - CONFIG = { - "x_min": -8, - "x_max": 8, - "y_min": -8, - "y_max": 8, - "graph_origin": ORIGIN, - "function_color": RED, - "axes_color": GREEN, - "x_axis_label": "$x$", - "y_axis_label": "$y$", - "exclude_zero_label": True, - "x_labeled_nums": range(-8, 8, 1), - } - 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) - - generalized_eq_coeff=[] - variables_eq=[] - eq,generalized_eq_coeff=formFormula(generalized_eq_coeff,variables_eq) - trText1=TextMobject("let $T_{ n }(x)$:=") - eq.next_to(trText1) - trTextGrup=VGroup(trText1,eq) - trTextGrup.scale(0.5) - trTextGrup.to_corner(UP+RIGHT) - self.play(Write(trTextGrup)) - self.setup_axes(animate=True) - - fx=TextMobject("${ e }^{ -x^{ 2 } }$") - fx.scale(0.5) - fx.shift(ORIGIN+x_each_unit*7.5*RIGHT+y_each_unit*0.5*UP) - mainfunction=self.get_graph(lambda x:math.exp(-1*pow(x,2)),color=RED,x_min=-8,x_max=8) - self.play(ShowCreation(mainfunction)) - self.play(FadeIn(fx)) - 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) - - 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)] - - 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) - - bottomText1=TextMobject("Apply","$f(1)=T_{n}(1)$") - bottomText2=TextMobject("This gives","$a_{ 0 }=e^{-1}$") - bottomText3=TextMobject("Now it could be of","any slope!") - #show graphs of second approx - bottomText4=TextMobject("Hence","apply","$f'(1)=T_{n}'(1)$") - #final graph - bottomText5=TextMobject("This gives","$a_{ 1 }=-2e^{-1}$") - bottomText6=TextMobject("Since the rate of change of this slope","could vary") - #show third approx graphs - bottomText7=TextMobject("Hence also","apply","$f''(1)=T_{ n }''(1)$") - #final graph - bottomText8=TextMobject("This gives","$a_{ 2 }=e^{-1}$") - - bottomText1.set_color_by_tex_to_color_map({"Apply":YELLOW}) - bottomText2.set_color_by_tex_to_color_map({"$a_{ 0 }=e^{-1}$":BLUE}) - bottomText3.set_color_by_tex_to_color_map({"any slope!":YELLOW}) - bottomText4.set_color_by_tex_to_color_map({"apply":YELLOW}) - bottomText5.set_color_by_tex_to_color_map({"$a_{ 1 }=-2e^{-1}$":BLUE}) - bottomText6.set_color_by_tex_to_color_map({"could vary":YELLOW}) - bottomText7.set_color_by_tex_to_color_map({"apply":YELLOW}) - bottomText8.set_color_by_tex_to_color_map({"$a_{ 2 }=e^{-1}$":BLUE}) - - bottomText1.scale(0.4) - bottomText2.scale(0.5) - bottomText3.scale(0.4) - bottomText4.scale(0.4) - bottomText5.scale(0.5) - bottomText6.scale(0.4) - bottomText7.scale(0.4) - 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) - - self.play(Write(bottomText1)) - self.wait(1) - self.play(ShowCreation(firstApprox[0]),ReplacementTransform(bottomText1,bottomText2)) - #change coeff in tn(x) - self.play(ReplacementTransform(generalized_eq_coeff[0],coeff[0])) - self.wait(1.5) - self.play(ReplacementTransform(bottomText2,bottomText3)) - self.wait(0.5) - self.play(ReplacementTransform(firstApprox[0],secondApprox[1])) - self.wait(0.5) - self.play(ReplacementTransform(secondApprox[1],secondApprox[2])) - # self.wait(0.5) - # self.play(ReplacementTransform(secondApprox[2],secondApprox[0])) - self.wait(1) - self.play(ReplacementTransform(bottomText3,bottomText4),FadeOut(secondApprox[2])) - self.wait(1) - self.play(Write(secondGraph),ReplacementTransform(bottomText4,bottomText5)) - #change a1 coeff - self.play(ReplacementTransform(generalized_eq_coeff[1],coeff[1])) - self.wait(1.5) - self.play(ReplacementTransform(bottomText5,bottomText6)) - self.play(ReplacementTransform(secondGraph,thirdApprox[0])) - self.wait(0.6) - self.play(ReplacementTransform(thirdApprox[0],thirdApprox[1])) - # self.wait(0.6) - # self.play(ReplacementTransform(thirdApprox[1],thirdApprox[2])) - self.wait(0.6) - self.play(ReplacementTransform(thirdApprox[1],thirdApprox[3])) - self.wait(0.6) - self.play(ReplacementTransform(thirdApprox[3],thirdApprox[4])) - self.wait(1.5) - self.play(ReplacementTransform(bottomText6,bottomText7)) - self.wait(1.5) - self.play(ReplacementTransform(bottomText7,bottomText8),ReplacementTransform(thirdApprox[4],thirdGraph)) - self.play(ReplacementTransform(generalized_eq_coeff[2],coeff[2])) - self.wait(2) - - textFinal=TextMobject("And so on..!") - textFinal.scale(0.7) - textFinal.shift(4.5*RIGHT+2.5*DOWN) - self.play(ReplacementTransform(bottomText8,textFinal)) - self.wait(2.5) - - 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) - finalFormula.set_color_by_tex_to_color_map({"$T_{ n }(x)$":GREEN,"$f(1)+f'(1)(x-1)+\\frac { f''(1) }{ 2! }(x-1)^2+..+\\frac { { f }^{ n }(1) }{ n! } { (x-1) }^{ n }$":RED}) - - self.play(FadeOut(self.axes),FadeOut(textFinal),FadeOut(thirdGraph),FadeOut(trTextGrup),FadeOut(mainfunction),FadeOut(fx),FadeOut(coeff[0]),FadeOut(coeff[1]),FadeOut(coeff[2])) - self.play(Write(finalFormula)) - self.wait(2) -- cgit From 6a04d04fcb710bf273be0e80471b692aa3f4d451 Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 14:45:25 +0530 Subject: Rename script3.py to video3_radiusOfConvergence.py --- .../Taylor Series/script3.py | 111 --------------------- .../Taylor Series/video3_radiusOfConvergence.py | 111 +++++++++++++++++++++ 2 files changed, 111 insertions(+), 111 deletions(-) delete mode 100644 FSF-2020/calculus/series-and-transformations/Taylor Series/script3.py create mode 100644 FSF-2020/calculus/series-and-transformations/Taylor Series/video3_radiusOfConvergence.py (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Taylor Series/script3.py b/FSF-2020/calculus/series-and-transformations/Taylor Series/script3.py deleted file mode 100644 index a2870d4..0000000 --- a/FSF-2020/calculus/series-and-transformations/Taylor Series/script3.py +++ /dev/null @@ -1,111 +0,0 @@ -from manimlib.imports import* -import math - - -class graphScene(GraphScene): - CONFIG = { - "x_min": -8, - "x_max": 8, - "y_min": -8, - "y_max": 8, - "graph_origin": ORIGIN, - "function_color": RED, - "axes_color": GREEN, - "x_axis_label": "$x$", - "y_axis_label": "$y$", - "exclude_zero_label": True, - "x_labeled_nums": range(-8, 8, 1), - } - 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) - - self.setup_axes(animate=True) - - lnx=self.get_graph(lambda x:math.log2(x),color=RED,x_min=0.01,x_max=8) - - bottomText1=TextMobject("Apply $f(x)=T_{n}(x)$") - bottomText2=TextMobject("Then apply $f'(x)=T_{n}'(x)$") - bottomText3=TextMobject("Then apply $f''(x)=T_{n}''(x)$") - bottomText4=TextMobject("and so on..") - - bottomText1.scale(0.5) - bottomText2.scale(0.5) - bottomText3.scale(0.5) - bottomText4.scale(0.5) - - bottomText1.shift(3*RIGHT+2*DOWN) - bottomText2.shift(3*RIGHT+2*DOWN) - bottomText3.shift(3*RIGHT+2*DOWN) - bottomText4.shift(3*RIGHT+2*DOWN) - - equations=[self.get_graph(lambda x:math.log2(2),color=BLUE), - self.get_graph(lambda x:math.log2(2)+(x-2)/2,color=BLUE), - self.get_graph(lambda x:math.log2(2)+(x-2)/2-((x-2)**2)/8,color=BLUE), - self.get_graph(lambda x:math.log2(2)+(x-2)/2-((x-2)**2)/8+((x-2)**3)/24,color=BLUE), - self.get_graph(lambda x:math.log2(2)+(x-2)/2-((x-2)**2)/8+((x-2)**3)/24-((x-2)**4)/64,color=BLUE), - self.get_graph(lambda x:math.log2(2)+(x-2)/2-((x-2)**2)/8+((x-2)**3)/24-((x-2)**4)/64+((x-2)**5)/160,color=BLUE), - self.get_graph(lambda x:math.log2(2)+(x-2)/2-((x-2)**2)/8+((x-2)**3)/24-((x-2)**4)/64+((x-2)**5)/160-((x-2)**6)/384,color=BLUE)] - - terms=[TextMobject("$T_{n}:=$"),TextMobject("$ln(2)$"),TextMobject("$+\\frac { x-2 }{ 2 } $"),TextMobject("$-\\frac { (x-2)^{2} }{ 8 }$"),TextMobject("+..")] - for obj in terms: - obj.scale(0.5) - - terms[0].shift(3*UP+3*RIGHT) - terms[1].next_to(terms[0],buff=0.1) - terms[2].next_to(terms[1],buff=0.1) - terms[3].next_to(terms[2],buff=0.1) - terms[4].next_to(terms[3],buff=0.1) - - self.play(ShowCreation(lnx)) - self.wait(1) - self.play(Write(bottomText1)) - self.wait(0.5) - self.play(ShowCreation(equations[0]),Write(terms[0]),Write(terms[1])) - self.wait(1) - self.play(ReplacementTransform(bottomText1,bottomText2)) - self.wait(0.5) - self.play(ReplacementTransform(equations[0],equations[1]),Write(terms[2])) - self.wait(1) - self.play(ReplacementTransform(bottomText2,bottomText3)) - self.wait(0.5) - self.play(ReplacementTransform(equations[1],equations[2]),Write(terms[3])) - self.wait(1) - self.play(ReplacementTransform(bottomText3,bottomText4),Write(terms[4])) - self.wait(1.5) - - self.play(FadeOut(terms[0]),FadeOut(terms[1]),FadeOut(terms[2]),FadeOut(terms[3]),FadeOut(terms[4]),FadeOut(bottomText4)) - - dline=DashedLine(start=ORIGIN+8*y_each_unit*UP,end=ORIGIN+8*y_each_unit*DOWN) - dline.shift(ORIGIN+x_each_unit*4*RIGHT) - - bottomText5=TextMobject("Here","after $x=4$",", the graph","continuously diverges away","from $ln(x)$") - bottomText5.scale(0.3) - bottomText5.shift(4.5*RIGHT+2*DOWN) - bottomText5.set_color_by_tex_to_color_map({"after $x=4$":YELLOW,"continuously diverges away":BLUE}) - - self.play(Write(bottomText5),Write(dline)) - self.wait(1) - self.play(ReplacementTransform(equations[2],equations[3])) - self.wait(0.3) - self.play(ReplacementTransform(equations[3],equations[4])) - self.wait(0.3) - self.play(ReplacementTransform(equations[4],equations[5])) - self.wait(0.3) - self.play(ReplacementTransform(equations[5],equations[6]),FadeOut(bottomText5)) - self.wait(1) - - circle=Circle(radius=ORIGIN+x_each_unit*2,color=PURPLE_E) - circle.shift(ORIGIN+RIGHT*x_each_unit*2) - radiusLine=Line(start=ORIGIN+x_each_unit*RIGHT*2,end=ORIGIN+x_each_unit*4*RIGHT,color=PURPLE_E) - radius=TextMobject("$R$") - radius.set_color(RED) - radius.scale(0.5) - radius.shift(ORIGIN+RIGHT*x_each_unit*2.45+DOWN*y_each_unit*0.6) - - self.play(FadeOut(equations[6]),Write(circle)) - self.wait(0.6) - self.play(Write(radiusLine)) - self.play(FadeIn(radius)) - self.wait(2) \ No newline at end of file diff --git a/FSF-2020/calculus/series-and-transformations/Taylor Series/video3_radiusOfConvergence.py b/FSF-2020/calculus/series-and-transformations/Taylor Series/video3_radiusOfConvergence.py new file mode 100644 index 0000000..a68afb6 --- /dev/null +++ b/FSF-2020/calculus/series-and-transformations/Taylor Series/video3_radiusOfConvergence.py @@ -0,0 +1,111 @@ +from manimlib.imports import* +import math + + +class graphScene(GraphScene): + CONFIG = { + "x_min": -8, + "x_max": 8, + "y_min": -8, + "y_max": 8, + "graph_origin": ORIGIN, + "function_color": RED, + "axes_color": GREEN, + "x_axis_label": "$x$", + "y_axis_label": "$y$", + "exclude_zero_label": True, + "x_labeled_nums": range(-8, 8, 1), + } + 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) + + self.setup_axes(animate=True) + + lnx=self.get_graph(lambda x:math.log2(x),color=RED,x_min=0.01,x_max=8) + + bottomText1=TextMobject("Apply $f(x)=T_{n}(x)$") + bottomText2=TextMobject("Then apply $f'(x)=T_{n}'(x)$") + bottomText3=TextMobject("Then apply $f''(x)=T_{n}''(x)$") + bottomText4=TextMobject("and so on..") + + bottomText1.scale(0.5) + bottomText2.scale(0.5) + bottomText3.scale(0.5) + bottomText4.scale(0.5) + + bottomText1.shift(3*RIGHT+2*DOWN) + bottomText2.shift(3*RIGHT+2*DOWN) + bottomText3.shift(3*RIGHT+2*DOWN) + bottomText4.shift(3*RIGHT+2*DOWN) + + equations=[self.get_graph(lambda x:math.log2(2),color=BLUE), + self.get_graph(lambda x:math.log2(2)+(x-2)/2,color=BLUE), + self.get_graph(lambda x:math.log2(2)+(x-2)/2-((x-2)**2)/8,color=BLUE), + self.get_graph(lambda x:math.log2(2)+(x-2)/2-((x-2)**2)/8+((x-2)**3)/24,color=BLUE), + self.get_graph(lambda x:math.log2(2)+(x-2)/2-((x-2)**2)/8+((x-2)**3)/24-((x-2)**4)/64,color=BLUE), + self.get_graph(lambda x:math.log2(2)+(x-2)/2-((x-2)**2)/8+((x-2)**3)/24-((x-2)**4)/64+((x-2)**5)/160,color=BLUE), + self.get_graph(lambda x:math.log2(2)+(x-2)/2-((x-2)**2)/8+((x-2)**3)/24-((x-2)**4)/64+((x-2)**5)/160-((x-2)**6)/384,color=BLUE)] + + terms=[TextMobject("$T_{n}:=$"),TextMobject("$ln(2)$"),TextMobject("$+\\frac { x-2 }{ 2 } $"),TextMobject("$-\\frac { (x-2)^{2} }{ 8 }$"),TextMobject("+..")] + for obj in terms: + obj.scale(0.5) + + terms[0].shift(3*UP+3*RIGHT) + terms[1].next_to(terms[0],buff=0.1) + terms[2].next_to(terms[1],buff=0.1) + terms[3].next_to(terms[2],buff=0.1) + terms[4].next_to(terms[3],buff=0.1) + + self.play(ShowCreation(lnx)) + self.wait(1) + self.play(Write(bottomText1)) + self.wait(0.5) + self.play(ShowCreation(equations[0]),Write(terms[0]),Write(terms[1])) + self.wait(1) + self.play(ReplacementTransform(bottomText1,bottomText2)) + self.wait(0.5) + self.play(ReplacementTransform(equations[0],equations[1]),Write(terms[2])) + self.wait(1) + self.play(ReplacementTransform(bottomText2,bottomText3)) + self.wait(0.5) + self.play(ReplacementTransform(equations[1],equations[2]),Write(terms[3])) + self.wait(1) + self.play(ReplacementTransform(bottomText3,bottomText4),Write(terms[4])) + self.wait(1.5) + + self.play(FadeOut(terms[0]),FadeOut(terms[1]),FadeOut(terms[2]),FadeOut(terms[3]),FadeOut(terms[4]),FadeOut(bottomText4)) + + dline=DashedLine(start=ORIGIN+8*y_each_unit*UP,end=ORIGIN+8*y_each_unit*DOWN) + dline.shift(ORIGIN+x_each_unit*4*RIGHT) + + bottomText5=TextMobject("Here","after $x=4$",", the graph","continuously diverges away","from $ln(x)$") + bottomText5.scale(0.3) + bottomText5.shift(4.5*RIGHT+2*DOWN) + bottomText5.set_color_by_tex_to_color_map({"after $x=4$":YELLOW,"continuously diverges away":BLUE}) + + self.play(Write(bottomText5),Write(dline)) + self.wait(1) + self.play(ReplacementTransform(equations[2],equations[3])) + self.wait(0.3) + self.play(ReplacementTransform(equations[3],equations[4])) + self.wait(0.3) + self.play(ReplacementTransform(equations[4],equations[5])) + self.wait(0.3) + self.play(ReplacementTransform(equations[5],equations[6]),FadeOut(bottomText5)) + self.wait(1) + + circle=Circle(radius=ORIGIN+x_each_unit*2,color=PURPLE_E) + circle.shift(ORIGIN+RIGHT*x_each_unit*2) + radiusLine=Line(start=ORIGIN+x_each_unit*RIGHT*2,end=ORIGIN+x_each_unit*4*RIGHT,color=PURPLE_E) + radius=TextMobject("$R$") + radius.set_color(RED) + radius.scale(0.5) + radius.shift(ORIGIN+RIGHT*x_each_unit*2.45+DOWN*y_each_unit*0.6) + + self.play(FadeOut(equations[6]),Write(circle)) + self.wait(0.6) + self.play(Write(radiusLine)) + self.play(FadeIn(radius)) + self.wait(2) -- cgit From 476d9b46e164221923e8685fb4a3d07453f5c8cc Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 14:45:50 +0530 Subject: Rename script4.py to video4_DivergentRemainder.py --- .../Taylor Series/script4.py | 82 ---------------------- .../Taylor Series/video4_DivergentRemainder.py | 82 ++++++++++++++++++++++ 2 files changed, 82 insertions(+), 82 deletions(-) delete mode 100644 FSF-2020/calculus/series-and-transformations/Taylor Series/script4.py create mode 100644 FSF-2020/calculus/series-and-transformations/Taylor Series/video4_DivergentRemainder.py (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Taylor Series/script4.py b/FSF-2020/calculus/series-and-transformations/Taylor Series/script4.py deleted file mode 100644 index 1f41c97..0000000 --- a/FSF-2020/calculus/series-and-transformations/Taylor Series/script4.py +++ /dev/null @@ -1,82 +0,0 @@ -from manimlib.imports import* -import math - - -class graphScene(GraphScene): - CONFIG = { - "x_min": -8, - "x_max": 8, - "y_min": -8, - "y_max": 8, - "graph_origin": ORIGIN, - "function_color": RED, - "axes_color": GREEN, - "x_axis_label": "$x$", - "y_axis_label": "$y$", - "exclude_zero_label": True, - "x_labeled_nums": range(-8, 8, 1), - } - 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) - - self.setup_axes(animate=True) - lnx=self.get_graph(lambda x:math.log2(x),color=RED,x_min=0.01,x_max=8) - equation=self.get_graph(lambda x:math.log2(2)+(x-2)/2-((x-2)**2)/8+((x-2)**3)/24-((x-2)**4)/64+((x-2)**5)/160-((x-2)**6)/384,color=BLUE) - - terms=[TextMobject("$T_{n}:=$"),TextMobject("$ln(2)$"),TextMobject("$+\\frac { x-2 }{ 2 } $"),TextMobject("$-\\frac { (x-2)^{2} }{ 8 }$"),TextMobject("+..")] - for obj in terms: - obj.scale(0.5) - - terms[0].shift(3*UP+3*RIGHT) - terms[1].next_to(terms[0],buff=0.1) - terms[2].next_to(terms[1],buff=0.1) - terms[3].next_to(terms[2],buff=0.1) - terms[4].next_to(terms[3],buff=0.1) - - self.play(ShowCreation(lnx)) - self.wait(1) - self.play(FadeIn(equation),FadeIn(terms[0]),FadeIn(terms[1]),FadeIn(terms[2]),FadeIn(terms[3]),FadeIn(terms[4])) - self.wait(1) - - bottomText1=TextMobject("$R_{n}(x)=\\frac { d }{ dx } ($","area bounded","$)$") - - bottomText1.set_color_by_tex_to_color_map({"area bounded":ORANGE}) - #bottomText2.set_color_by_tex_to_color_map({"area bounded":BLUE}) - arrow=TextMobject("$\downarrow$") - arrow.scale(2.5) - arrow.shift(ORIGIN+x_each_unit*RIGHT*9.5+UP*y_each_unit) - increasingText=TextMobject("Increases!") - increasingText.set_color(GREEN) - followupText=TextMobject("as n increase!") - followupText.scale(0.3) - followupText.shift(ORIGIN+x_each_unit*11*RIGHT+UP*y_each_unit*1.1) - increasingText.shift(ORIGIN+x_each_unit*11*RIGHT+UP*y_each_unit*1.6) - increasingText.scale(0.4) - - bottomText1.scale(0.5) - #bottomText2.scale(0.5) - #bottomText3.scale(0.5) - - bottomText1.shift(3.5*LEFT+2*DOWN) - #bottomText2.shift(3.5*LEFT+2.4*DOWN) - #bottomText3.shift(3.5*LEFT+2.8*DOWN) - - dline=DashedLine(start=ORIGIN+8*y_each_unit*UP,end=ORIGIN+8*y_each_unit*DOWN) - dline.shift(ORIGIN+x_each_unit*4*RIGHT) - - area1=self.get_riemann_rectangles(lnx,x_max=8,x_min=4,dx=0.01,start_color=BLUE,end_color=RED,stroke_width=0,fill_opacity=0.8) - area2=self.get_riemann_rectangles(equation,x_max=5.2,x_min=4,dx=0.025,start_color=BLACK,end_color=BLACK,stroke_width=0,fill_opacity=1) - - self.play(Write(dline)) - self.wait(0.5) - self.play(ShowCreation(area1),ShowCreation(area2),Write(bottomText1)) - # self.play(Write(bottomText2)) - # self.play(FadeIn(bottomText3)) - self.play(Write(arrow)) - self.wait(0.7) - self.play(Write(increasingText)) - self.play(FadeIn(followupText)) - self.wait(2) - \ No newline at end of file diff --git a/FSF-2020/calculus/series-and-transformations/Taylor Series/video4_DivergentRemainder.py b/FSF-2020/calculus/series-and-transformations/Taylor Series/video4_DivergentRemainder.py new file mode 100644 index 0000000..5389039 --- /dev/null +++ b/FSF-2020/calculus/series-and-transformations/Taylor Series/video4_DivergentRemainder.py @@ -0,0 +1,82 @@ +from manimlib.imports import* +import math + + +class graphScene(GraphScene): + CONFIG = { + "x_min": -8, + "x_max": 8, + "y_min": -8, + "y_max": 8, + "graph_origin": ORIGIN, + "function_color": RED, + "axes_color": GREEN, + "x_axis_label": "$x$", + "y_axis_label": "$y$", + "exclude_zero_label": True, + "x_labeled_nums": range(-8, 8, 1), + } + 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) + + self.setup_axes(animate=True) + lnx=self.get_graph(lambda x:math.log2(x),color=RED,x_min=0.01,x_max=8) + equation=self.get_graph(lambda x:math.log2(2)+(x-2)/2-((x-2)**2)/8+((x-2)**3)/24-((x-2)**4)/64+((x-2)**5)/160-((x-2)**6)/384,color=BLUE) + + terms=[TextMobject("$T_{n}:=$"),TextMobject("$ln(2)$"),TextMobject("$+\\frac { x-2 }{ 2 } $"),TextMobject("$-\\frac { (x-2)^{2} }{ 8 }$"),TextMobject("+..")] + for obj in terms: + obj.scale(0.5) + + terms[0].shift(3*UP+3*RIGHT) + terms[1].next_to(terms[0],buff=0.1) + terms[2].next_to(terms[1],buff=0.1) + terms[3].next_to(terms[2],buff=0.1) + terms[4].next_to(terms[3],buff=0.1) + + self.play(ShowCreation(lnx)) + self.wait(1) + self.play(FadeIn(equation),FadeIn(terms[0]),FadeIn(terms[1]),FadeIn(terms[2]),FadeIn(terms[3]),FadeIn(terms[4])) + self.wait(1) + + bottomText1=TextMobject("$R_{n}(x)=\\frac { d }{ dx } ($","area bounded","$)$") + + bottomText1.set_color_by_tex_to_color_map({"area bounded":ORANGE}) + #bottomText2.set_color_by_tex_to_color_map({"area bounded":BLUE}) + arrow=TextMobject("$\downarrow$") + arrow.scale(2.5) + arrow.shift(ORIGIN+x_each_unit*RIGHT*9.5+UP*y_each_unit) + increasingText=TextMobject("Increases!") + increasingText.set_color(GREEN) + followupText=TextMobject("as n increase!") + followupText.scale(0.3) + followupText.shift(ORIGIN+x_each_unit*11*RIGHT+UP*y_each_unit*1.1) + increasingText.shift(ORIGIN+x_each_unit*11*RIGHT+UP*y_each_unit*1.6) + increasingText.scale(0.4) + + bottomText1.scale(0.5) + #bottomText2.scale(0.5) + #bottomText3.scale(0.5) + + bottomText1.shift(3.5*LEFT+2*DOWN) + #bottomText2.shift(3.5*LEFT+2.4*DOWN) + #bottomText3.shift(3.5*LEFT+2.8*DOWN) + + dline=DashedLine(start=ORIGIN+8*y_each_unit*UP,end=ORIGIN+8*y_each_unit*DOWN) + dline.shift(ORIGIN+x_each_unit*4*RIGHT) + + area1=self.get_riemann_rectangles(lnx,x_max=8,x_min=4,dx=0.01,start_color=BLUE,end_color=RED,stroke_width=0,fill_opacity=0.8) + area2=self.get_riemann_rectangles(equation,x_max=5.2,x_min=4,dx=0.025,start_color=BLACK,end_color=BLACK,stroke_width=0,fill_opacity=1) + + self.play(Write(dline)) + self.wait(0.5) + self.play(ShowCreation(area1),ShowCreation(area2),Write(bottomText1)) + # self.play(Write(bottomText2)) + # self.play(FadeIn(bottomText3)) + self.play(Write(arrow)) + self.wait(0.7) + self.play(Write(increasingText)) + self.play(FadeIn(followupText)) + self.wait(2) + -- cgit From a933eb11ef98b70dbfec23d49e7b2cb97389c5de Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Tue, 26 May 2020 14:49:37 +0530 Subject: Added gifs to readme.md --- .../series-and-transformations/Taylor Series/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 FSF-2020/calculus/series-and-transformations/Taylor Series/README.md (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Taylor Series/README.md b/FSF-2020/calculus/series-and-transformations/Taylor Series/README.md new file mode 100644 index 0000000..ce3b088 --- /dev/null +++ b/FSF-2020/calculus/series-and-transformations/Taylor Series/README.md @@ -0,0 +1,11 @@ +#### Example of Taylors expansion +![GIF1](gifs/file1_Example_TaylorExpansion.gif) + +#### Taylor Series GeneralForm +![GIF2](gifs/file2_TaylorExpansionGeneralForm.gif) + +#### Radius Of Convergence +![GIF3](gifs/file3_radiusOfConvergence.gif) + +#### Divergence of a Remainder +![GIF4](gifs/file4_DivergentRemainder.gif) -- cgit From 3064bf04b5fa63a303abdf7dfcc099186ad4350b Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Fri, 29 May 2020 18:18:47 +0530 Subject: Add files via upload --- .../Laplace Transformations/gifs/DiracFunction.gif | Bin 0 -> 60841 bytes .../gifs/DiracFunctionFormation.gif | Bin 0 -> 315096 bytes .../gifs/LtransformDiracFunction.gif | Bin 0 -> 99703 bytes .../gifs/LtransformUnitStepFunction.gif | Bin 0 -> 151025 bytes .../gifs/UnitStepFunctionExample.gif | Bin 0 -> 192755 bytes .../Laplace Transformations/gifs/basicIntuition.gif | Bin 0 -> 113203 bytes .../gifs/solvingDEintuition.gif | Bin 0 -> 196162 bytes .../Laplace Transformations/gifs/unitStepFunction.gif | Bin 0 -> 56604 bytes 8 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/DiracFunction.gif create mode 100644 FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/DiracFunctionFormation.gif create mode 100644 FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/LtransformDiracFunction.gif create mode 100644 FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/LtransformUnitStepFunction.gif create mode 100644 FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/UnitStepFunctionExample.gif create mode 100644 FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/basicIntuition.gif create mode 100644 FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/solvingDEintuition.gif create mode 100644 FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/unitStepFunction.gif (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/DiracFunction.gif b/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/DiracFunction.gif new file mode 100644 index 0000000..cb62ed2 Binary files /dev/null and b/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/DiracFunction.gif differ diff --git a/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/DiracFunctionFormation.gif b/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/DiracFunctionFormation.gif new file mode 100644 index 0000000..23acbe9 Binary files /dev/null and b/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/DiracFunctionFormation.gif differ diff --git a/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/LtransformDiracFunction.gif b/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/LtransformDiracFunction.gif new file mode 100644 index 0000000..b1d50b5 Binary files /dev/null and b/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/LtransformDiracFunction.gif differ diff --git a/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/LtransformUnitStepFunction.gif b/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/LtransformUnitStepFunction.gif new file mode 100644 index 0000000..ccbd791 Binary files /dev/null and b/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/LtransformUnitStepFunction.gif differ diff --git a/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/UnitStepFunctionExample.gif b/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/UnitStepFunctionExample.gif new file mode 100644 index 0000000..2b1c38f Binary files /dev/null and b/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/UnitStepFunctionExample.gif differ diff --git a/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/basicIntuition.gif b/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/basicIntuition.gif new file mode 100644 index 0000000..3b974bb Binary files /dev/null and b/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/basicIntuition.gif differ diff --git a/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/solvingDEintuition.gif b/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/solvingDEintuition.gif new file mode 100644 index 0000000..9883a8c Binary files /dev/null and b/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/solvingDEintuition.gif differ diff --git a/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/unitStepFunction.gif b/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/unitStepFunction.gif new file mode 100644 index 0000000..16757e1 Binary files /dev/null and b/FSF-2020/calculus/series-and-transformations/Laplace Transformations/gifs/unitStepFunction.gif differ -- cgit From a356b658294689d860a63b5213b4ddb2a235b515 Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Fri, 29 May 2020 18:24:25 +0530 Subject: Added gifs --- .../Laplace Transformations/README.md | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 FSF-2020/calculus/series-and-transformations/Laplace Transformations/README.md (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Laplace Transformations/README.md b/FSF-2020/calculus/series-and-transformations/Laplace Transformations/README.md new file mode 100644 index 0000000..2d8f06b --- /dev/null +++ b/FSF-2020/calculus/series-and-transformations/Laplace Transformations/README.md @@ -0,0 +1,21 @@ +###Basic Intuition +![GIF1](gifs/basicIntuition.gif) + +###Solving D.E.intuition +![GIF2](gifs/solvingDEintuition.gif) + +###Unit Step Function +####Part1 +![GIF3](gifs/unitStepFunction.gif) +####Part2 +![GIF4](gifs/UnitStepFunctionExample.gif) +####Part3 +![GIF5](gifs/LtransformUnitStepFunction.gif) + +###Dirac Delta Function +####Part1 +![GIF6](gifs/DiracFunction.gif) +####Part2 +![GIF7](gifs/DiracFunctionFormation.gif) +####Part3 +![GIF8](gifs/LtransformDiracFunction.gif) -- cgit From f299ffa1757488368e9d0bbef71f8b2a1792639c Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Fri, 29 May 2020 18:25:52 +0530 Subject: Updated Gifs --- .../Laplace Transformations/README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Laplace Transformations/README.md b/FSF-2020/calculus/series-and-transformations/Laplace Transformations/README.md index 2d8f06b..d4cd8bc 100644 --- a/FSF-2020/calculus/series-and-transformations/Laplace Transformations/README.md +++ b/FSF-2020/calculus/series-and-transformations/Laplace Transformations/README.md @@ -1,21 +1,21 @@ -###Basic Intuition +### Basic Intuition ![GIF1](gifs/basicIntuition.gif) -###Solving D.E.intuition +### Solving D.E.intuition ![GIF2](gifs/solvingDEintuition.gif) -###Unit Step Function -####Part1 +### Unit Step Function +#### Part1 ![GIF3](gifs/unitStepFunction.gif) -####Part2 +#### Part2 ![GIF4](gifs/UnitStepFunctionExample.gif) -####Part3 +#### Part3 ![GIF5](gifs/LtransformUnitStepFunction.gif) -###Dirac Delta Function -####Part1 +### Dirac Delta Function +#### Part1 ![GIF6](gifs/DiracFunction.gif) -####Part2 +#### Part2 ![GIF7](gifs/DiracFunctionFormation.gif) -####Part3 +#### Part3 ![GIF8](gifs/LtransformDiracFunction.gif) -- cgit From 8f4d09e3556a899190545d0dfe068fb31ac5b15c Mon Sep 17 00:00:00 2001 From: G Sri Harsha Date: Fri, 29 May 2020 18:26:34 +0530 Subject: Add files via upload --- .../file5_formationDiracDeltaFunction.py | 142 +++++++++++++++++++++ 1 file changed, 142 insertions(+) create mode 100644 FSF-2020/calculus/series-and-transformations/Laplace Transformations/file5_formationDiracDeltaFunction.py (limited to 'FSF-2020/calculus/series-and-transformations') diff --git a/FSF-2020/calculus/series-and-transformations/Laplace Transformations/file5_formationDiracDeltaFunction.py b/FSF-2020/calculus/series-and-transformations/Laplace Transformations/file5_formationDiracDeltaFunction.py new file mode 100644 index 0000000..565a7cb --- /dev/null +++ b/FSF-2020/calculus/series-and-transformations/Laplace Transformations/file5_formationDiracDeltaFunction.py @@ -0,0 +1,142 @@ +from manimlib.imports import * +import math +import pylatex + +def func(x,t): + if(x>-t and x