summaryrefslogtreecommitdiff
path: root/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations
diff options
context:
space:
mode:
Diffstat (limited to 'FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations')
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/README.md26
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.gifbin0 -> 827096 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.py50
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.gifbin0 -> 979487 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.py85
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_Non_Differentiable_Function.gifbin0 -> 708466 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_Non_Differentiable_Function.py47
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent_plane_at_extrema_and_saddle_point.gifbin0 -> 1424279 bytes
-rw-r--r--FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent_plane_at_extrema_and_saddle_point.py62
9 files changed, 270 insertions, 0 deletions
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/README.md b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/README.md
new file mode 100644
index 0000000..2a274d0
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/README.md
@@ -0,0 +1,26 @@
+<h1><div align=”center”><b>SubTopic: Tangent Plane Approximations</b></h1></div>
+<br/></br>
+
+<tab>file1_Tangent_Plane
+
+![file1_Tangent_Plane](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.gif?raw=true)
+<br/></br>
+<br/></br>
+
+<tab>file2_Tangent_plane_approximation_visualization
+
+![file2_Tangent_plane_approximation_visualization](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.gif?raw=true)
+<br/></br>
+<br/></br>
+
+<tab>file3_Non_Differentiable_Function
+
+![file3_Non_Differentiable_Function](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_Non_Differentiable_Function.gif?raw=true)
+<br/></br>
+<br/></br>
+
+<tab>file4_Tangent_plane_at_extrema_and_saddle_point
+
+![file4_Tangent_plane_at_extrema_and_saddle_point](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent_plane_at_extrema_and_saddle_point.gif?raw=true)
+<br/></br>
+<br/></br>
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.gif
new file mode 100644
index 0000000..2b8bf5f
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.py
new file mode 100644
index 0000000..8efdbd2
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.py
@@ -0,0 +1,50 @@
+from manimlib.imports import*
+
+#---- tangent plane is parallel to the surface of the funtion at a point
+class tangentplane(ThreeDScene):
+ def construct(self):
+
+ s1_text=TextMobject("Suppose, the point $(x,y)$ lies on the surface of the function.").scale(0.5).shift(2*UP)
+ s2_text=TextMobject("When zooming on that point, the surface would appear more and more like a plane.").scale(0.5).shift(1*UP)
+ s3_text=TextMobject("This plane is called the tangent plane.").scale(0.5)
+
+ #---- graph of function f(x,y) = -x^2-y^2
+
+ f = 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 = [YELLOW_B,YELLOW_C,YELLOW_D, YELLOW_E]).shift([0,0,0]).scale(1)
+
+
+ d = Dot([0,0,0],color = '#800000') #---- critical point
+
+ r = Rectangle(color = PURPLE,fill_opacity=0.2).shift([0.1,0,0]).scale(0.3) #---- tangent plane
+
+ s = 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 = [YELLOW_B,YELLOW_C,YELLOW_D, YELLOW_E]).shift([0,0,0]).scale(3.5)
+
+ d2 = Dot([0,0,2.5],color = '#800000') #---- changing position of critical point
+
+ r2 = Rectangle(color = PURPLE,fill_opacity=0.5).shift([0.1,0,2.5]).scale(0.3) #---- changing position of tangent plane
+
+ self.set_camera_orientation(phi = 50 * DEGREES, theta = 45 * DEGREES)
+ self.add_fixed_in_frame_mobjects(s1_text)
+ self.add_fixed_in_frame_mobjects(s2_text)
+ self.add_fixed_in_frame_mobjects(s3_text)
+ self.wait(2)
+ self.play(FadeOut(s1_text))
+ self.play(FadeOut(s2_text))
+ self.play(FadeOut(s3_text))
+ self.wait(1)
+ self.play(Write(f))
+ self.play(Write(d))
+ self.play(Write(r))
+ self.wait(2)
+ self.play(ReplacementTransform(f,s),ReplacementTransform(d,d2),ReplacementTransform(r,r2))
+ self.wait(2)
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.gif
new file mode 100644
index 0000000..6d5a67a
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.py
new file mode 100644
index 0000000..02576d9
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.py
@@ -0,0 +1,85 @@
+from manimlib.imports import*
+import math as m
+
+#---- tangent plane approximation visualization
+class ApproximationScene(ThreeDScene):
+ def construct(self):
+
+ axes = ThreeDAxes().scale(1.2).fade(0.7)
+ label_x= TextMobject("$x$").shift([5.4,-0.5,0]).fade(0.7) #---- x axis
+ label_y= TextMobject("$y$").shift([-0.5,5.2,0]).rotate(-4.5).fade(0.7) #---- y axis
+
+ #---- graph of the function
+ s = ParametricSurface(
+ lambda u, v: np.array([
+ 1.5*np.cos(u)*np.cos(v),
+ 1.5*np.cos(u)*np.sin(v),
+ 1.5*np.sin(u)
+ ]),u_min=0,u_max=PI,v_min=PI,v_max=2*PI,checkerboard_colors=[BLUE_B,BLUE_C,BLUE_D,BLUE_E]).shift([0,1,2.4]).scale(1.3)
+
+ d1 = Dot([0.2,2.01,2.24],color = '#800000').rotate(1.1,LEFT) #---- point(x_0,y_0)
+ d1_copy = Dot([0.2,2.01,0],color = '#800000') #---- projection of point(x_0,y_0) on x-y plane
+
+ d1_text = TextMobject("$f(x_0,y_0)$",color=ORANGE).scale(0.5).shift([0.2,2.01,2.3])
+ d1_copy_text = TextMobject("$(x_0,y_0)$",color=ORANGE).scale(0.5).shift([0.2,2.01,0],4.1*DOWN)
+
+ d2 = Dot([2,2.6,3.5],color = '#800000').rotate(1,LEFT) #---- point(x,y)
+ d2_copy = Dot([2,2.6,0],color = '#800000') #---- projection of point(x,y) on x-y plane
+
+ d2_text = TextMobject("$f(x,y)$",color=ORANGE).scale(0.5).shift([0.8,1.4,1.5])
+ d2_copy_text = TextMobject("$(x,y)$",color=ORANGE).scale(0.5).shift([0.8,1.4,0],2.4*DOWN)
+
+ l1 = Line([0.2,2.01,2.21],[0.2,2.01,0],color= YELLOW).fade(0.2)
+ l2 = Line([2,2.6,3.4],[2,2.6,0],color= YELLOW).fade(0.2)
+
+ t_plane = Rectangle(color = PURPLE, fill_opacity=0.3).scale(0.6).rotate(m.radians(45),LEFT).shift([1.1,2.5,3.1]) #---- tangent plane
+ t_text= TextMobject("Tangent Plane",color = PINK).scale(0.5).shift(0.3*RIGHT+2.6*UP).rotate(math.radians(5),LEFT)
+
+ a1 = Line([0.2,2.01,0],[2,2.6,0],color ="#00FF7F")
+ a_x = Line([0.2,2.01,0],[2,2.01,0],color ="#9400D3")
+ a_y = Line([0.2,2.01,0],[0.2,2.6,0],color ="#8B4513")
+ a2 = Line([2,2.01,0],[2,2.6,0])
+ a3 = Line([0.2,2.6,0],[2,2.6,0])
+
+ ax_text = TextMobject("$f_x (x_0 , y_0 )(x – x_0 ) $").scale(0.5).shift(DOWN+0.8*LEFT).rotate(0.4)
+ ay_text = TextMobject("$ f_y (x_0 , y_0 )(y – y_0 ) $").scale(0.5).shift(0.8*DOWN+2.7*RIGHT).rotate(-0.6)
+ a1_text = TextMobject("$f_x (x_0 , y_0 )(x – x_0 ) + f_y (x_0 , y_0 )(y – y_0 )$ ").scale(0.4).rotate(0.7).shift(1.7*DOWN+0.6*RIGHT)
+
+ lines = VGroup(a1,a_y,a_x,a2,a3,d1_copy,d2_copy)
+
+
+ self.set_camera_orientation(phi = 60 * DEGREES, theta = 55 * DEGREES)
+ self.wait(1)
+ self.add(axes)
+ self.add(label_x)
+ self.add(label_y)
+ self.play(Write(s))
+ self.wait(1)
+ self.play(Write(d2))
+ self.add_fixed_in_frame_mobjects(d1_text)
+ self.wait(1)
+ self.play(Write(t_plane))
+ self.add_fixed_in_frame_mobjects(t_text)
+ self.wait(1)
+ self.play(Write(d1))
+ self.add_fixed_in_frame_mobjects(d2_text)
+ self.wait(1)
+ self.play(Write(l1),Write(d1_copy))
+ self.add_fixed_in_frame_mobjects(d2_copy_text)
+ self.wait(1)
+ self.play(Write(l2),Write(d2_copy))
+ self.add_fixed_in_frame_mobjects(d1_copy_text)
+ self.wait(2)
+ self.play(FadeOut(d1_text),FadeOut(d1_copy_text),FadeOut(d2_text),FadeOut(d2_copy_text),FadeOut(t_text))
+ self.wait(1)
+ self.play(Write(a1),Write(a_x),Write(a_y),Write(a2),Write(a3))
+ self.wait(1)
+ self.play(FadeOut(s),FadeOut(d1),FadeOut(d2),FadeOut(l1),FadeOut(l2),FadeOut(t_plane),FadeOut(label_x),FadeOut(label_y))
+ self.wait(1)
+ lines.scale(2)
+ axes.scale(1.5)
+ self.wait(1)
+ self.add_fixed_in_frame_mobjects(ax_text)
+ self.add_fixed_in_frame_mobjects(ay_text)
+ self.add_fixed_in_frame_mobjects(a1_text)
+ self.wait(1)
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_Non_Differentiable_Function.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_Non_Differentiable_Function.gif
new file mode 100644
index 0000000..7581a33
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_Non_Differentiable_Function.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_Non_Differentiable_Function.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_Non_Differentiable_Function.py
new file mode 100644
index 0000000..79d0948
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_Non_Differentiable_Function.py
@@ -0,0 +1,47 @@
+from manimlib.imports import*
+import math
+
+#---- tangent plane does not exists for f(x,y): sqrt(x**2+y**2) at origin
+
+class TangenttoSurface(ThreeDScene):
+ def construct(self):
+ axes = ThreeDAxes().rotate(2.3)
+ axes2 = ThreeDAxes().scale(2).rotate(2.3).shift([0,0,1.3])
+
+ #----f(x,y): sqrt(x**2+y**2)
+ p = ParametricSurface(
+ lambda u, v: np.array([
+ u,
+ v,
+ -math.sqrt(u**2+v**2)
+ ]),v_min = -1,v_max = 1, u_min = -1, u_max = 1, checkerboard_colors = [RED_C,TEAL_D],
+ resolution = (20, 20)).scale(1)
+
+ #----size increased of f(x,y): sqrt(x**2+y**2)
+ p2 = ParametricSurface(
+ lambda u, v: np.array([
+ u,
+ v,
+ -math.sqrt(u**2+v**2)
+ ]),v_min = -1,v_max = 1, u_min = -1, u_max = 1, checkerboard_colors = [RED_C,TEAL_D],
+ resolution = (20, 20)).scale(3).shift([0,0,0])
+
+ self.set_camera_orientation(phi = 75 * DEGREES,theta = 40*DEGREES)
+
+ d = Dot([0,0,0],color = '#800000') #---- critical point
+ d2 = Dot([0,0,1.5],color = '#800000').scale(2) #---- size increased of critical point
+
+ f_text = TextMobject("$f$ is not differentiable at origin,because the surface").scale(0.5).to_corner(UL)
+ f2_text = TextMobject("is not flat when zoomed in at the origin.").scale(0.5).to_corner(UL).shift(0.5*DOWN)
+
+ self.add(axes)
+ self.wait(1)
+ self.play(Write(p),Write(d))
+ self.wait(1)
+ self.move_camera(phi = 50 * DEGREES,theta = 40*DEGREES)
+ self.wait(1)
+ self.play(ReplacementTransform(axes,axes2),ReplacementTransform(p,p2),ReplacementTransform(d,d2))
+ self.wait(1)
+ self.add_fixed_in_frame_mobjects(f_text)
+ self.add_fixed_in_frame_mobjects(f2_text)
+ self.wait(2)
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent_plane_at_extrema_and_saddle_point.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent_plane_at_extrema_and_saddle_point.gif
new file mode 100644
index 0000000..3fe7992
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent_plane_at_extrema_and_saddle_point.gif
Binary files differ
diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent_plane_at_extrema_and_saddle_point.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent_plane_at_extrema_and_saddle_point.py
new file mode 100644
index 0000000..d129213
--- /dev/null
+++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent_plane_at_extrema_and_saddle_point.py
@@ -0,0 +1,62 @@
+from manimlib.imports import*
+
+class TangenttoSurface(ThreeDScene):
+ def construct(self):
+ axes = ThreeDAxes()
+
+ #----graph of first function f(x,y) = -x**2-y**2
+ f = 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 = [YELLOW_D, YELLOW_E],
+ resolution = (20, 20)).scale(1)
+ f_text = TextMobject("Tangent plane at relative maxima").to_corner(UL).scale(0.5)
+
+ #----graph of second function f(x,y) = -x**2+y**2
+ f2 = 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 = [RED_D, RED_E],
+ resolution = (20, 20)).scale(1)
+ f2_text = TextMobject("Tangent plane at saddle point").to_corner(UL).scale(0.5)
+
+ #----graph of third function f(x,y) = x**2+y**2
+ f3 = 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_D, GREEN_E],
+ resolution = (20, 20)).scale(1)
+ f3_text = TextMobject("Tangent plane at relative minima").to_corner(UL).scale(0.5)
+
+ self.set_camera_orientation(phi = 75 * DEGREES, theta = -45 * DEGREES )
+ d = Dot(np.array([0,0,0]), color = '#800000') #---- critical point
+
+ r = Rectangle(height = 2,breadth = 1,color = PURPLE).scale(0.5)
+
+ self.begin_ambient_camera_rotation(rate = 0.3)
+ self.add(axes)
+ self.play(Write(f),Write(d))
+ self.wait(1)
+ self.add_fixed_in_frame_mobjects(f_text)
+ self.play(ShowCreation(r))
+ self.wait(1)
+ self.play(FadeOut(r),FadeOut(f),FadeOut(d),FadeOut(f_text))
+ self.wait(1)
+ self.play(Write(f2),Write(d))
+ self.wait(1)
+ self.add_fixed_in_frame_mobjects(f2_text)
+ self.play(ShowCreation(r))
+ self.wait(1)
+ self.play(FadeOut(r),FadeOut(f2),FadeOut(d),FadeOut(f2_text))
+ self.wait(1)
+ self.play(Write(f3),Write(d))
+ self.wait(1)
+ self.add_fixed_in_frame_mobjects(f3_text)
+ self.play(ShowCreation(r))
+ self.wait(1)