summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file2_Differentials.py31
1 files changed, 18 insertions, 13 deletions
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file2_Differentials.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file2_Differentials.py
index b40be70..1025210 100644
--- a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file2_Differentials.py
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file2_Differentials.py
@@ -1,16 +1,21 @@
from manimlib.imports import*
-
-class firstScene(ThreeDScene):
-
+#---- visualization of the differentials along the axes
+class differentials(ThreeDScene):
def construct(self):
- axes = ThreeDAxes()
+ axes = ThreeDAxes()
+ label_x = TextMobject("$x$").shift([5.5,-0.3,0]).fade(0.4) #---- x axis
+ label_y = TextMobject("$y$").shift([-0.5,5.5,0]).rotate(-4.5).fade(0.4) #---- y axis
- s = Rectangle(color = '#00FF7F',fill_opacity=0.3).shift(2.3*UP+3.9*LEFT).scale(1).rotate(0.2,UP) #----surface z = f(x,y)
+ surface = ParametricSurface(
+ lambda u, v: np.array([
+ u,
+ v,
+ u**2+v**2
+ ]),u_min=-1,u_max=1, v_min=-1,v_max=1).set_color("#FF69B4").shift([0,2.5,0.3]).scale(1.2) #----surface z = f(x,y)
- label_y = TextMobject("$y$").shift(5*RIGHT+0.4*DOWN).rotate(1.571)
- label_x = TextMobject("$x$").shift(-0.1*UP+5.6*RIGHT).scale(0.5)
+
plane = Rectangle(color = '#E6E6FA',fill_opacity = 1).scale(3).shift(-1*RIGHT+3*UP).fade(0.9)
@@ -27,8 +32,8 @@ class firstScene(ThreeDScene):
label_dz= TextMobject("$dz$").scale(0.4).shift(5.3*RIGHT+0.4*UP)
- l3 = Line(color = '#FFDAB9').scale(0.8).shift(1.95*UP+0.7*RIGHT).rotate(1.571,DOWN).fade(0.7)
- l4 = Line(color = '#FFDAB9').scale(0.6).shift(2.86*UP+0.9*RIGHT).rotate(1.571,DOWN).fade(0.7)
+ l3 = Line(color = '#FFDAB9').scale(0.8).shift(1.95*UP+0.7*RIGHT).rotate(1.571,DOWN).fade(0.2)
+ l4 = Line(color = '#FFDAB9').scale(0.6).shift(2.86*UP+0.9*RIGHT).rotate(1.571,DOWN).fade(0.2)
line_y1 = DashedLine(color = '#00BFFF').scale(1.3).shift(0.82*UP+3.25*RIGHT).rotate(1.571)
line_y2 = DashedLine(color = '#00BFFF').scale(1.7).shift(1.2*UP+2.8*RIGHT).rotate(1.571)
@@ -43,12 +48,12 @@ class firstScene(ThreeDScene):
label = TextMobject("$f(x,y)$").scale(0.6).shift(4*RIGHT+3*UP)
- self.add(axes)
self.set_camera_orientation(phi=75*DEGREES,theta=10*DEGREES)
+ self.add(axes)
+ self.add(label_x)
+ self.add(label_y)
self.play(Write(plane))
- self.play(ShowCreation(label_y))
- self.add_fixed_in_frame_mobjects(label_x)
- self.play(Write(s))
+ self.play(Write(surface))
self.add_fixed_in_frame_mobjects(label)
self.wait(1)
self.play(Write(d),Write(d2))