From 5e27333898ff223d6fc52cd481207d4fb7bedb19 Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Sun, 14 Jun 2020 00:42:47 +0530 Subject: checked a typing mistake --- .../file2_line_int_independent_of_path.gif | Bin 1403902 -> 1409001 bytes .../file2_line_int_independent_of_path.py | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) 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 index 29c6d02..8d375bb 100644 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file2_line_int_independent_of_path.gif 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 index b9597b6..b8f7cfa 100644 --- 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 @@ -95,7 +95,7 @@ class LineIntegration(GraphScene): def get_endpoints_of_curve(self): points=[[-3,0],[2,2]] - point_labels= ["P_i","P_f"] + point_labels= ["P_f","P_i"] for point,label in zip(points,point_labels): dot=Dot(self.coords_to_point(*point)).set_color(RED) dot_label=TexMobject(label) -- cgit From a1eb4e61987d5c7cc9108ac110f832fd791c216f Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Sun, 14 Jun 2020 20:16:47 +0530 Subject: refined --- .../file1_grad_of_scalar_function.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file1_grad_of_scalar_function.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file1_grad_of_scalar_function.py index c9f479c..50e850f 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file1_grad_of_scalar_function.py +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file1_grad_of_scalar_function.py @@ -165,6 +165,7 @@ class GradOfScalar(ThreeDScene): config.update(self.default_vector_field_config) config.update(kwargs) vector_field= VectorField(func,**config) + vector_field.move_to(self.axes.c2p(0,0,0)) self.vector_field=vector_field if on_surface: @@ -175,10 +176,8 @@ class GradOfScalar(ThreeDScene): def get_vectors_on_surface(self): - config = dict() - config.update(self.default_vector_field_config["vector_config"]) vectors_on_surface = VGroup(*[ - self.vector_field.get_vector(point,**config) + self.vector_field.get_vector(point) for point in self.surface_points ]) -- cgit From 66cbc413aa8cd45db7f3167d53d21d13427e0c1b Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Wed, 17 Jun 2020 23:45:18 +0530 Subject: update --- .../file1_grad_of_scalar_function.gif | Bin 4012467 -> 4058562 bytes .../file1_grad_of_scalar_function.py | 50 ++-- .../file2_grad_of_scalar_function.gif | Bin 0 -> 6913246 bytes .../vector-fields/file2_grad_of_scalar_function.py | 320 +++++++++++++++++++++ 4 files changed, 350 insertions(+), 20 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file2_grad_of_scalar_function.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file2_grad_of_scalar_function.py diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file1_grad_of_scalar_function.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file1_grad_of_scalar_function.gif index 5a6e102..1fd2e15 100644 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file1_grad_of_scalar_function.gif and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file1_grad_of_scalar_function.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file1_grad_of_scalar_function.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file1_grad_of_scalar_function.py index 50e850f..fd3d9b5 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file1_grad_of_scalar_function.py +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file1_grad_of_scalar_function.py @@ -1,6 +1,6 @@ from manimlib.imports import * -class GradOfScalar(ThreeDScene): +class GradOfScalarFunc(ThreeDScene): CONFIG = { "axes_config": { @@ -27,7 +27,7 @@ class GradOfScalar(ThreeDScene): "num_axis_pieces": 1, }, "default_graph_style": { - "stroke_width": 2, + "stroke_width": 5, "stroke_color": WHITE, }, "default_vector_field_config": { @@ -38,8 +38,8 @@ class GradOfScalar(ThreeDScene): "y_min": -3, "y_max": 3, "min_magnitude": 0, - "max_magnitude": 2, - "colors": [TEAL,GREEN,GREEN,GREEN,YELLOW,RED], + "max_magnitude": 3, + "colors": [TEAL,GREEN,YELLOW,RED], "length_func": lambda norm : norm*np.exp(-.38*norm)/2, "opacity": 1.0, "vector_config": { @@ -49,9 +49,9 @@ class GradOfScalar(ThreeDScene): "default_surface_config": { "fill_opacity": 0.5, "checkerboard_colors": [BLUE_E], - "stroke_width": .5, + "stroke_width": .2, "stroke_color": WHITE, - "stroke_opacity": 0.75, + "stroke_opacity": 0.5, }, } @@ -66,17 +66,24 @@ class GradOfScalar(ThreeDScene): theta=-135 * DEGREES, ) - scalar_fn_text=TexMobject("f(x,y,z)=","xy").set_color(BLUE) + scalar_fn_text=TexMobject("f(x,y)=","xy").set_color(BLUE) scalar_fn_text.to_corner(UR,buff=.6) operator=TexMobject("\\vec\\nabla").next_to( scalar_fn_text,LEFT,buff=.2 ).set_color(GOLD) - grad_text=TexMobject(r"\dfrac{\partial f}{\partial x} \hat i+\dfrac{\partial f}{\partial y} \hat j+\dfrac{\partial f}{\partial z} \hat k").set_color(GOLD) + + grad_text=TexMobject(r"\dfrac{\partial f}{\partial x} \hat i+\dfrac{\partial f}{\partial y} \hat j").set_color(GOLD) grad_text.next_to(scalar_fn_text,DOWN).scale(.9) - VGroup(grad_text[0][1],grad_text[0][9],grad_text[0][17]).set_color(BLUE) - VGroup(grad_text[0][5:8],grad_text[0][13:16],grad_text[0][21:23]).set_color(WHITE) + VGroup( + grad_text[0][1], + grad_text[0][9] + ).set_color(BLUE) + VGroup( + grad_text[0][5:8], + grad_text[0][13:16] + ).set_color(WHITE) vector_field_text=TexMobject("\\vec F=y\hat i+x\hat j").set_color_by_gradient(*self.default_vector_field_config["colors"]) vector_field_text.next_to(scalar_fn_text,DOWN) @@ -108,30 +115,33 @@ class GradOfScalar(ThreeDScene): self.play(Write(grad_text)) self.wait(2) - self.play(FadeOut(grad_text)) - self.add_fixed_in_frame_mobjects(vector_field_text) - show_vec_field=[ + + show_vects=[ FadeIn(v_field1), - Write(vector_field_text), ] self.begin_ambient_camera_rotation(rate=.2) self.move_camera( # distance=20, phi=60 * DEGREES, - added_anims=show_vec_field, + added_anims=show_vects, run_time=4.5 ) - + + self.play(FadeOut(grad_text)) self.wait(2) self.stop_ambient_camera_rotation() - fadeout= [FadeOut(s_field1)] + self.add_fixed_in_frame_mobjects(vector_field_text) + vector_field= [ + FadeOut(s_field1), + Write(vector_field_text), + ] self.move_camera( # distance=20, phi=0 * DEGREES, theta=-90 * DEGREES, - added_anims=fadeout, + added_anims=vector_field, run_time=2 ) self.wait(2) @@ -182,7 +192,8 @@ class GradOfScalar(ThreeDScene): ]) return vectors_on_surface - + + def get_surface(self, func, **kwargs): axes=self.axes @@ -304,4 +315,3 @@ class GradOfScalar(ThreeDScene): - diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file2_grad_of_scalar_function.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file2_grad_of_scalar_function.gif new file mode 100644 index 0000000..c1ab66a Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file2_grad_of_scalar_function.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file2_grad_of_scalar_function.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file2_grad_of_scalar_function.py new file mode 100644 index 0000000..231b15c --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file2_grad_of_scalar_function.py @@ -0,0 +1,320 @@ +from manimlib.imports import * + +class GradOfScalarFunc(ThreeDScene): + + CONFIG = { + "axes_config": { + "x_min": -3, + "x_max": 3, + "y_min": -3, + "y_max": 3, + "z_min": 0, + "z_max": 3, + "a":-3 ,"b": 3, "c":-3 , "d":3, + "axes_shift": ORIGIN+IN+LEFT, + "x_axis_config": { + "tick_frequency": 1, + # "include_tip": False, + }, + "y_axis_config": { + "tick_frequency": 1, + # "include_tip": False, + }, + "z_axis_config": { + "tick_frequency": 1, + # "include_tip": False, + }, + "num_axis_pieces": 1, + }, + "default_graph_style": { + "stroke_width": 2, + "stroke_color": WHITE, + }, + "default_vector_field_config": { + "delta_x": .5, + "delta_y": .5, + "x_min": -3, + "x_max": 3, + "y_min": -3, + "y_max": 3, + "min_magnitude": 0, + "max_magnitude": 2, + "colors": [BLUE,GREEN,GREEN,ORANGE,RED], + "length_func": lambda norm : .45*sigmoid(norm), + "opacity": 1.0, + "vector_config": { + "stroke_width":6 + }, + }, + "default_surface_config": { + "fill_opacity": 0.5, + "checkerboard_colors": [BLUE_D], + "stroke_width": .5, + "stroke_color": WHITE, + "stroke_opacity": 0.2, + }, + } + + + def construct(self): + + self.setup_axes() + axes=self.axes + + self.set_camera_orientation(distance=35, + phi=80 * DEGREES, + theta=-80 * DEGREES, + ) + + scalar_fn_text=TexMobject("f(x,y)=","\cos(xy)").set_color(BLUE) + scalar_fn_text.to_corner(UR,buff=.6) + + operator=TexMobject("\\vec\\nabla").next_to( + scalar_fn_text,LEFT,buff=.2 + ).set_color(GOLD) + + grad_text=TexMobject(r"\dfrac{\partial f}{\partial x} \hat i+\dfrac{\partial f}{\partial y} \hat j+\dfrac{\partial f}{\partial z} \hat k").set_color(GOLD) + grad_text.next_to(scalar_fn_text,DOWN).scale(.9) + + VGroup( + grad_text[0][1], + grad_text[0][9], + grad_text[0][17] + ).set_color(BLUE) + VGroup( + grad_text[0][5:8], + grad_text[0][13:16], + grad_text[0][21:23] + ).set_color(WHITE) + + vector_field_text=TexMobject( + r"\vec F&=-y\sin(xy)\hat i\\ &-x\sin(xy)\hat j" + ).set_color_by_gradient( + *self.default_vector_field_config["colors"] + ) + vector_field_text.next_to(scalar_fn_text,DOWN) + + + '''always generate the scalar field first''' + s_field=self.get_scalar_field( + func= lambda x ,y : np.cos(x*y/2), + dn=.25 + ) + v_field=self.get_vector_field( + lambda v: np.array([ + -(v[1]-axes.c2p(0,0,0)[1])*np.sin((v[0]-axes.c2p(0,0,0)[0])*(v[1]-axes.c2p(0,0,0)[1])), + -(v[0]-axes.c2p(0,0,0)[0])*np.sin((v[0]-axes.c2p(0,0,0)[0])*(v[1]-axes.c2p(0,0,0)[1])), + 0, + ]), + on_surface=True, + ) + + self.add_fixed_in_frame_mobjects(scalar_fn_text) + + self.begin_ambient_camera_rotation(rate=.2) + self.play(Write(s_field),run_time=2) + self.wait(4) + self.stop_ambient_camera_rotation() + + self.add_fixed_in_frame_mobjects(operator) + self.play(Write(operator),FadeOut(scalar_fn_text[1])) + self.add_fixed_in_frame_mobjects(grad_text) + self.play(Write(grad_text)) + self.wait(1.5) + + self.play(FadeOut(grad_text)) + self.add_fixed_in_frame_mobjects(vector_field_text) + show_vec_field=[ + FadeIn(v_field), + Write(vector_field_text), + ] + # self.play(*show_vec_field,run_time=.5) + self.begin_ambient_camera_rotation(rate=.2) + self.move_camera( + # distance=20, + phi=50 * DEGREES, + added_anims=show_vec_field, + run_time=3 + ) + + self.wait(5) + self.stop_ambient_camera_rotation() + + fadeout= [FadeOut(s_field)] + # self.play(*fadeout) + self.move_camera( + # distance=20, + phi=0 * DEGREES, + theta=-90 * DEGREES, + added_anims=fadeout, + run_time=2 + ) + self.wait(2) + + + + + + def get_scalar_field(self,func,dn=.5): + surface= self.get_surface( + lambda x , y: + func(x,y), + ) + + self.surface_points=self.get_points(func,dn) + return surface + + def get_points(self,func,dn): + axes=self.axes + + x_vals=np.arange(axes.a,axes.b,dn) + y_vals=np.arange(axes.c,axes.d,dn) + points=[] + for x_val in x_vals: + for y_val in y_vals: + points+=[axes.c2p(x_val,y_val,func(x_val,y_val)+.05)] + return points + + def get_vector_field(self,func,on_surface=True,**kwargs): + config = dict() + config.update(self.default_vector_field_config) + config.update(kwargs) + vector_field= VectorField(func,**config) + vector_field.move_to(self.axes.c2p(0,0,0)) + self.vector_field=vector_field + + if on_surface: + vector_field=self.get_vectors_on_surface() + + return vector_field + + + + def get_vectors_on_surface(self): + vectors_on_surface = VGroup(*[ + self.vector_field.get_vector(point) + for point in self.surface_points + ]) + + return vectors_on_surface + + + def get_surface(self, func, **kwargs): + axes=self.axes + config = { + "u_min": axes.a, + "u_max": axes.b, + "v_min": axes.c, + "v_max": axes.d, + "resolution": ( + 4*(axes.y_max - axes.y_min) // axes.y_axis.tick_frequency, + 4*(axes.x_max - axes.x_min) // axes.x_axis.tick_frequency, + ), + } + + config.update(self.default_surface_config) + config.update(kwargs) + return ParametricSurface( + lambda x,y : axes.c2p( + x, y, func(x, y) + ), + **config + ) + + +#------------------------------------------------------- + #customize 3D axes + def get_three_d_axes(self, include_labels=True, include_numbers=False, **kwargs): + config = dict(self.axes_config) + config.update(kwargs) + axes = ThreeDAxes(**config) + axes.set_stroke(width=2) + self.axes=axes + + if include_numbers: + self.add_axes_numbers(axes) + + if include_labels: + self.add_axes_labels(axes) + + # Adjust axis orientation + axes.x_axis.rotate( + -90 * DEGREES, LEFT, + about_point=axes.c2p(0, 0, 0), + ) + axes.y_axis.rotate( + 90 * DEGREES, UP, + about_point=axes.c2p(0, 0, 0), + ) + + return axes + + + def setup_axes(self): + axes = self.get_three_d_axes(include_labels=True) + axes.scale(1) + # axes.center() + axes.shift(axes.axes_shift) + + self.add(axes) + self.axes = axes + + def add_axes_numbers(self, axes): + x_axis = axes.x_axis + y_axis = axes.y_axis + tex_vals_x = [ + + ("1", axes.b), + ("-1", axes.a), + ] + tex_vals_y=[ + + ("1", axes.d) + ] + x_labels = VGroup() + y_labels = VGroup() + for tex, val in tex_vals_x: + label = TexMobject(tex) + label.scale(1) + label.next_to(x_axis.n2p(val), DOWN) + # label.rotate(180 * DEGREES) + x_labels.add(label) + x_axis.add(x_labels) + x_axis.numbers = x_labels + + for tex, val in tex_vals_y: + label = TexMobject(tex) + label.scale(1) + label.next_to(y_axis.n2p(val), LEFT) + label.rotate(90 * DEGREES) + y_labels.add(label) + + y_axis.add(y_labels) + y_axis.numbers = y_labels + + return axes + + def add_axes_labels(self, axes): + x_label = TexMobject("x") + x_label.next_to(axes.x_axis.get_end(), RIGHT) + axes.x_axis.label = x_label + + y_label = TextMobject("y") + y_label.rotate(90 * DEGREES, OUT) + y_label.next_to(axes.y_axis.get_end(), UP) + axes.y_axis.label = y_label + + z_label = TextMobject("z") + z_label.rotate(90 * DEGREES, RIGHT) + z_label.next_to(axes.z_axis.get_zenith(), LEFT) + axes.z_axis.label = z_label + for axis in axes: + axis.add(axis.label) + return axes + + + + #uploaded by Somnath Pandit. FSF2020_Vector_fields + + + -- cgit From d794c1919eccf85cc8ddf4651c8de7722c7008c0 Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Thu, 18 Jun 2020 14:07:03 +0530 Subject: update --- .../line-integrals/file2_scalar_line_integral.gif | Bin 5612895 -> 3301509 bytes .../line-integrals/file2_scalar_line_integral.py | 18 ++++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file2_scalar_line_integral.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file2_scalar_line_integral.gif index 71c97d6..f9a8f98 100644 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file2_scalar_line_integral.gif and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file2_scalar_line_integral.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file2_scalar_line_integral.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file2_scalar_line_integral.py index 996ead1..200f768 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file2_scalar_line_integral.py +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file2_scalar_line_integral.py @@ -47,8 +47,8 @@ class LineIntegrationProcess(SpecialThreeDScene): axes=self.axes self.set_camera_orientation(distance=35, - phi=65 * DEGREES, - theta=-65 * DEGREES, + phi=60 * DEGREES, + theta=-60 * DEGREES, ) fn_text=TextMobject("$z=2+x^2y$").set_color(BLUE) @@ -86,7 +86,14 @@ class LineIntegrationProcess(SpecialThreeDScene): self.play(Write(area_text)) self.play(Write(self.area),run_time=2) self.play(FadeOut(VGroup(surface,fn_text))) - self.wait() + self.move_camera( + # distance=20, + phi=90 * DEGREES, + # theta=-90 * DEGREES, + # added_anims=into_graph, + run_time=2 + ) + self.wait(2) self.stop_ambient_camera_rotation() # self.get_lines() @@ -307,7 +314,8 @@ class LineIntegrationProcess(SpecialThreeDScene): line=DashedLine(start,end,color=color) return line - + +#------------------------------------------------------- #customize 3D axes def get_three_d_axes(self, include_labels=True, include_numbers=True, **kwargs): config = dict(self.axes_config) @@ -417,5 +425,3 @@ class LineIntegrationProcess(SpecialThreeDScene): #uploaded by Somnath Pandit.FSF2020_Line_Integrals - - -- cgit From f4e9b0f92f0e2af217e133dd928b12421ace28b6 Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Fri, 19 Jun 2020 00:37:29 +0530 Subject: new animation --- .../vector-fields/README.md | 8 ++ .../file3_constructing_vector_field.gif | Bin 0 -> 847326 bytes .../file3_constructing_vector_field.py | 134 +++++++++++++++++++++ 3 files changed, 142 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/README.md create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.py diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/README.md b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/README.md new file mode 100644 index 0000000..ef58bb1 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/README.md @@ -0,0 +1,8 @@ + + +**file2_grad_of_scalar_function** +![file2_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/vector-fields/file2_grad_of_scalar_function.gif) + +**file3_constructing_vector_field** +![file3_constructing_vector_field](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif) + diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif new file mode 100644 index 0000000..a3ac7ed Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.py new file mode 100644 index 0000000..f90705a --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.py @@ -0,0 +1,134 @@ +from manimlib.imports import * + + +class VectorFields(GraphScene): + CONFIG = { + "x_min" : -2, + "x_max" : 2, + "y_min" : -2, + "y_max" : 2, + "graph_origin": ORIGIN+2.5*LEFT, + "x_axis_width": 7, + "y_axis_height": 7, + "x_tick_frequency": 1, + "y_tick_frequency": 1, + "default_vector_field_config": { + "delta_x": .5, + "delta_y": .5, + "min_magnitude": 0, + "max_magnitude": 4, + "colors": [GREEN,GREEN,YELLOW,RED], + "length_func": lambda norm : .6*sigmoid(norm), + "opacity": .75, + "vector_config": { + "stroke_width":6, + "max_stroke_width_to_length_ratio":6 + }, + }, + + "a":-1.5 ,"b": 2, "c": -1.5 ,"d": 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[0]-self.graph_origin[0])*(v[1]-self.graph_origin[1]), + -(v[0]-self.graph_origin[0]), + 0, + ]) + ) + + self.show_points() + self.show_func_machine() + self.produce_vectors(vector_field) + self.wait(2) + + + + + def show_points(self): + dn=.5 + x_vals=np.arange(self.a,self.b,dn) + y_vals=np.arange(self.c,self.d,dn) + dots=VGroup() + for x_val in x_vals: + for y_val in y_vals: + dot=Dot( + self.coords_to_point(x_val,y_val), + radius=.05, + color=TEAL, + ) + dots.add(dot) + self.play(ShowCreation(dots, run_time=1)) + self.dots=dots + + def show_func_machine(self): + machine=RoundedRectangle( + height=2, + width=3.5, + color=PURPLE, + stroke_width=8 + ).to_edge(RIGHT, buff=.4) + + machine_label=TexMobject( + r"\vec F=xy\hat i-x\hat j", + stroke_width=1.5, + ).set_color_by_gradient( + *self.default_vector_field_config["colors"] + ).next_to(machine,IN) + self.add(machine,machine_label) + + self.func_machine=machine + + + def produce_vectors(self,vector_field): + count,i=3,0 + self.run_time=1 + for dot in self.dots: + if i==count: + self.run_time=.05 + position=dot.get_center() + vect= vector_field.get_vector(position) + self.go_to_machine(dot) + self.take_vec_from_machine(vect,position) + i+=1 + + def go_to_machine(self,dot): + self.play(ApplyMethod( + dot.move_to, + self.func_machine, + ), + run_time=self.run_time + ) + self.play(FadeOut(dot),run_time=self.run_time) + + def take_vec_from_machine(self,vect,position): + vect.next_to(self.func_machine,DL,buff=-.4) + self.play(ApplyMethod( + vect.move_to,position + ), + run_time=self.run_time + ) + + def get_vector_field(self,func,**kwargs): + config = dict() + config.update(self.default_vector_field_config) + config.update(kwargs) + vector_field= VectorField(func,**config) + + return vector_field + + + + + +#uploaded by Somnath Pandit. FSF2020_Vector_fields + + + -- cgit From dd361296965480c0c94b6ae035e7bdd898b112a4 Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Fri, 19 Jun 2020 21:16:20 +0530 Subject: new animation --- .../vector-fields/file1_vector_fields.gif | Bin 0 -> 5384744 bytes .../vector-fields/file1_vector_fields.py | 350 +++++++++++++++++++++ 2 files changed, 350 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file1_vector_fields.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file1_vector_fields.py diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file1_vector_fields.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file1_vector_fields.gif new file mode 100644 index 0000000..96e50ac Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file1_vector_fields.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file1_vector_fields.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file1_vector_fields.py new file mode 100644 index 0000000..6b1b686 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file1_vector_fields.py @@ -0,0 +1,350 @@ +from manimlib.imports import * + +class VectorFields(ThreeDScene): + + CONFIG = { + "axes_config": { + "x_min": -4, + "x_max": 4, + "y_min": -4, + "y_max": 4, + "z_min": -3, + "z_max": 3, + "a":-4 ,"b": 4, "c":-4 , "d":4, + "axes_shift": ORIGIN+2*LEFT, + "x_axis_config": { + "tick_frequency": 1, + # "include_tip": False, + }, + "y_axis_config": { + "tick_frequency": 1, + # "include_tip": False, + }, + "z_axis_config": { + "tick_frequency": 1, + # "include_tip": False, + }, + "num_axis_pieces": 10, + }, + "default_graph_style": { + "stroke_width": 2, + "stroke_color": WHITE, + }, + "default_vector_field_config": { + "delta_x": .5, + "delta_y": .5, + "x_min": -3, + "x_max": 3, + "y_min": -3, + "y_max": 3, + "min_magnitude": 0, + "max_magnitude": 4, + "colors": [BLUE,GREEN,ORANGE,RED], + "length_func": lambda norm : .45*sigmoid(norm), + "opacity": 1.0, + "vector_config": { + "stroke_width":3.5, + "max_tip_length_to_length_ratio": 0.35, + "max_stroke_width_to_length_ratio": 8, + }, + }, + + } + + + def construct(self): + + self.setup_axes() + axes=self.axes + + self.set_camera_orientation(distance=35, + phi=0 * DEGREES, + theta=-90 * DEGREES, + ) + self.move_camera(frame_center=axes.c2p(0,0,0)) + + self.show_2d_field() + self.wait(3) + + self.show_3d_field() + self.begin_ambient_camera_rotation(rate=-.3,) + self.wait(1.5) + axes.x_axis.rotate( + -90 * DEGREES, LEFT, + about_point=axes.c2p(0, 0, 0), + ), + axes.y_axis.rotate( + 90 * DEGREES, UP, + about_point=axes.c2p(0, 0, 0), + ), + self.move_camera( + # distance=20, + phi=85 * DEGREES, + rate_func=linear, + run_time=8 + ) + self.wait(5) + + + def show_2d_field(self): + d2_field_text=TexMobject( + r"\vec F(x,y)=-y\hat i+x\hat j", + stroke_width=1.5 + ).set_color_by_gradient( + *self.default_vector_field_config["colors"] + ) + d2_field_text.to_corner(UR,buff=.5) + + d2_field = self.get_vector_field( + lambda v: np.array([ + -v[1], + v[0], + 0 + ]), + ) + self.add_fixed_in_frame_mobjects(d2_field_text) + # self.add(d2_field) + self.play(Write(d2_field_text)) + self.play(FadeIn(d2_field)) + + self.d2_field=d2_field + self.d2_field_text=d2_field_text + + def show_3d_field(self): + d3_field_text=TexMobject( + r"\vec F(x,y,z)=-y\hat i+x\hat j+0 \hat k", + stroke_width=1.5 + ).set_color_by_gradient( + *self.default_vector_field_config["colors"] + ) + d3_field_text.to_corner(UR,buff=.5) + + d3_field= self.get_vector_field( + lambda v: np.array([ + -v[1], + v[0], + 0 + # v[0]*v[2] + ]), + z_min=-2, + z_max= 2, + delta_x= 1, + delta_y= 1, + delta_z= 1, + length_func=lambda norm : .5*sigmoid(norm), + opacity= 1, + ThreeD=True + ) + + self.remove(self.d2_field,self.d2_field_text) + self.add_fixed_in_frame_mobjects(d3_field_text) + # self.add(d3_field) + self.play(Write(d3_field_text)) + self.play(FadeIn(d3_field)) + + def get_vector_field(self,func,ThreeD=False,**kwargs): + config = dict() + config.update(self.default_vector_field_config) + config.update(kwargs) + if ThreeD: + vector_field= VectorField3D(func,**config) + else: + vector_field= VectorField(func,**config) + + vector_field.move_to(self.axes.c2p(0,0,0)) + self.vector_field=vector_field + + return vector_field + + + +#------------------------------------------------------- + #customize 3D axes + def get_three_d_axes(self, include_labels=True, include_numbers=False, **kwargs): + config = dict(self.axes_config) + config.update(kwargs) + axes = ThreeDAxes(**config) + axes.set_stroke(width=2) + self.axes=axes + + if include_numbers: + self.add_axes_numbers(axes) + + if include_labels: + self.add_axes_labels(axes) + + # Adjust axis orientation + axes.x_axis.rotate( + -0 * DEGREES, LEFT, + about_point=axes.c2p(0, 0, 0), + ) + axes.y_axis.rotate( + 0 * DEGREES, UP, + about_point=axes.c2p(0, 0, 0), + ) + + return axes + + + def setup_axes(self): + axes = self.get_three_d_axes(include_labels=True) + axes.scale(1) + # axes.center() + axes.shift(axes.axes_shift) + + self.add(axes) + self.axes = axes + + def add_axes_numbers(self, axes): + x_axis = axes.x_axis + y_axis = axes.y_axis + tex_vals_x = [ + + ("1", axes.b), + ] + tex_vals_y=[ + + ("1", axes.d) + ] + x_labels = VGroup() + y_labels = VGroup() + for tex, val in tex_vals_x: + label = TexMobject(tex) + label.scale(1) + label.next_to(x_axis.n2p(val), DOWN) + # label.rotate(180 * DEGREES) + x_labels.add(label) + x_axis.add(x_labels) + x_axis.numbers = x_labels + + for tex, val in tex_vals_y: + label = TexMobject(tex) + label.scale(1) + label.next_to(y_axis.n2p(val), LEFT) + label.rotate(90 * DEGREES) + y_labels.add(label) + + y_axis.add(y_labels) + y_axis.numbers = y_labels + + return axes + + def add_axes_labels(self, axes): + x_label = TexMobject("x") + x_label.next_to(axes.x_axis.get_end(), RIGHT) + axes.x_axis.label = x_label + + y_label = TextMobject("y") + y_label.rotate(90 * DEGREES, OUT) + y_label.next_to(axes.y_axis.get_end(), UP) + axes.y_axis.label = y_label + + z_label = TextMobject("z") + z_label.rotate(90 * DEGREES, RIGHT) + z_label.next_to(axes.z_axis.get_zenith(), LEFT) + axes.z_axis.label = z_label + for axis in axes: + axis.add(axis.label) + return axes + +#----------------------------------------------------------- + +class VectorField3D(VGroup): + CONFIG = { + "delta_x": 1, + "delta_y": 1, + "delta_z": 1, + "x_min": int(np.floor(-FRAME_WIDTH / 2)), + "x_max": int(np.ceil(FRAME_WIDTH / 2)), + "y_min": int(np.floor(-FRAME_HEIGHT / 2)), + "y_max": int(np.ceil(FRAME_HEIGHT / 2)), + "z_min":-1, + "z_max": 1, + "min_magnitude": 0, + "max_magnitude": 4, + "colors": DEFAULT_SCALAR_FIELD_COLORS, + # Takes in actual norm, spits out displayed norm + "length_func": lambda norm: 0.45 * sigmoid(norm), + "opacity": 1.0, + "vector_config": {}, + } + '''Position of the tip of vector to be fixed''' + def __init__(self, func, **kwargs): + VGroup.__init__(self, **kwargs) + self.func = func + self.rgb_gradient_function = get_rgb_gradient_function( + self.min_magnitude, + self.max_magnitude, + self.colors, + flip_alphas=False + ) + x_range = np.arange( + self.x_min, + self.x_max + self.delta_x, + self.delta_x + ) + y_range = np.arange( + self.y_min, + self.y_max + self.delta_y, + self.delta_y + ) + z_range = np.arange( + self.z_min, + self.z_max + self.delta_z, + self.delta_z + ) + for x, y, z in it.product(x_range, y_range, z_range): + point = x * RIGHT + y * UP + z * OUT + # print(point) + self.add(self.get_vector(point)) + self.set_opacity(self.opacity) + + def get_vector(self, point, **kwargs): + output = np.array(self.func(point)) + norm = get_norm(output) + if norm == 0: + output *= 0 + else: + output *= self.length_func(norm) / norm + # norm=np.linalg.norm(output) + vector_config = dict(self.vector_config) + vector_config.update(kwargs) + + vect = Vector( + output, + **vector_config + ) + vect_perp=vect.copy().rotate(PI/2, axis=output) + vect= VGroup(vect,vect_perp) + # vect= self.position_vector(vect,point,output,norm) + vect.shift(point) + fill_color = rgb_to_color( + self.rgb_gradient_function(np.array([norm]))[0] + ) + vect.set_color(fill_color) + return vect + + '''def position_vector(self,vect,point,output,norm): + theta,phi=self.get_theta_phi(output,norm) + vect.rotate(PI-phi, axis=RIGHT) + vect.rotate(theta, axis=IN) + # or apply rotation matrix? + return vect + + def get_theta_phi(self,output,norm): + if norm==0: + phi,theta=0,0 + else: + phi= np.arccos(output[-1]/norm) + if output[0]!=0: + theta= np.arccos(output[0]/(norm*np.sin(phi))) + else: + theta= 0 + return phi,theta''' + + + + #uploaded by Somnath Pandit. FSF2020_Vector_fields + + + -- cgit From 97c037a7a22fc31083ad48e6faa661645dfbcd40 Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Fri, 19 Jun 2020 23:36:15 +0530 Subject: update positions --- .../file3_constructing_vector_field.gif | Bin 847326 -> 969466 bytes .../file3_constructing_vector_field.py | 7 ++++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif index a3ac7ed..cc10583 100644 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.py index f90705a..1fce3da 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.py +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.py @@ -45,7 +45,9 @@ class VectorFields(GraphScene): ) self.show_points() + self.wait(.5) self.show_func_machine() + self.wait(1) self.produce_vectors(vector_field) self.wait(2) @@ -102,14 +104,14 @@ class VectorFields(GraphScene): def go_to_machine(self,dot): self.play(ApplyMethod( dot.move_to, - self.func_machine, + self.func_machine,[0,1,0], ), run_time=self.run_time ) self.play(FadeOut(dot),run_time=self.run_time) def take_vec_from_machine(self,vect,position): - vect.next_to(self.func_machine,DL,buff=-.4) + vect.next_to(self.func_machine,DOWN,buff=-.4) self.play(ApplyMethod( vect.move_to,position ), @@ -131,4 +133,3 @@ class VectorFields(GraphScene): #uploaded by Somnath Pandit. FSF2020_Vector_fields - -- cgit From 08734b800bc04c6936e8f4a97617d2dffd2c1776 Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Fri, 19 Jun 2020 23:43:09 +0530 Subject: Update README.md --- .../integrals-of-multivariable-functions/vector-fields/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/README.md b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/README.md index ef58bb1..7a8df11 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/README.md +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/README.md @@ -1,4 +1,5 @@ - +**file1_vector_fields** +![file1_vector_fields](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file1_vector_fields.gif) **file2_grad_of_scalar_function** ![file2_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/vector-fields/file2_grad_of_scalar_function.gif) -- cgit From 07ddf72082f5907f441ed73b15642c8d82dec80f Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Tue, 23 Jun 2020 21:11:09 +0530 Subject: update as per review --- .../file3_constructing_vector_field.gif | Bin 969466 -> 615613 bytes .../file3_constructing_vector_field.py | 40 ++++++++++++++++----- 2 files changed, 31 insertions(+), 9 deletions(-) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif index cc10583..e165a15 100644 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.py index 1fce3da..13211e9 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.py +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.py @@ -102,20 +102,41 @@ class VectorFields(GraphScene): i+=1 def go_to_machine(self,dot): - self.play(ApplyMethod( - dot.move_to, - self.func_machine,[0,1,0], + if self.run_time>.5: + self.play(ApplyMethod( + dot.next_to, + self.func_machine,4*UP, ), - run_time=self.run_time - ) - self.play(FadeOut(dot),run_time=self.run_time) + run_time=self.run_time + ) + self.dot=dot def take_vec_from_machine(self,vect,position): - vect.next_to(self.func_machine,DOWN,buff=-.4) - self.play(ApplyMethod( + vect.next_to(self.func_machine,DOWN,buff=.1) + if self.run_time>.5: + self.play( + ApplyMethod( + self.dot.shift,DOWN, + run_time=self.run_time + )), + self.play( + FadeOut(self.dot), + run_time=.2 + ) + self.play( + FadeIn(vect), + run_time=.4 + ) + else: + self.remove(self.dot) + self.add(vect) + self.wait(.1) + + self.play( + ApplyMethod( vect.move_to,position ), - run_time=self.run_time + run_time=self.run_time ) def get_vector_field(self,func,**kwargs): @@ -133,3 +154,4 @@ class VectorFields(GraphScene): #uploaded by Somnath Pandit. FSF2020_Vector_fields + -- cgit From 0dee2b48260041c5bffe471af4160a7ab515a99b Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Sat, 27 Jun 2020 14:40:33 +0530 Subject: slopefield --- .../vector-fields/file4_slope_field.py | 211 +++++++++++++++++++++ 1 file changed, 211 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file4_slope_field.py diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file4_slope_field.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file4_slope_field.py new file mode 100644 index 0000000..853bf9e --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file4_slope_field.py @@ -0,0 +1,211 @@ +from manimlib.imports import * + + +class SlopeFields(GraphScene): + CONFIG = { + "x_min" : -2, + "x_max" : 2, + "y_min" : -2, + "y_max" : 2, + "graph_origin": ORIGIN+2.5*LEFT, + "x_axis_width": 7, + "y_axis_height": 7, + "x_tick_frequency": 1, + "y_tick_frequency": 1, + "default_slope_field_config": { + "delta_x": .25, + "delta_y": .25, + "min_magnitude": -PI, + "max_magnitude": PI, + "colors": [BLUE_B,GREEN_B,YELLOW,ORANGE], + "length_func": lambda norm : .6*sigmoid(norm), + "opacity": .75, + "slope_config": { + "stroke_width":6, + "max_stroke_width_to_length_ratio":6 + }, + }, + + "a":-3 ,"b": 3, "c": -3 ,"d": 3, + } + + 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) + + slope_field=self.get_slope_field( + lambda x,y:-2*(x-self.graph_origin[0])*(y-self.graph_origin[1]), + x_min=self.a-2.5, + x_max=self.b-2.5, + y_min=self.c, + y_max=self.d, + ) + self.add(slope_field) + '''self.show_points() + self.wait(.5) + self.show_func_machine() + self.wait(1) + self.produce_slopes(slope_field)''' + self.wait(2) + + + + + def show_points(self): + dn=1 + x_vals=np.arange(self.a,self.b,dn) + y_vals=np.arange(self.c,self.d,dn) + dots=VGroup() + for x_val in x_vals: + for y_val in y_vals: + dot=Dot( + self.coords_to_point(x_val,y_val), + radius=.05, + color=TEAL, + ) + dots.add(dot) + self.play(ShowCreation(dots, run_time=1)) + self.dots=dots + + def show_func_machine(self): + machine=RoundedRectangle( + height=3, + width=4, + color=PURPLE, + stroke_width=8 + ).to_edge(RIGHT, buff=.4) + + machine_label=TextMobject( + r"Line segment\\ with slope\\"," $y'=-2xy$", + stroke_width=1.2, + color=BLUE + ).next_to(machine,IN) + machine_label[1].set_color_by_gradient( + *self.default_slope_field_config["colors"] + ) + self.add(machine, machine_label) + + self.func_machine = machine + + + def produce_slopes(self,slope_field): + count,i=1,0 + self.run_time=1 + for dot in self.dots: + if i==count: + self.run_time=.05 + position=dot.get_center() + line= slope_field.get_slope(position) + self.go_to_machine(dot) + self.take_line_from_machine(line,position) + i+=1 + + def go_to_machine(self,dot): + if self.run_time>.5: + self.play(ApplyMethod( + dot.next_to, + self.func_machine,4*UP, + ), + run_time=self.run_time + ) + self.dot=dot + + def take_line_from_machine(self,vect,position): + vect.next_to(self.func_machine,DOWN,buff=.1) + if self.run_time>.5: + self.play( + ApplyMethod( + self.dot.shift,DOWN, + run_time=self.run_time + )), + self.play( + FadeOut(self.dot), + run_time=.2 + ) + self.play( + FadeIn(vect), + run_time=.4 + ) + else: + self.remove(self.dot) + self.add(vect) + self.wait(.1) + + self.play( + ApplyMethod( + vect.move_to,position + ), + run_time=self.run_time + ) + + def get_slope_field(self,func,**kwargs): + config = dict() + config.update(self.default_slope_field_config) + config.update(kwargs) + slope_field= SlopeField(func,**config) + + return slope_field + + +class SlopeField(VGroup): + CONFIG = { + "delta_x": 0.5, + "delta_y": 0.5, + "x_min": int(np.floor(-FRAME_WIDTH / 2)), + "x_max": int(np.ceil(FRAME_WIDTH / 2)), + "y_min": int(np.floor(-FRAME_HEIGHT / 2)), + "y_max": int(np.ceil(FRAME_HEIGHT / 2)), + "min_magnitude": 0, + "max_magnitude": 2, + "slope_length_factor": .2, + "colors": DEFAULT_SCALAR_FIELD_COLORS, + "opacity": 1.0, + "line_config": {}, + } + + def __init__(self, func, **kwargs): + VGroup.__init__(self, **kwargs) + self.func = func + self.rgb_gradient_function = get_rgb_gradient_function( + self.min_magnitude, + self.max_magnitude, + self.colors, + flip_alphas=False + ) + x_range = np.arange( + self.x_min, + self.x_max + self.delta_x, + self.delta_x + ) + y_range = np.arange( + self.y_min, + self.y_max + self.delta_y, + self.delta_y + ) + for x, y in it.product(x_range, y_range): + point = x * RIGHT + y * UP + self.add(self.get_slope(point)) + self.set_opacity(self.opacity) + + def get_slope(self, point, **kwargs): + slope = self.func(*point[:2]) + line_config = dict(self.line_config) + line_config.update(kwargs) + line = Line(ORIGIN,self.slope_length_factor*RIGHT, **line_config) + line.move_to(point).rotate(np.arctan(slope)) + fill_color = rgb_to_color( + self.rgb_gradient_function(np.array([slope]))[0] + ) + line.set_color(fill_color) + return line + + + + +#uploaded by Somnath Pandit. FSF2020_Vector_fields + + + -- cgit From 58b9da3540c18794cd10562971c4841df3e98527 Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Sat, 27 Jun 2020 18:15:53 +0530 Subject: slope field --- .../vector-fields/README.md | 2 + .../vector-fields/file4_slope_field.gif | Bin 0 -> 1860382 bytes .../vector-fields/file4_slope_field.py | 134 +++++++++++++-------- 3 files changed, 87 insertions(+), 49 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file4_slope_field.gif diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/README.md b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/README.md index 7a8df11..ffab976 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/README.md +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/README.md @@ -7,3 +7,5 @@ **file3_constructing_vector_field** ![file3_constructing_vector_field](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif) +**file4_slope_field** +![file4_slope_field](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file4_slope_field.gif) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file4_slope_field.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file4_slope_field.gif new file mode 100644 index 0000000..c39ec54 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file4_slope_field.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file4_slope_field.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file4_slope_field.py index 853bf9e..8ebb6f5 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file4_slope_field.py +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file4_slope_field.py @@ -13,20 +13,17 @@ class SlopeFields(GraphScene): "x_tick_frequency": 1, "y_tick_frequency": 1, "default_slope_field_config": { - "delta_x": .25, - "delta_y": .25, - "min_magnitude": -PI, - "max_magnitude": PI, - "colors": [BLUE_B,GREEN_B,YELLOW,ORANGE], - "length_func": lambda norm : .6*sigmoid(norm), - "opacity": .75, - "slope_config": { - "stroke_width":6, - "max_stroke_width_to_length_ratio":6 + "delta_x": .2, + "delta_y": .2, + "opacity": 1, + "color": BLUE_A, + "slope_length_factor": .2, + "line_config": { + "stroke_width":2.5, }, }, - "a":-3 ,"b": 3, "c": -3 ,"d": 3, + "a":-1.9 ,"b": 2, "c": -1.9 ,"d": 2, } def construct(self): @@ -37,25 +34,28 @@ class SlopeFields(GraphScene): self.setup_axes(animate=False) slope_field=self.get_slope_field( - lambda x,y:-2*(x-self.graph_origin[0])*(y-self.graph_origin[1]), - x_min=self.a-2.5, - x_max=self.b-2.5, - y_min=self.c, - y_max=self.d, + lambda x,y:-2.0*(x-self.graph_origin[0])*(y-self.graph_origin[1]), + x_min=self.graph_origin[0]+self.a, + x_max=self.graph_origin[0]+self.b, + y_min=self.graph_origin[1]+self.c, + y_max=self.graph_origin[1]+self.d, + color= GREEN_B ) - self.add(slope_field) - '''self.show_points() + + self.show_points() self.wait(.5) self.show_func_machine() self.wait(1) - self.produce_slopes(slope_field)''' + self.produce_slopes(slope_field) + # self.add(slope_field) + self.glimpse_of_solutions() self.wait(2) def show_points(self): - dn=1 + dn=1.0/5 x_vals=np.arange(self.a,self.b,dn) y_vals=np.arange(self.c,self.d,dn) dots=VGroup() @@ -63,7 +63,7 @@ class SlopeFields(GraphScene): for y_val in y_vals: dot=Dot( self.coords_to_point(x_val,y_val), - radius=.05, + radius=.04, color=TEAL, ) dots.add(dot) @@ -83,16 +83,15 @@ class SlopeFields(GraphScene): stroke_width=1.2, color=BLUE ).next_to(machine,IN) - machine_label[1].set_color_by_gradient( - *self.default_slope_field_config["colors"] - ) - self.add(machine, machine_label) + machine_label[1].set_color(GREEN) + machine=VGroup(machine, machine_label) + self.play(FadeIn(machine)) self.func_machine = machine def produce_slopes(self,slope_field): - count,i=1,0 + count,i=3,0 self.run_time=1 for dot in self.dots: if i==count: @@ -114,8 +113,9 @@ class SlopeFields(GraphScene): self.dot=dot def take_line_from_machine(self,vect,position): - vect.next_to(self.func_machine,DOWN,buff=.1) + if self.run_time>.5: + vect.next_to(self.func_machine,DOWN,buff=.1) self.play( ApplyMethod( self.dot.shift,DOWN, @@ -129,17 +129,17 @@ class SlopeFields(GraphScene): FadeIn(vect), run_time=.4 ) - else: - self.remove(self.dot) - self.add(vect) - self.wait(.1) - - self.play( + self.play( ApplyMethod( vect.move_to,position ), run_time=self.run_time ) + else: + self.remove(self.dot) + self.add(vect) + vect.move_to(position) + def get_slope_field(self,func,**kwargs): config = dict() @@ -147,7 +147,52 @@ class SlopeFields(GraphScene): config.update(kwargs) slope_field= SlopeField(func,**config) - return slope_field + return slope_field + + def glimpse_of_solutions(self): + sol_text= TextMobject( + r"The solution curves\\ seem to be like...", + color= BLUE, + stroke_width=1.2 + ) + sol_text.to_corner(UR, buff=1) + condition_text= TextMobject( + r"for different\\ initial conditions", + color= GOLD, + stroke_width=1.1 + ) + condition_text.next_to(sol_text,DOWN,buff=1) + solution1 = self.get_graph( + lambda x : np.exp(-x**2), + x_min = self.a, + x_max = self.b, + color = PINK) + solution2 = self.get_graph( + lambda x : .5*np.exp(-x**2), + x_min = self.a, + x_max = self.b, + color = YELLOW) + solution3 = self.get_graph( + lambda x : 1.5*np.exp(-x**2), + x_min = self.a, + x_max = self.b, + color = BLUE) + solution4 = self.get_graph( + lambda x : -np.exp(-x**2), + x_min = self.a, + x_max = self.b, + color = RED_E) + + self.play(FadeOut(self.func_machine)) + self.play(Write(sol_text)) + self.wait(.6) + self.play(ShowCreation(solution1)) + self.play(Write(condition_text)) + self.play(ShowCreation(solution2)) + self.wait(.5) + self.play(ShowCreation(solution3)) + self.wait(.5) + self.play(ShowCreation(solution4)) class SlopeField(VGroup): @@ -158,23 +203,16 @@ class SlopeField(VGroup): "x_max": int(np.ceil(FRAME_WIDTH / 2)), "y_min": int(np.floor(-FRAME_HEIGHT / 2)), "y_max": int(np.ceil(FRAME_HEIGHT / 2)), - "min_magnitude": 0, - "max_magnitude": 2, - "slope_length_factor": .2, - "colors": DEFAULT_SCALAR_FIELD_COLORS, "opacity": 1.0, + "color": WHITE, + "slope_length_factor": .25, "line_config": {}, } def __init__(self, func, **kwargs): VGroup.__init__(self, **kwargs) self.func = func - self.rgb_gradient_function = get_rgb_gradient_function( - self.min_magnitude, - self.max_magnitude, - self.colors, - flip_alphas=False - ) + x_range = np.arange( self.x_min, self.x_max + self.delta_x, @@ -195,11 +233,9 @@ class SlopeField(VGroup): line_config = dict(self.line_config) line_config.update(kwargs) line = Line(ORIGIN,self.slope_length_factor*RIGHT, **line_config) - line.move_to(point).rotate(np.arctan(slope)) - fill_color = rgb_to_color( - self.rgb_gradient_function(np.array([slope]))[0] - ) - line.set_color(fill_color) + line.move_to(point).rotate(np.arctan(slope/3.2)) + + line.set_color(self.color) return line -- cgit From c5c9807d2b6262a2805054c036a7486f57e766df Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Tue, 30 Jun 2020 01:43:11 +0530 Subject: extended animation --- .../file3_constructing_vector_field.gif | Bin 615613 -> 3838142 bytes .../file3_constructing_vector_field.py | 81 +++++++++++++++------ 2 files changed, 60 insertions(+), 21 deletions(-) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif index e165a15..6a57cab 100644 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.py index 13211e9..fc56306 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.py +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.py @@ -3,10 +3,10 @@ from manimlib.imports import * class VectorFields(GraphScene): CONFIG = { - "x_min" : -2, - "x_max" : 2, - "y_min" : -2, - "y_max" : 2, + "x_min" : -4, + "x_max" : 4, + "y_min" : -4, + "y_max" : 4, "graph_origin": ORIGIN+2.5*LEFT, "x_axis_width": 7, "y_axis_height": 7, @@ -18,15 +18,15 @@ class VectorFields(GraphScene): "min_magnitude": 0, "max_magnitude": 4, "colors": [GREEN,GREEN,YELLOW,RED], - "length_func": lambda norm : .6*sigmoid(norm), + "length_func": lambda n: n/2.5, "opacity": .75, "vector_config": { "stroke_width":6, - "max_stroke_width_to_length_ratio":6 + "max_stroke_width_to_length_ratio":4 }, }, - "a":-1.5 ,"b": 2, "c": -1.5 ,"d": 2, + "a":-3.5 ,"b": 4, "c": -3.5 ,"d": 4, } def construct(self): @@ -35,27 +35,30 @@ class VectorFields(GraphScene): self.X=X ;self.Y=Y self.setup_axes(animate=False) - - vector_field=self.get_vector_field( - lambda v: np.array([ + vector_function = lambda v: np.array([ (v[0]-self.graph_origin[0])*(v[1]-self.graph_origin[1]), -(v[0]-self.graph_origin[0]), 0, ]) - ) + + vector_field=self.get_vector_field( + vector_function, + colors= [GREEN] + ) self.show_points() self.wait(.5) self.show_func_machine() self.wait(1) self.produce_vectors(vector_field) + self.wait(.5) + self.scale_down_vectors(vector_function) self.wait(2) - def show_points(self): - dn=.5 + dn=1 x_vals=np.arange(self.a,self.b,dn) y_vals=np.arange(self.c,self.d,dn) dots=VGroup() @@ -84,7 +87,9 @@ class VectorFields(GraphScene): ).set_color_by_gradient( *self.default_vector_field_config["colors"] ).next_to(machine,IN) - self.add(machine,machine_label) + + machine=VGroup(machine,machine_label) + self.add(machine) self.func_machine=machine @@ -92,6 +97,7 @@ class VectorFields(GraphScene): def produce_vectors(self,vector_field): count,i=3,0 self.run_time=1 + non_scaled_vectors=VGroup() for dot in self.dots: if i==count: self.run_time=.05 @@ -99,8 +105,11 @@ class VectorFields(GraphScene): vect= vector_field.get_vector(position) self.go_to_machine(dot) self.take_vec_from_machine(vect,position) + non_scaled_vectors.add(vect) i+=1 + self.non_scaled_vectors=non_scaled_vectors + def go_to_machine(self,dot): if self.run_time>.5: self.play(ApplyMethod( @@ -113,14 +122,19 @@ class VectorFields(GraphScene): def take_vec_from_machine(self,vect,position): vect.next_to(self.func_machine,DOWN,buff=.1) + if self.run_time>.5: + point_coord=TexMobject( + "(x_i,y_i)" + ).next_to(self.dot,RIGHT,buff= .01).scale(.75) + input_point=VGroup(point_coord, self.dot) self.play( ApplyMethod( - self.dot.shift,DOWN, + input_point.shift,DOWN, run_time=self.run_time )), self.play( - FadeOut(self.dot), + FadeOut(input_point), run_time=.2 ) self.play( @@ -130,15 +144,40 @@ class VectorFields(GraphScene): else: self.remove(self.dot) self.add(vect) - self.wait(.1) + self.wait(1.0/15) self.play( - ApplyMethod( - vect.move_to,position - ), + vect.move_to,position, run_time=self.run_time ) - + + def scale_down_vectors(self,vector_function): + scale_down_text=TextMobject( + r"Vectors are rescaled\\ for clarity\\ and \\", + r"colors are used to \\ indicate magnitudes", + stroke_width=1.2 + ) + scale_down_text[0][:7].set_color(BLUE) + scale_down_text[1].set_color_by_gradient( + *self.default_vector_field_config["colors"] + ) + scale_down_text.to_corner(UR).shift(DOWN) + scaled_vector_field= self.get_vector_field( + vector_function, + length_func= lambda norm : .75*sigmoid(norm) + ) + for vector in self.non_scaled_vectors: + scaled_vect= scaled_vector_field.get_vector(vector.get_center()) + vector.target= scaled_vect + + self.play(FadeOut(self.func_machine)) + self.play(Write(scale_down_text)) + self.wait(1.2) + self.play(LaggedStartMap( + MoveToTarget, self.non_scaled_vectors, + run_time=3 + )) + def get_vector_field(self,func,**kwargs): config = dict() config.update(self.default_vector_field_config) -- cgit From 837c5fd9c03ac9c2b8a770dcde852e27e256e3cf Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Thu, 2 Jul 2020 14:30:42 +0530 Subject: unfinished work --- .../unfinished_vector_line_integral.py | 479 +++++++++++++++++++++ 1 file changed, 479 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py new file mode 100644 index 0000000..9cdb976 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py @@ -0,0 +1,479 @@ +from manimlib.imports import * + +class LineIntegrationProcess(SpecialThreeDScene): + + CONFIG = { + "axes_config": { + "x_min": 0, + "x_max": 4, + "y_min": 0, + "y_max": 4, + "z_min": 0, + "z_max": 3, + "a":-3 ,"b": 3, "c":0 , "d":3, + "axes_shift":IN+2*DL, + "x_axis_config": { + "tick_frequency": 1, + # "include_tip": False, + }, + "y_axis_config": { + "tick_frequency": 1, + # "include_tip": False, + }, + "z_axis_config": { + "tick_frequency": 1, + # "include_tip": False, + }, + "num_axis_pieces": 20, + }, + "default_vector_field_config": { + "delta_x": .5, + "delta_y": .5, + "x_min": -3, + "x_max": 2, + "y_min": -3, + "y_max": 2, + "min_magnitude": 0, + "max_magnitude": 4, + "colors": [GREEN,YELLOW,RED], + "length_func": lambda norm : .4*sigmoid(norm), + "opacity": 1.0, + "vector_config": { + "stroke_width":2 + }, + }, + "default_graph_style": { + "stroke_width": 2, + "stroke_color": WHITE, + }, + + "Func": lambda x,y: 1+x**2*y/15 + } + + + def construct(self): + + self.setup_axes() + axes=self.axes + + self.set_camera_orientation(distance=10, + phi=0 * DEGREES, + theta=-90 * DEGREES, + ) + + fn_text=TexMobject( + r"\vec F = x^2\hat i-xy\hat j" + ).set_color_by_gradient( + *self.default_vector_field_config["colors"] + ) + fn_text.to_corner(UR,buff=.8).shift(DOWN) + + origin=axes.c2p(0,0,0) + v_field=self.get_vector_field( + lambda v: np.array([ + (v[0]-origin[0])**2, + -(v[0]-origin[0])*(v[1]-origin[1]), + 0, + ]), + ) + + # self.play(Write(surface)) + self.add_fixed_in_frame_mobjects(fn_text) + # self.play(Write(v_field),Write(fn_text)) + self.add(v_field, fn_text) + self.get_line_of_int() + # self.begin_ambient_camera_rotation(rate=0.04) + self.get_dot_product_values() + '''self.get_field_values_on_line() + self.wait(1.5) + self.area=self.get_area() + area_text=TextMobject("Line"," Integral in the",r" scalar field\\"," means this" ,"area") + area_text.set_color_by_tex_to_color_map({ + "Line": PINK, "scalar":BLUE, "area":TEAL_A + }) + area_text.to_edge(TOP,buff=MED_SMALL_BUFF) + + self.remove(self.values_on_line_text) + self.add_fixed_in_frame_mobjects(area_text) + self.play(Write(area_text)) + self.play(Write(self.area),run_time=2) + self.play(FadeOut(VGroup(surface,fn_text))) + self.wait() + + self.stop_ambient_camera_rotation() + # self.get_lines() + + self.remove(axes,surface) + self.trasform_to_graphs()''' + 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_line_of_int(self): + line_of_int_text=TextMobject(r"Line of integration is\\","$\\vec r(t)=\cos(t)\hat i+\sin(t)\hat j$") + line_of_int_text[1].set_color(PINK) + line_of_int_text.to_edge(TOP,buff=SMALL_BUFF) + + + line_of_int=(self.get_curve( + self.Func,on_surface=False + )) + line_of_int.set_style( + stroke_width=5, + stroke_color=PINK, + ) + + self.add_fixed_in_frame_mobjects(line_of_int_text) + self.play(Write(line_of_int_text)) + self.wait(.5) + self.play(ShowCreation(line_of_int),run_time=1.5) + # self.add(line_of_int) + + self.line_of_int=line_of_int + self.line_of_int_text=line_of_int_text + + def get_dot_product_values(self): + self.get_vector_and_tangent() + + + + def get_vector_and_tangent(self): + dot=self.dots[self.index] + self.show_specific_vectors(dot) + self.play(Write(self.func_val)) + self.wait(1) + self.show_tangent(dot) + self.play(FadeIn(VGroup(*[ + dot.set_color(ORANGE).scale(1.4) + for dot in self.dots ] + ))) + + + def show_specific_vectors(self,dots): + for dot in dots: + vector=self.vector_field.get_vector(dot.get_center()) + vector.set_color(ORANGE) + + self.play(Write(vector),run_time=.2) + + + def show_tangent(self,dot): + tangent_sym=TextMobject("$\\vec T(x_i,y_i)$",color="#DC75CD").scale(.8) + x=dot.get_center() + angle=self.angle_of_tangent( + self.point_to_coords(x)[0], + self.curve, + dx=0.01 + ) + vect = Vector().rotate(angle,about_point=x) + vect.set_color("#DC75CD") + tangent=vect.next_to(x,DR,buff=0) + tangent_sym.next_to(tangent,DOWN,buff=.1) + self.play(Write(VGroup(tangent,tangent_sym))) + + self.tangent_sym=tangent_sym + + def dot_product(self): + + dot_sym=Dot().next_to(self.func_val,RIGHT) + + self.play(FadeOut(VGroup( + self.at_any_points_text, + self.evaluate_text + ))) + self.play(Write(self.dot_prod_text)) + self.play( + FadeIn(dot_sym), + ApplyMethod( + self.tangent_sym.next_to, + dot_sym, RIGHT + )) + + self.dot_sym=dot_sym + def get_field_values_on_line(self): + self.remove(self.line_of_int_text) + + values_on_line_text=TextMobject("Values"," of"," function","on the ","line") + values_on_line_text.set_color_by_tex_to_color_map({ + "Values":YELLOW, "function":BLUE,"line":PINK + }) + values_on_line_text.to_edge(TOP,buff=SMALL_BUFF) + + values_on_surface=(self.get_curve( + self.Func,on_surface=True + )) + values_on_surface.set_style( + stroke_width=5, + stroke_color=YELLOW, + ) + + self.add_fixed_in_frame_mobjects(values_on_line_text) + self.play(Write(values_on_line_text)) + # self.wait() + self.play(ShowCreation(values_on_surface),run_time=3) + # self.add(values_on_surface) + + self.values_on_surface=values_on_surface + self.values_on_line_text=values_on_line_text + + + def trasform_to_graphs(self): + on_surface_graph=(self.get_graph( + self.Func,on_surface=True + )) + on_surface_graph.set_style( + stroke_width=5, + stroke_color=YELLOW, + ) + + line_graph=(self.get_graph( + self.Func,on_surface=False + )) + line_graph.set_style( + stroke_width=5, + stroke_color=PINK, + ) + + self.on_surface_graph=on_surface_graph + self.line_graph=line_graph + graph_area=self.get_area(graph=True) + + into_graph=[ + ReplacementTransform( + self.values_on_surface, + on_surface_graph + ), + ReplacementTransform( + self.line_of_int, + line_graph + ), + ReplacementTransform( + self.area, + graph_area + ), + ] + + self.move_camera( + # distance=20, + phi=90 * DEGREES, + theta=-90 * DEGREES, + added_anims=into_graph, + run_time=2 + ) + + def get_area(self,graph=False): + axes=self.axes + if graph: + on_surface=self.on_surface_graph + on_base=self.line_graph + else: + on_surface=self.values_on_surface + on_base=self.line_of_int + area =Polygon( + *[ + on_surface.get_point_from_function(t) + for t in np.arange(0,PI,0.01) + ], + *[ + on_base.get_point_from_function(t) + for t in np.arange(PI,0,-0.01) + ], + stroke_width=0, + fill_color=TEAL_A, + fill_opacity=.6, + ) + + return area + + def get_curve(self,func,on_surface=False ,**kwargs): + config = dict() + config.update(self.default_graph_style) + config.update({ + "t_min": 0, + "t_max": PI/2, + }) + config.update(kwargs) + r=abs(self.axes.a) + curve=ParametricFunction( + lambda t: self.axes.c2p( + r*np.cos(t), + r*np.sin(t), + func(r*np.cos(t), r*np.sin(t))*bool(on_surface) + ), + **config, + ) + return curve + + + def get_surface(self, func, **kwargs): + axes=self.axes + config = { + "u_min": axes.a-.2, + "u_max": axes.b+.2, + "v_min": axes.c-.1, + "v_max": axes.d, + "resolution": ( + 2*(axes.y_max - axes.y_min) // axes.y_axis.tick_frequency, + (axes.x_max - axes.x_min) // axes.x_axis.tick_frequency, + ), + } + + config.update(self.default_surface_config) + config.update(kwargs) + return ParametricSurface( + lambda x,y : axes.c2p( + x, y, func(x, y) + ), + **config + ) + + def get_graph(self,func,on_surface=False ,**kwargs): + config = dict() + config.update(self.default_graph_style) + config.update({ + "t_min": 0, + "t_max": PI, + }) + config.update(kwargs) + slice_curve=ParametricFunction( + lambda t: self.axes.c2p( + 4*np.cos(t), + 0, + 2+func(3*np.cos(t), 3*np.sin(t))*bool(on_surface) + ), + **config, + ) + return slice_curve + + def get_lines(self): + pass + axes = self.axes + labels=[axes.x_axis.n2p(axes.a), axes.x_axis.n2p(axes.b), axes.y_axis.n2p(axes.c), + axes.y_axis.n2p(axes.d)] + + + surface_corners=[] + for x,y,z in self.region_corners: + surface_corners.append([x,y,self.Func(x,y)]) + + lines=VGroup() + for start , end in zip(surface_corners, + self.region_corners): + lines.add(self.draw_lines(start,end,"PINK")) + + for start , end in zip(labels, + self.region_corners): + # lines.add(self.draw_lines(start,end,"BLUE")) + # print (start,end) + pass + # self.play(ShowCreation(lines)) + self.add(lines) + + + def draw_lines(self,start,end,color): + start=self.axes.c2p(*start) + end=self.axes.c2p(*end) + line=DashedLine(start,end,color=color) + + return line + +#------------------------------------------------------- + #customize 3D axes + def get_three_d_axes(self, include_labels=True, include_numbers=True, **kwargs): + config = dict(self.axes_config) + config.update(kwargs) + axes = ThreeDAxes(**config) + axes.set_stroke(width=2) + self.axes=axes + + if include_numbers: + self.add_axes_numbers(axes) + + if include_labels: + self.add_axes_labels(axes) + + # Adjust axis orientation + '''axes.x_axis.rotate( + -90 * DEGREES, LEFT, + about_point=axes.c2p(0, 0, 0), + ) + axes.y_axis.rotate( + 90 * DEGREES, UP, + about_point=axes.c2p(0, 0, 0), + )''' + + return axes + + + def setup_axes(self): + axes = self.get_three_d_axes(include_labels=True) + axes.scale(1) + # axes.center() + axes.shift(axes.axes_shift) + + self.add(axes) + self.axes = axes + + def add_axes_numbers(self, axes): + x_axis = axes.x_axis + y_axis = axes.y_axis + tex_vals_x = [ + + ("1", axes.b), + ] + tex_vals_y=[ + + ("1", axes.d) + ] + x_labels = VGroup() + y_labels = VGroup() + for tex, val in tex_vals_x: + label = TexMobject(tex) + label.scale(1) + label.next_to(x_axis.n2p(val), DOWN) + # label.rotate(180 * DEGREES) + x_labels.add(label) + x_axis.add(x_labels) + x_axis.numbers = x_labels + + for tex, val in tex_vals_y: + label = TexMobject(tex) + label.scale(1) + label.next_to(y_axis.n2p(val), LEFT) + label.rotate(90 * DEGREES) + y_labels.add(label) + + y_axis.add(y_labels) + y_axis.numbers = y_labels + + return axes + + def add_axes_labels(self, axes): + x_label = TexMobject("x") + x_label.next_to(axes.x_axis.get_end(), RIGHT) + axes.x_axis.label = x_label + + y_label = TextMobject("y") + y_label.rotate(90 * DEGREES, OUT) + y_label.next_to(axes.y_axis.get_end(), UP) + axes.y_axis.label = y_label + + z_label = TexMobject("") + z_label.rotate(90 * DEGREES, RIGHT) + z_label.next_to(axes.z_axis.get_zenith(), LEFT) + axes.z_axis.label = z_label + for axis in axes: + axis.add(axis.label) + return axes + + + + #uploaded by Somnath Pandit.FSF2020_Line_Integrals -- cgit From d193d392587d0f67eb4e8993324ec5d633695f3b Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Thu, 2 Jul 2020 15:01:46 +0530 Subject: unfinished work --- .../unfinished_vector_line_integral.py | 39 ++++++++++------------ 1 file changed, 17 insertions(+), 22 deletions(-) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py index 9cdb976..410ea98 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py @@ -146,34 +146,29 @@ class LineIntegrationProcess(SpecialThreeDScene): def get_vector_and_tangent(self): - dot=self.dots[self.index] - self.show_specific_vectors(dot) - self.play(Write(self.func_val)) - self.wait(1) - self.show_tangent(dot) - self.play(FadeIn(VGroup(*[ - dot.set_color(ORANGE).scale(1.4) - for dot in self.dots ] - ))) + t_tracker = ValueTracker(0) + self.t_tracker = t_tracker + t = t_tracker.get_value + coord = [np.cos(t()), np.sin(t())] + self.show_vectors(coord) + self.show_tangent(coord) - def show_specific_vectors(self,dots): - for dot in dots: - vector=self.vector_field.get_vector(dot.get_center()) - vector.set_color(ORANGE) - - self.play(Write(vector),run_time=.2) - + def show_vector(self,coord): + vector = self.vector_field.get_vector(coord) + vector.set_color(ORANGE) + + self.add(vector) + # self.play(Write(vector),run_time=.2) - def show_tangent(self,dot): + def show_tangent(self,coord): tangent_sym=TextMobject("$\\vec T(x_i,y_i)$",color="#DC75CD").scale(.8) - x=dot.get_center() - angle=self.angle_of_tangent( - self.point_to_coords(x)[0], - self.curve, + angle=self.angle_of_tangent( + coord[0], + self.line_of_int, dx=0.01 ) - vect = Vector().rotate(angle,about_point=x) + vect = Vector().rotate(angle,about_point=coord) vect.set_color("#DC75CD") tangent=vect.next_to(x,DR,buff=0) tangent_sym.next_to(tangent,DOWN,buff=.1) -- cgit From 30e1c7072158642732aee18a87a803955c15d94a Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Thu, 2 Jul 2020 15:37:42 +0530 Subject: unfinished work --- .../unfinished_vector_line_integral.py | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py index 410ea98..2a6467d 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py @@ -84,7 +84,7 @@ class LineIntegrationProcess(SpecialThreeDScene): self.get_line_of_int() # self.begin_ambient_camera_rotation(rate=0.04) self.get_dot_product_values() - '''self.get_field_values_on_line() + '''self.get_dot_prod_values_on_line() self.wait(1.5) self.area=self.get_area() area_text=TextMobject("Line"," Integral in the",r" scalar field\\"," means this" ,"area") @@ -132,7 +132,7 @@ class LineIntegrationProcess(SpecialThreeDScene): ) self.add_fixed_in_frame_mobjects(line_of_int_text) - self.play(Write(line_of_int_text)) + # self.play(Write(line_of_int_text)) self.wait(.5) self.play(ShowCreation(line_of_int),run_time=1.5) # self.add(line_of_int) @@ -142,15 +142,20 @@ class LineIntegrationProcess(SpecialThreeDScene): def get_dot_product_values(self): self.get_vector_and_tangent() - + self.play(ApplyMethod( + t_tracker.set_value, PI/2, + rate_func=linear, + run_time=.5, + ) + ) def get_vector_and_tangent(self): t_tracker = ValueTracker(0) self.t_tracker = t_tracker t = t_tracker.get_value - coord = [np.cos(t()), np.sin(t())] - self.show_vectors(coord) + coord = [np.cos(t()), np.sin(t()), 0] + self.show_vector(coord) self.show_tangent(coord) @@ -193,7 +198,8 @@ class LineIntegrationProcess(SpecialThreeDScene): )) self.dot_sym=dot_sym - def get_field_values_on_line(self): + + """def get_dot_prod_values_on_line(self): self.remove(self.line_of_int_text) values_on_line_text=TextMobject("Values"," of"," function","on the ","line") @@ -217,8 +223,8 @@ class LineIntegrationProcess(SpecialThreeDScene): # self.add(values_on_surface) self.values_on_surface=values_on_surface - self.values_on_line_text=values_on_line_text - + self.values_on_line_text=values_on_line_text""" + def trasform_to_graphs(self): on_surface_graph=(self.get_graph( -- cgit From f6a555f55d4eef5918f2c302f3ad0f8e0cd36b55 Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Wed, 8 Jul 2020 20:05:10 +0530 Subject: Update README.md --- .../integrals-of-multivariable-functions/double-integrals/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/README.md b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/README.md index 5fa2146..cd0885d 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/README.md +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/README.md @@ -1,5 +1,5 @@ **file1_area_under_func** -![file1_area_under_func](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file1_area_under_func.gif) +![file1_area_under_func](double-integrals/file1_area_under_func.gif) **file2_volume_under_surface** ![file2_volume_under_surface](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file2_volume_under_surface.gif) -- cgit From 2a241a79084127242fb629aac1a6cbe142b88273 Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Wed, 8 Jul 2020 20:15:59 +0530 Subject: Update README.md --- .../integrals-of-multivariable-functions/double-integrals/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/README.md b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/README.md index cd0885d..3811ce3 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/README.md +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/README.md @@ -1,5 +1,5 @@ **file1_area_under_func** -![file1_area_under_func](double-integrals/file1_area_under_func.gif) +![file1_area_under_func](file1_area_under_func.gif) **file2_volume_under_surface** ![file2_volume_under_surface](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file2_volume_under_surface.gif) -- cgit From 5820cb0fa508c71902a7c9183a773b5d7409eab8 Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Wed, 8 Jul 2020 20:25:53 +0530 Subject: added gifs folder,updated README s --- .../double-integrals/README.md | 14 +++++++------- .../double-integrals/file1_area_under_func.gif | Bin 1277788 -> 0 bytes .../double-integrals/file2_volume_under_surface.gif | Bin 6614909 -> 0 bytes .../double-integrals/file3_y_limit_dependent_on_x.gif | Bin 1165354 -> 0 bytes .../double-integrals/file4_non_rect_region.gif | Bin 2529511 -> 0 bytes .../double-integrals/file5_elementary_area.gif | Bin 547368 -> 0 bytes .../double-integrals/file6_doing_integration.gif | Bin 3349455 -> 0 bytes .../double-integrals/file7_int_process_of_example.gif | Bin 3031924 -> 0 bytes .../double-integrals/gifs/file1_area_under_func.gif | Bin 0 -> 1277788 bytes .../gifs/file2_volume_under_surface.gif | Bin 0 -> 6614909 bytes .../gifs/file3_y_limit_dependent_on_x.gif | Bin 0 -> 1165354 bytes .../double-integrals/gifs/file4_non_rect_region.gif | Bin 0 -> 2529511 bytes .../double-integrals/gifs/file5_elementary_area.gif | Bin 0 -> 547368 bytes .../double-integrals/gifs/file6_doing_integration.gif | Bin 0 -> 3349455 bytes .../gifs/file7_int_process_of_example.gif | Bin 0 -> 3031924 bytes .../fubini's-theorem/README.md | 8 ++++---- .../fubini's-theorem/file1_surface1.gif | Bin 3752052 -> 0 bytes .../fubini's-theorem/file2_surface2.gif | Bin 3791121 -> 0 bytes .../file3.o_iteration_methods_checkpoint.gif | Bin 465521 -> 0 bytes .../fubini's-theorem/file3_iteration_methods.gif | Bin 1813461 -> 0 bytes .../fubini's-theorem/file4_curvy_region.gif | Bin 1282583 -> 0 bytes .../fubini's-theorem/gifs/file1_surface1.gif | Bin 0 -> 3752052 bytes .../fubini's-theorem/gifs/file2_surface2.gif | Bin 0 -> 3791121 bytes .../gifs/file3.o_iteration_methods_checkpoint.gif | Bin 0 -> 465521 bytes .../fubini's-theorem/gifs/file3_iteration_methods.gif | Bin 0 -> 1813461 bytes .../fubini's-theorem/gifs/file4_curvy_region.gif | Bin 0 -> 1282583 bytes .../fundamental-theorem-of-line-integral/README.md | 6 +++--- .../file1_grad_of_scalar_function.gif | Bin 4058562 -> 0 bytes .../file2_line_int_independent_of_path.gif | Bin 1409001 -> 0 bytes .../file3_line_int_example.gif | Bin 1385308 -> 0 bytes .../gifs/file1_grad_of_scalar_function.gif | Bin 0 -> 4058562 bytes .../gifs/file2_line_int_independent_of_path.gif | Bin 0 -> 1409001 bytes .../gifs/file3_line_int_example.gif | Bin 0 -> 1385308 bytes .../line-integrals/README.md | 9 ++++----- .../line-integrals/file1_scalar_line_int_as_sum.gif | Bin 1051018 -> 0 bytes .../line-integrals/file2_scalar_line_integral.gif | Bin 3301509 -> 0 bytes .../line-integrals/file3_vector_line_int_as_sum.gif | Bin 1670998 -> 0 bytes .../line-integrals/file4_helix.gif | Bin 1237895 -> 0 bytes .../gifs/file1_scalar_line_int_as_sum.gif | Bin 0 -> 1051018 bytes .../gifs/file2_scalar_line_integral.gif | Bin 0 -> 3301509 bytes .../gifs/file3_vector_line_int_as_sum.gif | Bin 0 -> 1670998 bytes .../line-integrals/gifs/file4_helix.gif | Bin 0 -> 1237895 bytes .../vector-fields/README.md | 8 ++++---- .../vector-fields/file1_vector_fields.gif | Bin 5384744 -> 0 bytes .../vector-fields/file2_grad_of_scalar_function.gif | Bin 6913246 -> 0 bytes .../vector-fields/file3_constructing_vector_field.gif | Bin 3838142 -> 0 bytes .../vector-fields/file4_slope_field.gif | Bin 1860382 -> 0 bytes .../vector-fields/gifs/file1_vector_fields.gif | Bin 0 -> 5384744 bytes .../gifs/file2_grad_of_scalar_function.gif | Bin 0 -> 6913246 bytes .../gifs/file3_constructing_vector_field.gif | Bin 0 -> 3838142 bytes .../vector-fields/gifs/file4_slope_field.gif | Bin 0 -> 1860382 bytes 51 files changed, 22 insertions(+), 23 deletions(-) delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file1_area_under_func.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file2_volume_under_surface.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file3_y_limit_dependent_on_x.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file4_non_rect_region.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file5_elementary_area.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file6_doing_integration.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file7_int_process_of_example.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file1_area_under_func.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file2_volume_under_surface.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file3_y_limit_dependent_on_x.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file4_non_rect_region.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file5_elementary_area.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file6_doing_integration.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file7_int_process_of_example.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file1_surface1.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file2_surface2.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file3.o_iteration_methods_checkpoint.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file3_iteration_methods.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file4_curvy_region.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/gifs/file1_surface1.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/gifs/file2_surface2.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/gifs/file3.o_iteration_methods_checkpoint.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/gifs/file3_iteration_methods.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/gifs/file4_curvy_region.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file1_grad_of_scalar_function.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file2_line_int_independent_of_path.gif delete 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/gifs/file1_grad_of_scalar_function.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/gifs/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/gifs/file3_line_int_example.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file1_scalar_line_int_as_sum.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file2_scalar_line_integral.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file3_vector_line_int_as_sum.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file4_helix.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file1_scalar_line_int_as_sum.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file2_scalar_line_integral.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file3_vector_line_int_as_sum.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file4_helix.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file1_vector_fields.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file2_grad_of_scalar_function.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file4_slope_field.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/gifs/file1_vector_fields.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/gifs/file2_grad_of_scalar_function.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/gifs/file3_constructing_vector_field.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/gifs/file4_slope_field.gif diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/README.md b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/README.md index 5fa2146..97cab8f 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/README.md +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/README.md @@ -1,21 +1,21 @@ **file1_area_under_func** -![file1_area_under_func](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file1_area_under_func.gif) +![file1_area_under_func](gifs/file1_area_under_func.gif) **file2_volume_under_surface** -![file2_volume_under_surface](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file2_volume_under_surface.gif) +![file2_volume_under_surface](gifsfile2_volume_under_surface.gif) **file3_y_limit_dependent_on_x** -![file3_y_limit_dependent_on_x](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file3_y_limit_dependent_on_x.gif) +![file3_y_limit_dependent_on_x](gifs/file3_y_limit_dependent_on_x.gif) **file4_non_rect_region** -![file4_non_rect_region](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file4_non_rect_region.gif) +![file4_non_rect_region](gifs/file4_non_rect_region.gif) **file5_elementary_area** -![file5_elementary_area](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file5_elementary_area.gif) +![file5_elementary_area](gifs/file5_elementary_area.gif) **file6_doing_integration** -![file6_doing_integration](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file6_doing_integration.gif) +![file6_doing_integration](gifs/file6_doing_integration.gif) **file7_int_process_of_example** -![file7_int_process_of_example](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file7_int_process_of_example.gif) +![file7_int_process_of_example](gifs/file7_int_process_of_example.gif) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file1_area_under_func.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file1_area_under_func.gif deleted file mode 100644 index 223218b..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file1_area_under_func.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file2_volume_under_surface.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file2_volume_under_surface.gif deleted file mode 100644 index 1455573..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file2_volume_under_surface.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file3_y_limit_dependent_on_x.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file3_y_limit_dependent_on_x.gif deleted file mode 100644 index dcfacb6..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file3_y_limit_dependent_on_x.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file4_non_rect_region.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file4_non_rect_region.gif deleted file mode 100644 index c8e7c8c..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file4_non_rect_region.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file5_elementary_area.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file5_elementary_area.gif deleted file mode 100644 index 5c9ac03..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file5_elementary_area.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file6_doing_integration.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file6_doing_integration.gif deleted file mode 100644 index 7a9271b..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file6_doing_integration.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file7_int_process_of_example.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file7_int_process_of_example.gif deleted file mode 100644 index 9fbdde8..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/file7_int_process_of_example.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file1_area_under_func.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file1_area_under_func.gif new file mode 100644 index 0000000..223218b Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file1_area_under_func.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file2_volume_under_surface.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file2_volume_under_surface.gif new file mode 100644 index 0000000..1455573 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file2_volume_under_surface.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file3_y_limit_dependent_on_x.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file3_y_limit_dependent_on_x.gif new file mode 100644 index 0000000..dcfacb6 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file3_y_limit_dependent_on_x.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file4_non_rect_region.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file4_non_rect_region.gif new file mode 100644 index 0000000..c8e7c8c Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file4_non_rect_region.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file5_elementary_area.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file5_elementary_area.gif new file mode 100644 index 0000000..5c9ac03 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file5_elementary_area.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file6_doing_integration.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file6_doing_integration.gif new file mode 100644 index 0000000..7a9271b Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file6_doing_integration.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file7_int_process_of_example.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file7_int_process_of_example.gif new file mode 100644 index 0000000..9fbdde8 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals/gifs/file7_int_process_of_example.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/README.md b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/README.md index c1c6e8e..3aa9be2 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/README.md +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/README.md @@ -1,14 +1,14 @@ **file1_surface1** -![file1_surface1](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file1_surface1.gif) +![file1_surface1](gifs/file1_surface1.gif) **file2_surface2** -![file2_surface2](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file2_surface2.gif) +![file2_surface2](gifs/file2_surface2.gif) **file3_iteration_methods** -![file3_iteration_methods](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file3_iteration_methods.gif) +![file3_iteration_methods](gifs/file3_iteration_methods.gif) **file4_curvy_limits** -![file4_curvy_limits](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file4_curvy_region.gif) +![file4_curvy_limits](gifs/file4_curvy_region.gif) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file1_surface1.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file1_surface1.gif deleted file mode 100644 index 8c9fa0a..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file1_surface1.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file2_surface2.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file2_surface2.gif deleted file mode 100644 index 37c4b1d..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file2_surface2.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file3.o_iteration_methods_checkpoint.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file3.o_iteration_methods_checkpoint.gif deleted file mode 100644 index 2e507f9..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file3.o_iteration_methods_checkpoint.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file3_iteration_methods.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file3_iteration_methods.gif deleted file mode 100644 index 4e1611b..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file3_iteration_methods.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file4_curvy_region.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file4_curvy_region.gif deleted file mode 100644 index b0620e5..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/file4_curvy_region.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/gifs/file1_surface1.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/gifs/file1_surface1.gif new file mode 100644 index 0000000..8c9fa0a Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/gifs/file1_surface1.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/gifs/file2_surface2.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/gifs/file2_surface2.gif new file mode 100644 index 0000000..37c4b1d Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/gifs/file2_surface2.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/gifs/file3.o_iteration_methods_checkpoint.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/gifs/file3.o_iteration_methods_checkpoint.gif new file mode 100644 index 0000000..2e507f9 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/gifs/file3.o_iteration_methods_checkpoint.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/gifs/file3_iteration_methods.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/gifs/file3_iteration_methods.gif new file mode 100644 index 0000000..4e1611b Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/gifs/file3_iteration_methods.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/gifs/file4_curvy_region.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/gifs/file4_curvy_region.gif new file mode 100644 index 0000000..b0620e5 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem/gifs/file4_curvy_region.gif differ 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 aa8c7f8..3cdddae 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,9 +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) +![file1_grad_of_scalar_function](gifs/file1_grad_of_scalar_function.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) +![file2_line_int_independent_of_path](gifs/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) +![file3_line_int_example](gifs/file3_line_int_example.gif) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file1_grad_of_scalar_function.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file1_grad_of_scalar_function.gif deleted file mode 100644 index 1fd2e15..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file1_grad_of_scalar_function.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_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 deleted file mode 100644 index 8d375bb..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/file2_line_int_independent_of_path.gif and /dev/null differ 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 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/file3_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/gifs/file1_grad_of_scalar_function.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/gifs/file1_grad_of_scalar_function.gif new file mode 100644 index 0000000..1fd2e15 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/gifs/file1_grad_of_scalar_function.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/gifs/file2_line_int_independent_of_path.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/gifs/file2_line_int_independent_of_path.gif new file mode 100644 index 0000000..8d375bb Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/gifs/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/gifs/file3_line_int_example.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/fundamental-theorem-of-line-integral/gifs/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/gifs/file3_line_int_example.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/README.md b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/README.md index 17077b6..d93df26 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/README.md +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/README.md @@ -1,14 +1,13 @@ **file1_scalar_line_int_as_sum** -![file1_scalar_line_int_as_sum](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file1_scalar_line_int_as_sum.gif) +![file1_scalar_line_int_as_sum](gifs/file1_scalar_line_int_as_sum.gif) **file2_scalar_line_integral** -![file2_scalar_line_integral](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file2_scalar_line_integral.gif) +![file2_scalar_line_integral](gifs/file2_scalar_line_integral.gif) **file3_vector_line_int_as_sum** -![file3_vector_line_int_as_sum](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file3_vector_line_int_as_sum.gif) - +![file3_vector_line_int_as_sum](gifs/file3_vector_line_int_as_sum.gif) **file4_helix** -![file4_helix](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file4_helix.gif) +![file4_helix](gifs/file4_helix.gif) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file1_scalar_line_int_as_sum.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file1_scalar_line_int_as_sum.gif deleted file mode 100644 index 1984b08..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file1_scalar_line_int_as_sum.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file2_scalar_line_integral.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file2_scalar_line_integral.gif deleted file mode 100644 index f9a8f98..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file2_scalar_line_integral.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file3_vector_line_int_as_sum.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file3_vector_line_int_as_sum.gif deleted file mode 100644 index 46b35bc..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file3_vector_line_int_as_sum.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file4_helix.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file4_helix.gif deleted file mode 100644 index ceedb1f..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file4_helix.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file1_scalar_line_int_as_sum.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file1_scalar_line_int_as_sum.gif new file mode 100644 index 0000000..1984b08 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file1_scalar_line_int_as_sum.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file2_scalar_line_integral.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file2_scalar_line_integral.gif new file mode 100644 index 0000000..f9a8f98 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file2_scalar_line_integral.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file3_vector_line_int_as_sum.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file3_vector_line_int_as_sum.gif new file mode 100644 index 0000000..46b35bc Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file3_vector_line_int_as_sum.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file4_helix.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file4_helix.gif new file mode 100644 index 0000000..ceedb1f Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file4_helix.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/README.md b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/README.md index ffab976..456cc5f 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/README.md +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/README.md @@ -1,11 +1,11 @@ **file1_vector_fields** -![file1_vector_fields](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file1_vector_fields.gif) +![file1_vector_fields](gifs/file1_vector_fields.gif) **file2_grad_of_scalar_function** -![file2_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/vector-fields/file2_grad_of_scalar_function.gif) +![file2_grad_of_scalar_function](gifs/file2_grad_of_scalar_function.gif) **file3_constructing_vector_field** -![file3_constructing_vector_field](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif) +![file3_constructing_vector_field](gifs/file3_constructing_vector_field.gif) **file4_slope_field** -![file4_slope_field](https://github.com/panditsomnath10016git/FSF-mathematics-python-code-archive/blob/master/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file4_slope_field.gif) +![file4_slope_field](gifs/vector-fields/file4_slope_field.gif) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file1_vector_fields.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file1_vector_fields.gif deleted file mode 100644 index 96e50ac..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file1_vector_fields.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file2_grad_of_scalar_function.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file2_grad_of_scalar_function.gif deleted file mode 100644 index c1ab66a..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file2_grad_of_scalar_function.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif deleted file mode 100644 index 6a57cab..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file3_constructing_vector_field.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file4_slope_field.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file4_slope_field.gif deleted file mode 100644 index c39ec54..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/file4_slope_field.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/gifs/file1_vector_fields.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/gifs/file1_vector_fields.gif new file mode 100644 index 0000000..96e50ac Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/gifs/file1_vector_fields.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/gifs/file2_grad_of_scalar_function.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/gifs/file2_grad_of_scalar_function.gif new file mode 100644 index 0000000..c1ab66a Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/gifs/file2_grad_of_scalar_function.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/gifs/file3_constructing_vector_field.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/gifs/file3_constructing_vector_field.gif new file mode 100644 index 0000000..6a57cab Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/gifs/file3_constructing_vector_field.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/gifs/file4_slope_field.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/gifs/file4_slope_field.gif new file mode 100644 index 0000000..c39ec54 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/gifs/file4_slope_field.gif differ -- cgit From ee347c3f62fcd989fb97982c848919630bfc0b4d Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Wed, 8 Jul 2020 20:43:35 +0530 Subject: added gifs folder,updated README s --- .../integrals-of-multivariable-functions/vector-fields/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/README.md b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/README.md index 456cc5f..d8c0956 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/README.md +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields/README.md @@ -8,4 +8,4 @@ ![file3_constructing_vector_field](gifs/file3_constructing_vector_field.gif) **file4_slope_field** -![file4_slope_field](gifs/vector-fields/file4_slope_field.gif) +![file4_slope_field](gifs/file4_slope_field.gif) -- cgit From 07f57d47215c6d0a370c8f43bc786e01bb95019b Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Wed, 8 Jul 2020 21:01:11 +0530 Subject: Update README.md --- .../integrals-of-multivariable-functions/README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/README.md b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/README.md index 4de6c1d..922dd86 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/README.md +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/README.md @@ -3,11 +3,12 @@ FSF2020--Somnath Pandit # **Topics:** ## Double Integral - +Check the note ![here](https://math.animations.fossee.in/contents/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals) ## Fubini's Theorem - +Check the note ![here](https://math.animations.fossee.in/contents/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem) ## Line Integrals - +Check the note ![here](https://math.animations.fossee.in/contents/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals) ## Fundamental Theorem of Line integrals - +Check the note ![here](https://math.animations.fossee.in/contents/calculus-of-several-variables/div,-grad,-curl-and-all-that/the-fundamental-theorem-of-line-integrals) ## Vector Fields +Check the note ![here](https://math.animations.fossee.in/contents/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields) -- cgit From 86f6dc8c256aef1dc8babea3f3257e67f5e67c4d Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Wed, 8 Jul 2020 21:09:37 +0530 Subject: Update README.md --- .../integrals-of-multivariable-functions/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/README.md b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/README.md index 922dd86..9115c78 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/README.md +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/README.md @@ -3,12 +3,12 @@ FSF2020--Somnath Pandit # **Topics:** ## Double Integral -Check the note ![here](https://math.animations.fossee.in/contents/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals) +Check the note [here](https://math.animations.fossee.in/contents/calculus-of-several-variables/integrals-of-multivariable-functions/double-integrals) ## Fubini's Theorem -Check the note ![here](https://math.animations.fossee.in/contents/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem) +Check the note [here](https://math.animations.fossee.in/contents/calculus-of-several-variables/integrals-of-multivariable-functions/fubini's-theorem) ## Line Integrals -Check the note ![here](https://math.animations.fossee.in/contents/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals) +Check the note [here](https://math.animations.fossee.in/contents/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals) ## Fundamental Theorem of Line integrals -Check the note ![here](https://math.animations.fossee.in/contents/calculus-of-several-variables/div,-grad,-curl-and-all-that/the-fundamental-theorem-of-line-integrals) +Check the note [here](https://math.animations.fossee.in/contents/calculus-of-several-variables/div,-grad,-curl-and-all-that/the-fundamental-theorem-of-line-integrals) ## Vector Fields -Check the note ![here](https://math.animations.fossee.in/contents/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields) +Check the note [here](https://math.animations.fossee.in/contents/calculus-of-several-variables/integrals-of-multivariable-functions/vector-fields) -- cgit From 293e8a8f90c763acefc8193f901d20c1034b8746 Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Thu, 9 Jul 2020 00:47:53 +0530 Subject: uncomplete vect line int --- .../unfinished_vector_line_integral.py | 359 +++++---------------- 1 file changed, 82 insertions(+), 277 deletions(-) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py index 2a6467d..17febce 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py @@ -1,42 +1,25 @@ from manimlib.imports import * -class LineIntegrationProcess(SpecialThreeDScene): +class LineIntegrationProcess(GraphScene): CONFIG = { - "axes_config": { - "x_min": 0, - "x_max": 4, - "y_min": 0, - "y_max": 4, - "z_min": 0, - "z_max": 3, - "a":-3 ,"b": 3, "c":0 , "d":3, - "axes_shift":IN+2*DL, - "x_axis_config": { - "tick_frequency": 1, - # "include_tip": False, - }, - "y_axis_config": { - "tick_frequency": 1, - # "include_tip": False, - }, - "z_axis_config": { - "tick_frequency": 1, - # "include_tip": False, - }, - "num_axis_pieces": 20, - }, + "x_min" : -0, + "x_max" : 1, + "y_min" : -0, + "y_max" : 1, + "axes_color":WHITE, + "graph_origin": ORIGIN+5*LEFT+3*DOWN, + "x_axis_width": 5, + "y_axis_height": 5, + "x_tick_frequency": 1, + "y_tick_frequency": 1, "default_vector_field_config": { "delta_x": .5, "delta_y": .5, - "x_min": -3, - "x_max": 2, - "y_min": -3, - "y_max": 2, "min_magnitude": 0, - "max_magnitude": 4, + "max_magnitude": 15, "colors": [GREEN,YELLOW,RED], - "length_func": lambda norm : .4*sigmoid(norm), + "length_func": lambda norm : .45*sigmoid(norm), "opacity": 1.0, "vector_config": { "stroke_width":2 @@ -46,21 +29,16 @@ class LineIntegrationProcess(SpecialThreeDScene): "stroke_width": 2, "stroke_color": WHITE, }, - - "Func": lambda x,y: 1+x**2*y/15 } def construct(self): - - self.setup_axes() - axes=self.axes - - self.set_camera_orientation(distance=10, - phi=0 * DEGREES, - theta=-90 * DEGREES, - ) + 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) + fn_text=TexMobject( r"\vec F = x^2\hat i-xy\hat j" ).set_color_by_gradient( @@ -68,42 +46,28 @@ class LineIntegrationProcess(SpecialThreeDScene): ) fn_text.to_corner(UR,buff=.8).shift(DOWN) - origin=axes.c2p(0,0,0) + origin=self.graph_origin v_field=self.get_vector_field( lambda v: np.array([ (v[0]-origin[0])**2, -(v[0]-origin[0])*(v[1]-origin[1]), 0, ]), + x_min= 0+origin[0], + x_max= 5+origin[0], + y_min= -0+origin[1], + y_max= 5+origin[1], ) - # self.play(Write(surface)) - self.add_fixed_in_frame_mobjects(fn_text) + # self.play(Write(surface)) # self.play(Write(v_field),Write(fn_text)) self.add(v_field, fn_text) self.get_line_of_int() - # self.begin_ambient_camera_rotation(rate=0.04) self.get_dot_product_values() - '''self.get_dot_prod_values_on_line() + '''self.get_field_values_on_line() self.wait(1.5) - self.area=self.get_area() - area_text=TextMobject("Line"," Integral in the",r" scalar field\\"," means this" ,"area") - area_text.set_color_by_tex_to_color_map({ - "Line": PINK, "scalar":BLUE, "area":TEAL_A - }) - area_text.to_edge(TOP,buff=MED_SMALL_BUFF) - - self.remove(self.values_on_line_text) - self.add_fixed_in_frame_mobjects(area_text) - self.play(Write(area_text)) - self.play(Write(self.area),run_time=2) - self.play(FadeOut(VGroup(surface,fn_text))) - self.wait() - - self.stop_ambient_camera_rotation() - # self.get_lines() - self.remove(axes,surface) + self.remove(surface) self.trasform_to_graphs()''' self.wait(2) @@ -123,19 +87,20 @@ class LineIntegrationProcess(SpecialThreeDScene): line_of_int_text.to_edge(TOP,buff=SMALL_BUFF) - line_of_int=(self.get_curve( - self.Func,on_surface=False - )) + line_of_int= self.get_graph( + lambda x : np.sqrt(1-x**2), + x_min=1, + x_max=0, + ) line_of_int.set_style( stroke_width=5, - stroke_color=PINK, + stroke_color=BLUE, ) - self.add_fixed_in_frame_mobjects(line_of_int_text) # self.play(Write(line_of_int_text)) self.wait(.5) - self.play(ShowCreation(line_of_int),run_time=1.5) - # self.add(line_of_int) + # self.play(ShowCreation(line_of_int),run_time=1.5) + self.add(line_of_int) self.line_of_int=line_of_int self.line_of_int_text=line_of_int_text @@ -143,7 +108,7 @@ class LineIntegrationProcess(SpecialThreeDScene): def get_dot_product_values(self): self.get_vector_and_tangent() self.play(ApplyMethod( - t_tracker.set_value, PI/2, + self.t_tracker.set_value, PI/2, rate_func=linear, run_time=.5, ) @@ -175,7 +140,7 @@ class LineIntegrationProcess(SpecialThreeDScene): ) vect = Vector().rotate(angle,about_point=coord) vect.set_color("#DC75CD") - tangent=vect.next_to(x,DR,buff=0) + tangent=vect.next_to(coord,DR,buff=0) tangent_sym.next_to(tangent,DOWN,buff=.1) self.play(Write(VGroup(tangent,tangent_sym))) @@ -198,34 +163,29 @@ class LineIntegrationProcess(SpecialThreeDScene): )) self.dot_sym=dot_sym - - """def get_dot_prod_values_on_line(self): - self.remove(self.line_of_int_text) - - values_on_line_text=TextMobject("Values"," of"," function","on the ","line") - values_on_line_text.set_color_by_tex_to_color_map({ - "Values":YELLOW, "function":BLUE,"line":PINK + + + + def get_curve(self,func,on_surface=False ,**kwargs): + config = dict() + config.update(self.default_graph_style) + config.update({ + "t_min": 0, + "t_max": PI/2, }) - values_on_line_text.to_edge(TOP,buff=SMALL_BUFF) - - values_on_surface=(self.get_curve( - self.Func,on_surface=True - )) - values_on_surface.set_style( - stroke_width=5, - stroke_color=YELLOW, - ) - - self.add_fixed_in_frame_mobjects(values_on_line_text) - self.play(Write(values_on_line_text)) - # self.wait() - self.play(ShowCreation(values_on_surface),run_time=3) - # self.add(values_on_surface) - - self.values_on_surface=values_on_surface - self.values_on_line_text=values_on_line_text""" + config.update(kwargs) + r=1 + curve=ParametricFunction( + lambda t: self.coords_to_point( + r*np.cos(t), + r*np.sin(t), + ), + **config, + ) + return curve - + + #------------------------------------------------------- def trasform_to_graphs(self): on_surface_graph=(self.get_graph( self.Func,on_surface=True @@ -268,8 +228,7 @@ class LineIntegrationProcess(SpecialThreeDScene): theta=-90 * DEGREES, added_anims=into_graph, run_time=2 - ) - + ) def get_area(self,graph=False): axes=self.axes if graph: @@ -293,188 +252,34 @@ class LineIntegrationProcess(SpecialThreeDScene): ) return area - - def get_curve(self,func,on_surface=False ,**kwargs): - config = dict() - config.update(self.default_graph_style) - config.update({ - "t_min": 0, - "t_max": PI/2, - }) - config.update(kwargs) - r=abs(self.axes.a) - curve=ParametricFunction( - lambda t: self.axes.c2p( - r*np.cos(t), - r*np.sin(t), - func(r*np.cos(t), r*np.sin(t))*bool(on_surface) - ), - **config, - ) - return curve - - def get_surface(self, func, **kwargs): - axes=self.axes - config = { - "u_min": axes.a-.2, - "u_max": axes.b+.2, - "v_min": axes.c-.1, - "v_max": axes.d, - "resolution": ( - 2*(axes.y_max - axes.y_min) // axes.y_axis.tick_frequency, - (axes.x_max - axes.x_min) // axes.x_axis.tick_frequency, - ), - } - - config.update(self.default_surface_config) - config.update(kwargs) - return ParametricSurface( - lambda x,y : axes.c2p( - x, y, func(x, y) - ), - **config - ) - - def get_graph(self,func,on_surface=False ,**kwargs): - config = dict() - config.update(self.default_graph_style) - config.update({ - "t_min": 0, - "t_max": PI, + def get_field_values_on_line(self): + self.remove(self.line_of_int_text) + + values_on_line_text=TextMobject("Values"," of"," function","on the ","line") + values_on_line_text.set_color_by_tex_to_color_map({ + "Values":YELLOW, "function":BLUE,"line":PINK }) - config.update(kwargs) - slice_curve=ParametricFunction( - lambda t: self.axes.c2p( - 4*np.cos(t), - 0, - 2+func(3*np.cos(t), 3*np.sin(t))*bool(on_surface) - ), - **config, - ) - return slice_curve - - def get_lines(self): - pass - axes = self.axes - labels=[axes.x_axis.n2p(axes.a), axes.x_axis.n2p(axes.b), axes.y_axis.n2p(axes.c), - axes.y_axis.n2p(axes.d)] - - - surface_corners=[] - for x,y,z in self.region_corners: - surface_corners.append([x,y,self.Func(x,y)]) - - lines=VGroup() - for start , end in zip(surface_corners, - self.region_corners): - lines.add(self.draw_lines(start,end,"PINK")) - - for start , end in zip(labels, - self.region_corners): - # lines.add(self.draw_lines(start,end,"BLUE")) - # print (start,end) - pass - # self.play(ShowCreation(lines)) - self.add(lines) - - - def draw_lines(self,start,end,color): - start=self.axes.c2p(*start) - end=self.axes.c2p(*end) - line=DashedLine(start,end,color=color) - - return line - -#------------------------------------------------------- - #customize 3D axes - def get_three_d_axes(self, include_labels=True, include_numbers=True, **kwargs): - config = dict(self.axes_config) - config.update(kwargs) - axes = ThreeDAxes(**config) - axes.set_stroke(width=2) - self.axes=axes - - if include_numbers: - self.add_axes_numbers(axes) - - if include_labels: - self.add_axes_labels(axes) - - # Adjust axis orientation - '''axes.x_axis.rotate( - -90 * DEGREES, LEFT, - about_point=axes.c2p(0, 0, 0), - ) - axes.y_axis.rotate( - 90 * DEGREES, UP, - about_point=axes.c2p(0, 0, 0), - )''' - - return axes - + values_on_line_text.to_edge(TOP,buff=SMALL_BUFF) - def setup_axes(self): - axes = self.get_three_d_axes(include_labels=True) - axes.scale(1) - # axes.center() - axes.shift(axes.axes_shift) - - self.add(axes) - self.axes = axes + values_on_surface=(self.get_curve( + self.Func,on_surface=True + )) + values_on_surface.set_style( + stroke_width=5, + stroke_color=YELLOW, + ) - def add_axes_numbers(self, axes): - x_axis = axes.x_axis - y_axis = axes.y_axis - tex_vals_x = [ - - ("1", axes.b), - ] - tex_vals_y=[ - - ("1", axes.d) - ] - x_labels = VGroup() - y_labels = VGroup() - for tex, val in tex_vals_x: - label = TexMobject(tex) - label.scale(1) - label.next_to(x_axis.n2p(val), DOWN) - # label.rotate(180 * DEGREES) - x_labels.add(label) - x_axis.add(x_labels) - x_axis.numbers = x_labels - - for tex, val in tex_vals_y: - label = TexMobject(tex) - label.scale(1) - label.next_to(y_axis.n2p(val), LEFT) - label.rotate(90 * DEGREES) - y_labels.add(label) - - y_axis.add(y_labels) - y_axis.numbers = y_labels + self.add_fixed_in_frame_mobjects(values_on_line_text) + self.play(Write(values_on_line_text)) + # self.wait() + self.play(ShowCreation(values_on_surface),run_time=3) + # self.add(values_on_surface) - return axes + self.values_on_surface=values_on_surface + self.values_on_line_text=values_on_line_text + + - def add_axes_labels(self, axes): - x_label = TexMobject("x") - x_label.next_to(axes.x_axis.get_end(), RIGHT) - axes.x_axis.label = x_label - - y_label = TextMobject("y") - y_label.rotate(90 * DEGREES, OUT) - y_label.next_to(axes.y_axis.get_end(), UP) - axes.y_axis.label = y_label - - z_label = TexMobject("") - z_label.rotate(90 * DEGREES, RIGHT) - z_label.next_to(axes.z_axis.get_zenith(), LEFT) - axes.z_axis.label = z_label - for axis in axes: - axis.add(axis.label) - return axes - - - + #uploaded by Somnath Pandit.FSF2020_Line_Integrals -- cgit From a9f13e9567d1b5312386122d420aace6edbced21 Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Thu, 9 Jul 2020 04:20:52 +0530 Subject: scalar line int as sum minor change --- .../line-integrals/file1_scalar_line_int_as_sum.py | 12 ++++++------ .../gifs/file1_scalar_line_int_as_sum.gif | Bin 1051018 -> 1058303 bytes 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file1_scalar_line_int_as_sum.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file1_scalar_line_int_as_sum.py index e3f3574..af32ebf 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file1_scalar_line_int_as_sum.py +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file1_scalar_line_int_as_sum.py @@ -155,17 +155,13 @@ class LineIntegrationAsSum(GraphScene): sum_up_text.set_color_by_tex("summed",PURPLE) sum_up_text.next_to(multiply_text,DOWN) - dot.set_color(ORANGE).scale(1.2) self.play(FadeIn(VGroup( point_coord,dot ))) self.play(Write(self.evaluate_text)) self.play(Write(func_val)) - self.play(FadeIn(VGroup(*[ - dot.set_color(ORANGE).scale(1.4) - for dot in dots ] - ))) + self.wait(2) self.remove(point_coord) self.get_ds(dots,index) @@ -182,7 +178,11 @@ class LineIntegrationAsSum(GraphScene): func_val, RIGHT,buff=.2 )) self.play(Write(sum_up_text)) - + dot.set_color(ORANGE).scale(1.2) + self.play(FadeIn(VGroup(*[ + dot.set_color(ORANGE).scale(1.4) + for dot in dots ] + ))) self.func_val=func_val self.sum_text_group=VGroup(multiply_text,sum_up_text) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file1_scalar_line_int_as_sum.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file1_scalar_line_int_as_sum.gif index 1984b08..17ea3f0 100644 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file1_scalar_line_int_as_sum.gif and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file1_scalar_line_int_as_sum.gif differ -- cgit From 8dc65a09205f5ae700ad47d6a460268e2d7f46da Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Thu, 9 Jul 2020 04:22:39 +0530 Subject: vector line int progress --- .../unfinished_vector_line_integral.py | 151 ++++++++++----------- 1 file changed, 74 insertions(+), 77 deletions(-) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py index 17febce..d5dda1f 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py @@ -8,9 +8,9 @@ class LineIntegrationProcess(GraphScene): "y_min" : -0, "y_max" : 1, "axes_color":WHITE, - "graph_origin": ORIGIN+5*LEFT+3*DOWN, - "x_axis_width": 5, - "y_axis_height": 5, + "graph_origin": ORIGIN+6.5*LEFT+3*DOWN, + "x_axis_width": 6, + "y_axis_height": 6, "x_tick_frequency": 1, "y_tick_frequency": 1, "default_vector_field_config": { @@ -18,8 +18,8 @@ class LineIntegrationProcess(GraphScene): "delta_y": .5, "min_magnitude": 0, "max_magnitude": 15, - "colors": [GREEN,YELLOW,RED], - "length_func": lambda norm : .45*sigmoid(norm), + "colors": [BLUE], + "length_func": lambda norm : norm/35, "opacity": 1.0, "vector_config": { "stroke_width":2 @@ -40,11 +40,12 @@ class LineIntegrationProcess(GraphScene): self.setup_axes(animate=False) fn_text=TexMobject( - r"\vec F = x^2\hat i-xy\hat j" + r"\vec F = x^2\hat i-xy\hat j", + stroke_width=2.5 ).set_color_by_gradient( *self.default_vector_field_config["colors"] ) - fn_text.to_corner(UR,buff=.8).shift(DOWN) + fn_text.to_corner(UR,buff=.8).shift(2*LEFT) origin=self.graph_origin v_field=self.get_vector_field( @@ -53,10 +54,10 @@ class LineIntegrationProcess(GraphScene): -(v[0]-origin[0])*(v[1]-origin[1]), 0, ]), - x_min= 0+origin[0], - x_max= 5+origin[0], + x_min= -.001+origin[0], + x_max= 5.8+origin[0], y_min= -0+origin[1], - y_max= 5+origin[1], + y_max= 6.+origin[1], ) # self.play(Write(surface)) @@ -93,8 +94,8 @@ class LineIntegrationProcess(GraphScene): x_max=0, ) line_of_int.set_style( - stroke_width=5, - stroke_color=BLUE, + stroke_width=3, + stroke_color=PINK, ) # self.play(Write(line_of_int_text)) @@ -105,46 +106,81 @@ class LineIntegrationProcess(GraphScene): self.line_of_int=line_of_int self.line_of_int_text=line_of_int_text - def get_dot_product_values(self): + def get_dot_product_values(self): + t_tracker = ValueTracker(0) + self.t_tracker = t_tracker self.get_vector_and_tangent() + self.get_dot_product_graph() + self.wait(1.5) self.play(ApplyMethod( self.t_tracker.set_value, PI/2, rate_func=linear, - run_time=.5, + run_time=2, ) ) + def get_dot_product_graph(self): + pass + def get_vector_and_tangent(self): - t_tracker = ValueTracker(0) - self.t_tracker = t_tracker - t = t_tracker.get_value - coord = [np.cos(t()), np.sin(t()), 0] - self.show_vector(coord) - self.show_tangent(coord) + self.play(FadeOut(self.axes)) + self.show_vector() + self.show_tangent() - def show_vector(self,coord): - vector = self.vector_field.get_vector(coord) - vector.set_color(ORANGE) + def show_vector(self): + t = self.t_tracker.get_value + vect_label=TextMobject( + "$\\vec F(x_i,y_i)$", + color=YELLOW, + stroke_width=2 + ).scale(.8) - self.add(vector) + vector = always_redraw( lambda: + self.vector_field.get_vector( + self.coords_to_point( + np.cos(t()), np.sin(t()) + ), + stroke_width=6, + max_stroke_width_to_length_ratio= 8, + ).set_color(YELLOW), + ) + vector.set_color(ORANGE) + vect_label.next_to(vector,RIGHT,buff=.1) + self.add(vector,vect_label) # self.play(Write(vector),run_time=.2) - def show_tangent(self,coord): - tangent_sym=TextMobject("$\\vec T(x_i,y_i)$",color="#DC75CD").scale(.8) - angle=self.angle_of_tangent( - coord[0], - self.line_of_int, - dx=0.01 + self.vect_label = vect_label + + def show_tangent(self): + tangent_label=TextMobject("$\\vec T(x_i,y_i)$",color="#DC75CD",stroke_width=2).scale(.8) + + t = self.t_tracker.get_value + + tangent = always_redraw(lambda: + Vector( + color="#DC75CD", + stroke_width=6, + ).scale(1).next_to( + self.coords_to_point( + np.cos(t()), np.sin(t()) + ),DR,buff=-.1 + ).rotate( + self.angle_of_tangent( + np.cos(t()), + self.line_of_int, + dx=-0.00001 + ), + about_point=self.coords_to_point( + np.cos(t()), np.sin(t()) + ) + ) ) - vect = Vector().rotate(angle,about_point=coord) - vect.set_color("#DC75CD") - tangent=vect.next_to(coord,DR,buff=0) - tangent_sym.next_to(tangent,DOWN,buff=.1) - self.play(Write(VGroup(tangent,tangent_sym))) + tangent_label.next_to(tangent,UP,buff=.1) + self.play(Write(VGroup(tangent,tangent_label))) - self.tangent_sym=tangent_sym + self.tangent_label=tangent_label def dot_product(self): @@ -221,22 +257,9 @@ class LineIntegrationProcess(GraphScene): graph_area ), ] + + def get_area(self): - self.move_camera( - # distance=20, - phi=90 * DEGREES, - theta=-90 * DEGREES, - added_anims=into_graph, - run_time=2 - ) - def get_area(self,graph=False): - axes=self.axes - if graph: - on_surface=self.on_surface_graph - on_base=self.line_graph - else: - on_surface=self.values_on_surface - on_base=self.line_of_int area =Polygon( *[ on_surface.get_point_from_function(t) @@ -253,32 +276,6 @@ class LineIntegrationProcess(GraphScene): return area - def get_field_values_on_line(self): - self.remove(self.line_of_int_text) - - values_on_line_text=TextMobject("Values"," of"," function","on the ","line") - values_on_line_text.set_color_by_tex_to_color_map({ - "Values":YELLOW, "function":BLUE,"line":PINK - }) - values_on_line_text.to_edge(TOP,buff=SMALL_BUFF) - - values_on_surface=(self.get_curve( - self.Func,on_surface=True - )) - values_on_surface.set_style( - stroke_width=5, - stroke_color=YELLOW, - ) - - self.add_fixed_in_frame_mobjects(values_on_line_text) - self.play(Write(values_on_line_text)) - # self.wait() - self.play(ShowCreation(values_on_surface),run_time=3) - # self.add(values_on_surface) - - self.values_on_surface=values_on_surface - self.values_on_line_text=values_on_line_text - -- cgit From 4e77f217f276a9811efd968f47d78701aaf61676 Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Fri, 10 Jul 2020 00:41:24 +0530 Subject: checkpoint vector line int --- .../line-integrals/README.md | 6 +- .../line-integrals/file4_helix.py | 245 ------------------ .../line-integrals/file4_vector_line_integral.py | 282 +++++++++++++++++++++ .../line-integrals/file5_helix.py | 245 ++++++++++++++++++ .../line-integrals/gifs/file4_helix.gif | Bin 1237895 -> 0 bytes .../gifs/file4_vector_line_integral.gif | Bin 0 -> 1304411 bytes .../line-integrals/gifs/file5_helix.gif | Bin 0 -> 1237895 bytes .../unfinished_vector_line_integral.py | 282 --------------------- 8 files changed, 531 insertions(+), 529 deletions(-) delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file4_helix.py create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file4_vector_line_integral.py create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file5_helix.py delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file4_helix.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file4_vector_line_integral.gif create mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file5_helix.gif delete mode 100644 FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/README.md b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/README.md index d93df26..14d95bd 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/README.md +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/README.md @@ -8,6 +8,8 @@ **file3_vector_line_int_as_sum** ![file3_vector_line_int_as_sum](gifs/file3_vector_line_int_as_sum.gif) +**file4_vector_line_integral** +![file4_vector_line_integral](gifs/file4_vector_line_integral) -**file4_helix** -![file4_helix](gifs/file4_helix.gif) +**file5_helix** +![file5_helix](gifs/file5_helix.gif) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file4_helix.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file4_helix.py deleted file mode 100644 index 50aeb33..0000000 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file4_helix.py +++ /dev/null @@ -1,245 +0,0 @@ -from manimlib.imports import * - -class ParametricCurve(ThreeDScene): - - CONFIG = { - "axes_config": { - "x_min": 0, - "x_max": 3, - "y_min": 0, - "y_max": 3, - "z_min": 0, - "z_max": 4, - "a":0 ,"b": 2, "c":0 , "d":2, - "axes_shift":2*IN+1.4*RIGHT+1.4*DOWN, - "x_axis_config": { - "tick_frequency": 1, - "include_tip": False, - }, - "y_axis_config": { - "tick_frequency": 1, - "include_tip": False, - }, - "z_axis_config": { - "tick_frequency": 1, - # "include_tip": False, - }, - }, - - } - - - def construct(self): - - self.setup_axes() - - self.set_camera_orientation( - distance=25, - phi=60 * DEGREES, - theta=40 * DEGREES, - ) - - label=TextMobject("Helix",color=PURPLE).scale(1.6) - label.to_corner(UR,buff=2) - self.add_fixed_in_frame_mobjects(label) - - helix=self.get_helix( - radius=1.5, - t_min= 0, - t_max= 4*PI, - color=PURPLE - ) - parameter_label=TextMobject( - "Parametric equation: ", - color=TEAL - ).next_to(label,DOWN,buff=.3 - ) - parametric_eqn=TextMobject( - "$x=\cos$ (","t", - r")\\$y=\sin $(","t", - r")\\$z$=","t" - ).next_to(parameter_label,DOWN,buff=.1) - parametric_eqn.set_color_by_tex("t",RED) - self.parametric_eqn=parametric_eqn - - parametriztion=VGroup( - parameter_label, - parametric_eqn - ) - - - self.play(ShowCreation(helix),run_time=2) - self.begin_ambient_camera_rotation(.1) - self.wait(1) - self.add_fixed_in_frame_mobjects(parametriztion) - self.play(Write(parametriztion)) - self.wait(1) - self.stop_ambient_camera_rotation() - self.move_camera( - distance=20, - phi=85 * DEGREES, - # theta=-90 * DEGREES, - run_time=3 - ) - scale_axes=VGroup(self.axes,helix).scale(1.2) - self.show_the_parameter() - self.wait(2) - - - - def get_helix(self,radius=1, **kwargs): - config = { - "t_min": 0, - "t_max": 2*PI, - } - config.update(kwargs) - helix= ParametricFunction( - lambda t : self.axes.c2p( - radius*np.cos(t), - radius*np.sin(t), - t/4 - ), - **config - ) - - self.helix=helix - return helix - - def show_the_parameter(self): - t_tracker = ValueTracker(0) - t=t_tracker.get_value - - t_label = TexMobject( - "t = ",color=RED - ).next_to(self.parametric_eqn,DL,buff=.85) - - t_text = always_redraw( - lambda: DecimalNumber( - t(), - color=GOLD, - ).next_to(t_label, RIGHT, MED_SMALL_BUFF) - ) - t_text.suspend_updating() - - dot = Sphere( - radius= 1.5*DEFAULT_DOT_RADIUS, - stroke_width= 1, - fill_opacity= 1.0, - ) - dot.set_color(GOLD) - dot.add_updater(lambda v: v.move_to( - self.helix.get_point_from_function(PI*t()) - )) - - pi = TexMobject( - "\\pi ", - color=GOLD, - ).next_to(t_text,RIGHT,buff=-.3) - - group = VGroup(t_text,t_label,pi).scale(1.5) - - self.wait(1) - self.add_fixed_in_frame_mobjects(group) - t_text.resume_updating() - self.play(FadeIn(group)) - self.add(dot) - self.play( - t_tracker.set_value,2, - rate_func=linear, - run_time=5 - ) - - -#-------------------------------------------------------- - - #customize 3D axes - def get_three_d_axes(self, include_labels=True, include_numbers=False, **kwargs): - config = dict(self.axes_config) - config.update(kwargs) - axes = ThreeDAxes(**config) - axes.set_stroke(width=1.5) - - if include_numbers: - self.add_axes_numbers(axes) - - if include_labels: - self.add_axes_labels(axes) - - # Adjust axis orientation - axes.x_axis.rotate( - 90 * DEGREES, LEFT, - about_point=axes.c2p(0, 0, 0), - ) - axes.y_axis.rotate( - 90 * DEGREES, UP, - about_point=axes.c2p(0, 0, 0), - ) - - - return axes - - - def setup_axes(self): - axes = self.get_three_d_axes(include_labels=True) - axes.scale(1) - # axes.center() - axes.shift(axes.axes_shift) - self.add(axes) - self.axes = axes - - def add_axes_numbers(self, axes): - x_axis = axes.x_axis - y_axis = axes.y_axis - tex_vals_x = [ - ("1", axes.b), - ] - tex_vals_y=[ - ("1", axes.d) - ] - x_labels = VGroup() - y_labels = VGroup() - for tex, val in tex_vals_x: - label = TexMobject(tex) - label.scale(1) - label.next_to(x_axis.n2p(val), DOWN) - label.rotate(180 * DEGREES) - x_labels.add(label) - x_axis.add(x_labels) - x_axis.numbers = x_labels - - for tex, val in tex_vals_y: - label = TexMobject(tex) - label.scale(1) - label.next_to(y_axis.n2p(val), LEFT) - label.rotate(90 * DEGREES) - y_labels.add(label) - - y_axis.add(y_labels) - y_axis.numbers = y_labels - - return axes - - def add_axes_labels(self, axes): - x_label = TexMobject("x") - x_label.next_to(axes.x_axis.get_end(), RIGHT) - axes.x_axis.label = x_label - - y_label = TextMobject("y") - y_label.rotate(90 * DEGREES, OUT) - y_label.next_to(axes.y_axis.get_end(), UP) - axes.y_axis.label = y_label - - z_label = TextMobject("z") - z_label.rotate(90 * DEGREES, LEFT) - z_label.next_to(axes.z_axis.get_zenith(), LEFT) - axes.z_axis.label = z_label - for axis in axes: - axis.add(axis.label) - return axes - - #uploaded by Somnath Pandit.FSF2020_Line_integrals - - - - - diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file4_vector_line_integral.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file4_vector_line_integral.py new file mode 100644 index 0000000..d5dda1f --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file4_vector_line_integral.py @@ -0,0 +1,282 @@ +from manimlib.imports import * + +class LineIntegrationProcess(GraphScene): + + CONFIG = { + "x_min" : -0, + "x_max" : 1, + "y_min" : -0, + "y_max" : 1, + "axes_color":WHITE, + "graph_origin": ORIGIN+6.5*LEFT+3*DOWN, + "x_axis_width": 6, + "y_axis_height": 6, + "x_tick_frequency": 1, + "y_tick_frequency": 1, + "default_vector_field_config": { + "delta_x": .5, + "delta_y": .5, + "min_magnitude": 0, + "max_magnitude": 15, + "colors": [BLUE], + "length_func": lambda norm : norm/35, + "opacity": 1.0, + "vector_config": { + "stroke_width":2 + }, + }, + "default_graph_style": { + "stroke_width": 2, + "stroke_color": WHITE, + }, + } + + + 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) + + fn_text=TexMobject( + r"\vec F = x^2\hat i-xy\hat j", + stroke_width=2.5 + ).set_color_by_gradient( + *self.default_vector_field_config["colors"] + ) + fn_text.to_corner(UR,buff=.8).shift(2*LEFT) + + origin=self.graph_origin + v_field=self.get_vector_field( + lambda v: np.array([ + (v[0]-origin[0])**2, + -(v[0]-origin[0])*(v[1]-origin[1]), + 0, + ]), + x_min= -.001+origin[0], + x_max= 5.8+origin[0], + y_min= -0+origin[1], + y_max= 6.+origin[1], + ) + + # self.play(Write(surface)) + # self.play(Write(v_field),Write(fn_text)) + self.add(v_field, fn_text) + self.get_line_of_int() + self.get_dot_product_values() + '''self.get_field_values_on_line() + self.wait(1.5) + + self.remove(surface) + self.trasform_to_graphs()''' + 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_line_of_int(self): + line_of_int_text=TextMobject(r"Line of integration is\\","$\\vec r(t)=\cos(t)\hat i+\sin(t)\hat j$") + line_of_int_text[1].set_color(PINK) + line_of_int_text.to_edge(TOP,buff=SMALL_BUFF) + + + line_of_int= self.get_graph( + lambda x : np.sqrt(1-x**2), + x_min=1, + x_max=0, + ) + line_of_int.set_style( + stroke_width=3, + stroke_color=PINK, + ) + + # self.play(Write(line_of_int_text)) + self.wait(.5) + # self.play(ShowCreation(line_of_int),run_time=1.5) + self.add(line_of_int) + + self.line_of_int=line_of_int + self.line_of_int_text=line_of_int_text + + def get_dot_product_values(self): + t_tracker = ValueTracker(0) + self.t_tracker = t_tracker + self.get_vector_and_tangent() + self.get_dot_product_graph() + self.wait(1.5) + self.play(ApplyMethod( + self.t_tracker.set_value, PI/2, + rate_func=linear, + run_time=2, + ) + ) + + def get_dot_product_graph(self): + pass + + + def get_vector_and_tangent(self): + self.play(FadeOut(self.axes)) + self.show_vector() + self.show_tangent() + + + def show_vector(self): + t = self.t_tracker.get_value + vect_label=TextMobject( + "$\\vec F(x_i,y_i)$", + color=YELLOW, + stroke_width=2 + ).scale(.8) + + vector = always_redraw( lambda: + self.vector_field.get_vector( + self.coords_to_point( + np.cos(t()), np.sin(t()) + ), + stroke_width=6, + max_stroke_width_to_length_ratio= 8, + ).set_color(YELLOW), + ) + vector.set_color(ORANGE) + vect_label.next_to(vector,RIGHT,buff=.1) + self.add(vector,vect_label) + # self.play(Write(vector),run_time=.2) + + self.vect_label = vect_label + + def show_tangent(self): + tangent_label=TextMobject("$\\vec T(x_i,y_i)$",color="#DC75CD",stroke_width=2).scale(.8) + + t = self.t_tracker.get_value + + tangent = always_redraw(lambda: + Vector( + color="#DC75CD", + stroke_width=6, + ).scale(1).next_to( + self.coords_to_point( + np.cos(t()), np.sin(t()) + ),DR,buff=-.1 + ).rotate( + self.angle_of_tangent( + np.cos(t()), + self.line_of_int, + dx=-0.00001 + ), + about_point=self.coords_to_point( + np.cos(t()), np.sin(t()) + ) + ) + ) + tangent_label.next_to(tangent,UP,buff=.1) + self.play(Write(VGroup(tangent,tangent_label))) + + self.tangent_label=tangent_label + + def dot_product(self): + + dot_sym=Dot().next_to(self.func_val,RIGHT) + + self.play(FadeOut(VGroup( + self.at_any_points_text, + self.evaluate_text + ))) + self.play(Write(self.dot_prod_text)) + self.play( + FadeIn(dot_sym), + ApplyMethod( + self.tangent_sym.next_to, + dot_sym, RIGHT + )) + + self.dot_sym=dot_sym + + + + def get_curve(self,func,on_surface=False ,**kwargs): + config = dict() + config.update(self.default_graph_style) + config.update({ + "t_min": 0, + "t_max": PI/2, + }) + config.update(kwargs) + r=1 + curve=ParametricFunction( + lambda t: self.coords_to_point( + r*np.cos(t), + r*np.sin(t), + ), + **config, + ) + return curve + + + #------------------------------------------------------- + def trasform_to_graphs(self): + on_surface_graph=(self.get_graph( + self.Func,on_surface=True + )) + on_surface_graph.set_style( + stroke_width=5, + stroke_color=YELLOW, + ) + + line_graph=(self.get_graph( + self.Func,on_surface=False + )) + line_graph.set_style( + stroke_width=5, + stroke_color=PINK, + ) + + self.on_surface_graph=on_surface_graph + self.line_graph=line_graph + graph_area=self.get_area(graph=True) + + into_graph=[ + ReplacementTransform( + self.values_on_surface, + on_surface_graph + ), + ReplacementTransform( + self.line_of_int, + line_graph + ), + ReplacementTransform( + self.area, + graph_area + ), + ] + + def get_area(self): + + area =Polygon( + *[ + on_surface.get_point_from_function(t) + for t in np.arange(0,PI,0.01) + ], + *[ + on_base.get_point_from_function(t) + for t in np.arange(PI,0,-0.01) + ], + stroke_width=0, + fill_color=TEAL_A, + fill_opacity=.6, + ) + + return area + + + + + #uploaded by Somnath Pandit.FSF2020_Line_Integrals diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file5_helix.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file5_helix.py new file mode 100644 index 0000000..50aeb33 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file5_helix.py @@ -0,0 +1,245 @@ +from manimlib.imports import * + +class ParametricCurve(ThreeDScene): + + CONFIG = { + "axes_config": { + "x_min": 0, + "x_max": 3, + "y_min": 0, + "y_max": 3, + "z_min": 0, + "z_max": 4, + "a":0 ,"b": 2, "c":0 , "d":2, + "axes_shift":2*IN+1.4*RIGHT+1.4*DOWN, + "x_axis_config": { + "tick_frequency": 1, + "include_tip": False, + }, + "y_axis_config": { + "tick_frequency": 1, + "include_tip": False, + }, + "z_axis_config": { + "tick_frequency": 1, + # "include_tip": False, + }, + }, + + } + + + def construct(self): + + self.setup_axes() + + self.set_camera_orientation( + distance=25, + phi=60 * DEGREES, + theta=40 * DEGREES, + ) + + label=TextMobject("Helix",color=PURPLE).scale(1.6) + label.to_corner(UR,buff=2) + self.add_fixed_in_frame_mobjects(label) + + helix=self.get_helix( + radius=1.5, + t_min= 0, + t_max= 4*PI, + color=PURPLE + ) + parameter_label=TextMobject( + "Parametric equation: ", + color=TEAL + ).next_to(label,DOWN,buff=.3 + ) + parametric_eqn=TextMobject( + "$x=\cos$ (","t", + r")\\$y=\sin $(","t", + r")\\$z$=","t" + ).next_to(parameter_label,DOWN,buff=.1) + parametric_eqn.set_color_by_tex("t",RED) + self.parametric_eqn=parametric_eqn + + parametriztion=VGroup( + parameter_label, + parametric_eqn + ) + + + self.play(ShowCreation(helix),run_time=2) + self.begin_ambient_camera_rotation(.1) + self.wait(1) + self.add_fixed_in_frame_mobjects(parametriztion) + self.play(Write(parametriztion)) + self.wait(1) + self.stop_ambient_camera_rotation() + self.move_camera( + distance=20, + phi=85 * DEGREES, + # theta=-90 * DEGREES, + run_time=3 + ) + scale_axes=VGroup(self.axes,helix).scale(1.2) + self.show_the_parameter() + self.wait(2) + + + + def get_helix(self,radius=1, **kwargs): + config = { + "t_min": 0, + "t_max": 2*PI, + } + config.update(kwargs) + helix= ParametricFunction( + lambda t : self.axes.c2p( + radius*np.cos(t), + radius*np.sin(t), + t/4 + ), + **config + ) + + self.helix=helix + return helix + + def show_the_parameter(self): + t_tracker = ValueTracker(0) + t=t_tracker.get_value + + t_label = TexMobject( + "t = ",color=RED + ).next_to(self.parametric_eqn,DL,buff=.85) + + t_text = always_redraw( + lambda: DecimalNumber( + t(), + color=GOLD, + ).next_to(t_label, RIGHT, MED_SMALL_BUFF) + ) + t_text.suspend_updating() + + dot = Sphere( + radius= 1.5*DEFAULT_DOT_RADIUS, + stroke_width= 1, + fill_opacity= 1.0, + ) + dot.set_color(GOLD) + dot.add_updater(lambda v: v.move_to( + self.helix.get_point_from_function(PI*t()) + )) + + pi = TexMobject( + "\\pi ", + color=GOLD, + ).next_to(t_text,RIGHT,buff=-.3) + + group = VGroup(t_text,t_label,pi).scale(1.5) + + self.wait(1) + self.add_fixed_in_frame_mobjects(group) + t_text.resume_updating() + self.play(FadeIn(group)) + self.add(dot) + self.play( + t_tracker.set_value,2, + rate_func=linear, + run_time=5 + ) + + +#-------------------------------------------------------- + + #customize 3D axes + def get_three_d_axes(self, include_labels=True, include_numbers=False, **kwargs): + config = dict(self.axes_config) + config.update(kwargs) + axes = ThreeDAxes(**config) + axes.set_stroke(width=1.5) + + if include_numbers: + self.add_axes_numbers(axes) + + if include_labels: + self.add_axes_labels(axes) + + # Adjust axis orientation + axes.x_axis.rotate( + 90 * DEGREES, LEFT, + about_point=axes.c2p(0, 0, 0), + ) + axes.y_axis.rotate( + 90 * DEGREES, UP, + about_point=axes.c2p(0, 0, 0), + ) + + + return axes + + + def setup_axes(self): + axes = self.get_three_d_axes(include_labels=True) + axes.scale(1) + # axes.center() + axes.shift(axes.axes_shift) + self.add(axes) + self.axes = axes + + def add_axes_numbers(self, axes): + x_axis = axes.x_axis + y_axis = axes.y_axis + tex_vals_x = [ + ("1", axes.b), + ] + tex_vals_y=[ + ("1", axes.d) + ] + x_labels = VGroup() + y_labels = VGroup() + for tex, val in tex_vals_x: + label = TexMobject(tex) + label.scale(1) + label.next_to(x_axis.n2p(val), DOWN) + label.rotate(180 * DEGREES) + x_labels.add(label) + x_axis.add(x_labels) + x_axis.numbers = x_labels + + for tex, val in tex_vals_y: + label = TexMobject(tex) + label.scale(1) + label.next_to(y_axis.n2p(val), LEFT) + label.rotate(90 * DEGREES) + y_labels.add(label) + + y_axis.add(y_labels) + y_axis.numbers = y_labels + + return axes + + def add_axes_labels(self, axes): + x_label = TexMobject("x") + x_label.next_to(axes.x_axis.get_end(), RIGHT) + axes.x_axis.label = x_label + + y_label = TextMobject("y") + y_label.rotate(90 * DEGREES, OUT) + y_label.next_to(axes.y_axis.get_end(), UP) + axes.y_axis.label = y_label + + z_label = TextMobject("z") + z_label.rotate(90 * DEGREES, LEFT) + z_label.next_to(axes.z_axis.get_zenith(), LEFT) + axes.z_axis.label = z_label + for axis in axes: + axis.add(axis.label) + return axes + + #uploaded by Somnath Pandit.FSF2020_Line_integrals + + + + + diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file4_helix.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file4_helix.gif deleted file mode 100644 index ceedb1f..0000000 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file4_helix.gif and /dev/null differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file4_vector_line_integral.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file4_vector_line_integral.gif new file mode 100644 index 0000000..8c63d36 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file4_vector_line_integral.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file5_helix.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file5_helix.gif new file mode 100644 index 0000000..ceedb1f Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file5_helix.gif differ diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py deleted file mode 100644 index d5dda1f..0000000 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/unfinished_vector_line_integral.py +++ /dev/null @@ -1,282 +0,0 @@ -from manimlib.imports import * - -class LineIntegrationProcess(GraphScene): - - CONFIG = { - "x_min" : -0, - "x_max" : 1, - "y_min" : -0, - "y_max" : 1, - "axes_color":WHITE, - "graph_origin": ORIGIN+6.5*LEFT+3*DOWN, - "x_axis_width": 6, - "y_axis_height": 6, - "x_tick_frequency": 1, - "y_tick_frequency": 1, - "default_vector_field_config": { - "delta_x": .5, - "delta_y": .5, - "min_magnitude": 0, - "max_magnitude": 15, - "colors": [BLUE], - "length_func": lambda norm : norm/35, - "opacity": 1.0, - "vector_config": { - "stroke_width":2 - }, - }, - "default_graph_style": { - "stroke_width": 2, - "stroke_color": WHITE, - }, - } - - - 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) - - fn_text=TexMobject( - r"\vec F = x^2\hat i-xy\hat j", - stroke_width=2.5 - ).set_color_by_gradient( - *self.default_vector_field_config["colors"] - ) - fn_text.to_corner(UR,buff=.8).shift(2*LEFT) - - origin=self.graph_origin - v_field=self.get_vector_field( - lambda v: np.array([ - (v[0]-origin[0])**2, - -(v[0]-origin[0])*(v[1]-origin[1]), - 0, - ]), - x_min= -.001+origin[0], - x_max= 5.8+origin[0], - y_min= -0+origin[1], - y_max= 6.+origin[1], - ) - - # self.play(Write(surface)) - # self.play(Write(v_field),Write(fn_text)) - self.add(v_field, fn_text) - self.get_line_of_int() - self.get_dot_product_values() - '''self.get_field_values_on_line() - self.wait(1.5) - - self.remove(surface) - self.trasform_to_graphs()''' - 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_line_of_int(self): - line_of_int_text=TextMobject(r"Line of integration is\\","$\\vec r(t)=\cos(t)\hat i+\sin(t)\hat j$") - line_of_int_text[1].set_color(PINK) - line_of_int_text.to_edge(TOP,buff=SMALL_BUFF) - - - line_of_int= self.get_graph( - lambda x : np.sqrt(1-x**2), - x_min=1, - x_max=0, - ) - line_of_int.set_style( - stroke_width=3, - stroke_color=PINK, - ) - - # self.play(Write(line_of_int_text)) - self.wait(.5) - # self.play(ShowCreation(line_of_int),run_time=1.5) - self.add(line_of_int) - - self.line_of_int=line_of_int - self.line_of_int_text=line_of_int_text - - def get_dot_product_values(self): - t_tracker = ValueTracker(0) - self.t_tracker = t_tracker - self.get_vector_and_tangent() - self.get_dot_product_graph() - self.wait(1.5) - self.play(ApplyMethod( - self.t_tracker.set_value, PI/2, - rate_func=linear, - run_time=2, - ) - ) - - def get_dot_product_graph(self): - pass - - - def get_vector_and_tangent(self): - self.play(FadeOut(self.axes)) - self.show_vector() - self.show_tangent() - - - def show_vector(self): - t = self.t_tracker.get_value - vect_label=TextMobject( - "$\\vec F(x_i,y_i)$", - color=YELLOW, - stroke_width=2 - ).scale(.8) - - vector = always_redraw( lambda: - self.vector_field.get_vector( - self.coords_to_point( - np.cos(t()), np.sin(t()) - ), - stroke_width=6, - max_stroke_width_to_length_ratio= 8, - ).set_color(YELLOW), - ) - vector.set_color(ORANGE) - vect_label.next_to(vector,RIGHT,buff=.1) - self.add(vector,vect_label) - # self.play(Write(vector),run_time=.2) - - self.vect_label = vect_label - - def show_tangent(self): - tangent_label=TextMobject("$\\vec T(x_i,y_i)$",color="#DC75CD",stroke_width=2).scale(.8) - - t = self.t_tracker.get_value - - tangent = always_redraw(lambda: - Vector( - color="#DC75CD", - stroke_width=6, - ).scale(1).next_to( - self.coords_to_point( - np.cos(t()), np.sin(t()) - ),DR,buff=-.1 - ).rotate( - self.angle_of_tangent( - np.cos(t()), - self.line_of_int, - dx=-0.00001 - ), - about_point=self.coords_to_point( - np.cos(t()), np.sin(t()) - ) - ) - ) - tangent_label.next_to(tangent,UP,buff=.1) - self.play(Write(VGroup(tangent,tangent_label))) - - self.tangent_label=tangent_label - - def dot_product(self): - - dot_sym=Dot().next_to(self.func_val,RIGHT) - - self.play(FadeOut(VGroup( - self.at_any_points_text, - self.evaluate_text - ))) - self.play(Write(self.dot_prod_text)) - self.play( - FadeIn(dot_sym), - ApplyMethod( - self.tangent_sym.next_to, - dot_sym, RIGHT - )) - - self.dot_sym=dot_sym - - - - def get_curve(self,func,on_surface=False ,**kwargs): - config = dict() - config.update(self.default_graph_style) - config.update({ - "t_min": 0, - "t_max": PI/2, - }) - config.update(kwargs) - r=1 - curve=ParametricFunction( - lambda t: self.coords_to_point( - r*np.cos(t), - r*np.sin(t), - ), - **config, - ) - return curve - - - #------------------------------------------------------- - def trasform_to_graphs(self): - on_surface_graph=(self.get_graph( - self.Func,on_surface=True - )) - on_surface_graph.set_style( - stroke_width=5, - stroke_color=YELLOW, - ) - - line_graph=(self.get_graph( - self.Func,on_surface=False - )) - line_graph.set_style( - stroke_width=5, - stroke_color=PINK, - ) - - self.on_surface_graph=on_surface_graph - self.line_graph=line_graph - graph_area=self.get_area(graph=True) - - into_graph=[ - ReplacementTransform( - self.values_on_surface, - on_surface_graph - ), - ReplacementTransform( - self.line_of_int, - line_graph - ), - ReplacementTransform( - self.area, - graph_area - ), - ] - - def get_area(self): - - area =Polygon( - *[ - on_surface.get_point_from_function(t) - for t in np.arange(0,PI,0.01) - ], - *[ - on_base.get_point_from_function(t) - for t in np.arange(PI,0,-0.01) - ], - stroke_width=0, - fill_color=TEAL_A, - fill_opacity=.6, - ) - - return area - - - - - #uploaded by Somnath Pandit.FSF2020_Line_Integrals -- cgit From f934d4374276b6341ef1cc9e864b3673ad63eaa4 Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Fri, 10 Jul 2020 14:45:23 +0530 Subject: Update README.md --- .../integrals-of-multivariable-functions/line-integrals/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/README.md b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/README.md index 14d95bd..7e4299d 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/README.md +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/README.md @@ -9,7 +9,7 @@ ![file3_vector_line_int_as_sum](gifs/file3_vector_line_int_as_sum.gif) **file4_vector_line_integral** -![file4_vector_line_integral](gifs/file4_vector_line_integral) +![file4_vector_line_integral](gifs/file4_vector_line_integral.gif) **file5_helix** ![file5_helix](gifs/file5_helix.gif) -- cgit From 27aef26cda374eae07775d98155da0f48eb14da0 Mon Sep 17 00:00:00 2001 From: Somnath Pandit Date: Fri, 10 Jul 2020 23:35:53 +0530 Subject: vector line integral final --- .../line-integrals/file4_vector_line_integral.py | 324 +++++++++++++-------- .../gifs/file4_vector_line_integral.gif | Bin 1304411 -> 2243758 bytes 2 files changed, 208 insertions(+), 116 deletions(-) diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file4_vector_line_integral.py b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file4_vector_line_integral.py index d5dda1f..6730820 100644 --- a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file4_vector_line_integral.py +++ b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/file4_vector_line_integral.py @@ -8,9 +8,9 @@ class LineIntegrationProcess(GraphScene): "y_min" : -0, "y_max" : 1, "axes_color":WHITE, - "graph_origin": ORIGIN+6.5*LEFT+3*DOWN, - "x_axis_width": 6, - "y_axis_height": 6, + "graph_origin": ORIGIN+6.3*LEFT+3*DOWN, + "x_axis_width": 5.5, + "y_axis_height": 5.5, "x_tick_frequency": 1, "y_tick_frequency": 1, "default_vector_field_config": { @@ -45,7 +45,7 @@ class LineIntegrationProcess(GraphScene): ).set_color_by_gradient( *self.default_vector_field_config["colors"] ) - fn_text.to_corner(UR,buff=.8).shift(2*LEFT) + fn_text.to_edge(TOP,buff=.1).shift(2*LEFT) origin=self.graph_origin v_field=self.get_vector_field( @@ -55,21 +55,19 @@ class LineIntegrationProcess(GraphScene): 0, ]), x_min= -.001+origin[0], - x_max= 5.8+origin[0], + x_max= 5.4+origin[0], y_min= -0+origin[1], - y_max= 6.+origin[1], + y_max= 5.5+origin[1], ) - - # self.play(Write(surface)) - # self.play(Write(v_field),Write(fn_text)) + self.add(v_field, fn_text) + self.play(Write(fn_text)) + self.wait(2) self.get_line_of_int() self.get_dot_product_values() - '''self.get_field_values_on_line() - self.wait(1.5) - - self.remove(surface) - self.trasform_to_graphs()''' + self.wait(2) + self.remove(v_field,fn_text) + self.write_area_as_intgral_value() self.wait(2) @@ -83,9 +81,12 @@ class LineIntegrationProcess(GraphScene): return vector_field def get_line_of_int(self): - line_of_int_text=TextMobject(r"Line of integration is\\","$\\vec r(t)=\cos(t)\hat i+\sin(t)\hat j$") + line_of_int_text=TextMobject( + r"Line of integration is\\", + "$\\vec r(t)=\cos(t)\hat i+\sin(t)\hat j$" + ) line_of_int_text[1].set_color(PINK) - line_of_int_text.to_edge(TOP,buff=SMALL_BUFF) + line_of_int_text.to_corner(UR,buff=.8) line_of_int= self.get_graph( @@ -98,36 +99,53 @@ class LineIntegrationProcess(GraphScene): stroke_color=PINK, ) - # self.play(Write(line_of_int_text)) + self.play(Write(line_of_int_text)) self.wait(.5) - # self.play(ShowCreation(line_of_int),run_time=1.5) - self.add(line_of_int) + self.play(ShowCreation(line_of_int),run_time=2) + # self.add(line_of_int) self.line_of_int=line_of_int self.line_of_int_text=line_of_int_text - + + def get_dot_product_values(self): t_tracker = ValueTracker(0) self.t_tracker = t_tracker self.get_vector_and_tangent() self.get_dot_product_graph() self.wait(1.5) + self.play(ApplyMethod( + self.t_tracker.set_value, PI/6, + rate_func=linear, + run_time=2.5, + ) + ) + self.wait(1) self.play(ApplyMethod( self.t_tracker.set_value, PI/2, rate_func=linear, - run_time=2, + run_time=4, ) ) + self.dot_prod_graph.suspend_updating() - def get_dot_product_graph(self): - pass - - def get_vector_and_tangent(self): + vect_tangent_text=TextMobject( + "Get the"," vector",r" and\\"," tangent", + " on the"," line" + ) + vect_tangent_text.set_color_by_tex_to_color_map({ + "tangent": ORANGE, "vector": YELLOW, "line":PINK + }) + vect_tangent_text.to_corner(UR,buff=.8) + self.vect_tangent_text= vect_tangent_text + self.play(FadeOut(self.axes)) + self.remove(self.line_of_int_text) + self.play(Write(vect_tangent_text)) self.show_vector() self.show_tangent() - + self.wait(1.3) def show_vector(self): t = self.t_tracker.get_value @@ -146,137 +164,211 @@ class LineIntegrationProcess(GraphScene): max_stroke_width_to_length_ratio= 8, ).set_color(YELLOW), ) - vector.set_color(ORANGE) + vect_label.next_to(vector,RIGHT,buff=.1) - self.add(vector,vect_label) - # self.play(Write(vector),run_time=.2) + vector_group= VGroup(vector,vect_label) + + # self.add(vector_group) + self.play(Write(vector_group),run_time=1) + self.wait(.4) self.vect_label = vect_label + self.vector_group= vector_group def show_tangent(self): - tangent_label=TextMobject("$\\vec T(x_i,y_i)$",color="#DC75CD",stroke_width=2).scale(.8) + tangent_label=TextMobject( + "$\\vec T(x_i,y_i)$", + color=ORANGE, + stroke_width=2 + ).scale(.8) t = self.t_tracker.get_value tangent = always_redraw(lambda: Vector( - color="#DC75CD", + color=ORANGE, stroke_width=6, ).scale(1).next_to( self.coords_to_point( np.cos(t()), np.sin(t()) ),DR,buff=-.1 ).rotate( - self.angle_of_tangent( - np.cos(t()), - self.line_of_int, - dx=-0.00001 + self.angle_of_tangent( + np.cos(t()), + self.line_of_int, + dx=-0.00001 ), - about_point=self.coords_to_point( - np.cos(t()), np.sin(t()) + about_point=self.coords_to_point( + np.cos(t()), np.sin(t()) ) ) ) tangent_label.next_to(tangent,UP,buff=.1) - self.play(Write(VGroup(tangent,tangent_label))) + tangent_group=VGroup(tangent,tangent_label) + + # self.add(tangent_group) + self.play(Write(tangent_group)) + self.wait(.6) self.tangent_label=tangent_label - - def dot_product(self): + self.tangent_group=tangent_group - dot_sym=Dot().next_to(self.func_val,RIGHT) + def get_dot_product_graph(self): + t = self.t_tracker.get_value - self.play(FadeOut(VGroup( - self.at_any_points_text, - self.evaluate_text - ))) - self.play(Write(self.dot_prod_text)) - self.play( - FadeIn(dot_sym), - ApplyMethod( - self.tangent_sym.next_to, - dot_sym, RIGHT - )) - - self.dot_sym=dot_sym - - - - def get_curve(self,func,on_surface=False ,**kwargs): - config = dict() - config.update(self.default_graph_style) - config.update({ - "t_min": 0, - "t_max": PI/2, - }) - config.update(kwargs) - r=1 - curve=ParametricFunction( - lambda t: self.coords_to_point( - r*np.cos(t), - r*np.sin(t), - ), - **config, + self.start_x= 1.3 ; self.end_x=2.3 + + t_axis= self.get_graph( + lambda x : 2.0/5, + x_min= self.start_x, + x_max= self.end_x, + ).set_style( + stroke_width=4, ) - return curve - - #------------------------------------------------------- - def trasform_to_graphs(self): - on_surface_graph=(self.get_graph( - self.Func,on_surface=True + dot_prod_axis= Vector(3*UP).next_to( + t_axis,LEFT,buff=-.1 + ).set_color(GREEN) + dot_prod_label=TexMobject( + "\\vec F","\\cdot","\\vec T", + stroke_width= 1.5, + ).next_to(dot_prod_axis,UP).scale(.8) + dot_prod_label[0].set_color(YELLOW) + dot_prod_label[2].set_color(ORANGE) + + dot_prod_graph_axes= VGroup(t_axis,dot_prod_axis) + + self.write_about_graph() + self.wait(1) + # self.add(dot_prod_graph_axes) + self.play(Write(dot_prod_graph_axes)) + self.show_the_parameter(t,t_axis) + self.wait(.6) + self.play(ReplacementTransform( + self.vect_label,dot_prod_label[0] + )) + self.play(ReplacementTransform( + self.tangent_label,dot_prod_label[1:3] )) - on_surface_graph.set_style( - stroke_width=5, - stroke_color=YELLOW, - ) + self.show_graph_area(t_axis) + + self.dot_prod_graph_axes= dot_prod_graph_axes + self.dot_prod_label= dot_prod_label - line_graph=(self.get_graph( - self.Func,on_surface=False + def write_about_graph(self): + graph_text=TextMobject( + "Graph",r" of the "," vector",r" $-$\\ ", + r"tangent",r" dot product\\", + " with the parameter ","$t$" + ) + graph_text.set_color_by_tex_to_color_map({ + "Graph":GREEN, "vector": YELLOW, + "tangent":ORANGE, "$t$":RED + }) + graph_text.to_corner(UR,buff=.5) + self.graph_text=graph_text + + self.remove(self.vect_tangent_text) + self.play(Write(graph_text),run_time=4) + + def show_the_parameter(self,t,t_axis): + t_dot=Dot(color=RED).next_to(t_axis,LEFT,buff=0) + t_dot.add_updater(lambda obj : + obj.move_to(self.c2g([t(),0]) )) - line_graph.set_style( - stroke_width=5, - stroke_color=PINK, + t_text=TextMobject("$t$=").next_to(t_dot,UP,buff=.25) + t_val=always_redraw( + lambda: DecimalNumber( + t()/PI, + color=GOLD + ).next_to(t_text,RIGHT,buff=0).scale(.8) ) + t_label=VGroup( + t_text,t_val + ).set_color(RED) - self.on_surface_graph=on_surface_graph - self.line_graph=line_graph - graph_area=self.get_area(graph=True) - into_graph=[ - ReplacementTransform( - self.values_on_surface, - on_surface_graph - ), - ReplacementTransform( - self.line_of_int, - line_graph - ), - ReplacementTransform( - self.area, - graph_area - ), - ] - - def get_area(self): + pi = TexMobject( + "\\pi ", + color=GOLD, + ).next_to(t_val,RIGHT,buff=0.05) + t_label.add(pi) + + t_label.add_updater(lambda label : + label.next_to(t_dot,UP) + ) + + t_group=VGroup(t_dot,t_label) + + # self.add(t_group) + self.play(Write(t_group)) - area =Polygon( + self.t_group= t_group + + + def show_graph_area(self,t_axis): + t = self.t_tracker.get_value + dot_prod_graph= always_redraw(lambda: Polygon( *[ - on_surface.get_point_from_function(t) - for t in np.arange(0,PI,0.01) + self.c2g([t,-2*np.cos(t)**2*np.sin(t)]) + for t in np.arange(0,t(),0.01) ], *[ - on_base.get_point_from_function(t) - for t in np.arange(PI,0,-0.01) + self.c2g([t,0]) + for t in [ t(),0 ] ], - stroke_width=0, - fill_color=TEAL_A, + stroke_width=2.5, + fill_color=TEAL_D, fill_opacity=.6, + )) + + self.add(dot_prod_graph) + + self.dot_prod_graph=dot_prod_graph + + def c2g(self,coord): + """ get points for the dot product graph + from its coordinates""" + + return self.coords_to_point( + self.start_x+coord[0]/(PI/2), + 2.0/5+coord[1]/2, ) - return area - - + def write_area_as_intgral_value(self): + area_text=TextMobject( + "Value of the "," line"," integral in the", + r"Vector field\\", + "is equal to this ","area" + ) + area_text.set_color_by_tex_to_color_map({ + "Vector field": BLUE, "line":PINK, "area":TEAL_C + }) + area_text.to_edge(TOP,buff=MED_SMALL_BUFF) + + + self.play(FadeOut(VGroup( + self.line_of_int, + self.vector_group, + self.tangent_group, + self.t_group, + self.dot_prod_graph_axes, + self.dot_prod_label, + self.graph_text + ) + )) + area= self.dot_prod_graph.copy().scale(1.3) + area.next_to(area_text,DOWN,buff=1.5) + + # self.add(area_text) + self.play(Write(area_text),run_time=4) + self.play(ReplacementTransform( + self.dot_prod_graph, + area + )) + self.wait(.5) #uploaded by Somnath Pandit.FSF2020_Line_Integrals + + diff --git a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file4_vector_line_integral.gif b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file4_vector_line_integral.gif index 8c63d36..1be7e1e 100644 Binary files a/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file4_vector_line_integral.gif and b/FSF-2020/calculus-of-several-variables/integrals-of-multivariable-functions/line-integrals/gifs/file4_vector_line_integral.gif differ -- cgit