diff options
author | Vaishnavi | 2020-05-25 21:58:32 +0530 |
---|---|---|
committer | GitHub | 2020-05-25 21:58:32 +0530 |
commit | 4e34d62cf2c2ae709756e0f37aeafe680e265a91 (patch) | |
tree | 707b7f54245a44b6e99198d25bbaa76cf1f800ea | |
parent | 53b53c1682d65a861b3707507d9ad48393ad70cd (diff) | |
download | FSF-mathematics-python-code-archive-4e34d62cf2c2ae709756e0f37aeafe680e265a91.tar.gz FSF-mathematics-python-code-archive-4e34d62cf2c2ae709756e0f37aeafe680e265a91.tar.bz2 FSF-mathematics-python-code-archive-4e34d62cf2c2ae709756e0f37aeafe680e265a91.zip |
Create theorem.py
-rw-r--r-- | FSF-2020/approximations-and-optimizations/Critical Points/theorem.py | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/FSF-2020/approximations-and-optimizations/Critical Points/theorem.py b/FSF-2020/approximations-and-optimizations/Critical Points/theorem.py new file mode 100644 index 0000000..6889a52 --- /dev/null +++ b/FSF-2020/approximations-and-optimizations/Critical Points/theorem.py @@ -0,0 +1,55 @@ +from manimlib.imports import* + +class TheoremAnimation(ThreeDScene): + def construct(self): + + axes = ThreeDAxes() + + #----parabola: x**2+y**2 + parabola1 = 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=[TEAL_E], + resolution=(20, 20)).scale(1) + + #----parabola: -x**2-y**2 + parabola2 = 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=[PURPLE_E,PURPLE_E], + resolution=(20, 20)).scale(1) + + self.set_camera_orientation(phi=75 * DEGREES) + self.begin_ambient_camera_rotation(rate=0.4) + + d = Dot(np.array([0,0,0]), color = '#800000') #---- critical point + r = Rectangle(fill_color= '#C0C0C0',fill_opacity =0.3).move_to(ORIGIN) #----tangent plane + + parabola1_text = TextMobject("Maximum with horizontal tangent plane").scale(0.7).to_corner(UL) + + parabola2_text = TextMobject("Minimum with horizontal tangent plane").scale(0.7).to_corner(UL) + + self.add(axes) + self.add_fixed_in_frame_mobjects(parabola2_text) + self.wait(1) + self.play(Write(parabola1)) + self.wait(1) + self.play(ShowCreation(d)) + self.wait(1) + self.play(ShowCreation(r)) + self.wait(2) + self.play(FadeOut(parabola2_text),FadeOut(parabola1),FadeOut(r),FadeOut(d)) + + self.wait(1) + self.add_fixed_in_frame_mobjects(parabola1_text) + self.wait(1) + self.play(Write(parabola2)) + self.wait(1) + self.play(ShowCreation(d)) + self.wait(1) + self.play(ShowCreation(r)) + self.wait(2) |