summaryrefslogtreecommitdiff
path: root/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential
diff options
context:
space:
mode:
Diffstat (limited to 'FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential')
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/README.md34
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file1_Visualization_of_dz.gifbin0 -> 565199 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file1_Visualization_of_dz.py59
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file2_Differentials.gifbin0 -> 729982 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file2_Differentials.py77
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file3_Total_differential_of_z.gifbin0 -> 1444924 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file3_Total_differential_of_z.py100
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file4_total_differential_change.gifbin0 -> 300675 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file4_total_differential_change.py54
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file5_Total_differential_approximation.gifbin0 -> 423246 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file5_Total_differential_approximation.py52
11 files changed, 376 insertions, 0 deletions
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/README.md b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/README.md
new file mode 100644
index 0000000..ce4da11
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/README.md
@@ -0,0 +1,34 @@
+<h1><div align=”center”><b>SubTopic: Total Differential</b></h1></div>
+<br/></br>
+
+<tab>file1_Visualization_of_dz
+
+![file1_Visualization_of_dz](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file1_Visualization_of_dz.gif?raw=true)
+<br/></br>
+<br/></br>
+
+<tab>file2_Differentials
+
+![file2_Differentials](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file2_Differentials.gif?raw=true)
+
+<br/></br>
+<br/></br>
+
+<tab>file3_Total_differential_of_z
+
+![file3_Total_differential_of_z](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file3_Total_differential_of_z.gif?raw=true)
+<br/></br>
+<br/></br>
+
+<tab>file4_total_differential_change
+
+![file4_total_differential_change](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file4_total_differential_change.gif?raw=true)
+<br/></br>
+<br/></br>
+
+<tab>file5_Total_differential_approximation
+
+ ![file5_Total_differential_approximation](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file5_Total_differential_approximation.gif?raw=true)
+
+<br/></br>
+<br/></br>
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file1_Visualization_of_dz.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file1_Visualization_of_dz.gif
new file mode 100644
index 0000000..2e148af
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file1_Visualization_of_dz.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file1_Visualization_of_dz.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file1_Visualization_of_dz.py
new file mode 100644
index 0000000..1fdd0b9
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file1_Visualization_of_dz.py
@@ -0,0 +1,59 @@
+from manimlib.imports import*
+
+#---- visualization of total differential dz between two points lying on the surface of the function
+class differentialdz(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
+
+ #---- surface of the funtion 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").fade(0.6).scale(2).shift(3*UP+1*LEFT)
+
+ d = Dot([1.4,1.75,1],color = '#00FFFF').rotate(1.571,UP) #---- point on the surface
+ d2 = Dot([2,2,1],color = '#00FFFF').rotate(1.571,UP) #---- point on the surface
+
+ p1 = TextMobject("$P_1$",color ='#ADFF2F').scale(0.6).shift(2*RIGHT+1*UP)
+ p2 = TextMobject("$P_2$",color = '#ADFF2F').scale(0.6).shift(2.6*RIGHT+0.9*UP)
+
+ l = DashedLine(color = '#800000').rotate(1.571,UP).scale(1).shift(1.7*UP+1.6*RIGHT)
+ l2 = DashedLine(color = '#800000').rotate(1.571,UP).scale(0.8).shift(2.26*UP+1.2*RIGHT)
+
+ l_text = TextMobject("$(x_1,y_1)$",color = '#ADFF2F').scale(0.6).shift(2*RIGHT+1.6*DOWN)
+ l2_text = TextMobject("$(x_2,y_2)$",color = '#ADFF2F').scale(0.6).shift(2.7*RIGHT+1.2*DOWN)
+
+ a = Arrow(color = '#FFFACD').scale(0.7).rotate(1.38,RIGHT).shift(2.5*LEFT+3.1*UP)
+
+ a_text = TextMobject("$dz$",color='#800000').scale(0.5).shift(2.3*RIGHT+0.5*UP)
+
+ plane = Rectangle(color = '#E6E6FA',fill_opacity = 1).scale(3).shift(1*RIGHT+3*UP).fade(0.9)
+
+ label = TextMobject("$z = f(x,y)$").scale(0.6).shift(3.5*RIGHT+1.8*UP)
+
+ self.set_camera_orientation(phi=75*DEGREES,theta=-10*DEGREES)
+ self.add(axes)
+ self.add(label_x)
+ self.add(label_y)
+ self.wait(1)
+ self.play(Write(plane))
+ self.play(Write(surface))
+ self.add_fixed_in_frame_mobjects(label)
+ self.wait(1)
+ self.play(ShowCreation(l),ShowCreation(l2),Write(d),Write(d2))
+ self.wait(1)
+ self.add_fixed_in_frame_mobjects(p1)
+ self.add_fixed_in_frame_mobjects(p2)
+ self.wait(1)
+ self.add_fixed_in_frame_mobjects(l_text)
+ self.add_fixed_in_frame_mobjects(l2_text)
+ self.play(ShowCreation(a))
+ self.wait(1)
+ self.add_fixed_in_frame_mobjects(a_text)
+ self.wait(2)
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file2_Differentials.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file2_Differentials.gif
new file mode 100644
index 0000000..6baf271
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file2_Differentials.gif
Binary files differ
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
new file mode 100644
index 0000000..1025210
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file2_Differentials.py
@@ -0,0 +1,77 @@
+from manimlib.imports import*
+
+#---- visualization of the differentials along the axes
+class differentials(ThreeDScene):
+ def construct(self):
+
+ 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
+
+ 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)
+
+
+
+ plane = Rectangle(color = '#E6E6FA',fill_opacity = 1).scale(3).shift(-1*RIGHT+3*UP).fade(0.9)
+
+ d = Dot([1,2,1],color = '#9400D3').rotate(1.571,UP)
+ d2 = Dot([2,2.9,1],color = '#9400D3').rotate(1.571,UP)
+
+ p1 = TextMobject("$P_1$",color ='#ADFF2F').scale(0.6).shift(2*RIGHT+1*UP)
+ p2 = TextMobject("$P_2$",color = '#ADFF2F').scale(0.6).shift(2.6*RIGHT+0.4*UP)
+
+
+ l1 = DashedLine(color = '#00BFFF').scale(1.6).shift(3.5*UP+3.25*LEFT).rotate(1.571)
+ l2 = DashedLine(color = '#00BFFF').scale(1).shift(4*UP+2*LEFT).rotate(1.571)
+
+ 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.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)
+
+ label_dy= TextMobject("$dy$").scale(0.6).shift(3*RIGHT+0.8*DOWN).rotate(math.radians(90))
+
+ line_x1 = DashedLine(color = '#00BFFF').scale(1.5).shift(2.2*UP+1.6*RIGHT).rotate(1.571,RIGHT)
+ line_x2 = DashedLine(color = '#00BFFF').scale(1.2).shift(2.9*UP+1.6*RIGHT).rotate(1.571,RIGHT)
+
+ label_dx= TextMobject("$dx$").scale(0.4).shift(-0.4*UP+2.5*RIGHT)
+
+ label = TextMobject("$f(x,y)$").scale(0.6).shift(4*RIGHT+3*UP)
+
+
+ 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(Write(surface))
+ self.add_fixed_in_frame_mobjects(label)
+ self.wait(1)
+ self.play(Write(d),Write(d2))
+ self.add_fixed_in_frame_mobjects(p1)
+ self.add_fixed_in_frame_mobjects(p2)
+ self.wait(1)
+ self.play(Write(l1))
+ self.play(Write(l2))
+ self.add_fixed_in_frame_mobjects(label_dz)
+ self.wait(1)
+ self.play(Write(l3))
+ self.play(Write(l4))
+ self.wait(1)
+ self.play(Write(line_y1))
+ self.play(Write(line_y2))
+ self.play(ShowCreation(label_dy))
+ self.wait(1)
+ self.play(Write(line_x1))
+ self.play(Write(line_x2))
+ self.add_fixed_in_frame_mobjects(label_dx)
+ self.wait(1)
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file3_Total_differential_of_z.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file3_Total_differential_of_z.gif
new file mode 100644
index 0000000..a54d2da
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file3_Total_differential_of_z.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file3_Total_differential_of_z.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file3_Total_differential_of_z.py
new file mode 100644
index 0000000..b8d6f96
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file3_Total_differential_of_z.py
@@ -0,0 +1,100 @@
+from manimlib.imports import*
+
+#---- visualization of total differential definition
+class totaldifferential(ThreeDScene):
+ def construct(self):
+ axes = ThreeDAxes().fade(0.5)
+ 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").fade(0.6).shift([1,0.8,1.5]).scale(2)
+
+ plane = Rectangle(color = '#E6E6FA',fill_opacity = 1).scale(3).shift(-1*RIGHT+3*UP).fade(0.9)
+ label_x = TextMobject("$x$").shift(5*RIGHT+0.4*DOWN).rotate(1.571)
+ label_y = TextMobject("$y$").shift(0.3*DOWN+5.6*RIGHT).scale(0.5)
+ label_z = TextMobject("$z$").shift(3.5*UP+0.2*LEFT).scale(0.5)
+
+ s1 = Square(color = '#00FF00',fill_opacity=0.4).shift([1,1,0])
+ s2 = Square(color = '#00FF00',fill_opacity=0.4).shift([1,1,3]).scale(0.95)
+
+ l1 = Line([2,0,3],[2,0,0],color = '#FFFACD')
+ l2 = Line([0,2,3],[0,2,0],color = '#FFFACD')
+ l3 = Line([2,1.95,3],[2,2,0],color = '#FFFACD')
+
+ d1 = Dot([2,0,1.5],color = '#FFD700').rotate(1.571,UP)
+ d1_text = TextMobject("$P1$").scale(0.4).shift(1.2*LEFT+1.1*UP)
+
+ d2 = Dot([0,2,3],color = '#FFD700').rotate(1.571,UP)
+ d2_text = TextMobject("$P2$").scale(0.4).shift(2.3*RIGHT+3.1*UP)
+
+ d3 = Dot([2,2,2],color = '#FFD700').rotate(1.571,UP)
+ d3_text = TextMobject("$Q$").scale(0.4).shift([1.6,-1,0]+2.5*UP)
+
+ s3 = Square().shift([1,1,1.5]).scale(0.95)
+ s4 = Square().shift([1,1,2]).scale(0.95)
+
+ m1_line = DashedLine([2,0,1.5],[2,2,2],color = '#87CEEB')
+ m2_line = DashedLine([2,2,2],[0,2,3],color = '#87CEEB')
+
+ dx_line = Line([2,2,0],[4,2,0],color = '#00FF7F')
+ dy_line = Line([2,2,0],[2,4,0],color = '#00FF7F')
+
+ dx = DashedLine([3.5,0,0],[3.5,2,0],color = '#87CEEB')
+ dy = DashedLine([0,3.5,0],[2,3.5,0],color = '#87CEEB')
+
+ dx_text = TextMobject("$dx$").scale(0.8).shift([4,1,0]).rotate(1.571)
+ dy_text = TextMobject("$dy$").scale(0.8).shift([1,3.8,0]).rotate(math.radians(180))
+
+ parx_line = Line([0,2,1.5],[0,5,1.5],color = '#00FF7F')
+ parm_line = Line([0,2,2],[0,5,2],color = '#00FF7F')
+ pary_line = Line([0,2.1,3],[0,5,3],color = '#00FF7F')
+
+ delx = DashedLine([0,4,2],[0,4,1.5],color = '#F0F8FF')
+ dely = DashedLine([0,4,3],[0,4,2],color = '#FAEBD7')
+
+ dely_text = TextMobject("$\\frac{\\partial z}{\\partial y}dy$").shift(4.6*RIGHT+2.3*UP).scale(0.4)
+ delx_text = TextMobject("$\\frac{\\partial z}{\\partial x}dx$").shift(4.6*RIGHT+1.4*UP).scale(0.4)
+
+
+ self.set_camera_orientation(phi=75*DEGREES,theta=20*DEGREES)
+ self.add(axes)
+ self.play(Write(plane))
+ self.play(ShowCreation(label_x))
+ self.add_fixed_in_frame_mobjects(label_y)
+ self.add_fixed_in_frame_mobjects(label_z)
+ self.wait(1)
+ self.play(Write(surface))
+ self.play(ShowCreation(d1))
+ self.add_fixed_in_frame_mobjects(d1_text)
+ self.play(ShowCreation(d2))
+ self.add_fixed_in_frame_mobjects(d2_text)
+ self.wait(1)
+ self.play(Write(s2))
+ self.wait(1)
+ self.play(Write(l1),Write(l2),Write(l3))
+ self.wait(1)
+ self.play(Write(s1))
+ self.wait(1)
+ self.play(FadeOut(surface))
+ self.play(ShowCreation(d3))
+ self.add_fixed_in_frame_mobjects(d3_text)
+ self.play(ShowCreation(m1_line))
+ self.play(ShowCreation(m2_line))
+ self.wait(1)
+ self.play(ShowCreation(dx_line),ShowCreation(dx),ShowCreation(dx_text))
+ self.wait(1)
+ self.play(ShowCreation(dy_line),ShowCreation(dy),ShowCreation(dy_text))
+ self.wait(2)
+ self.play(Write(s3))
+ self.play(Write(s4))
+ self.wait(1)
+ self.play(ShowCreation(parx_line),ShowCreation(parm_line),ShowCreation(pary_line))
+ self.wait(1)
+ self.play(ShowCreation(dely))
+ self.add_fixed_in_frame_mobjects(dely_text)
+ self.wait(1)
+ self.play(ShowCreation(delx))
+ self.add_fixed_in_frame_mobjects(delx_text)
+ self.wait(1)
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file4_total_differential_change.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file4_total_differential_change.gif
new file mode 100644
index 0000000..f2227a8
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file4_total_differential_change.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file4_total_differential_change.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file4_total_differential_change.py
new file mode 100644
index 0000000..78e41a2
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file4_total_differential_change.py
@@ -0,0 +1,54 @@
+from manimlib.imports import*
+
+
+class firstScene(ThreeDScene):
+
+ def construct(self):
+
+ axes = ThreeDAxes()
+
+ s = Rectangle(color = '#F08080',fill_opacity=1).fade(0.7).shift(1.9*UP+5*LEFT).scale(0.9)#----surface z = f(x,y)
+
+ s2= Rectangle(color = '#F08080',fill_opacity=1).fade(0.7).shift(2.4*UP+3.1*RIGHT).scale(0.6) #----reflection of the surface on the x-y plane
+
+ l1 = DashedLine(color = '#AFEEEE').rotate(1.571,UP).scale(1).shift(1.53*UP+1.5*RIGHT)
+ l2 = DashedLine(color = '#AFEEEE').rotate(1.571,UP).scale(1).shift(2.9*UP+1.4*RIGHT)
+ l3 = DashedLine(color = '#AFEEEE').rotate(1.571,UP).scale(1).shift(1.5*UP-1.6*RIGHT)
+ l4 = DashedLine(color = '#AFEEEE').rotate(1.571,UP).scale(1).shift(2.9*UP-1.75*RIGHT)
+
+
+ l1_text = TextMobject("$(x+\\triangle x,y)$").shift(RIGHT+1.7*DOWN).scale(0.4)
+ l2_text = TextMobject("$(x+\\triangle x,y+\\triangle y)$").shift(3*RIGHT+1.8*DOWN).scale(0.4)
+ l3_text = TextMobject("$f(x,y)$").shift(1.6*RIGHT+1.5*UP).scale(0.4)
+ l4_text = TextMobject("$(x,y+\\triangle y)$").shift(3.5*RIGHT+0.7*DOWN).scale(0.4)
+
+ label_x = TextMobject("$x$").shift(5*RIGHT+0.4*DOWN)
+ label_y = TextMobject("$y$").shift(5*UP-0.6*RIGHT)
+
+ self.add(axes)
+ self.set_camera_orientation(phi=75*DEGREES,theta=10*DEGREES)
+ self.wait(1)
+ self.play(ShowCreation(label_x),ShowCreation(label_y))
+ self.play(Write(s))
+ self.wait(1)
+ self.add_fixed_in_frame_mobjects(l3_text)
+ self.wait(1)
+ self.play(Write(l3))
+ self.wait(1)
+ self.play(Write(l1))
+ self.add_fixed_in_frame_mobjects(l1_text)
+ self.wait(1)
+ self.play(Write(l2))
+ self.add_fixed_in_frame_mobjects(l2_text)
+ self.wait(1)
+ self.play(Write(l4))
+ self.add_fixed_in_frame_mobjects(l4_text)
+ self.wait(1)
+ self.play(Write(s2))
+ self.wait(1)
+
+
+
+
+
+
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file5_Total_differential_approximation.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file5_Total_differential_approximation.gif
new file mode 100644
index 0000000..ebbf240
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file5_Total_differential_approximation.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file5_Total_differential_approximation.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file5_Total_differential_approximation.py
new file mode 100644
index 0000000..e7b39bb
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file5_Total_differential_approximation.py
@@ -0,0 +1,52 @@
+from manimlib.imports import*
+
+#---- approximation value of function between two points using total differentials
+class approximation(ThreeDScene):
+
+ def construct(self):
+
+ 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
+
+ surface = ParametricSurface(
+ lambda u, v: np.array([
+ np.sin(u),
+ v,
+ -u**2-v
+ ]),u_min=-1,u_max=1, v_min=-1,v_max=1).set_color("#00008B").scale(2).shift(3.8*UP+2*LEFT)
+
+ d = Dot([1.4,1.75,1],color = '#00FFFF').rotate(1.571,UP)
+ d2 = Dot([2,2,1],color = '#00FFFF').rotate(1.571,UP)
+
+ l = DashedLine(color = '#800000').rotate(1.571,UP).scale(1).shift(1.7*UP+1.6*RIGHT)
+ l2 = DashedLine(color = '#800000').rotate(1.571,UP).scale(0.8).shift(2.26*UP+1.2*RIGHT)
+
+ l_text = TextMobject("$(x_1,y_1)$",color = '#ADFF2F').scale(0.6).shift(2*RIGHT+1.6*DOWN)
+ l2_text = TextMobject("$(x_2,y_2)$",color = '#ADFF2F').scale(0.6).shift(2.7*RIGHT+1.2*DOWN)
+
+ plane = Rectangle(color = '#E6E6FA',fill_opacity = 1).scale(3).shift(1*RIGHT+3*UP).fade(0.9)
+
+ tangentplane = Rectangle(color = '#E6E6FA',fill_opacity = 1).scale(1.1).shift(2*LEFT+3.4*UP).fade(0.5).rotate(0.8,RIGHT)
+ tangentplane_text = TextMobject("Tangent Plane").scale(0.4).shift(3*RIGHT+1*UP)
+
+ label = TextMobject("$z = f(x,y)$").scale(0.6).shift(4*RIGHT+3*UP)
+
+ self.set_camera_orientation(phi=75*DEGREES,theta=-10*DEGREES)
+ self.add(axes)
+ self.add(label_x)
+ self.add(label_y)
+ self.wait(1)
+ self.play(Write(plane))
+ self.wait(1)
+ self.play(Write(surface))
+ self.add_fixed_in_frame_mobjects(label)
+ self.wait(1.5)
+ self.play(ShowCreation(l),ShowCreation(l2),Write(d),Write(d2))
+ self.wait(1)
+ self.add_fixed_in_frame_mobjects(l_text)
+ self.add_fixed_in_frame_mobjects(l2_text)
+ self.wait(1)
+ self.play(Write(tangentplane))
+ self.add_fixed_in_frame_mobjects(tangentplane_text)
+ self.wait(2)