summaryrefslogtreecommitdiff
path: root/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers
diff options
context:
space:
mode:
authorVaishnavi2020-07-01 18:00:51 +0530
committerGitHub2020-07-01 18:00:51 +0530
commit8f468915a373f38c9af9f342cf5da8c1cc546ca3 (patch)
treec990f1197bcfc8156ba0f5b4fdc162dfcda1af03 /FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers
parent3d2a78b9719213ad8e7926e6da33ffc35a244430 (diff)
downloadFSF-mathematics-python-code-archive-8f468915a373f38c9af9f342cf5da8c1cc546ca3.tar.gz
FSF-mathematics-python-code-archive-8f468915a373f38c9af9f342cf5da8c1cc546ca3.tar.bz2
FSF-mathematics-python-code-archive-8f468915a373f38c9af9f342cf5da8c1cc546ca3.zip
Update file3_Optimizing_function_w.r.t_one_constraint.py
Diffstat (limited to 'FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers')
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file3_Optimizing_function_w.r.t_one_constraint.py40
1 files changed, 26 insertions, 14 deletions
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file3_Optimizing_function_w.r.t_one_constraint.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file3_Optimizing_function_w.r.t_one_constraint.py
index bf75dd8..742d6b5 100644
--- a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file3_Optimizing_function_w.r.t_one_constraint.py
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file3_Optimizing_function_w.r.t_one_constraint.py
@@ -1,29 +1,41 @@
from manimlib.imports import*
+import math as m
class firstScene(ThreeDScene):
def construct(self):
axes = ThreeDAxes()
+ label_x = TextMobject("$x$").shift([5.5,-0.5,0]).fade(0.4) #---- x axis
+ label_y = TextMobject("$y$").shift([-0.5,5.5,0]).rotate(-4.5).fade(0.4) #---- y axis
+
+ #---- constraint g(x,y)
cylinder = ParametricSurface(
lambda u, v: np.array([
- np.cos(TAU * v),
- np.sin(TAU * v),
- 2 * (u)
- ]),checkerboard_colors=[YELLOW_C,YELLOW_D,YELLOW_E]
- ).fade(0.4) #Resolution of the surfaces
-
+ np.cos(TAU * u),
+ np.sin(TAU * u),
+ 2 * (v)
+ ]),checkerboard_colors=[YELLOW_C,YELLOW_D,YELLOW_E]).rotate(m.radians(-40),RIGHT).shift([0.5,0.5,0]).scale(0.8)
+
+ #---- constraint h(x,y)
plane = ParametricSurface(
lambda u, v: np.array([
u,
v,
u+v
- ]),checkerboard_colors=[TEAL_C,TEAL_D,TEAL_E]
- ).scale(2.5)
- self.add(axes)
- self.set_camera_orientation(phi=75*DEGREES,theta=45*DEGREES)
+ ]),checkerboard_colors=[TEAL_C,TEAL_D,TEAL_E]).shift([0,0,0]).rotate(m.radians(-40),RIGHT).scale(2).fade(0.3)
+
+ figure = VGroup(cylinder,plane).rotate(m.radians(-45),DOWN).scale(1.5)
+
+ self.set_camera_orientation(phi=65*DEGREES,theta=45*DEGREES)
+ self.add(axes)
+ self.add(label_x)
+ self.add(label_y)
+ self.wait(1)
self.play(Write(cylinder))
self.play(Write(plane))
self.wait(1)
- self.begin_ambient_camera_rotation(rate=0.7)
- self.wait(5)
- self.move_camera(phi=35*DEGREES,theta=-45*DEGREES)
- self.wait(2)
+ self.begin_ambient_camera_rotation(rate=0.4)
+ self.wait(1)
+ self.wait(1)
+ self.play(FadeOut(label_x),FadeOut(label_y))
+ self.wait(1)
+ self.wait(1)