summaryrefslogtreecommitdiff
path: root/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields
diff options
context:
space:
mode:
authorPurusharth Saxena2020-07-20 14:49:01 +0530
committerGitHub2020-07-20 14:49:01 +0530
commit2a002d6106850ac3002c1ef8893df1a3352ea0ce (patch)
tree5bb70edfb838ffe86e0a0a5850df9fcab5702eaf /FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields
parent5525ce2c688e64385c43f0e31679bc76e3875aae (diff)
parentbcd70e78f623191176ece96184ec1fa39c6f30b1 (diff)
downloadFSF-mathematics-python-code-archive-2a002d6106850ac3002c1ef8893df1a3352ea0ce.tar.gz
FSF-mathematics-python-code-archive-2a002d6106850ac3002c1ef8893df1a3352ea0ce.tar.bz2
FSF-mathematics-python-code-archive-2a002d6106850ac3002c1ef8893df1a3352ea0ce.zip
Merge pull request #84 from mohan-padmapriya/add-gifs
Add gifs
Diffstat (limited to 'FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields')
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file1_paths-3d.gifbin0 -> 4409648 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file1_paths-3d.py41
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file2_line-int.gifbin0 -> 7935159 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file2_line-int.py132
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file3_path-independent.gifbin0 -> 2453243 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file3_path-independent.py131
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file4_path-dependent.gifbin0 -> 2476998 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file4_path-dependent.py130
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file5_closed-loop.gifbin0 -> 1154185 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file5_closed-loop.py63
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file6_potential-func.gifbin0 -> 3881592 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file6_potential-func.py33
12 files changed, 530 insertions, 0 deletions
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file1_paths-3d.gif b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file1_paths-3d.gif
new file mode 100644
index 0000000..56c58b1
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file1_paths-3d.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file1_paths-3d.py b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file1_paths-3d.py
new file mode 100644
index 0000000..28b2bd4
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file1_paths-3d.py
@@ -0,0 +1,41 @@
+from manimlib.imports import *
+import numpy as np
+
+class routes(ThreeDScene):
+ def construct(self):
+
+ axes = ThreeDAxes()
+ self.begin_ambient_camera_rotation(rate=0.08)
+ self.set_camera_orientation(phi=45 * DEGREES,theta=-65*DEGREES, distance = 45)
+ function = ParametricFunction(
+ lambda t: np.array([
+ 1.5*np.cos(t),
+ 1.5*np.sin(t),
+ t/4
+ ]), t_min = 0, t_max =3*PI).set_color("#0EB1D2")
+
+
+ line = Line(np.array([1.5, 0, 0]), np.array([-1.5, 0, 2.35619])).set_color("#F8F32B")
+
+ dot1 = Sphere(radius = 0.1).move_to(np.array([1.5,0,0])).set_color("#74226C")
+ dot2 = Sphere(radius = 0.1).move_to(np.array([1.5,0,0])).set_color("#74226C")
+
+ label1 = TexMobject(r"A").move_to(np.array([1.5,0,0])).set_color("#FCF7F8")
+ label2 = TexMobject(r"B").move_to(np.array([-1.5,0,2.42])).set_color("#FCF7F8")
+
+ title = TexMobject(r"\textit{Work done}",r"\textit{ against gravity is the}", r"\textit{ same for both paths}").set_color("#F1E3F3").move_to(np.array([0,-3,0]))
+ title[1].set_color("#F8F32B")
+
+ self.add(axes)
+ self.wait()
+ self.play(ShowCreation(function), ShowCreation(line), run_time = 2)
+ self.wait()
+ self.play(MoveAlongPath(dot1, function), run_time = 2)
+ self.wait()
+ self.play(MoveAlongPath(dot2, line), run_time = 1.2)
+ self.wait()
+ self.add_fixed_in_frame_mobjects(title)
+ self.play(Write(title))
+ self.wait()
+
+
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file2_line-int.gif b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file2_line-int.gif
new file mode 100644
index 0000000..22d0509
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file2_line-int.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file2_line-int.py b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file2_line-int.py
new file mode 100644
index 0000000..704acf7
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file2_line-int.py
@@ -0,0 +1,132 @@
+from manimlib.imports import *
+
+def field_func(coordinate):
+ x,y = coordinate[:2]
+ return np.array([
+ -x,
+ -y,
+ 0
+ ])
+
+
+class LineIntegral(MovingCameraScene, Scene):
+ def setup(self):
+ MovingCameraScene.setup(self)
+ Scene.setup(self)
+
+ def get_pending(self,path,proportion,dx=0.01):
+ if proportion < 1:
+ coord_i = path.point_from_proportion(proportion)
+ coord_f = path.point_from_proportion(proportion+dx)
+ else:
+ coord_i = path.point_from_proportion(proportion-dx)
+ coord_f = path.point_from_proportion(proportion)
+ line = Line(coord_i,coord_f)
+ angle = line.get_angle()
+ return angle
+
+ def construct(self):
+
+
+ # all the text
+ vec_f = TexMobject(r"\vec F",r" \textit{ is a vector field defined on the plane}").set_color("#EDF2EF")
+ c = TexMobject(r"C",r" \textit{ is a curve on the plane, oriented counter-clockwise.}").set_color("#EDF2EF")
+ dr = TexMobject(r"\vec dr", r"\textit{ gives the direction as we move along C}").set_color("#EDF2EF")
+
+ intg = TexMobject(r"\oint \vec F \cdot \vec dr", r"\textit{ gives the rotation along the curve}").shift(2.5*DOWN).scale(0.7).set_color("#EDF2EF")
+ text = VGroup(vec_f, c, dr).scale(0.6).set_stroke(width = 1.5)
+ text.arrange(DOWN, buff = 0.2)
+ text.shift(3.2*DOWN)
+
+ vec_f[0].set_color("#D1D646")
+ dr[0].set_color("#D1D646")
+ intg[0].set_color("#D1D646")
+
+
+
+
+ self.camera_frame.save_state()
+ vec_f_sym = TexMobject(r"\vec F")
+ c_sym = TexMobject(r"C").move_to(4.8*RIGHT+1.3*UP)
+ dr_sym = TexMobject(r"\vec dr").next_to(vec_f_sym, DOWN, buff = SMALL_BUFF)
+ dp_sym = TexMobject(r"\vec F \cdot \vec dr")
+ intg_sym = TexMobject(r"\oint \vec F \cdot \vec dr")
+
+ symbols = VGroup(vec_f_sym, dr_sym, dp_sym, intg_sym).shift(3*UP).set_color("#D1D646")
+
+
+
+
+ vector_field = VectorField(field_func, x_min = -15, x_max = 15, y_min = -15, y_max = 15).fade(0.5)
+ boundary = Ellipse(width = 9, height = 3).set_color("#32908F")
+ b2 = Ellipse(width = 9, height = 3).set_color(WHITE)
+
+ start_angle = self.get_pending(boundary, 0)
+
+ pointer = Triangle(fill_opacity = 1).set_height(0.25).set_color(WHITE)
+ pointer.set_fill(WHITE)
+ pointer.move_to(boundary.get_start())
+ pointer.rotate(- PI / 2)
+ pointer.save_state()
+ pointer.rotate(start_angle, about_point=pointer.get_center())
+ dp_sym_1 = TexMobject(r"\vec F \cdot \vec dr").next_to(pointer, RIGHT, buff = SMALL_BUFF).scale(0.5).set_color("#D1D646").add_background_rectangle()
+ intg_sym_1 = TexMobject(r"\oint \vec F \cdot \vec dr").next_to(pointer, RIGHT, buff = SMALL_BUFF).scale(0.5).set_color("#75485E").add_background_rectangle()
+ dp = TexMobject(r"\vec F \cdot \vec dr \textit{ measures whether } \vec F \textit{ and } \vec dr", r" \textit{ are oriented the same way }").next_to(dp_sym_1, DOWN, buff = SMALL_BUFF).scale(0.3).set_color("#EDF2EF")
+ dp[1].next_to(dp[0], DOWN, buff = SMALL_BUFF)
+
+
+ # groups according to animation
+ #one = VGroup( vec_f, vec_f_sym)
+ #two = VGroup(boundary, c_sym)
+ #three = VGroup(dr_sym, pointer)
+ #four = VGroup(dp, dp_sym) #this is when to zoom in
+ #five = VGroup(intg, intg_sym)
+
+ delete = VGroup(vec_f, vec_f_sym, c, dr, dr_sym)
+
+
+ self.play(ShowCreation(vec_f), ShowCreation(vec_f_sym))
+ self.wait()
+ self.play(ShowCreation(vector_field), Indicate(vec_f_sym))
+ self.wait(2)
+ self.play(ShowCreation(c))
+ self.wait()
+ self.play(ShowCreation(boundary), ShowCreation(c_sym), Indicate(c))
+ self.wait(2)
+ self.play(ShowCreation(dr))
+ self.wait(2)
+ self.play(ShowCreation(dr_sym), Indicate(dr), ShowCreation(pointer))
+
+ self.play(FadeOut(delete))
+ self.play(
+ self.camera_frame.scale,.25,
+ self.camera_frame.move_to,pointer
+ )
+ self.play(ShowCreation(dp_sym_1), ShowCreation(dp[0]), ShowCreation(dp[1]))
+ self.add(dp_sym)
+ self.wait(3)
+ self.play(Restore(self.camera_frame))
+ self.remove(dp[0], dp[1], dp_sym_1)
+ self.wait()
+ self.add(boundary, pointer, self.camera_frame)
+ def update_rotate_move(mob,alpha):
+ pointer.restore()
+
+ angle = self.get_pending(boundary,alpha)
+
+ pointer.move_to(boundary.point_from_proportion(alpha))
+ pointer.rotate(angle, about_point=pointer.get_center())
+
+
+
+ self.play(
+ #self.camera_frame.scale,.25,
+ UpdateFromAlphaFunc(pointer,update_rotate_move),
+ run_time=3,
+ )
+ self.play(Write(b2))
+ self.play(ReplacementTransform(dp_sym, intg_sym), ShowCreation(intg))
+ self.play(ReplacementTransform(b2, intg_sym))
+ self.play(Indicate(intg_sym))
+ self.wait(2)
+
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file3_path-independent.gif b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file3_path-independent.gif
new file mode 100644
index 0000000..27035d8
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file3_path-independent.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file3_path-independent.py b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file3_path-independent.py
new file mode 100644
index 0000000..c662c31
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file3_path-independent.py
@@ -0,0 +1,131 @@
+from manimlib.imports import *
+import numpy as np
+
+def func(coordinate):
+ x,y = coordinate[:2]
+ return np.array([
+ -2*x,
+ -2*y,
+ 0
+ ])
+
+
+
+
+class many_paths(GraphScene):
+ CONFIG = {
+ "x_min" : 0,
+ "x_max" : 8.5,
+ "x_axis_height": 8.5,
+ "y_min" : 0,
+ "y_max" : 8.5,
+ "y_axis_height": 8.5,
+ "graph_origin" : ORIGIN,
+ "function_color" : RED,
+
+ }
+ def construct(self):
+ self.setup_axes(animate=False)
+ self.remove(self.x_axis, self.y_axis)
+ background = VectorField(func,
+ x_min = 0, x_max = 8.5, y_min = 0, y_max = 8.5, colors = ["#DBD8AE"]
+ )
+
+ pointer = Dot(np.array([0, 1.5, 0])).scale(0.7).set_color_by_gradient(["#84732B", YELLOW_E])
+ start = np.array([0, 1.5, 0])
+ end = np.array([7.53, 5.043, 0])
+ path_one= self.get_graph(self.one, x_min = 0, x_max = 7.53)
+ path_two= self.get_graph(self.two, x_min = 0, x_max = 7.53)
+ path_three = self.get_graph(self.three, x_min = 0, x_max = 7.53)
+
+ group = VGroup(path_one, path_two, background, path_three).move_to(np.array([-3,0, 0])).scale(0.75)
+
+
+
+ path_one.set_color("#F6523C")
+ path_two.set_color("#80475E")
+ path_three.set_color("#0F7173")
+
+ # all the text
+ #function = TexMobject(r"f(x,y) = -(x^2 + y^2)").scale(0.6).set_color("#DBD8AE").shift(3.6*UP + 3*LEFT)
+ field = TexMobject(r"\vec F = -2x\hat i - 2y\hat j").set_color("#DBD8AE").shift(3.6*DOWN + 3*LEFT)
+ c1 = TexMobject(r"C_{1}: y = 6sin(\frac{x}{3} + 1.5)").scale(0.7).set_color("#0F7173").shift(3*UP + 4*RIGHT)
+ #c3 = TexMobject(r"C_{3}: y = 6sin(\frac{x}{3} + 1.5)").scale(0.7).set_color("#0F7173").next_to(li_path2, DOWN, buff = LARGE_BUFF)
+ li_path1 = TexMobject(r"\int_{C_{1}} \vec F \cdot \vec dr = ").set_color("#0F7173").next_to(c1, DOWN, buff = 0.2)
+ c2 = TexMobject(r"C_{2}: y = 0.47x + 1.5").scale(0.7).set_color("#80475E").next_to(li_path1, DOWN, buff = 0.4)
+ li_path2 = TexMobject(r"\int_{C_{2}} \vec F \cdot \vec dr = ").set_color("#80475E").next_to(c2, DOWN, buff = 0.2)
+ c3 = TexMobject(r"C_{3}: y = \frac{x^{16}}{2}+ 1.5").scale(0.7).set_color("#F6523C").next_to(li_path2, DOWN, buff = 0.4)
+ li_path3 = TexMobject(r"\int_{C_{3}} \vec F \cdot \vec dr = ").set_color("#F6523C").next_to(c3, DOWN, buff = 0.2)
+
+ cs = VGroup(c1, c2, c3)
+
+
+ c_1 = lambda x: c1_value.get_value()
+ c_2 = lambda x: c2_value.get_value()
+ c_3 = lambda x: c3_value.get_value()
+
+ c1_value = ValueTracker(0)
+ c2_value = ValueTracker(0)
+ c3_value = ValueTracker(0)
+
+ c1_tex = DecimalNumber(c1_value.get_value()).add_updater(lambda v: v.set_value(c1_value.get_value())).next_to(li_path1, RIGHT, buff = SMALL_BUFF).set_color("#0F7173")
+ c2_tex = DecimalNumber(c2_value.get_value()).add_updater(lambda v: v.set_value(c2_value.get_value())).next_to(li_path2, RIGHT, buff = SMALL_BUFF).set_color("#80475E")
+ c3_tex = DecimalNumber(c3_value.get_value()).add_updater(lambda v: v.set_value(c3_value.get_value())).next_to(li_path3, RIGHT, buff = SMALL_BUFF).set_color("#F6523C")
+
+
+ paths = VGroup(li_path1, li_path2, li_path3, c1_tex, c2_tex, c3_tex)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ self.play(ShowCreation(field), ShowCreation(background))
+ self.wait()
+ self.play(ShowCreation(path_one), ShowCreation(path_two), ShowCreation(path_three), ShowCreation(cs))
+ self.wait(2)
+ self.add(c1_tex)
+ self.play(ShowCreation(li_path1))
+ self.play(MoveAlongPath(pointer, path_three), c1_value.set_value,-78.9,
+ rate_func=linear,
+ run_time=3
+ )
+ self.wait(2)
+ self.play(ShowCreation(li_path2))
+ self.add(c2_tex)
+ self.play(MoveAlongPath(pointer, path_two), c2_value.set_value,-78.9,
+ rate_func=linear,
+ run_time=3
+ )
+ self.play(ShowCreation(li_path3))
+ self.add(c3_tex)
+ self.play(MoveAlongPath(pointer, path_one), c3_value.set_value,-78.9,
+ rate_func=linear,
+ run_time=3
+ )
+ self.wait()
+ self.play(Indicate(paths))
+ self.wait()
+ #self.play(MoveAlongPath(pointer, path_three))
+ #self.wait(2)
+
+ def one(self,x):
+ return x**2/16 + 1.5
+
+ def three(self,x):
+ return 6*np.sin(x/3) + 1.5
+
+ def two(self,x):
+ return 0.4705*x + 1.5
+
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file4_path-dependent.gif b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file4_path-dependent.gif
new file mode 100644
index 0000000..d96e1e1
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file4_path-dependent.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file4_path-dependent.py b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file4_path-dependent.py
new file mode 100644
index 0000000..cb951e7
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file4_path-dependent.py
@@ -0,0 +1,130 @@
+from manimlib.imports import *
+import numpy as np
+
+def func(coordinate):
+ x,y = coordinate[:2]
+ return np.array([
+ y,
+ -x,
+ 0
+ ])
+
+
+
+
+class many_paths(GraphScene):
+ CONFIG = {
+ "x_min" : 0,
+ "x_max" : 8.5,
+ "x_axis_height": 8.5,
+ "y_min" : 0,
+ "y_max" : 8.5,
+ "y_axis_height": 8.5,
+ "graph_origin" : ORIGIN,
+ "function_color" : RED,
+
+ }
+ def construct(self):
+ self.setup_axes(animate=False)
+ self.remove(self.x_axis, self.y_axis)
+ background = VectorField(func,
+ x_min = 0, x_max = 8.5, y_min = 0, y_max = 8.5, colors = ["#DBD8AE"]
+ )
+
+ pointer = Dot(np.array([0, 1.5, 0])).scale(0.7).set_color_by_gradient(["#84732B", YELLOW_E])
+ start = np.array([0, 1.5, 0])
+ end = np.array([7.53, 5.043, 0])
+ path_one= self.get_graph(self.one, x_min = 0, x_max = 7.53)
+ path_two= self.get_graph(self.two, x_min = 0, x_max = 7.53)
+ path_three = self.get_graph(self.three, x_min = 0, x_max = 7.53)
+
+ group = VGroup(path_one, path_two, background, path_three).move_to(np.array([-3,0, 0])).scale(0.75)
+
+
+
+ path_one.set_color("#F6523C")
+ path_two.set_color("#80475E")
+ path_three.set_color("#0F7173")
+
+ # all the text
+ #function = TexMobject(r"f(x,y) = -(x^2 + y^2)").scale(0.6).set_color("#DBD8AE").shift(3.6*UP + 3*LEFT)
+ field = TexMobject(r"\vec F = y\hat i - x\hat j").set_color("#DBD8AE").shift(3.6*DOWN + 3*LEFT)
+ c1 = TexMobject(r"C_{1}: y = 6sin(\frac{x}{3} + 1.5)").scale(0.7).set_color("#0F7173").shift(3*UP + 4*RIGHT)
+ #c3 = TexMobject(r"C_{3}: y = 6sin(\frac{x}{3} + 1.5)").scale(0.7).set_color("#0F7173").next_to(li_path2, DOWN, buff = LARGE_BUFF)
+ li_path1 = TexMobject(r"\int_{C_{1}} \vec F \cdot \vec dr = ").set_color("#0F7173").next_to(c1, DOWN, buff = 0.2)
+ c2 = TexMobject(r"C_{2}: y = 0.47x + 1.5").scale(0.7).set_color("#80475E").next_to(li_path1, DOWN, buff = 0.4)
+ li_path2 = TexMobject(r"\int_{C_{2}} \vec F \cdot \vec dr = ").set_color("#80475E").next_to(c2, DOWN, buff = 0.2)
+ c3 = TexMobject(r"C_{3}: y = \frac{x^{16}}{2} + 1.5").scale(0.7).set_color("#F6523C").next_to(li_path2, DOWN, buff = 0.4)
+ li_path3 = TexMobject(r"\int_{C_{3}} \vec F \cdot \vec dr = ").set_color("#F6523C").next_to(c3, DOWN, buff = 0.2)
+
+ cs = VGroup(c1, c2, c3)
+
+
+ c_1 = lambda x: c1_value.get_value()
+ c_2 = lambda x: c2_value.get_value()
+ c_3 = lambda x: c3_value.get_value()
+
+ c1_value = ValueTracker(0)
+ c2_value = ValueTracker(0)
+ c3_value = ValueTracker(0)
+
+ c1_tex = DecimalNumber(c1_value.get_value()).add_updater(lambda v: v.set_value(c1_value.get_value())).next_to(li_path1, RIGHT, buff = SMALL_BUFF).set_color("#0F7173")
+ c2_tex = DecimalNumber(c2_value.get_value()).add_updater(lambda v: v.set_value(c2_value.get_value())).next_to(li_path2, RIGHT, buff = SMALL_BUFF).set_color("#80475E")
+ c3_tex = DecimalNumber(c3_value.get_value()).add_updater(lambda v: v.set_value(c3_value.get_value())).next_to(li_path3, RIGHT, buff = SMALL_BUFF).set_color("#F6523C")
+
+
+ paths = VGroup(li_path1, li_path2, li_path3, c1_tex, c2_tex, c3_tex)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ self.play(ShowCreation(field), ShowCreation(background))
+ self.wait()
+ self.play(ShowCreation(path_one), ShowCreation(path_two), ShowCreation(path_three), ShowCreation(cs))
+ self.wait(2)
+ self.add(c1_tex)
+ self.play(ShowCreation(li_path1))
+ self.play(MoveAlongPath(pointer, path_three), c1_value.set_value,-49.67,
+ rate_func=linear,
+ run_time=3
+ )
+ self.wait(2)
+ self.play(ShowCreation(li_path2))
+ self.add(c2_tex)
+ self.play(MoveAlongPath(pointer, path_two), c2_value.set_value,-11.3,
+ rate_func=linear,
+ run_time=3
+ )
+ self.play(ShowCreation(li_path3))
+ self.add(c3_tex)
+ self.play(MoveAlongPath(pointer, path_one), c3_value.set_value,-2.4,
+ rate_func=linear,
+ run_time=3
+ )
+ self.wait()
+ self.play(Indicate(paths))
+ self.wait()
+ #self.play(MoveAlongPath(pointer, path_three))
+ #self.wait(2)
+
+ def one(self,x):
+ return x**2/16 + 1.5
+
+ def three(self,x):
+ return 6*np.sin(x/3) + 1.5
+
+ def two(self,x):
+ return 0.4705*x + 1.5
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file5_closed-loop.gif b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file5_closed-loop.gif
new file mode 100644
index 0000000..87e5dd5
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file5_closed-loop.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file5_closed-loop.py b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file5_closed-loop.py
new file mode 100644
index 0000000..9211f0d
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file5_closed-loop.py
@@ -0,0 +1,63 @@
+from manimlib.imports import *
+import numpy as np
+
+def div(coordinate):
+ x,y = coordinate[:2]
+ return np.array([
+ x,
+ y,
+ 0
+ ])
+
+
+class Loop(Scene):
+ def get_pending(self,path,proportion,dx=0.01):
+ if proportion < 1:
+ coord_i = path.point_from_proportion(proportion)
+ coord_f = path.point_from_proportion(proportion+dx)
+ else:
+ coord_i = path.point_from_proportion(proportion-dx)
+ coord_f = path.point_from_proportion(proportion)
+ line = Line(coord_i,coord_f)
+ angle = line.get_angle()
+ return angle
+ def construct(self):
+
+
+
+ boundary = VMobject(stroke_color = "#F4EDED")
+ boundary.set_points_smoothly([np.array([-2, 1.8,0]),np.array([-1.6, 0.5,0]),np.array([-3.2, -1.2,0]),np.array([2.6, -1.5,0]),np.array([1, 0,0]),np.array([3.5,2.3, 0]), np.array([-2,1.8, 0])])
+ #c = TexMobject(r"C").next_to(surf,RIGHT+UP).set_color("#F4EDED")
+
+
+ text = TexMobject(r"\oint \vec F \cdot \vec dr", r" = 0").shift(3*DOWN).set_stroke(width = 1.5)
+ vec_field = VectorField(div)
+
+ start_angle = self.get_pending(boundary, 0)
+
+ pointer = Triangle(fill_opacity = 1).set_height(0.25).set_color(WHITE)
+ pointer.set_fill(WHITE)
+ pointer.move_to(boundary.get_start())
+ pointer.rotate(- PI / 2)
+ pointer.save_state()
+ pointer.rotate(start_angle, about_point=pointer.get_center())
+
+
+ self.play(ShowCreation(boundary), ShowCreation(vec_field))
+ self.wait()
+ self.play(Write(text[0]))
+ def update_rotate_move(mob,alpha):
+ pointer.restore()
+
+ angle = self.get_pending(boundary,alpha)
+
+ pointer.move_to(boundary.point_from_proportion(alpha))
+ pointer.rotate(angle, about_point=pointer.get_center())
+ self.play(
+ #self.camera_frame.scale,.25,
+ UpdateFromAlphaFunc(pointer,update_rotate_move),
+ run_time=3,
+ )
+ self.play(ShowCreation(text[1]))
+ self.play(Indicate(text))
+ self.wait()
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file6_potential-func.gif b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file6_potential-func.gif
new file mode 100644
index 0000000..97a9500
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file6_potential-func.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file6_potential-func.py b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file6_potential-func.py
new file mode 100644
index 0000000..e52a03a
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Conservative fields/Conservative_file6_potential-func.py
@@ -0,0 +1,33 @@
+from manimlib.imports import *
+
+def field_func(coordinate):
+ x,y = coordinate[:2]
+ return np.array([
+ np.cos(x),
+ np.cos(y),
+ 0
+ ])
+
+class Potential(ThreeDScene):
+ def construct(self):
+ axes = ThreeDAxes()
+ self.add(axes)
+ self.set_camera_orientation(phi=0*DEGREES,theta=0*DEGREES,distance=40)
+ vec_field = VectorField(field_func, x_min =-3, x_max = 3, y_min =-3, y_max =3)
+ surf = ParametricSurface(lambda u,v: np.array([u,v,
+ np.sin(u) + np.sin(v)]),
+ u_min = -3, u_max = 3, v_min = -3, v_max = 3, stroke_color = PURPLE_E, checkerboard_colors = [PURPLE_E, PURPLE_E]).fade(0.5)
+
+ #text
+ vec = TexMobject(r"\vec F = \cos x \hat i + \cos y \hat j ").set_color(YELLOW_C).shift(3.8*UP+3.6*RIGHT).scale(0.7)
+ func = TexMobject(r"\textit{has a potential function }", r"f(x,y) = \sin x + \sin y").scale(0.7).next_to(vec, DOWN, buff = 0.2)
+ func[1].set_color(PURPLE_E)
+
+ self.play(ShowCreation(vec_field))
+ self.add_fixed_in_frame_mobjects(vec)
+ self.wait()
+ self.play(FadeIn(surf))
+ self.begin_ambient_camera_rotation()
+ self.move_camera(phi=45*DEGREES,theta=60*DEGREES)
+ self.add_fixed_in_frame_mobjects(func)
+ self.wait(2)