summaryrefslogtreecommitdiff
path: root/FSF-2020/calculus-of-several-variables
diff options
context:
space:
mode:
authorvishal786-commits2020-06-16 13:15:39 +0530
committerGitHub2020-06-16 13:15:39 +0530
commit93971fcabe8b15fbb124947c8322df4c3151a4a7 (patch)
tree2b09e75fc2cca83cff39c5bbe57af6e9c2d97b3f /FSF-2020/calculus-of-several-variables
parent92ea2d74d0d0d37e81a918857741c1daacede823 (diff)
downloadFSF-mathematics-python-code-archive-93971fcabe8b15fbb124947c8322df4c3151a4a7.tar.gz
FSF-mathematics-python-code-archive-93971fcabe8b15fbb124947c8322df4c3151a4a7.tar.bz2
FSF-mathematics-python-code-archive-93971fcabe8b15fbb124947c8322df4c3151a4a7.zip
Create file1_flux_through_sphere.py
Diffstat (limited to 'FSF-2020/calculus-of-several-variables')
-rw-r--r--FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/flux/file1_flux_through_sphere.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/flux/file1_flux_through_sphere.py b/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/flux/file1_flux_through_sphere.py
new file mode 100644
index 0000000..e07715e
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/triple-and-surface-integrals/flux/file1_flux_through_sphere.py
@@ -0,0 +1,50 @@
+from manimlib.imports import *
+class fluxsphere(ThreeDScene):
+
+
+ def construct(self):
+ s = Sphere(checkerboard_colors=[BLUE_D,BLUE_D])
+ s.scale(2.3)
+
+ n = VGroup(
+ *[self.n(*self.func(u, v))
+ for u in np.arange(0, PI, 0.4)
+ for v in np.arange(0, TAU, 0.8)]
+ )
+
+
+
+ self.move_camera(0.8 * PI / 2, -0.45 * PI)
+ self.play(Write(s))
+ # self.play(Write(f))
+ self.play(ShowCreation(n), run_time=4)
+ # self.add(n)
+ self.begin_ambient_camera_rotation(rate=0.1)
+ self.wait(5)
+
+
+ def func(self, u, v):
+ return [
+ np.cos(v) * np.sin(u),
+ np.sin(v) * np.sin(u),
+ np.cos(u)
+ ]
+
+ def vect(self, x, y, z):
+ return np.array([
+ x, y, z
+ ])
+
+ def n(self, x, y, z):
+ vect = np.array([
+ x,
+ y,
+ z
+ ])
+
+ mag = math.sqrt(vect[0] ** 2 + vect[1] ** 2 + vect[2] ** 2)
+ v = Vector(
+ (1.5/mag) * vect,
+ color=RED_B,
+ stroke_width=4).shift(2*x * RIGHT + 2*y * UP + 2*z * OUT)
+ return v