summaryrefslogtreecommitdiff
path: root/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div
diff options
context:
space:
mode:
Diffstat (limited to 'FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div')
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file10_gauss.pngbin0 -> 192422 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file10_gauss.py51
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file11_gravitational-field.pngbin0 -> 12102 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file11_gravitational-filed.ipynb119
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file12_ponder-curl.pngbin0 -> 34864 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file12_ponder-curl.py17
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file1_sources-and-sinks.gifbin0 -> 17712731 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file1_sources-and-sinks.py76
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file2_div-curl-types.py162
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file2_div_curl-types.gifbin0 -> 800 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file3_threed-vec-field.gifbin0 -> 3462931 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file3_threed-vec-field.ipynb67
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file4_output-curl.gifbin0 -> 1331084 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file4_output-curl.ipynb67
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file5_neg-div.gifbin0 -> 1583652 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file5_neg-div.ipynb6
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file6_macro-micro-curl.gifbin0 -> 2824993 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file6_macro-micro-curl.py42
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file7_div-formula.gifbin0 -> 1049376 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file7_div-formula.py225
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file8_curl-paddle.gifbin0 -> 29737449 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file8_curl-paddle.py55
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file9_formal-def.gifbin0 -> 28855629 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file9_formal-def.py82
24 files changed, 969 insertions, 0 deletions
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file10_gauss.png b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file10_gauss.png
new file mode 100644
index 0000000..74e2723
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file10_gauss.png
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file10_gauss.py b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file10_gauss.py
new file mode 100644
index 0000000..d77f92e
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file10_gauss.py
@@ -0,0 +1,51 @@
+import sys
+import numpy as np
+import matplotlib.pyplot as plt
+from matplotlib.patches import Circle
+
+def E(q, r0, x, y):
+ """Return the electric field vector E=(Ex,Ey) due to charge q at r0."""
+ den = np.hypot(x-r0[0], y-r0[1])**3
+ return q * (x - r0[0]) / den, q * (y - r0[1]) / den
+
+# Grid of x, y points
+nx, ny = 64, 64
+x = np.linspace(-2, 2, nx)
+y = np.linspace(-2, 2, ny)
+X, Y = np.meshgrid(x, y)
+
+# Create a multipole with nq charges of alternating sign, equally spaced
+# on the unit circle.
+nq = 2**int(sys.argv[1])
+charges = []
+for i in range(nq):
+ q = i%2 * 2 - 1
+ charges.append((q, (np.cos(2*np.pi*i/nq), np.sin(2*np.pi*i/nq))))
+
+# Electric field vector, E=(Ex, Ey), as separate components
+Ex, Ey = np.zeros((ny, nx)), np.zeros((ny, nx))
+for charge in charges:
+ ex, ey = E(*charge, x=X, y=Y)
+ Ex += ex
+ Ey += ey
+
+fig = plt.figure()
+plt.rcParams['axes.facecolor'] = 'black'
+ax = fig.add_subplot(111)
+
+# Plot the streamlines with an appropriate colormap and arrow style
+color = 2 * np.log(np.hypot(Ex, Ey))
+ax.streamplot(x, y, Ex, Ey, color=color, linewidth=1, cmap=plt.cm.inferno,
+ density=2, arrowstyle='->', arrowsize=1.5)
+
+# Add filled circles for the charges themselves
+charge_colors = {True: '#aa0000', False: '#0000aa'}
+for q, pos in charges:
+ ax.add_artist(Circle(pos, 0.05, color=charge_colors[q>0]))
+
+ax.set_xlabel('$x$')
+ax.set_ylabel('$y$')
+ax.set_xlim(-2,2)
+ax.set_ylim(-2,2)
+ax.set_aspect('equal')
+plt.show()
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file11_gravitational-field.png b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file11_gravitational-field.png
new file mode 100644
index 0000000..129e51b
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file11_gravitational-field.png
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file11_gravitational-filed.ipynb b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file11_gravitational-filed.ipynb
new file mode 100644
index 0000000..4ad8c27
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file11_gravitational-filed.ipynb
@@ -0,0 +1,119 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "%gui qt"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import numpy as np\n",
+ "from mayavi import mlab\n",
+ "import scipy\n",
+ "import time"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stderr",
+ "output_type": "stream",
+ "text": [
+ "/home/padmapriya/mohyavi/lib/python3.6/site-packages/ipykernel_launcher.py:3: RuntimeWarning: invalid value encountered in true_divide\n",
+ " This is separate from the ipykernel package so we can avoid doing imports until\n",
+ "/home/padmapriya/mohyavi/lib/python3.6/site-packages/ipykernel_launcher.py:4: RuntimeWarning: invalid value encountered in true_divide\n",
+ " after removing the cwd from sys.path.\n",
+ "/home/padmapriya/mohyavi/lib/python3.6/site-packages/ipykernel_launcher.py:5: RuntimeWarning: invalid value encountered in true_divide\n",
+ " \"\"\"\n"
+ ]
+ }
+ ],
+ "source": [
+ "x, y, z = np.mgrid[-2:3, -2:3, -2:3]\n",
+ "r = np.sqrt(x**2 + y**2 + z**2)\n",
+ "u = x/r**3\n",
+ "v = y/r**3\n",
+ "w = z/r**3\n",
+ "\n",
+ "a = mlab.quiver3d(x, y, z, u, v, w)\n",
+ "mlab.axes(a)\n",
+ "mlab.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "x, y, z = np.mgrid[-2:3, -2:3, -2:3]\n",
+ "u = y**3 - 9*y\n",
+ "v = x**3 - 9*x\n",
+ "w = x\n",
+ "\n",
+ "a = mlab.quiver3d(x, y, z, u, v, w, colormap = 'gist_earth')\n",
+ "mlab.fig(bgcolor = (0,0,0))\n",
+ "\n",
+ "for i in range(50):\n",
+ " mlab.view(65, -65)\n",
+ " mlab.view(azimuth= 3.6*i, elevation=-60, distance=10)\n",
+ " mlab.process_ui_events()\n",
+ " time.sleep = 0.005\n",
+ " mlab.savefig('curl_%02d.png' % i)\n",
+ " \n",
+ "\n",
+ "x, y, z = np.mgrid[-2:3, -2:3, -2:3]\n",
+ "p = x\n",
+ "q = y\n",
+ "r = 4.5*(x**2 - y**2)\n",
+ "\n",
+ "b = mlab.quiver3d(x, y, z, p, q, r, colormap = 'gist_earth')\n",
+ "for j in range(25):\n",
+ " mlab.view(65, -65)\n",
+ " mlab.view(azimuth= 3.6*j, elevation=-60, distance=10)\n",
+ " mlab.process_ui_events()\n",
+ " time.sleep = 0.005\n",
+ " mlab.savefig('curl2_%02d.png' % j)"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.6.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 4
+}
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file12_ponder-curl.png b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file12_ponder-curl.png
new file mode 100644
index 0000000..2e7fc79
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file12_ponder-curl.png
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file12_ponder-curl.py b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file12_ponder-curl.py
new file mode 100644
index 0000000..be8a17a
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file12_ponder-curl.py
@@ -0,0 +1,17 @@
+from manimlib.imports import *
+import numpy as np
+
+def curl(coordinate):
+ x,y = coordinate[:2]
+ return np.array([
+ y,
+ 0,
+ 0
+ ])
+
+class Ponder_curl(Scene):
+ def construct(self):
+ vf = VectorField(curl)
+ self.add(vf)
+ self.wait()
+
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file1_sources-and-sinks.gif b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file1_sources-and-sinks.gif
new file mode 100644
index 0000000..dcc0843
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file1_sources-and-sinks.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file1_sources-and-sinks.py b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file1_sources-and-sinks.py
new file mode 100644
index 0000000..d26525e
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file1_sources-and-sinks.py
@@ -0,0 +1,76 @@
+from manimlib.imports import *
+import numpy as np
+
+def divergence(coordinate):
+ x,y = coordinate[:2]
+ return np.array([
+ np.sin(x),
+ np.cos(y),
+ 0
+ ])
+
+def curl(coordinate):
+ x,y = coordinate[:2]
+ return np.array([
+ np.sin(y),
+ np.cos(x),
+ 0
+ ])
+
+class fluid_flow(Scene):
+ def construct(self):
+
+
+
+ ball_a = Dot().set_color_by_gradient(["#F87666", "#F53A23", PURPLE_E]).move_to(np.array([-6,-1,0])).fade(0.2).scale(1.2)
+ ball_b = Dot().set_color_by_gradient(["#F87666", "#F53A23", PURPLE_E]).move_to(np.array([0.1,3,0])).fade(0.2).scale(1.2)
+ ball_c = Dot().set_color_by_gradient(["#F87666", "#F53A23", PURPLE_E]).move_to(np.array([-0.5,-1, 0])).fade(0.2).scale(1.2)
+ ball_d = Dot().set_color_by_gradient(["#F87666", "#F53A23", PURPLE_E]).move_to(np.array([4.5,-1.2,0])).fade(0.2).scale(1.2)
+ ball2 = Dot().set_color_by_gradient(["#F87666", "#F53A23", PURPLE_E]).move_to(np.array([-0.5,0,0])).fade(0.2).scale(1.2)
+ ball3 = Dot().set_color_by_gradient(["#F87666", "#F53A23", PURPLE_E]).move_to(np.array([-1.5,1.2,0])).fade(0.2).scale(1.2)
+ ball4 = Dot().set_color_by_gradient(["#F87666", "#F53A23", PURPLE_E]).move_to(np.array([-1.5,-1.2,0])).fade(0.2).scale(1.2)
+ ball5 = Sphere(radius = 0.2, chekerboard_colors =["#F87666", "#F53A23", PURPLE_E]).set_color_by_gradient(["#F87666", "#F53A23", PURPLE_E]).fade(0.2).move_to(np.array([-4.7,0,0]))
+
+ flow_one = StreamLines(
+ divergence,
+ virtual_time=3,
+ min_magnitude=0,
+ max_magnitude=1,
+ ).set_color_by_gradient(["#003853", "#0478A1","#04AED9", WHITE])
+ flow_div =(AnimatedStreamLines(
+ flow_one,
+ line_anim_class=ShowPassingFlashWithThinningStrokeWidth
+ ))
+
+ flow_two = StreamLines(
+ curl,
+
+ virtual_time=3,
+ min_magnitude=0,
+ max_magnitude=1,
+ ).set_color_by_gradient(["#003853", "#0478A1","#04AED9", WHITE])
+ flow_curl =(AnimatedStreamLines(
+ flow_two,
+ line_anim_class=ShowPassingFlashWithThinningStrokeWidth
+ ))
+
+ label_div = TexMobject(r"\textit{Fluid flows out from }", r"\textit{sources }", r"\textit{and into }", r"\textit{sinks}" ).move_to(np.array([0,3.5, 0])).set_stroke(width = 1.5).scale(0.7)
+ label_div[1].set_color("#F87666")
+ label_div[3].set_color("#F87666")
+ title_div = TexMobject(r"Divergence").set_stroke(width = 1.5).move_to(3*DOWN).set_color("#F87666").scale(1.2)
+ label_curl = TexMobject(r"\textit{Fluid also rotates }", r"\textit{clockwise }", r"\textit{and }", r"\textit{counter-clockwise}" ).move_to(np.array([0,3.5, 0])).set_stroke(width = 1.5).scale(0.7)
+ label_curl[1].set_color("#F87666")
+ label_curl[3].set_color("#F87666")
+ title_curl = TexMobject(r"Curl").set_stroke(width = 1.5).move_to(3*DOWN).set_color("#F87666").scale(1.2)
+
+
+
+
+ self.add(flow_div, label_div)
+ self.play(Write(title_div))
+ self.wait(5)
+ self.remove(flow_div)
+ self.wait()
+ self.add(flow_curl)
+ self.play(ReplacementTransform(label_div, label_curl), ReplacementTransform(title_div, title_curl))
+ self.wait(6)
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file2_div-curl-types.py b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file2_div-curl-types.py
new file mode 100644
index 0000000..e8e1a83
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file2_div-curl-types.py
@@ -0,0 +1,162 @@
+from manimlib.imports import *
+import numpy as np
+
+def pos_div(coordinate):
+ x,y = coordinate[:2]
+ return np.array([
+ x,
+ y,
+ 0
+ ])
+
+def neg_div(coordinate):
+ x,y = coordinate[:2]
+ return np.array([
+ -x,
+ -y,
+ 0
+ ])
+
+def zero_div(coordinate):
+ x,y = coordinate[:2]
+ y = 1.0
+ return np.array([
+ y,
+ 0,
+ 0
+ ])
+
+def curl_c(coordinate):
+ x,y = coordinate[:2]
+ return np.array([
+ y,
+ -x,
+ 0
+ ])
+
+def curl_ac(coordinate):
+ x,y = coordinate[:2]
+ return np.array([
+ -y,
+ x,
+ 0
+ ])
+
+
+
+
+class Examples(Scene):
+ def construct(self):
+
+ vf1 = VectorField(pos_div, x_min = -1.5, x_max = 1.5, y_min = -1.5, y_max = 1.5).shift(2.5*UP, 4*LEFT)
+ vf3 = VectorField(neg_div, x_min = -1.5, x_max = 1.5, y_min = -1.5, y_max = 1.5).shift(2.5*UP, 4*RIGHT)
+ vf2 = VectorField(zero_div, x_min = -1.5, x_max = 1.5, y_min = -1.5, y_max = 1.5).move_to(np.array([0, 0.5, 0]))
+ vf4 = VectorField(curl_c, x_min = -1.5, x_max = 1.5, y_min = -1.5, y_max = 1.5).shift(2*DOWN, 4*RIGHT)
+ vf5 = VectorField(curl_ac, x_min = -1.5, x_max = 1.5, y_min = -1.5, y_max = 1.5).shift(2*DOWN, 4*LEFT)
+ dot = Dot().move_to(vf1.get_center())
+ label3 = TexMobject(r"\textit{Sink}", r"\textrm{div} F < 0").set_color(BLUE_E).scale(0.6).shift(3*DOWN + 0.7*RIGHT)
+ label1 = TexMobject(r"\textit{Source}", r"\textrm{div} F > 0").set_color(YELLOW_E).scale(0.6).shift(2.8*DOWN + 0.7*RIGHT)
+ label2 = TexMobject(r"\textrm{div} F =0", r"\textrm{ curl} F = 0").scale(0.6).shift(3*DOWN + 0.7*RIGHT)
+ label4 = TexMobject(r"\textit{Clockwise rotation}", r"\textrm{curl} F < 0").set_color(BLUE_E).scale(0.6).shift(3*DOWN + 0.7*RIGHT)
+ label5 = TexMobject(r"\textit{Counter-clockwise rotation}", r"\textrm{curl} F > 0").set_color(YELLOW_E).scale(0.6).shift(3*DOWN + 0.7*RIGHT)
+
+ label1[1].next_to(label1[0], DOWN, buff = SMALL_BUFF).set_color(WHITE)
+ label2[1].next_to(label2[0], DOWN, buff = SMALL_BUFF).set_color(WHITE)
+ label3[1].next_to(label3[0], DOWN, buff = SMALL_BUFF).set_color(WHITE)
+
+ label4[1].next_to(label4[0], DOWN, buff = SMALL_BUFF).set_color(WHITE)
+ label5[1].next_to(label5[0], DOWN, buff = SMALL_BUFF).set_color(WHITE)
+
+ lines_a = StreamLines(
+ pos_div,
+ virtual_time=1.5,
+ min_magnitude=0,
+ max_magnitude=1.5,
+ x_min = -1, x_max = 1, y_min = -1, y_max = 1
+ ).shift(2.5*UP, 4*LEFT)
+ lines1 = AnimatedStreamLines(
+ lines_a,
+ line_anim_class=ShowPassingFlashWithThinningStrokeWidth
+ )
+
+ lines_b = StreamLines(
+ zero_div,
+ virtual_time=1.5,
+ min_magnitude=0,
+ max_magnitude=1.5,
+ x_min = -0.5, x_max = 0.5, y_min = -0.5, y_max = 0.5
+ ).move_to(np.array([-0.2, 0.5, 0]))
+ lines2 = AnimatedStreamLines(
+ lines_b,
+ line_anim_class=ShowPassingFlashWithThinningStrokeWidth
+ )
+
+ lines_c = StreamLines(
+ neg_div,
+ virtual_time=1.5,
+ min_magnitude=0,
+ max_magnitude=1.5,
+ x_min = -1, x_max = 1, y_min = -1, y_max = 1
+ ).shift(2.5*UP, 4*RIGHT)
+ lines3 =(AnimatedStreamLines(
+ lines_c,
+ line_anim_class=ShowPassingFlashWithThinningStrokeWidth
+ ))
+
+ lines_d = StreamLines(
+ curl_c,
+ virtual_time=1.5,
+ min_magnitude=0,
+ max_magnitude=1.5,
+ x_min = -1, x_max = 1, y_min = -1, y_max = 1
+ ).shift(2*DOWN, 4*RIGHT)
+ lines4 =(AnimatedStreamLines(
+ lines_d,
+ line_anim_class=ShowPassingFlashWithThinningStrokeWidth
+ ))
+
+ lines_e = StreamLines(
+ curl_ac,
+ virtual_time=1.5,
+ min_magnitude=0,
+ max_magnitude=1.5,
+ x_min = -1, x_max = 1, y_min = -1, y_max = 1
+ ).shift(2*DOWN, 4*LEFT)
+ lines5 =(AnimatedStreamLines(
+ lines_e,
+ line_anim_class=ShowPassingFlashWithThinningStrokeWidth
+ ))
+ self.play(Write(vf1))
+ self.wait()
+ self.add(lines1)
+ self.play(ShowCreation(label1[0]), ShowCreation(label1[1]))
+ self.wait(4)
+ self.remove(lines1)
+ self.play(Write(vf2))
+ self.add(lines2)
+ self.play(ReplacementTransform(label1, label2))
+ self.play(Indicate(label2))
+ self.wait(4)
+ self.remove(lines2)
+ self.play(Write(vf3))
+ self.add(lines3)
+ self.play(ReplacementTransform(label2, label3))
+ self.play(Indicate(label3))
+ self.wait(4)
+ self.remove(lines3)
+ self.play(Write(vf4))
+ self.add(lines4)
+ self.play(ReplacementTransform(label3, label4))
+ self.play(Indicate(label4))
+ self.wait(4)
+ self.remove(lines4)
+ self.play(Write(vf5))
+ self.add(lines5)
+ self.play(ReplacementTransform(label4, label5))
+ self.play(Indicate(label5))
+ self.wait(4)
+ self.remove(lines5)
+ self.wait()
+
+
+
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file2_div_curl-types.gif b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file2_div_curl-types.gif
new file mode 100644
index 0000000..9d60f45
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file2_div_curl-types.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file3_threed-vec-field.gif b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file3_threed-vec-field.gif
new file mode 100644
index 0000000..ad331a3
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file3_threed-vec-field.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file3_threed-vec-field.ipynb b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file3_threed-vec-field.ipynb
new file mode 100644
index 0000000..8d41df4
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file3_threed-vec-field.ipynb
@@ -0,0 +1,67 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "%gui qt"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import numpy as np\n",
+ "from mayavi import mlab"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "x, y, z = np.mgrid[-2:3, -2:3, -2:3]\n",
+ "u = y**3 - 9*y\n",
+ "v = x**3 - 9*x\n",
+ "w = x\n",
+ "\n",
+ "a = mlab.quiver3d(x, y, z, u, v, w)\n",
+ "mlab.axes(a)\n",
+ "mlab.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.6.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 4
+}
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file4_output-curl.gif b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file4_output-curl.gif
new file mode 100644
index 0000000..956458b
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file4_output-curl.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file4_output-curl.ipynb b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file4_output-curl.ipynb
new file mode 100644
index 0000000..0f8b326
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file4_output-curl.ipynb
@@ -0,0 +1,67 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "%gui qt"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import numpy as np\n",
+ "from mayavi import mlab"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "x, y, z = np.mgrid[-2:3, -2:3, -2:3]\n",
+ "u = x\n",
+ "v = y\n",
+ "w = 4.5*(x**2 - y**2)\n",
+ "\n",
+ "a = mlab.quiver3d(x, y, z, u, v, w)\n",
+ "mlab.axes(a)\n",
+ "mlab.show()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.6.9"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 4
+}
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file5_neg-div.gif b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file5_neg-div.gif
new file mode 100644
index 0000000..7634acf
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file5_neg-div.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file5_neg-div.ipynb b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file5_neg-div.ipynb
new file mode 100644
index 0000000..7fec515
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file5_neg-div.ipynb
@@ -0,0 +1,6 @@
+{
+ "cells": [],
+ "metadata": {},
+ "nbformat": 4,
+ "nbformat_minor": 4
+}
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file6_macro-micro-curl.gif b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file6_macro-micro-curl.gif
new file mode 100644
index 0000000..9b30ce5
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file6_macro-micro-curl.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file6_macro-micro-curl.py b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file6_macro-micro-curl.py
new file mode 100644
index 0000000..02c75a3
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file6_macro-micro-curl.py
@@ -0,0 +1,42 @@
+from manimlib.imports import *
+import numpy as np
+
+def curl(coordinate):
+ x,y = coordinate[:2]
+ return np.array([
+ -y,
+ x,
+ 0
+ ])
+
+
+class Subtle(Scene):
+ def construct(self):
+ vf1 = VectorField(curl)
+ pinwheel = SVGMobject("geo").move_to(np.array([2, 0, 0])).scale(0.3).set_stroke(width = 0.3).set_color_by_gradient(["#adf802", YELLOW_C]).move_to(np.array([2.3, 0, 0]))
+ self.add(pinwheel)
+
+ label1 = TexMobject(r"\textit{Microscopic curl}").shift(3*DOWN).add_background_rectangle()
+ label2 = TexMobject(r"\textit{Macroscopic curl}").shift(3*DOWN)
+
+ ball1 = Dot(checkerboard_colors = [BLUE_E, PURPLE_E], resolution = [2,2], radius = 0.4).move_to(np.array([-1, -1, 0]))
+ ball2 = Sphere(checkerboard_colors = [BLUE_E, TEAL], resolution = [16, 16], radius = 0.3).move_to(np.array([2, 0, 0]))
+ circ = Circle(radius = 2)
+
+
+ self.add(vf1)
+ self.wait()
+ self.play(ShowCreation(pinwheel))
+ self.bring_to_front(pinwheel)
+ self.play(Rotating(pinwheel), ShowCreation(label1))
+ self.wait(2)
+ #self.add(ball1)
+ move_submobjects_along_vector_field(pinwheel, curl)
+ self.play(FadeOut(label1), ShowCreation(label2))
+ self.play(Indicate(label2))
+
+ self.wait(5)
+
+
+
+
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file7_div-formula.gif b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file7_div-formula.gif
new file mode 100644
index 0000000..4910d2f
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file7_div-formula.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file7_div-formula.py b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file7_div-formula.py
new file mode 100644
index 0000000..4e1eab2
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file7_div-formula.py
@@ -0,0 +1,225 @@
+from manimlib.imports import *
+import numpy as np
+
+def div(coordinate):
+ x,y = coordinate[:2]
+ return np.array([
+ x,
+ y,
+ 0
+ ])
+
+
+
+
+class Grid(VMobject):
+ CONFIG = {
+ "height": 6.0,
+ "width": 6.0,
+ }
+
+ def __init__(self, rows, columns, **kwargs):
+ digest_config(self, kwargs, locals())
+ VMobject.__init__(self, **kwargs)
+
+ def generate_points(self):
+ x_step = self.width / self.columns
+ y_step = self.height / self.rows
+
+ for x in np.arange(0, self.width + x_step, x_step):
+ self.add(Line(
+ [x - self.width / 2., -self.height / 2., 0],
+ [x - self.width / 2., self.height / 2., 0],
+ ))
+ for y in np.arange(0, self.height + y_step, y_step):
+ self.add(Line(
+ [-self.width / 2., y - self.height / 2., 0],
+ [self.width / 2., y - self.height / 2., 0]
+ ))
+
+
+class ScreenGrid(VGroup):
+ CONFIG = {
+ "rows":8,
+ "columns":14,
+ "height": FRAME_Y_RADIUS*2,
+ "width": 14,
+ "grid_stroke":0.5,
+ "grid_color":WHITE,
+ "axis_color":RED,
+ "axis_stroke":2,
+ "show_points":False,
+ "point_radius":0,
+ "labels_scale":0.5,
+ "labels_buff":0,
+ "number_decimals":2
+ }
+
+ def __init__(self,**kwargs):
+ VGroup.__init__(self,**kwargs)
+ rows=self.rows
+ columns=self.columns
+ grilla=Grid(width=self.width,height=self.height,rows=rows,columns=columns).set_stroke(self.grid_color,self.grid_stroke)
+
+ vector_ii=ORIGIN+np.array((-self.width/2,-self.height/2,0))
+ vector_id=ORIGIN+np.array((self.width/2,-self.height/2,0))
+ vector_si=ORIGIN+np.array((-self.width/2,self.height/2,0))
+ vector_sd=ORIGIN+np.array((self.width/2,self.height/2,0))
+
+ ejes_x=Line(LEFT*self.width/2,RIGHT*self.width/2)
+ ejes_y=Line(DOWN*self.height/2,UP*self.height/2)
+
+ ejes=VGroup(ejes_x,ejes_y).set_stroke(self.axis_color,self.axis_stroke)
+
+ divisiones_x=self.width/columns
+ divisiones_y=self.height/rows
+
+ direcciones_buff_x=[UP,DOWN]
+ direcciones_buff_y=[RIGHT,LEFT]
+ dd_buff=[direcciones_buff_x,direcciones_buff_y]
+ vectores_inicio_x=[vector_ii,vector_si]
+ vectores_inicio_y=[vector_si,vector_sd]
+ vectores_inicio=[vectores_inicio_x,vectores_inicio_y]
+ tam_buff=[0,0]
+ divisiones=[divisiones_x,divisiones_y]
+ orientaciones=[RIGHT,DOWN]
+ puntos=VGroup()
+ leyendas=VGroup()
+
+
+ for tipo,division,orientacion,coordenada,vi_c,d_buff in zip([columns,rows],divisiones,orientaciones,[0,1],vectores_inicio,dd_buff):
+ for i in range(1,tipo):
+ for v_i,direcciones_buff in zip(vi_c,d_buff):
+ ubicacion=v_i+orientacion*division*i
+ punto=Dot(ubicacion,radius=self.point_radius)
+ coord=round(punto.get_center()[coordenada],self.number_decimals)
+ leyenda=TextMobject("%s"%coord).scale(self.labels_scale)
+ leyenda.next_to(punto,direcciones_buff,buff=self.labels_buff)
+ puntos.add(punto)
+ leyendas.add(leyenda)
+
+ self.add(grilla,ejes,leyendas)
+ if self.show_points==True:
+ self.add(puntos)
+
+
+
+
+
+
+class ExpDiv(Scene):
+ def construct(self):
+
+ #all the text
+ field_text = TexMobject(r"\vec F = P\hat i + Q\hat j").shift(3*UP+5*RIGHT)
+ field_text_2 = TexMobject(r"\vec F = 2x\hat i + 2y\hat j").shift(3*UP+5*RIGHT)
+ p = TexMobject(r"P = 2x").scale(0.8)
+ q = TexMobject(r"Q = 2y").next_to(p, RIGHT).scale(0.8)
+ pq = VGroup(p, q)
+ pq.next_to(field_text_2, DOWN, buff = SMALL_BUFF)
+ dpq = TexMobject(r"\frac{\partial P}{\partial x}", r" \frac{\partial Q}{\partial y}").scale(0.8).next_to(pq, DOWN, buff = LARGE_BUFF)
+
+
+ dp_dq = TexMobject(r"\frac{\partial P}{\partial x} + \frac{\partial Q}{\partial y}", r" = \textrm{div} \vec F").scale(0.8).next_to(pq, DOWN, buff = LARGE_BUFF)
+ #dp_dq1 = TexMobject(r" = \textrm{div} \vec F").scale(0.8)
+ #dp_dq1.next_to(dp_dq[0], DOWN, buff = SMALL_BUFF)
+ dp_text = TexMobject(r"\frac{\partial P}{\partial x}\textit{: the rate of change of the horizontal component as x increases}").shift(3*DOWN).scale(0.8)
+ dq_text = TexMobject(r"\frac{\partial Q}{\partial y}\textit{: the rate of change of the vertical component as y increases}").shift(3*DOWN).scale(0.8)
+
+
+ vector_field = VectorField(div, x_min = -4, x_max = 4, y_min = -4, y_max = 4).shift(1.5*LEFT)
+
+ x_comps=VGroup()
+ y_comps=VGroup()
+ for vector in vector_field:
+ x = Vector(RIGHT, color = BLUE_E)
+ y = Vector(UP, color= YELLOW_E)
+ x.put_start_and_end_on(vector.points[0], np.array([vector.get_end()[0],vector.points[0][1],0]))
+ y.put_start_and_end_on(vector.points[0], np.array([vector.points[0][0],vector.get_end()[1],0]))
+ x_comps.add(x)
+ y_comps.add(y)
+
+ line1 = Arrow(4*LEFT, 4*RIGHT).shift(3.5*DOWN+1.5*LEFT)
+ line2 = Arrow(4*DOWN, 4*UP).shift(3*RIGHT)
+
+
+
+
+ # f(x) = x**2
+ fx = lambda x: x.get_value()/10
+ # ValueTrackers definition
+ x_value = ValueTracker(-4)
+ fx_value = ValueTracker(fx(x_value))
+ # DecimalNumber definition
+ x_tex = DecimalNumber(x_value.get_value()).add_updater(lambda v: v.set_value(x_value.get_value()))
+ fx_tex = DecimalNumber(fx_value.get_value()).add_updater(lambda v: v.set_value(fx(x_value)))
+ # TeX labels definition
+ x_label = TexMobject("x = ")
+ fx_label = TexMobject("P = ")
+ # Grouping of labels and numbers
+ group = VGroup(x_tex,fx_tex,x_label,fx_label).scale(0.8)
+ VGroup(x_tex, fx_tex).arrange_submobjects(DOWN,buff=0.3)
+ # Align labels and numbers
+ x_label.next_to(x_tex,LEFT, buff=0.1,aligned_edge=x_label.get_bottom())
+ fx_label.next_to(fx_tex,LEFT, buff=0.1,aligned_edge=fx_label.get_bottom())
+
+
+ fy = lambda y: y.get_value()/10
+ # ValueTrackers definition
+ y_value = ValueTracker(-4)
+ fy_value = ValueTracker(fy(y_value))
+ # DecimalNumber definition
+ y_tex = DecimalNumber(y_value.get_value()).add_updater(lambda v: v.set_value(y_value.get_value()))
+ fy_tex = DecimalNumber(fy_value.get_value()).add_updater(lambda v: v.set_value(fy(y_value)))
+ # Tey labels definition
+ y_label = TexMobject("y = ")
+ fy_label = TexMobject("Q = ")
+ # Grouping of labels and numbers
+ group_2 = VGroup(y_tex,fy_tex,y_label,fy_label).scale(0.8)
+ VGroup(y_tex, fy_tex).arrange_submobjects(DOWN,buff=0.3)
+ # Align labels and numbers
+ y_label.next_to(y_tex,LEFT, buff=0.1,aligned_edge=y_label.get_bottom())
+ fy_label.next_to(fy_tex,LEFT, buff=0.1,aligned_edge=fy_label.get_bottom())
+
+
+ self.play(ShowCreation(field_text))
+ self.wait()
+ self.play(ShowCreation(vector_field), ReplacementTransform(field_text, field_text_2))
+ self.wait()
+ self.play(ShowCreation(p), ShowCreation(q), FadeOut(vector_field))
+ self.wait()
+ self.play(ShowCreation(dpq[0]), ShowCreation(x_comps))
+ self.play(Indicate(dpq[0]))
+ self.wait()
+ self.play(ShowCreation(dp_text))
+ self.wait()
+ self.play(Uncreate(dp_text))
+
+ self.add(group.move_to(5*RIGHT+3*DOWN))
+ self.play(Write(line1),
+ x_value.set_value,4,
+ rate_func=linear,
+ run_time=3
+ )
+ self.wait(2)
+ self.play(FadeOut(group), FadeOut(line1), ApplyFunction(lambda a:a.fade(), x_comps))
+
+ self.play(ShowCreation(dpq[1]), ShowCreation(y_comps))
+ self.play(Indicate(dpq[1]))
+ self.wait(2)
+ self.play(ShowCreation(dq_text))
+ self.wait()
+ self.play(Uncreate(dq_text))
+
+ self.add(group_2.move_to(5*RIGHT+3*DOWN))
+ self.play(Write(line2),
+ y_value.set_value,4,
+ rate_func=linear,
+ run_time=3
+ )
+ self.wait(2)
+ self.play(ReplacementTransform(dpq, dp_dq), FadeOut(line2), ReplacementTransform(x_comps, vector_field), ReplacementTransform(y_comps, vector_field), FadeOut(group_2))
+
+ self.play(Indicate(dp_dq))
+ self.wait()
+
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file8_curl-paddle.gif b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file8_curl-paddle.gif
new file mode 100644
index 0000000..41db451
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file8_curl-paddle.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file8_curl-paddle.py b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file8_curl-paddle.py
new file mode 100644
index 0000000..7a11992
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file8_curl-paddle.py
@@ -0,0 +1,55 @@
+from manimlib.imports import *
+
+def field_func(coordinate):
+ x,y = coordinate[:2]
+ return np.array([
+ -y,
+ x,
+ 0
+ ])
+
+class Paddlewheel(ThreeDScene):
+ def construct(self):
+ axes = ThreeDAxes()
+ #self.add(axes)
+ text = TextMobject("Insert the paddle into the flow of water").shift(3*DOWN).add_background_rectangle()
+ text_a = TextMobject("The rotation of the wheel is proportional to the component of curl in the direction of the axle").shift(3*DOWN).scale(0.7)
+
+ vec_field = VectorField(field_func, x_min =-4, x_max = 4, y_min =-4, y_max =4)
+
+ self.set_camera_orientation(phi=0*DEGREES,theta=0*DEGREES,distance=40)
+ lines_a = StreamLines(
+ field_func,
+ virtual_time=3,
+ min_magnitude=0,
+ max_magnitude=3,
+ ).set_color_by_gradient([WHITE, BLUE_E])
+ flow = AnimatedStreamLines(
+ lines_a,
+ line_anim_class=ShowPassingFlashWithThinningStrokeWidth
+ )
+
+ paddle = VGroup(Line(np.array([3, 0, 0]), np.array([-3, 0, 0])),
+ Line(np.array([0, 3, 0]), np.array([0, -3, 0]))).set_stroke(width = 8).set_color(YELLOW_E)
+ cylinder = ParametricSurface(
+ lambda u, v: np.array([
+ 0.1*np.cos(u),
+ 0.1*np.sin(u),
+ v,
+ ]),
+ u_min = 0, u_max = 2*np.pi, v_min = -0.2, v_max = 3.5, checkerboard_colors = [YELLOW_E, YELLOW_E]).fade(0.5)
+ plane = ParametricSurface(lambda u, v: np.array([u, v, 0]), checkerboard_colors = [WHITE, WHITE]).fade(0.9)
+
+ self.add(paddle, cylinder, flow)
+ self.add_fixed_in_frame_mobjects(text)
+ self.play(Rotating(paddle))
+ self.wait()
+ self.play(FadeIn(vec_field))
+ self.remove(flow, text)
+ self.bring_to_front(cylinder)
+ #self.play(Rotating(paddle))
+ self.wait()
+ self.add_fixed_in_frame_mobjects(text_a)
+ #self.play(ReplacementTransform(text, text_a))
+ self.move_camera(phi=60*DEGREES,theta=30*DEGREES)
+ self.wait()
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file9_formal-def.gif b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file9_formal-def.gif
new file mode 100644
index 0000000..6247aea
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file9_formal-def.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file9_formal-def.py b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file9_formal-def.py
new file mode 100644
index 0000000..ecafca4
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/Curl and Div/DivCurl_file9_formal-def.py
@@ -0,0 +1,82 @@
+from manimlib.imports import *
+import numpy as np
+
+
+
+def func(coordinate):
+ x,y = coordinate[:2]
+ return np.array([
+ 1.9*np.cos(x+2*y),
+ 1.5*np.sin(x-2*y),
+ 0
+ ])
+
+def coord(x,y,z=0):
+ return np.array([x,y,z])
+
+class Instrument(Scene):
+ CONFIG = {
+ "x_coords": ([1, 2.2, 3.9, 3, -0, -0.2, 1]),
+ "y_coords": ([1.5, 1, -0.5, -2.0, -1.4, 0.5, 1.5]),
+ }
+
+ def setup(self):
+ self.tuples = list(zip(self.x_coords,self.y_coords))
+ dots = self.get_all_mobs()
+
+ def get_dots(self, coords):
+ dots = VGroup(*[Dot(coord(x,y)) for x,y in coords])
+ return dots
+
+ def get_all_mobs(self):
+ dots = self.get_dots(self.tuples)
+ return dots
+
+
+class Curl_one(MovingCameraScene, Instrument):
+ def setup(self):
+ MovingCameraScene.setup(self)
+ Instrument.setup(self)
+
+
+ def construct(self):
+ vec = VectorField(func)
+
+
+ frame_one = Circle(radius = 0.5).move_to(np.array([4, 2, 0]))
+ dot = Dot(frame_one.get_center()).scale(0.5)
+ surface = VMobject()
+ surface.set_points_smoothly([*[coord(x,y) for x,y in self.tuples]])
+ surface.move_to(dot.get_center()).set_stroke(width = 0.5)
+
+ label = TexMobject(r"A").scale(0.5).next_to(dot, LEFT+UP, buff = SMALL_BUFF)
+ #self.add(frame_one)
+ self.camera_frame.save_state()
+ self.play(
+ self.camera_frame.set_width,frame_one.get_width()*7.0,
+ self.camera_frame.move_to,frame_one)
+
+
+
+
+ self.add(vec, dot, label)
+ lines = StreamLines(
+ func,
+ virtual_time=7,
+ min_magnitude=0,
+ max_magnitude=8,
+ )
+ lines1 = AnimatedStreamLines(
+ lines,
+ line_anim_class=ShowPassingFlashWithThinningStrokeWidth
+ )
+
+ self.add(lines1)
+ self.wait(3)
+ self.play(Restore(self.camera_frame))
+ self.wait(2)
+ self.add(surface)
+ self.wait(3)
+ self.play(ApplyMethod(surface.scale, 0.01), run_time = 2)
+ self.remove(surface)
+ self.wait(2)