summaryrefslogtreecommitdiff
path: root/FSF-2020/calculus-of-several-variables/approximations-and-optimizations
diff options
context:
space:
mode:
authorVaishnavi2020-06-24 08:15:49 +0530
committerGitHub2020-06-24 08:15:49 +0530
commit2c882380322e86d894bb1c36e7aac00839f205ae (patch)
tree2e3be15a5f035f71f2c2664189ff50d2476092e7 /FSF-2020/calculus-of-several-variables/approximations-and-optimizations
parent988fbb80727496b4839dfe5c7036bff1d848eff2 (diff)
downloadFSF-mathematics-python-code-archive-2c882380322e86d894bb1c36e7aac00839f205ae.tar.gz
FSF-mathematics-python-code-archive-2c882380322e86d894bb1c36e7aac00839f205ae.tar.bz2
FSF-mathematics-python-code-archive-2c882380322e86d894bb1c36e7aac00839f205ae.zip
Create file1_Extrema_over_g(x,y)=k.py
Diffstat (limited to 'FSF-2020/calculus-of-several-variables/approximations-and-optimizations')
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file1_Extrema_over_g(x,y)=k.py53
1 files changed, 53 insertions, 0 deletions
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file1_Extrema_over_g(x,y)=k.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file1_Extrema_over_g(x,y)=k.py
new file mode 100644
index 0000000..17f31ac
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file1_Extrema_over_g(x,y)=k.py
@@ -0,0 +1,53 @@
+from manimlib.imports import*
+
+class firstScene(ThreeDScene):
+ def construct(self):
+ axes = ThreeDAxes()
+ surface = ParametricSurface(
+ lambda u, v: np.array([
+ u,
+ v,
+ u**2+v**2+u**3-v**3
+ ]),u_min=-0.5,u_max=0.5, v_min=-0.5,v_max=0.5).scale(5).shift([0,1,2.5]).set_color('#F0FFFF').fade(0.4)
+
+ c = Circle().set_color('#FF00FF').shift([-0.4,0,1.5]).rotate(1.9,UP).scale(0.7)
+
+ minima = Dot(color = '#4169E1').shift([-0.5,0.5,1]).rotate(1.571,UP)
+ maxima = Dot(color = '#4169E1').shift([0.1,0,2.2]).rotate(1.571,UP)
+
+ l1 = DashedLine([-0.5,0.5,0.9],[-0.5,0.5,0],color = '#F08080')
+ l2 = DashedLine([0.1,0,2.1],[0.1,0,0],color = '#F08080')
+
+ c2 = Circle(fill_opacity= 0.5).shift([-0.3,0.2,0]).scale(0.4)
+
+ minima_refl = Dot(color = '#4682B4').shift([-0.5,0.5,0]).rotate(1.571,UP)
+ maxima_refl = Dot(color = '#4682B4').shift([0.1,0,0]).rotate(1.571,UP)
+
+ max_text = TextMobject("maximum over $g(x,y)=k$",color = '#FFA074').shift([-1.7,0,0]).scale(0.5).shift(2.2*UP)
+ min_text = TextMobject("minimum over $g(x,y)=k$",color = '#FFA074').shift([2.5,0.5,1]).scale(0.5).shift(0.5*UP)
+ label_f = TextMobject("$z=f(x,y)$",color = '#8A2BE2').scale(0.5).shift(3*UP+3*RIGHT)
+ label_g = TextMobject("$g(x,y)=k$",color = '#8A2BE2').scale(0.5).shift(2*RIGHT)
+
+
+ self.add(axes)
+ self.set_camera_orientation(phi=75*DEGREES,theta=45*DEGREES)
+ self.play(Write(surface))
+ self.add_fixed_in_frame_mobjects(label_f)
+ self.wait(2)
+ self.play(Write(c))
+ self.wait(1)
+ self.play(Write(maxima))
+ self.add_fixed_in_frame_mobjects(max_text)
+ self.wait(1)
+ self.play(Write(minima))
+ self.add_fixed_in_frame_mobjects(min_text)
+ self.wait(1)
+ self.play(ShowCreation(l1),ShowCreation(l2))
+ self.play(Write(c2))
+ self.add_fixed_in_frame_mobjects(label_g)
+ self.wait(1)
+ self.play(Write(maxima_refl))
+ self.play(Write(minima_refl))
+ self.wait(1)
+
+