diff options
author | Vaishnavi | 2020-05-27 20:41:12 +0530 |
---|---|---|
committer | GitHub | 2020-05-27 20:41:12 +0530 |
commit | ccf9bdb8caddf9f12e0472c0510eded3e5a895a8 (patch) | |
tree | 5075a65f2d888aa0c4bfb3c6ba346c1cb1b16829 | |
parent | 65853aee28e884322684f8198a755234e6d80239 (diff) | |
download | FSF-mathematics-python-code-archive-ccf9bdb8caddf9f12e0472c0510eded3e5a895a8.tar.gz FSF-mathematics-python-code-archive-ccf9bdb8caddf9f12e0472c0510eded3e5a895a8.tar.bz2 FSF-mathematics-python-code-archive-ccf9bdb8caddf9f12e0472c0510eded3e5a895a8.zip |
Create file4_Tangent plane_at_critical_points.py
Manim code of Video 4 of the lecture note on the subtopic Tangent Plane Approximations
-rw-r--r-- | FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent plane_at_critical_points.py | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent plane_at_critical_points.py b/FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent plane_at_critical_points.py new file mode 100644 index 0000000..d129213 --- /dev/null +++ b/FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent plane_at_critical_points.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) |