From 9621629c384f7c91b2170a3a5f467aaeefbc669a Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 27 May 2020 20:44:57 +0530 Subject: Rename file3_Visualization of types of critical points.py to file3_Visualization_of_types_of_critical_points.py --- ...e3_Visualization of types of critical points.py | 70 ---------------------- ...e3_Visualization_of_types_of_critical_points.py | 70 ++++++++++++++++++++++ 2 files changed, 70 insertions(+), 70 deletions(-) delete mode 100644 FSF-2020/approximations-and-optimizations/Critical-Points/file3_Visualization of types of critical points.py create mode 100644 FSF-2020/approximations-and-optimizations/Critical-Points/file3_Visualization_of_types_of_critical_points.py 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) 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 new file mode 100644 index 0000000..f9055e6 --- /dev/null +++ b/FSF-2020/approximations-and-optimizations/Critical-Points/file3_Visualization_of_types_of_critical_points.py @@ -0,0 +1,70 @@ +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) -- cgit