summaryrefslogtreecommitdiff
path: root/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points
diff options
context:
space:
mode:
Diffstat (limited to 'FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points')
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/README.md38
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file1_Critical_Point_of_a_function.gifbin0 -> 8077401 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file1_Critical_Point_of_a_function.py77
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file2_Traces_and_Tangent.gifbin0 -> 2552938 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file2_Traces_and_Tangent.py88
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.gifbin0 -> 2198637 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.py73
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file4_Relative_Maximum_and_Relative_Minimum.gifbin0 -> 1587319 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file4_Relative_Maximum_and_Relative_Minimum.py51
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file5_Saddle_Point.gifbin0 -> 7136893 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file5_Saddle_Point.py71
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file6_f(x,y)=(y-x)(1-2x-3y).gifbin0 -> 1522415 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file6_f(x,y)=(y-x)(1-2x-3y).py29
13 files changed, 427 insertions, 0 deletions
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/README.md b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/README.md
new file mode 100644
index 0000000..857d298
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/README.md
@@ -0,0 +1,38 @@
+<h1><div align=”center”><b>SubTopic: Critical Points</b></h1></div>
+<br/></br>
+
+<tab>file1_Critical_Point_of_a_function
+
+![file1_Critical_Point_of_a_function](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file1_Critical_Point_of_a_function.gif?raw=true)
+<br/></br>
+<br/></br>
+
+<tab>file2_Traces_and_Tangent
+
+![file2_Traces_and_Tangent](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file2_Traces_and_Tangent.gif?raw=true)
+<br/></br>
+<br/></br>
+
+<tab>file3_Tangent_plane_at_extrema_of_a_function
+
+![file3_Tangent_plane_at_extrema_of_a_function](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.gif?raw=true)
+<br/></br>
+<br/></br>
+
+<tab>file4_Relative_Maximum_and_Relative_Minimum
+
+![file4_Relative_Maxima_and_Relative_Minima](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file4_Relative_Maximum_and_Relative_Minimum.gif?raw=true)
+<br/></br>
+<br/></br>
+
+<tab>file5_Saddle_Point
+
+![file5_Saddle_Point](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file5_Saddle_Point.gif?raw=true)
+<br/></br>
+<br/></br>
+
+<tab>file6_f(x,y)=(y-x)(1-2x-3y)
+
+![file6_f(x,y)=(y-x)(1-2x-3y)](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file6_f(x%2Cy)%3D(y-x)(1-2x-3y).gif?raw=true)
+<br/></br>
+<br/></br>
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file1_Critical_Point_of_a_function.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file1_Critical_Point_of_a_function.gif
new file mode 100644
index 0000000..ca3989c
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file1_Critical_Point_of_a_function.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file1_Critical_Point_of_a_function.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file1_Critical_Point_of_a_function.py
new file mode 100644
index 0000000..e8cb08d
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file1_Critical_Point_of_a_function.py
@@ -0,0 +1,77 @@
+from manimlib.imports import*
+import math as m
+
+#---- case 1: parial derivatives exist at critical point of the function
+class firstScene(ThreeDScene):
+ def construct(self):
+
+ axes = ThreeDAxes()
+ label_x = TextMobject("$x$").shift([5.5,-0.5,0]) #---- x axis
+ label_y = TextMobject("$y$").shift([-0.5,5.5,0]).rotate(-4.5) #---- y axis
+
+ #---- f(x,y) = e^(-10x^2-10y^2)
+ surface = ParametricSurface(
+ lambda u, v: np.array([
+ u,
+ v,
+ m.exp(-10*u**2-10*v**2)
+ ]),u_min = -1, u_max = 1, v_min = -1, v_max = 1, checkerboard_colors = [TEAL_E,TEAL_D,TEAL_C,TEAL_B]).fade(0.6).scale(3.5).shift([0,0,1.5])
+
+ l1 = Line([0,0,3.75],[0,0,0],color = '#800000')
+
+ d = Dot([0,0,3.75],color = '#800000') #---- critical point
+
+ d_text = TextMobject("$\\frac{\\partial f}{\\partial x}=\\frac{\\partial f}{\\partial y} = 0$").scale(0.8).to_corner(UL)
+
+ f_text = TextMobject("Critical Point ",color = YELLOW).shift(3.4*UP).scale(0.5)
+
+ self.set_camera_orientation(phi = 45*DEGREES, theta = 40*DEGREES)
+ self.add(axes)
+ self.add(label_x)
+ self.add(label_y)
+ self.add_fixed_in_frame_mobjects(d_text)
+ self.begin_ambient_camera_rotation(rate = 0.2)
+ self.play(Write(surface))
+ self.wait(1)
+ self.play(Write(l1))
+ self.play(Write(d))
+ self.wait(1)
+ self.add_fixed_in_frame_mobjects(f_text)
+ self.wait(3)
+ self.play(FadeOut(f_text),FadeOut(surface),FadeOut(axes),FadeOut(d_text),FadeOut(d),FadeOut(l1),FadeOut(label_x),FadeOut(label_y))
+
+
+#---- case 2: parial derivatives do not exist at critical point of the function
+class secondScene(ThreeDScene):
+ def construct(self):
+ axes = ThreeDAxes()
+ label_x = TextMobject("$x$").shift([5.5,-0.5,0]) #---- x axis
+ label_y = TextMobject("$y$").shift([-0.5,5.5,0]).rotate(-4.5) #---- y axis
+
+ #---- g(x,y)= |x|+|y|
+ surface = ParametricSurface(
+ lambda u, v: np.array([
+ u,
+ v,
+ abs(u)+abs(v)
+ ]),u_min = -1.5, u_max = 1.5, v_min = -1.5, v_max = 1.5, checkerboard_colors = [TEAL_E,TEAL_D,TEAL_C,TEAL_B])
+
+ d2 = Dot([0,0,0],color = '#800000') #---- critical point
+
+ d2_text = TextMobject("$\\frac{\\partial f}{\\partial x}$ and/or $\\frac{\\partial f}{\\partial y}$ does not exist").scale(0.7).to_corner(UL)
+
+ g_text = TextMobject("Critical Point",color = YELLOW).shift(1.2*RIGHT).scale(0.6)
+
+ self.set_camera_orientation(phi = 60*DEGREES, theta = 40*DEGREES)
+ self.add(axes)
+ self.add(label_x)
+ self.add(label_y)
+ self.add_fixed_in_frame_mobjects(d2_text)
+ self.begin_ambient_camera_rotation(rate = 0.2)
+ self.wait(1)
+ self.play(Write(surface2))
+ self.wait(1)
+ self.play(Write(d2))
+ self.wait(1)
+ self.add_fixed_in_frame_mobjects(g_text)
+ self.wait(2)
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file2_Traces_and_Tangent.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file2_Traces_and_Tangent.gif
new file mode 100644
index 0000000..84acf2e
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file2_Traces_and_Tangent.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file2_Traces_and_Tangent.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file2_Traces_and_Tangent.py
new file mode 100644
index 0000000..4b020e1
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file2_Traces_and_Tangent.py
@@ -0,0 +1,88 @@
+from manimlib.imports import*
+import math as m
+
+#---- tangent to the trace with x constant
+class firstScene(ThreeDScene):
+ def construct(self):
+
+ axes = ThreeDAxes().scale(1)
+ label_x = TextMobject("$x$").shift([5.8,-0.5,0])
+ label_y = TextMobject("$y$").shift([-0.5,-5.6,0]).rotate(-4.5)
+
+ #---- graph of f(x,y) = -x^2-y^2
+ 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,checkerboard_colors=[PURPLE_C,PURPLE_D,PURPLE_E,PURPLE_B]).scale(1.5).shift([0,0,2]).rotate(0.2)
+
+ #---- curve(trace) along y axis
+ curve = ParametricSurface(
+ lambda u, v: np.array([
+ u*0.4,
+ v,
+ -v**2
+ ]),v_min =-1 , v_max =1 , u_min = -0.1, u_max = 0.1).scale(1.6).shift([0.02,0.1,2.3]).set_color("#800000").rotate(0.1)
+
+ d = Dot(color =YELLOW).shift([-0.05,-0.2,2.3]) #---- critical point
+
+ x_text = TextMobject("Tangent to the trace with $x$ constant at critical point").shift(3*RIGHT+2*UP).scale(0.5).to_corner(UL)
+
+ tangent_line = Line([-0.05,-1.5,2.3],[-0.05,1.5,2.3],color = '#228B22')
+
+ self.add(axes)
+ self.set_camera_orientation(phi = 40 * DEGREES, theta = 55 * DEGREES)
+ self.begin_ambient_camera_rotation(rate = 0.1)
+ self.add(label_x)
+ self.add(label_y)
+ self.play(Write(surface))
+ self.add_fixed_in_frame_mobjects(x_text)
+ self.add(curve)
+ self.wait(1)
+ self.play(Write(tangent_line),Write(d))
+ self.wait(1)
+
+
+
+#---- tangent to the trace with y constant
+class secondScene(ThreeDScene):
+ def construct(self):
+
+ axes = ThreeDAxes().scale(1)
+ label_x = TextMobject("$x$").shift([5.8,-0.5,0])
+ label_y = TextMobject("$y$").shift([-0.5,-5.6,0]).rotate(-4.5)
+
+ #---- graph of f(x,y) = -x^2-y^2
+ 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, checkerboard_colors = [PURPLE_B,PURPLE_C,PURPLE_D,PURPLE_E]).scale(1.5).shift([0,0,2]).rotate(0.2)
+
+ #---- curve(trace) along x axis
+ curve = ParametricSurface(
+ lambda u, v: np.array([
+ u,
+ v*0.4,
+ -u**2
+ ]),v_min = -0.1, v_max = 0.1, u_min = -1, u_max = 1).scale(1.6).shift([0.07,0.1,2.3]).set_color("#800000")
+
+ d = Dot(color = YELLOW).shift([0,-0.2,2.3]) #---- critical point
+
+ tangent_line = Line(color = '#228B22').scale(1).shift([0,-0.2,2.3]).rotate(m.radians(190),LEFT)
+
+ y_text = TextMobject("Tangent to the trace with $y$ constant at critical point").shift(3*RIGHT+2*UP).scale(0.5).to_corner(UL)
+
+ self.add(axes)
+ self.set_camera_orientation(phi = 40 * DEGREES, theta = 55 * DEGREES)
+ self.add(label_x)
+ self.add(label_y)
+ self.begin_ambient_camera_rotation(rate = 0.1)
+ self.play(Write(surface))
+ self.add_fixed_in_frame_mobjects(y_text)
+ self.add(curve)
+ self.wait(1.5)
+ self.play(Write(tangent_line),Write(d))
+ self.wait(0.5)
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.gif
new file mode 100644
index 0000000..14fb318
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.py
new file mode 100644
index 0000000..e674113
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.py
@@ -0,0 +1,73 @@
+from manimlib.imports import*
+
+#---- tangent plane to minima of the function
+class firstScene(ThreeDScene):
+ def construct(self):
+
+ axes = ThreeDAxes()
+ label_x = TextMobject("$x$").shift([5.5,-0.5,0]) #---- x axis
+ label_y = TextMobject("$y$").shift([-0.5,5.5,0]).rotate(-4.5) #---- y axis
+
+ #---- parabola: f(x,y) = x**2 + y**2
+ parabola = ParametricSurface(
+ lambda u, v: np.array([
+ u,
+ v,
+ u**2+v**2
+ ]),v_min = -1, v_max = 1, u_min = -1, u_max = 1, checkerboard_colors = [GREEN_E,GREEN_D,GREEN_C,GREEN_B], resolution = (20, 20)).scale(1)
+
+ d = Dot(np.array([0,0,0]), color = '#800000') # ---- critical point
+
+ tangent_plane = Rectangle(fill_color = '#C0C0C0', fill_opacity = 0.3).move_to(ORIGIN).fade(0.7) # ----tangent plane
+
+ parabola_text = TextMobject("Minimum with horizontal tangent plane").scale(0.7).to_corner(UL)
+
+ self.set_camera_orientation(phi = 75 * DEGREES, theta = 45 * DEGREES)
+ self.begin_ambient_camera_rotation(rate = 0.2)
+ self.add(axes)
+ self.add(label_x)
+ self.add(label_y)
+ self.add_fixed_in_frame_mobjects(parabola_text)
+ self.wait(1)
+ self.play(Write(parabola))
+ self.play(ShowCreation(d))
+ self.wait(1)
+ self.play(ShowCreation(tangent_plane))
+ self.wait(2)
+ self.play(FadeOut(parabola_text),FadeOut(parabola),FadeOut(tangent_plane),FadeOut(d),FadeOut(label_x),FadeOut(label_y),FadeOut(axes))
+
+
+#---- tangent plane to maxima of the function
+class secondScene(ThreeDScene):
+ def construct(self):
+
+ axes = ThreeDAxes()
+ label_x = TextMobject("$x$").shift([5.5,-0.5,0]) #---- x axis
+ label_y = TextMobject("$y$").shift([-0.5,5.5,0]).rotate(-4.5) #---- y axis
+
+ #----parabola: g(x,y) = -x**2-y**2
+ parabola = ParametricSurface(
+ lambda u, v: np.array([
+ u,
+ v,
+ -u**2-v**2
+ ]),v_min = -1, v_max = 1, u_min = -1, u_max = 1, checkerboard_colors = [BLUE_E,BLUE_D,BLUE_C,BLUE_B], resolution = (20, 20)).scale(1)
+
+ d = Dot(np.array([0,0,0]), color = '#800000') #---- critical point
+
+ tangent_plane = Rectangle(fill_color = '#C0C0C0',fill_opacity = 0.3).move_to(ORIGIN).fade(0.7) #---- tangent plane
+
+ parabola_text = TextMobject("Maximum with horizontal tangent plane").scale(0.7).to_corner(UL)
+
+ self.set_camera_orientation(phi = 75 * DEGREES, theta = 45 * DEGREES)
+ self.begin_ambient_camera_rotation(rate = 0.2)
+ self.add(axes)
+ self.add(label_x)
+ self.add(label_y)
+ self.add_fixed_in_frame_mobjects(parabola_text)
+ self.wait(1)
+ self.play(Write(parabola))
+ self.play(ShowCreation(d))
+ self.wait(1)
+ self.play(ShowCreation(tangent_plane))
+ self.wait(2)
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file4_Relative_Maximum_and_Relative_Minimum.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file4_Relative_Maximum_and_Relative_Minimum.gif
new file mode 100644
index 0000000..6b93359
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file4_Relative_Maximum_and_Relative_Minimum.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file4_Relative_Maximum_and_Relative_Minimum.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file4_Relative_Maximum_and_Relative_Minimum.py
new file mode 100644
index 0000000..3bd810d
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file4_Relative_Maximum_and_Relative_Minimum.py
@@ -0,0 +1,51 @@
+from manimlib.imports import*
+import math as m
+
+#---- locating extrema of a funtion using critical points
+class Extrema(ThreeDScene):
+ def construct(self):
+
+ h_text = TextMobject("Relative Maximum and Relative Minimum",color = GREEN)
+
+ axes = ThreeDAxes()
+ label_x = TextMobject("$x$").shift([5.5,-0.3,0]) #---- x axis
+ label_y = TextMobject("$y$").shift([-0.3,5.5,0]).rotate(-4.5) #---- y axis
+
+ #---- f(x,y) = 5(x+y)e^(-x^2-y^2)
+ surface = ParametricSurface(
+ lambda u, v: np.array([
+ u,
+ v,
+ 5*(u+v)*m.exp(-u**2-v**2)
+ ]),u_min = -PI, u_max = PI, v_min = -PI, v_max = PI).set_color(TEAL).shift([0,0,0]).fade(0.4)
+
+ d1 = Dot(color = YELLOW).shift([0.5,0.5,3.02]) #---- critical point for maxima
+ l1 = Line([0.5,0.5,0.1],[0.5,0.5,3],color = YELLOW)
+
+ d2 = Dot(color = YELLOW).shift([-1.15,0,-2.98]) #---- critical point for minima
+ l2 = Line([-1.15,0,0],[-1.15,0,-2.98],color = YELLOW)
+
+ max_text = TextMobject("Relative Maximum").shift(3.1*UP+1.5*RIGHT).scale(0.5)
+ min_text = TextMobject("Relative Minimum").shift(3.1*DOWN+1.5*LEFT).scale(0.5)
+
+ self.add_fixed_in_frame_mobjects(h_text)
+ self.wait(1)
+ self.wait(1)
+ self.play(FadeOut(h_text))
+ self.wait(1)
+ self.set_camera_orientation(phi = 100*DEGREES, theta = -40*DEGREES)
+ self.add(axes)
+ self.add(label_x)
+ self.add(label_y)
+ self.play(Write(surface))
+ self.wait(1)
+ self.play(Write(l1),Write(d1))
+ self.add_fixed_in_frame_mobjects(max_text)
+ self.wait(1)
+ self.play(Write(l2),Write(d2))
+ self.add_fixed_in_frame_mobjects(min_text)
+ self.wait(1)
+ self.wait(1)
+ self.play(FadeOut(l1),FadeOut(d1),FadeOut(l2),FadeOut(d2),FadeOut(max_text),FadeOut(min_text))
+ self.begin_ambient_camera_rotation(rate = 0.3)
+ self.wait(3)
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file5_Saddle_Point.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file5_Saddle_Point.gif
new file mode 100644
index 0000000..7300f3a
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file5_Saddle_Point.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file5_Saddle_Point.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file5_Saddle_Point.py
new file mode 100644
index 0000000..67dbb18
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file5_Saddle_Point.py
@@ -0,0 +1,71 @@
+from manimlib.imports import*
+import math as m
+
+#---- saddle point of a function
+class SaddlePoint(ThreeDScene):
+ def construct(self):
+
+ h_text = TextMobject("Saddle Point",color = GREEN)
+
+ axes = ThreeDAxes()
+ label_x = TextMobject("$x$").shift([5.5,-0.3,0]) #---- x axis
+ label_y = TextMobject("$y$").shift([-0.3,5.5,0]).rotate(-4.5) #---- y axis
+
+ #---- f(x,y) = -x^2-y^2
+ 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,checkerboard_colors = [BLUE_B,BLUE_C,BLUE_D,BLUE_E]).shift([0,0,0]).scale(3)
+
+ #---- curve(trace) along y axis
+ curve_x = ParametricSurface(
+ lambda u, v: np.array([
+ u*0.1,
+ v,
+ v**2
+ ]),v_min = -1, v_max = 1, u_min = -0.2, u_max = 0.2).shift([0,0,-2]).scale(3.1).set_color("#800000").rotate(m.radians(180),UP)
+
+ x_text = TextMobject("A dip at critical point along x axis").scale(0.5).to_corner(UL)
+
+ #---- curve(trace) along x axis
+ curve_y = ParametricSurface(
+ lambda u, v: np.array([
+ u,
+ v*0.1,
+ -u**2
+ ]),v_min = -0.2, v_max = 0.2, u_min = -1, u_max = 1).scale(3).shift([0.1,0,2.2]).set_color("#800000").rotate(m.radians(182),DOWN)
+
+ y_text = TextMobject("A peak at critical point along y axis").scale(0.5).to_corner(UL)
+
+ d = Dot(color = YELLOW).shift([0,-0.22,0]) #---- critical point(saddle point)
+
+ self.add_fixed_in_frame_mobjects(h_text)
+ self.wait(1)
+ self.play(FadeOut(h_text))
+ self.wait(1)
+ self.set_camera_orientation(phi = 75*DEGREES, theta = 40*DEGREES)
+ self.add(axes)
+ self.add(label_x)
+ self.add(label_y)
+ self.play(Write(surface))
+ self.wait(1)
+ self.move_camera(phi = 45*DEGREES, theta = 70*DEGREES)
+ self.add(curve_y)
+ self.play(Write(d))
+ self.wait(1)
+ self.add_fixed_in_frame_mobjects(x_text)
+ self.wait(1)
+ self.wait(1)
+ self.play(FadeOut(curve_y),FadeOut(d),FadeOut(x_text))
+ self.wait(1)
+ self.move_camera(phi = 40*DEGREES, theta = 30*DEGREES)
+ self.add(curve_x)
+ self.play(Write(d))
+ self.wait(1)
+ self.add_fixed_in_frame_mobjects(y_text)
+ self.begin_ambient_camera_rotation(rate = 0.3)
+ self.wait(3)
+ self.play(FadeOut(curve_x),FadeOut(d),FadeOut(y_text))
+ self.wait(1)
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file6_f(x,y)=(y-x)(1-2x-3y).gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file6_f(x,y)=(y-x)(1-2x-3y).gif
new file mode 100644
index 0000000..4bc92f8
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file6_f(x,y)=(y-x)(1-2x-3y).gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file6_f(x,y)=(y-x)(1-2x-3y).py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file6_f(x,y)=(y-x)(1-2x-3y).py
new file mode 100644
index 0000000..41c3b61
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file6_f(x,y)=(y-x)(1-2x-3y).py
@@ -0,0 +1,29 @@
+from manimlib.imports import*
+
+#---- visualization of the function
+class ExampleAnimation(ThreeDScene):
+ def construct(self):
+ axes = ThreeDAxes()
+ label_x = TextMobject("$x$").shift([5.5,-0.5,0]) #---- x axis
+ label_y = TextMobject("$y$").shift([-0.5,5.5,0]).rotate(-4.5) #---- y axis
+
+ #---- f(x,y) = (y-x)(1-2x-3y)
+ surface = ParametricSurface(
+ lambda u, v: np.array([
+ u,
+ v,
+ (v-u)*(1-2*u-3*v)
+ ]),v_min = -1, v_max = 1, u_min = -1, u_max = 1, checkerboard_colors = [PURPLE_B,PURPLE_C,PURPLE_D, PURPLE_E]).scale(1).fade(0.2).shift([0.2,0.2,0])
+
+ f_text = TextMobject("$f(x,y) = (y-x)(1-2x-3y)$").to_corner(UL)
+
+ self.set_camera_orientation(phi = 60 * DEGREES, theta = 75 * DEGREES)
+ self.begin_ambient_camera_rotation(rate=0.1)
+ self.add_fixed_in_frame_mobjects(f_text)
+ self.wait(1)
+ self.add(axes)
+ self.add(label_x)
+ self.add(label_y)
+ self.wait(1)
+ self.play(Write(f))
+ self.wait(4)