summaryrefslogtreecommitdiff
path: root/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/gradient/file6-maximum.py
diff options
context:
space:
mode:
authorPurusharth Saxena2020-05-26 11:46:17 +0530
committerGitHub2020-05-26 11:46:17 +0530
commitd6d7d7b4d0d6398c021662656827697d66a1294b (patch)
treef92d4e0f9245b174d8f64bcd284fbb0069719780 /FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/gradient/file6-maximum.py
parent5f9490569944289da655c634ac5f5dfea04c390a (diff)
parentc36313078049f0f94fca6229b434bffefd323e95 (diff)
downloadFSF-mathematics-python-code-archive-d6d7d7b4d0d6398c021662656827697d66a1294b.tar.gz
FSF-mathematics-python-code-archive-d6d7d7b4d0d6398c021662656827697d66a1294b.tar.bz2
FSF-mathematics-python-code-archive-d6d7d7b4d0d6398c021662656827697d66a1294b.zip
Merge pull request #12 from mohan-padmapriya/grad-edit
Code for subtopic one: Gradient
Diffstat (limited to 'FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/gradient/file6-maximum.py')
-rw-r--r--FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/gradient/file6-maximum.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/gradient/file6-maximum.py b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/gradient/file6-maximum.py
new file mode 100644
index 0000000..255a0eb
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/div-curl-grad-and-all-that/gradient/file6-maximum.py
@@ -0,0 +1,39 @@
+from manimlib.imports import *
+import numpy as np
+
+
+def function(coordinate):
+ x,y = coordinate[:2]
+ return np.array([
+ x,
+ y,
+ 2 - x**2 - y**2
+ ])
+
+class ThreeDVector_one(ThreeDScene):
+ def construct(self):
+ axes = ThreeDAxes()
+ self.add(axes)
+ self.set_camera_orientation(phi=75*DEGREES,theta=45*DEGREES,distance=40)
+ self.begin_ambient_camera_rotation(rate=0.5)
+
+ surface = ParametricSurface(
+ lambda x, y: np.array([
+ x,
+ y,
+ 2 - x**2 - y**2
+ ]),u_min=-2,u_max=2, v_min=-2,v_max=2).set_color(RED_E).fade(0.7)
+
+ probe = Sphere(radius = 0.2).set_color(PURPLE_E)
+ probe_one = Sphere(radius = 0.1).set_color(PURPLE_E).move_to(np.array([0,0,2.1]))
+ text_one_b = TexMobject(r" \textrm{ reads 0 at local maximum }").next_to(probe, RIGHT, buff = SMALL_BUFF)
+ name = TextMobject("PROBE2.0 ").next_to(probe, DOWN, buff = SMALL_BUFF).scale(0.5)
+ text = VGroup(probe, text_one_b, name).to_edge(1.5*UP+0.5*LEFT).scale(0.5)
+
+
+ self.play(ShowCreation(surface))
+ self.add(probe_one)
+ field = VectorField(function).scale(0.8)
+ self.play(FadeIn(field))
+ self.add_fixed_in_frame_mobjects(text)
+ self.wait(3)