diff options
author | Purusharth S | 2020-05-23 18:57:11 +0530 |
---|---|---|
committer | Purusharth S | 2020-05-23 18:57:11 +0530 |
commit | fe5e18510140b3e02f3f6f03ad449c218f1b8579 (patch) | |
tree | a3d204b56e34d19c6d7ddfaeaf8136faaff1f298 /FSF-2020/series-and-transformations/Power Series | |
parent | 94c40fe490487efcba7c3cc9df0153e86bcab26a (diff) | |
download | FSF-mathematics-python-code-archive-fe5e18510140b3e02f3f6f03ad449c218f1b8579.tar.gz FSF-mathematics-python-code-archive-fe5e18510140b3e02f3f6f03ad449c218f1b8579.tar.bz2 FSF-mathematics-python-code-archive-fe5e18510140b3e02f3f6f03ad449c218f1b8579.zip |
add topic-name folder
Diffstat (limited to 'FSF-2020/series-and-transformations/Power Series')
-rw-r--r-- | FSF-2020/series-and-transformations/Power Series/PowerSeriesQuestions.pdf | bin | 112622 -> 0 bytes | |||
-rw-r--r-- | FSF-2020/series-and-transformations/Power Series/script1.py | 128 | ||||
-rw-r--r-- | FSF-2020/series-and-transformations/Power Series/script2.py | 94 | ||||
-rw-r--r-- | FSF-2020/series-and-transformations/Power Series/script3.py | 156 | ||||
-rw-r--r-- | FSF-2020/series-and-transformations/Power Series/script4.py | 108 | ||||
-rw-r--r-- | FSF-2020/series-and-transformations/Power Series/script5.py | 136 |
6 files changed, 0 insertions, 622 deletions
diff --git a/FSF-2020/series-and-transformations/Power Series/PowerSeriesQuestions.pdf b/FSF-2020/series-and-transformations/Power Series/PowerSeriesQuestions.pdf Binary files differdeleted file mode 100644 index 04ed6d5..0000000 --- a/FSF-2020/series-and-transformations/Power Series/PowerSeriesQuestions.pdf +++ /dev/null diff --git a/FSF-2020/series-and-transformations/Power Series/script1.py b/FSF-2020/series-and-transformations/Power Series/script1.py deleted file mode 100644 index 28eb07c..0000000 --- a/FSF-2020/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) diff --git a/FSF-2020/series-and-transformations/Power Series/script2.py b/FSF-2020/series-and-transformations/Power Series/script2.py deleted file mode 100644 index 72356c6..0000000 --- a/FSF-2020/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) diff --git a/FSF-2020/series-and-transformations/Power Series/script3.py b/FSF-2020/series-and-transformations/Power Series/script3.py deleted file mode 100644 index f710f42..0000000 --- a/FSF-2020/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/series-and-transformations/Power Series/script4.py b/FSF-2020/series-and-transformations/Power Series/script4.py deleted file mode 100644 index 412d20c..0000000 --- a/FSF-2020/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/series-and-transformations/Power Series/script5.py b/FSF-2020/series-and-transformations/Power Series/script5.py deleted file mode 100644 index e9681aa..0000000 --- a/FSF-2020/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) |