From 976d88d42dbb1bb80c2ff68f683f011b84d86503 Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Tue, 9 Jun 2020 17:12:12 +0530 Subject: new file and rename --- .../fundamental-theorem-of-line-integral/README.md | 8 +- .../file2_line_int_example.gif | Bin 1385308 -> 0 bytes .../file2_line_int_example.py | 159 ------------------- .../file2_line_int_independent_of_path.gif | Bin 0 -> 1403902 bytes .../file2_line_int_independent_of_path.py | 174 +++++++++++++++++++++ .../file3_line_int_example.gif | Bin 0 -> 1385308 bytes .../file3_line_int_example.py | 149 ++++++++++++++++++ 7 files changed, 329 insertions(+), 161 deletions(-) delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file2_line_int_example.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file2_line_int_example.py create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file2_line_int_independent_of_path.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file2_line_int_independent_of_path.py create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file3_line_int_example.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file3_line_int_example.py diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/README.md b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/README.md index edd176f..aa8c7f8 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/README.md +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/README.md @@ -1,5 +1,9 @@ **file1_grad_of_scalar_function** ![file1_grad_of_scalar_function](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file1_grad_of_scalar_function.gif) -**file2_line_int_example** -![file2_line_int_example](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file2_line_int_example.gif) +**file2_line_int_independent_of_path** +![file2_line_int_independent_of_path](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file2_line_int_independent_of_path.gif) + +**file3_line_int_example** +![file3_line_int_example](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file3_line_int_example.gif) + diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file2_line_int_example.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file2_line_int_example.gif deleted file mode 100644 index 20ed081..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file2_line_int_example.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file2_line_int_example.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file2_line_int_example.py deleted file mode 100644 index 6dabe49..0000000 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file2_line_int_example.py +++ /dev/null @@ -1,159 +0,0 @@ -from manimlib.imports import * - - -class LineIntegration(GraphScene): - CONFIG = { - "x_min" : -1, - "x_max" : 2, - "y_min" : -1, - "y_max" : 2, - "graph_origin": ORIGIN+3*LEFT+1.5*DOWN, - "x_axis_width": 10, - "y_axis_height": 10 , - "x_tick_frequency": 1, - "y_tick_frequency": 1, - "default_vector_field_config": { - "delta_x": .5, - "delta_y": .5, - "min_magnitude": 0, - "max_magnitude": .5, - "colors": [GREEN,BLUE,BLUE,TEAL], - "length_func": lambda norm : .4*sigmoid(norm), - "opacity": .75, - "vector_config": { - "stroke_width":2 - }, - }, - - "a": .45,"b": 2, - } - - def construct(self): - X = RIGHT*self.x_axis_width/(self.x_max- self.x_min) - Y = UP*self.y_axis_height/(self.y_max- self.y_min) - self.X=X ;self.Y=Y - - self.setup_axes(animate=False) - - - - - vector_field=self.get_vector_field( - lambda v: np.array([ - v[1]-self.graph_origin[1], - v[0]-self.graph_origin[0], - 0, - ]) - ) - vector_field_text=TexMobject( - "\\vec F=y\hat i+x\hat j", - stroke_width=2 - ).to_corner(UR,buff=.75).scale(1.2) - - vector_field_text[0][0:3].set_color(TEAL), - self.add(vector_field,) - self.play(Write(vector_field_text)) - self.wait() - self.get_endpoints_of_curve() - self.wait(.6) - self.play( - vector_field_text.shift,5*LEFT, - - ) - vector_field.set_fill(opacity=.2) - self.show_line_integral() - self.wait(2) - - - - - - def get_vector_field(self,func,**kwargs): - config = dict() - config.update(self.default_vector_field_config) - config.update(kwargs) - vector_field= VectorField(func,**config) - - self.vector_field= vector_field - - return vector_field - - - - def get_points(self): - dn=.1 - x_vals=np.arange(self.a,self.b,dn) - y_vals=np.arange(self.a,self.b,dn) - points=[] - for x_val in x_vals: - for y_val in y_vals: - points+=[self.coords_to_point(x_val,y_val)] - return points - - def get_endpoints_of_curve(self): - dots=[[1,1],[0,0]] - dot_labels= ["(1,1)","(0,0)"] - for dot,label in zip(dots,dot_labels): - dot=Dot(self.coords_to_point(*dot)).set_color(RED) - dot_label=TexMobject(label) - dot_label.next_to(dot,DR) - self.add(dot,dot_label) - self.end_points=dots - - def show_line_integral(self): - int_text=TexMobject( - "\\int_\\text{\\textbf{path}}\\vec F \\cdot d\\vec r= 1", - color=BLUE, - stroke_width=1.5 - ).scale(1.2) - int_text[0][0].set_color(RED_C) - int_text[0][5:7].set_color(TEAL) - int_text.to_edge(RIGHT+UP,buff=1) - - close_int=TexMobject("O").set_color(RED).scale(1.3) - close_int.move_to(int_text[0][0],OUT) - close_int_val=TexMobject("0",color=BLUE).scale(1.4) - close_int_val.move_to(int_text[0][-1],OUT) - - self.play(Write(int_text)) - - - self.show_method([[0,1]]) - self.play(Indicate(int_text)) - self.wait() - - self.show_method([[1,0]]) - self.play(Indicate(int_text)) - self.wait() - self.remove(int_text[0][-1]) - self.add(close_int) - - for i in range(2): - self.play(self.paths[i].rotate,PI) - self.play(Indicate(close_int)) - self.play(Write(close_int_val)) - self.wait() - - - def show_method(self,points): - points=points+self.end_points - paths=[] - for i in range(-1,len(points)-2): - path=Arrow( - self.coords_to_point(*points[i]), - self.coords_to_point(*points[i+1]), - buff=0 - ).set_color(BLUE) - paths+=VGroup(path) - self.play(GrowArrow(path),run_time=1.5) - - self.paths=paths - - - - - -#uploaded by Somnath Pandit. FSF2020_Fundamental_Theorem_of_Line_Integrals - - - diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file2_line_int_independent_of_path.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file2_line_int_independent_of_path.gif new file mode 100644 index 0000000..29c6d02 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file2_line_int_independent_of_path.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file2_line_int_independent_of_path.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file2_line_int_independent_of_path.py new file mode 100644 index 0000000..b9597b6 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file2_line_int_independent_of_path.py @@ -0,0 +1,174 @@ +from manimlib.imports import * + + +class LineIntegration(GraphScene): + CONFIG = { + "x_min" : -5, + "x_max" : 5, + "y_min" : -5, + "y_max" : 5, + "axes_color":BLACK, + "graph_origin": ORIGIN+1.2*DOWN, + "x_axis_width": 10, + "y_axis_height": 10 , + "x_axis_label": "", + "y_axis_label": "", + "x_tick_frequency": 1, + "y_tick_frequency": 1, + "default_vector_field_config": { + "delta_x": .6, + "delta_y": .6, + "min_magnitude": 0, + "max_magnitude": .5, + "colors": [GREEN,BLUE,BLUE,TEAL], + "length_func": lambda norm : .45*sigmoid(norm), + "opacity": .75, + "vector_config": { + "stroke_width":1.5 + }, + }, + + "a": .45,"b": 2, + "path_color": PURPLE + } + + def construct(self): + X = RIGHT*self.x_axis_width/(self.x_max- self.x_min) + Y = UP*self.y_axis_height/(self.y_max- self.y_min) + self.X=X ;self.Y=Y + + self.setup_axes(animate=False) + + + + + vector_field=self.get_vector_field( + lambda v: np.array([ + v[1]-self.graph_origin[1], + v[0]-self.graph_origin[0], + 0, + ]) + ) + vector_field_text=TexMobject( + "\\vec F(x,y)","=y\hat i+x\hat j", + stroke_width=1.5 + ).to_edge(TOP,buff=.2) + + vector_field_text[0][0:2].set_color(TEAL) + + grad_f=TexMobject( + "\\vec\\nabla f(x,y)", + stroke_width=1.5 + ) + grad_f[0][2].set_color(LIGHT_BROWN) + grad_f.move_to(vector_field_text[0]) + + self.add(vector_field,) + self.play(Write(vector_field_text)) + self.wait() + self.play( + ReplacementTransform( + vector_field_text[0],grad_f + ) + ) + self.get_endpoints_of_curve() + self.wait(.6) + vector_field.set_fill(opacity=.4) + self.show_line_integral() + self.wait(2) + + + + + + def get_vector_field(self,func,**kwargs): + config = dict() + config.update(self.default_vector_field_config) + config.update(kwargs) + vector_field= VectorField(func,**config) + + self.vector_field= vector_field + + return vector_field + + + + def get_endpoints_of_curve(self): + points=[[-3,0],[2,2]] + point_labels= ["P_i","P_f"] + for point,label in zip(points,point_labels): + dot=Dot(self.coords_to_point(*point)).set_color(RED) + dot_label=TexMobject(label) + dot_label.next_to(dot,DR,buff=.2) + self.play(FadeIn(VGroup(dot,dot_label))) + self.wait(.2) + + self.end_points=points + + def show_line_integral(self): + int_text=TexMobject( + r"\int_{P_i}^{P_f}\vec F \cdot d\vec r", + stroke_width=1.5, + ).scale(1.2) + int_text[0][0].set_color(self.path_color) + int_text[0][5:7].set_color(TEAL) + int_text.to_edge(RIGHT+UP,buff=1) + + int_value= TexMobject(r"=f(P_i)-f(P_f)", + stroke_width=1.5 + ).next_to(int_text,DOWN) + VGroup(int_value[0][1], + int_value[0][7] + ).set_color(LIGHT_BROWN) + + path_indepent_text=TextMobject( + r"Value of the Line Integral is\\ independent of Path",color=GOLD,stroke_width=2,).to_corner(DR,buff=1) + + path_indepent_text[0][-4:].set_color(self.path_color) + + + self.play(Write(VGroup( + int_text,int_value + )), + run_time=2 + ) + self.wait(1.5) + + + self.show_path([[0,1],[-1,2],[1,3]]) + self.play(Indicate(int_value)) + self.play(Uncreate(self.path)) + + self.show_path([[0,1]]) + self.play(Indicate(int_value)) + self.play(Uncreate(self.path)) + + self.show_path([[-1,1],[-1,-2],[-5,0],[-2,3.5],[1,1]]) + self.play(Indicate(int_value),run_time=2) + self.wait(.6) + + self.play(Write(path_indepent_text)) + + + + def show_path(self,points): + points=[self.end_points[0]]+points+[self.end_points[1]] + + path= VMobject() + path.set_points_smoothly([ + self.coords_to_point(*point) + for point in points + ]) + path.set_color(self.path_color) + self.play(ShowCreation(path),run_time=1.5) + + self.path=path + + + + + +#uploaded by Somnath Pandit. FSF2020_Fundamental_Theorem_of_Line_Integrals + + + diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file3_line_int_example.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file3_line_int_example.gif new file mode 100644 index 0000000..20ed081 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file3_line_int_example.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file3_line_int_example.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file3_line_int_example.py new file mode 100644 index 0000000..71506a3 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file3_line_int_example.py @@ -0,0 +1,149 @@ +from manimlib.imports import * + + +class LineIntegration(GraphScene): + CONFIG = { + "x_min" : -1, + "x_max" : 2, + "y_min" : -1, + "y_max" : 2, + "graph_origin": ORIGIN+3*LEFT+1.5*DOWN, + "x_axis_width": 10, + "y_axis_height": 10 , + "x_tick_frequency": 1, + "y_tick_frequency": 1, + "default_vector_field_config": { + "delta_x": .5, + "delta_y": .5, + "min_magnitude": 0, + "max_magnitude": .5, + "colors": [GREEN,BLUE,BLUE,TEAL], + "length_func": lambda norm : .4*sigmoid(norm), + "opacity": .75, + "vector_config": { + "stroke_width":2 + }, + }, + + "a": .45,"b": 2, + } + + def construct(self): + X = RIGHT*self.x_axis_width/(self.x_max- self.x_min) + Y = UP*self.y_axis_height/(self.y_max- self.y_min) + self.X=X ;self.Y=Y + + self.setup_axes(animate=False) + + + + + vector_field=self.get_vector_field( + lambda v: np.array([ + v[1]-self.graph_origin[1], + v[0]-self.graph_origin[0], + 0, + ]) + ) + vector_field_text=TexMobject( + "\\vec F=y\hat i+x\hat j", + stroke_width=2 + ).to_corner(UR,buff=.75).scale(1.2) + + vector_field_text[0][0:3].set_color(TEAL), + self.add(vector_field,) + self.play(Write(vector_field_text)) + self.wait() + self.get_endpoints_of_curve() + self.wait(.6) + self.play( + vector_field_text.shift,5*LEFT, + + ) + vector_field.set_fill(opacity=.2) + self.show_line_integral() + self.wait(2) + + + + + + def get_vector_field(self,func,**kwargs): + config = dict() + config.update(self.default_vector_field_config) + config.update(kwargs) + vector_field= VectorField(func,**config) + + self.vector_field= vector_field + + return vector_field + + + + def get_endpoints_of_curve(self): + points=[[1,1],[0,0]] + point_labels= ["(1,1)","(0,0)"] + for point,label in zip(points,point_labels): + dot=Dot(self.coords_to_point(*point)).set_color(RED) + dot_label=TexMobject(label) + dot_label.next_to(dot,DR) + self.add(dot,dot_label) + self.end_points=points + + def show_line_integral(self): + int_text=TexMobject( + "\\int_\\text{\\textbf{path}}\\vec F \\cdot d\\vec r= 1", + color=BLUE, + stroke_width=1.5 + ).scale(1.2) + int_text[0][0].set_color(RED_C) + int_text[0][5:7].set_color(TEAL) + int_text.to_edge(RIGHT+UP,buff=1) + + close_int=TexMobject("O").set_color(RED).scale(1.3) + close_int.move_to(int_text[0][0],OUT) + close_int_val=TexMobject("0",color=BLUE).scale(1.4) + close_int_val.move_to(int_text[0][-1],OUT) + + self.play(Write(int_text)) + + + self.show_method([[0,1]]) + self.play(Indicate(int_text)) + self.wait() + + self.show_method([[1,0]]) + self.play(Indicate(int_text)) + self.wait() + self.remove(int_text[0][-1]) + self.add(close_int) + + for i in range(2): + self.play(self.paths[i].rotate,PI) + self.play(Indicate(close_int)) + self.play(Write(close_int_val)) + self.wait() + + + def show_method(self,points): + points=points+self.end_points + paths=[] + for i in range(-1,len(points)-2): + path=Arrow( + self.coords_to_point(*points[i]), + self.coords_to_point(*points[i+1]), + buff=0 + ).set_color(BLUE) + paths+=VGroup(path) + self.play(GrowArrow(path),run_time=1.5) + + self.paths=paths + + + + + +#uploaded by Somnath Pandit. FSF2020_Fundamental_Theorem_of_Line_Integrals + + + -- cgit