summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVaishnavi2020-06-14 00:25:05 +0530
committerGitHub2020-06-14 00:25:05 +0530
commitb956f1dcb43cf2b93febad29890dbbd1e264dd2f (patch)
tree3925aa0695077cfe175352afd5a3ff708700a2ad
parent51ee2ee8400ae4591f0559e3c5e90c7059219f42 (diff)
downloadFSF-mathematics-python-code-archive-b956f1dcb43cf2b93febad29890dbbd1e264dd2f.tar.gz
FSF-mathematics-python-code-archive-b956f1dcb43cf2b93febad29890dbbd1e264dd2f.tar.bz2
FSF-mathematics-python-code-archive-b956f1dcb43cf2b93febad29890dbbd1e264dd2f.zip
Update and rename file3_Visualization_of_types_of_critical_points.py to file3_Tangent_plane_at_extrema_of_a_function.py
modified code for gif 3
-rw-r--r--FSF-2020/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.py53
-rw-r--r--FSF-2020/approximations-and-optimizations/Critical-Points/file3_Visualization_of_types_of_critical_points.py70
2 files changed, 53 insertions, 70 deletions
diff --git a/FSF-2020/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.py b/FSF-2020/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.py
new file mode 100644
index 0000000..a9b29f3
--- /dev/null
+++ b/FSF-2020/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.py
@@ -0,0 +1,53 @@
+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=[GREEN_E,GREEN_D,GREEN_C,GREEN_B],
+ 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=[BLUE_E,BLUE_D,BLUE_C,BLUE_B],
+ resolution=(20, 20)).scale(1)
+
+ self.set_camera_orientation(phi=75 * DEGREES)
+ self.begin_ambient_camera_rotation(rate=0.2)
+
+ d = Dot(np.array([0,0,0]), color = '#800000') #---- critical point
+ r = Rectangle(fill_color= '#C0C0C0',fill_opacity = 0.3).move_to(ORIGIN).fade(0.7) #----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.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.play(ShowCreation(d))
+ self.wait(1)
+ self.play(ShowCreation(r))
+ self.wait(1)
diff --git a/FSF-2020/approximations-and-optimizations/Critical-Points/file3_Visualization_of_types_of_critical_points.py b/FSF-2020/approximations-and-optimizations/Critical-Points/file3_Visualization_of_types_of_critical_points.py
deleted file mode 100644
index f9055e6..0000000
--- a/FSF-2020/approximations-and-optimizations/Critical-Points/file3_Visualization_of_types_of_critical_points.py
+++ /dev/null
@@ -1,70 +0,0 @@
-from manimlib.imports import *
-
-class TypescpAnimation(ThreeDScene):
- def construct(self):
- axes = ThreeDAxes()
-
- r_text = TextMobject("Relative Maximum at ORIGIN",color ='#87CEFA')
- f_text = TextMobject("$f(x,y) = -x^2-y^2$").to_corner(UL)
-
- #----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)
-
- r2_text = TextMobject("Saddle Point at ORIGIN",color ='#87CEFA')
- f2_text = TextMobject("$f(x,y) = -x^2+y^2$").to_corner(UL)
-
- #----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)
-
- r3_text = TextMobject("Relative Minimum at ORIGIN",color ='#87CEFA')
- f3_text = TextMobject("$f(x,y) = x^2+y^2$").to_corner(UL)
-
- #----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)
-
- self.set_camera_orientation(phi = 75 * DEGREES, theta = -45 * DEGREES )
- d = Dot(np.array([0,0,0]), color = '#800000') #---- critical point
-
- self.add_fixed_in_frame_mobjects(r_text)
- self.wait(1)
- self.play(FadeOut(r_text))
- self.add(axes)
- self.play(Write(f),Write(d))
- self.add_fixed_in_frame_mobjects(f_text)
- self.wait(2)
- self.play(FadeOut(axes),FadeOut(f),FadeOut(f_text),FadeOut(d))
-
- self.add_fixed_in_frame_mobjects(r2_text)
- self.wait(1)
- self.play(FadeOut(r2_text))
- self.add(axes)
- self.play(Write(f2),Write(d))
- self.add_fixed_in_frame_mobjects(f2_text)
- self.wait(2)
- self.play(FadeOut(axes),FadeOut(f2),FadeOut(f2_text),FadeOut(d))
-
- self.add_fixed_in_frame_mobjects(r3_text)
- self.wait(1)
- self.play(FadeOut(r3_text))
- self.add(axes)
- self.play(Write(f3),Write(d))
- self.add_fixed_in_frame_mobjects(f3_text)
- self.wait(2)