summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file1_TangentPlanes.py39
-rw-r--r--FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.py52
2 files changed, 52 insertions, 39 deletions
diff --git a/FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file1_TangentPlanes.py b/FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file1_TangentPlanes.py
deleted file mode 100644
index 8e3a19e..0000000
--- a/FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file1_TangentPlanes.py
+++ /dev/null
@@ -1,39 +0,0 @@
-from manimlib.imports import*
-
-class TangenttoSurface(ThreeDScene):
- def construct(self):
- axes = ThreeDAxes()
-
- #parabola: -x**2-y**2
- p = 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_C,TEAL_D],
- resolution=(20, 20)).scale(1).shift(1*RIGHT+2*UP)
- self.set_camera_orientation(phi = 35 * DEGREES,theta = -40 * DEGREES )
-
- r = Rectangle(side_length=2,side_breadth= 1, fill_color=PURPLE, fill_opacity=0.2).shift(ORIGIN-1+3*UP+2*RIGHT).scale(0.7) #---tangent plane along x axis
-
- r_text = TextMobject("Tangent Plane along $x$ axis",color = '#FFE4E1').scale(0.6).to_corner(UL)
- r2_text = TextMobject("Tangent Plane along $y$ axis",color = '#FFE4E1').scale(0.6).to_corner(UL)
-
- a = Arrow(color = '#FFFFF0').shift(ORIGIN-1+3*UP+4*RIGHT).scale(0.5)
- a2 = Arrow(color = '#FFFFF0').shift(ORIGIN+0.5+3*UP+RIGHT).scale(0.5)
- a2.rotate(1.571) #----1.571 radian = 90 degrees
-
- self.add(axes)
- self.play(Write(p))
- self.begin_ambient_camera_rotation(rate = 0.1)
- self.add_fixed_in_frame_mobjects(r_text)
- self.play(ShowCreation(r))
- self.play(ShowCreation(a))
- self.wait(1)
- self.play(FadeOut(r),FadeOut(a),FadeOut(r_text))
-
- r.rotate(1.571) #---tangent plane along y axis
- self.play(ShowCreation(r))
- self.play(ShowCreation(a2))
- self.add_fixed_in_frame_mobjects(r2_text)
- self.wait(2)
diff --git a/FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.py b/FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.py
new file mode 100644
index 0000000..3632d7e
--- /dev/null
+++ b/FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.py
@@ -0,0 +1,52 @@
+from manimlib.imports import*
+
+#---- tangent plane is parallel to the surface of the funtion at a point
+class firstScene(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)
+
+