From 56ab459970db5ee7d05f3f30cdbd750f64f1800b Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 04:47:27 +0530 Subject: Rename FSF-2020/approximations-and-optimizations/Critical-Points/file5_f(x,y)=(y-x)(1-2x-3y).py to FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file5_f(x,y)=(y-x)(1-2x-3y).py --- .../Critical-Points/file5_f(x,y)=(y-x)(1-2x-3y).py | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file5_f(x,y)=(y-x)(1-2x-3y).py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file5_f(x,y)=(y-x)(1-2x-3y).py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file5_f(x,y)=(y-x)(1-2x-3y).py new file mode 100644 index 0000000..41c3b61 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file5_f(x,y)=(y-x)(1-2x-3y).py @@ -0,0 +1,29 @@ +from manimlib.imports import* + +#---- visualization of the function +class ExampleAnimation(ThreeDScene): + def construct(self): + axes = ThreeDAxes() + label_x = TextMobject("$x$").shift([5.5,-0.5,0]) #---- x axis + label_y = TextMobject("$y$").shift([-0.5,5.5,0]).rotate(-4.5) #---- y axis + + #---- f(x,y) = (y-x)(1-2x-3y) + surface = ParametricSurface( + lambda u, v: np.array([ + u, + v, + (v-u)*(1-2*u-3*v) + ]),v_min = -1, v_max = 1, u_min = -1, u_max = 1, checkerboard_colors = [PURPLE_B,PURPLE_C,PURPLE_D, PURPLE_E]).scale(1).fade(0.2).shift([0.2,0.2,0]) + + f_text = TextMobject("$f(x,y) = (y-x)(1-2x-3y)$").to_corner(UL) + + self.set_camera_orientation(phi = 60 * DEGREES, theta = 75 * DEGREES) + self.begin_ambient_camera_rotation(rate=0.1) + self.add_fixed_in_frame_mobjects(f_text) + self.wait(1) + self.add(axes) + self.add(label_x) + self.add(label_y) + self.wait(1) + self.play(Write(f)) + self.wait(4) -- cgit From 91f4e736577c6a4bf1f17b5eded2942905a0573d Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 04:49:41 +0530 Subject: Rename FSF-2020/approximations-and-optimizations/Critical-Points/file4_Types_of_critical_points.py to FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file4_Types_of_critical_points.py --- .../file4_Types_of_critical_points.py | 134 +++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file4_Types_of_critical_points.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file4_Types_of_critical_points.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file4_Types_of_critical_points.py new file mode 100644 index 0000000..656fb68 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file4_Types_of_critical_points.py @@ -0,0 +1,134 @@ +from manimlib.imports import* + + +#---- Relative Maxima +class firstScene(ThreeDScene): + def construct(self): + + r_text = TextMobject("Relative Maximum at ORIGIN",color ='#87CEFA') + + axes = ThreeDAxes() + label_x = TextMobject("$x$").shift([5.5,-0.5,0]) #---- x axis + label_y = TextMobject("$y$").shift([-0.5,5.5,0]).rotate(-4.5) #---- y axis + + #----graph of the function f(x,y) = -x**2-y**2 + surface = 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]).scale(1.5).shift([0,0,-0.51]).fade(0.3) + + f_text = TextMobject("$f(x,y) = -x^2-y^2$").to_corner(UL) + + d = Dot(color = "#800000").shift([0,0,0]) #---- critical point + + self.set_camera_orientation(phi = 75 * DEGREES, theta = 45 * DEGREES) + self.add_fixed_in_frame_mobjects(r_text) + self.wait(1) + self.play(FadeOut(r_text)) + self.begin_ambient_camera_rotation(rate = 0.1) + self.add(axes) + self.add(label_x) + self.add(label_y) + self.play(Write(surface),Write(d)) + self.add_fixed_in_frame_mobjects(f_text) + self.wait(2) + self.play(FadeOut(axes),FadeOut(surface),FadeOut(f_text),FadeOut(d),FadeOut(label_x),FadeOut(label_y)) + + +#---- Relative Minima +class secondScene(ThreeDScene): + def construct(self): + + r2_text = TextMobject("Relative Minimum at ORIGIN",color ='#87CEFA') + + axes = ThreeDAxes() + label_x = TextMobject("$x$").shift([5.5,-0.5,0]) #---- x axis + label_y = TextMobject("$y$").shift([-0.5,5.5,0]).rotate(-4.5) #---- y axis + + #----graph of the function g(x,y) = x**2+y**2 + surface = 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_B,TEAL_C,TEAL_D,TEAL_E]).scale(1.5).shift([0,0,0.55]).fade(0.1) + + d = Dot(color = "#800000").shift([0,0,0]) #---- critical point + + g_text = TextMobject("$f(x,y) = x^2+y^2$").to_corner(UL) + + self.set_camera_orientation(phi = 75 * DEGREES, theta = 45 * DEGREES) + self.add_fixed_in_frame_mobjects(r2_text) + self.wait(1) + self.play(FadeOut(r2_text)) + self.begin_ambient_camera_rotation(rate = 0.1) + self.add(axes) + self.add(label_x) + self.add(label_y) + self.play(Write(surface),Write(d)) + self.add_fixed_in_frame_mobjects(g_text) + self.wait(2) + self.play(FadeOut(axes),FadeOut(surface),FadeOut(g_text),FadeOut(d),FadeOut(label_x),FadeOut(label_y)) + + + +#---- Saddle Point +class thirdScene(ThreeDScene): + def construct(self): + + r3_text = TextMobject("Saddle Point", color = '#87CEFA') + + axes = ThreeDAxes() + label_x = TextMobject("$x$").shift([5.5,-0.5,0]) #---- x axis + label_y = TextMobject("$y$").shift([-0.5,5.5,0]).rotate(-4.5) #---- y axis + + #---- graph of function h(x,y) = -x^2 + y^2 + surface = 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_B,PURPLE_C,PURPLE_D,PURPLE_E]).scale(1.5).shift([0,0,0]) + + #---- curve(trace) along x axis + curve_x = ParametricSurface( + lambda u, v: np.array([ + u*0.4, + v, + v**2 + ]),v_min = -1, v_max = 1, u_min = -0.2, u_max = 0.2).shift([0,0,0.34]).scale(1.5).set_color("#800000") + + #---- curve(trace) along y axis + curve_y = ParametricSurface( + lambda u, v: np.array([ + u, + v*0.4, + -u**2 + ]),v_min = -0.2, v_max = 0.2, u_min = -1, u_max = 1).scale(1.6).shift([0,0,-0.1]).set_color("#800000") + + d = Dot(color = GREEN).shift([0,0,0.1]) #---- critical point + + h_text = TextMobject("$f(x,y) = -x^2+y^2$").to_corner(UL) + + self.add_fixed_in_frame_mobjects(r3_text) + self.wait(1) + self.set_camera_orientation(phi = 50 * DEGREES,theta = 45 * DEGREES) + self.play(FadeOut(r3_text)) + self.add(axes) + self.add(label_x) + self.add(label_y) + self.begin_ambient_camera_rotation(rate = 0.3) + self.add_fixed_in_frame_mobjects(h_text) + self.play(Write(surface)) + self.wait(1) + self.add(curve_y) + self.add(d) + self.wait(1) + self.play(FadeOut(curve_y)) + self.wait(1) + self.add(curve_x) + self.wait(1) + self.add(d) + self.wait(1) -- cgit From 9c6d394101ad89681ef497cd0667fa23e6f3d168 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 04:50:58 +0530 Subject: Rename FSF-2020/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.py to FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.py --- ...file3_Tangent_plane_at_extrema_of_a_function.py | 73 ++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.py new file mode 100644 index 0000000..e674113 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.py @@ -0,0 +1,73 @@ +from manimlib.imports import* + +#---- tangent plane to minima of the function +class firstScene(ThreeDScene): + def construct(self): + + axes = ThreeDAxes() + label_x = TextMobject("$x$").shift([5.5,-0.5,0]) #---- x axis + label_y = TextMobject("$y$").shift([-0.5,5.5,0]).rotate(-4.5) #---- y axis + + #---- parabola: f(x,y) = x**2 + y**2 + parabola = 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) + + d = Dot(np.array([0,0,0]), color = '#800000') # ---- critical point + + tangent_plane = Rectangle(fill_color = '#C0C0C0', fill_opacity = 0.3).move_to(ORIGIN).fade(0.7) # ----tangent plane + + parabola_text = TextMobject("Minimum with horizontal tangent plane").scale(0.7).to_corner(UL) + + self.set_camera_orientation(phi = 75 * DEGREES, theta = 45 * DEGREES) + self.begin_ambient_camera_rotation(rate = 0.2) + self.add(axes) + self.add(label_x) + self.add(label_y) + self.add_fixed_in_frame_mobjects(parabola_text) + self.wait(1) + self.play(Write(parabola)) + self.play(ShowCreation(d)) + self.wait(1) + self.play(ShowCreation(tangent_plane)) + self.wait(2) + self.play(FadeOut(parabola_text),FadeOut(parabola),FadeOut(tangent_plane),FadeOut(d),FadeOut(label_x),FadeOut(label_y),FadeOut(axes)) + + +#---- tangent plane to maxima of the function +class secondScene(ThreeDScene): + def construct(self): + + axes = ThreeDAxes() + label_x = TextMobject("$x$").shift([5.5,-0.5,0]) #---- x axis + label_y = TextMobject("$y$").shift([-0.5,5.5,0]).rotate(-4.5) #---- y axis + + #----parabola: g(x,y) = -x**2-y**2 + parabola = 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) + + d = Dot(np.array([0,0,0]), color = '#800000') #---- critical point + + tangent_plane = Rectangle(fill_color = '#C0C0C0',fill_opacity = 0.3).move_to(ORIGIN).fade(0.7) #---- tangent plane + + parabola_text = TextMobject("Maximum with horizontal tangent plane").scale(0.7).to_corner(UL) + + self.set_camera_orientation(phi = 75 * DEGREES, theta = 45 * DEGREES) + self.begin_ambient_camera_rotation(rate = 0.2) + self.add(axes) + self.add(label_x) + self.add(label_y) + self.add_fixed_in_frame_mobjects(parabola_text) + self.wait(1) + self.play(Write(parabola)) + self.play(ShowCreation(d)) + self.wait(1) + self.play(ShowCreation(tangent_plane)) + self.wait(2) -- cgit From a79446a128f65df2de58229ee5b48a12fe29cdd4 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 04:51:58 +0530 Subject: Rename FSF-2020/approximations-and-optimizations/Critical-Points/file2_Traces_and_Tangent.py to FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file2_Traces_and_Tangent.py --- .../Critical-Points/file2_Traces_and_Tangent.py | 88 ++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file2_Traces_and_Tangent.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file2_Traces_and_Tangent.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file2_Traces_and_Tangent.py new file mode 100644 index 0000000..4b020e1 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file2_Traces_and_Tangent.py @@ -0,0 +1,88 @@ +from manimlib.imports import* +import math as m + +#---- tangent to the trace with x constant +class firstScene(ThreeDScene): + def construct(self): + + axes = ThreeDAxes().scale(1) + label_x = TextMobject("$x$").shift([5.8,-0.5,0]) + label_y = TextMobject("$y$").shift([-0.5,-5.6,0]).rotate(-4.5) + + #---- graph of f(x,y) = -x^2-y^2 + surface = ParametricSurface( + lambda u, v: np.array([ + u, + v, + -u**2-v**2 + ]),u_min=-1,u_max=1, v_min=-1,v_max=1,checkerboard_colors=[PURPLE_C,PURPLE_D,PURPLE_E,PURPLE_B]).scale(1.5).shift([0,0,2]).rotate(0.2) + + #---- curve(trace) along y axis + curve = ParametricSurface( + lambda u, v: np.array([ + u*0.4, + v, + -v**2 + ]),v_min =-1 , v_max =1 , u_min = -0.1, u_max = 0.1).scale(1.6).shift([0.02,0.1,2.3]).set_color("#800000").rotate(0.1) + + d = Dot(color =YELLOW).shift([-0.05,-0.2,2.3]) #---- critical point + + x_text = TextMobject("Tangent to the trace with $x$ constant at critical point").shift(3*RIGHT+2*UP).scale(0.5).to_corner(UL) + + tangent_line = Line([-0.05,-1.5,2.3],[-0.05,1.5,2.3],color = '#228B22') + + self.add(axes) + self.set_camera_orientation(phi = 40 * DEGREES, theta = 55 * DEGREES) + self.begin_ambient_camera_rotation(rate = 0.1) + self.add(label_x) + self.add(label_y) + self.play(Write(surface)) + self.add_fixed_in_frame_mobjects(x_text) + self.add(curve) + self.wait(1) + self.play(Write(tangent_line),Write(d)) + self.wait(1) + + + +#---- tangent to the trace with y constant +class secondScene(ThreeDScene): + def construct(self): + + axes = ThreeDAxes().scale(1) + label_x = TextMobject("$x$").shift([5.8,-0.5,0]) + label_y = TextMobject("$y$").shift([-0.5,-5.6,0]).rotate(-4.5) + + #---- graph of f(x,y) = -x^2-y^2 + surface = ParametricSurface( + lambda u, v: np.array([ + u, + v, + -u**2-v**2 + ]),u_min = -1, u_max = 1, v_min = -1, v_max = 1, checkerboard_colors = [PURPLE_B,PURPLE_C,PURPLE_D,PURPLE_E]).scale(1.5).shift([0,0,2]).rotate(0.2) + + #---- curve(trace) along x axis + curve = ParametricSurface( + lambda u, v: np.array([ + u, + v*0.4, + -u**2 + ]),v_min = -0.1, v_max = 0.1, u_min = -1, u_max = 1).scale(1.6).shift([0.07,0.1,2.3]).set_color("#800000") + + d = Dot(color = YELLOW).shift([0,-0.2,2.3]) #---- critical point + + tangent_line = Line(color = '#228B22').scale(1).shift([0,-0.2,2.3]).rotate(m.radians(190),LEFT) + + y_text = TextMobject("Tangent to the trace with $y$ constant at critical point").shift(3*RIGHT+2*UP).scale(0.5).to_corner(UL) + + self.add(axes) + self.set_camera_orientation(phi = 40 * DEGREES, theta = 55 * DEGREES) + self.add(label_x) + self.add(label_y) + self.begin_ambient_camera_rotation(rate = 0.1) + self.play(Write(surface)) + self.add_fixed_in_frame_mobjects(y_text) + self.add(curve) + self.wait(1.5) + self.play(Write(tangent_line),Write(d)) + self.wait(0.5) -- cgit From 9977b22482702c409517e391ba380f59c5cd557c Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 04:53:16 +0530 Subject: Rename FSF-2020/approximations-and-optimizations/Critical-Points/file1_Critical_Point_of_a_function.py to FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file1_Critical_Point_of_a_function.py --- .../file1_Critical_Point_of_a_function.py | 77 ++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file1_Critical_Point_of_a_function.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file1_Critical_Point_of_a_function.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file1_Critical_Point_of_a_function.py new file mode 100644 index 0000000..e8cb08d --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file1_Critical_Point_of_a_function.py @@ -0,0 +1,77 @@ +from manimlib.imports import* +import math as m + +#---- case 1: parial derivatives exist at critical point of the function +class firstScene(ThreeDScene): + def construct(self): + + axes = ThreeDAxes() + label_x = TextMobject("$x$").shift([5.5,-0.5,0]) #---- x axis + label_y = TextMobject("$y$").shift([-0.5,5.5,0]).rotate(-4.5) #---- y axis + + #---- f(x,y) = e^(-10x^2-10y^2) + surface = ParametricSurface( + lambda u, v: np.array([ + u, + v, + m.exp(-10*u**2-10*v**2) + ]),u_min = -1, u_max = 1, v_min = -1, v_max = 1, checkerboard_colors = [TEAL_E,TEAL_D,TEAL_C,TEAL_B]).fade(0.6).scale(3.5).shift([0,0,1.5]) + + l1 = Line([0,0,3.75],[0,0,0],color = '#800000') + + d = Dot([0,0,3.75],color = '#800000') #---- critical point + + d_text = TextMobject("$\\frac{\\partial f}{\\partial x}=\\frac{\\partial f}{\\partial y} = 0$").scale(0.8).to_corner(UL) + + f_text = TextMobject("Critical Point ",color = YELLOW).shift(3.4*UP).scale(0.5) + + self.set_camera_orientation(phi = 45*DEGREES, theta = 40*DEGREES) + self.add(axes) + self.add(label_x) + self.add(label_y) + self.add_fixed_in_frame_mobjects(d_text) + self.begin_ambient_camera_rotation(rate = 0.2) + self.play(Write(surface)) + self.wait(1) + self.play(Write(l1)) + self.play(Write(d)) + self.wait(1) + self.add_fixed_in_frame_mobjects(f_text) + self.wait(3) + self.play(FadeOut(f_text),FadeOut(surface),FadeOut(axes),FadeOut(d_text),FadeOut(d),FadeOut(l1),FadeOut(label_x),FadeOut(label_y)) + + +#---- case 2: parial derivatives do not exist at critical point of the function +class secondScene(ThreeDScene): + def construct(self): + axes = ThreeDAxes() + label_x = TextMobject("$x$").shift([5.5,-0.5,0]) #---- x axis + label_y = TextMobject("$y$").shift([-0.5,5.5,0]).rotate(-4.5) #---- y axis + + #---- g(x,y)= |x|+|y| + surface = ParametricSurface( + lambda u, v: np.array([ + u, + v, + abs(u)+abs(v) + ]),u_min = -1.5, u_max = 1.5, v_min = -1.5, v_max = 1.5, checkerboard_colors = [TEAL_E,TEAL_D,TEAL_C,TEAL_B]) + + d2 = Dot([0,0,0],color = '#800000') #---- critical point + + d2_text = TextMobject("$\\frac{\\partial f}{\\partial x}$ and/or $\\frac{\\partial f}{\\partial y}$ does not exist").scale(0.7).to_corner(UL) + + g_text = TextMobject("Critical Point",color = YELLOW).shift(1.2*RIGHT).scale(0.6) + + self.set_camera_orientation(phi = 60*DEGREES, theta = 40*DEGREES) + self.add(axes) + self.add(label_x) + self.add(label_y) + self.add_fixed_in_frame_mobjects(d2_text) + self.begin_ambient_camera_rotation(rate = 0.2) + self.wait(1) + self.play(Write(surface2)) + self.wait(1) + self.play(Write(d2)) + self.wait(1) + self.add_fixed_in_frame_mobjects(g_text) + self.wait(2) -- cgit From b94975950b6d53d171cb15123a65c4d4abad75b4 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 04:54:27 +0530 Subject: Rename FSF-2020/approximations-and-optimizations/Critical-Points/README.md to FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/README.md --- .../Critical-Points/README.md | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/README.md (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/README.md b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/README.md new file mode 100644 index 0000000..f0747bb --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/README.md @@ -0,0 +1,32 @@ +

SubTopic: Critical Points

+

+ +file1_Critical_Point_of_a_function + +![file1_Critical_Point_of_a_function](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/approximations-and-optimizations/Critical-Points/file1_Critical_Point_of_a_function.gif?raw=true) +

+

+ +file2_Traces_and_Tangent + +![file2_Traces_and_Tangent](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/approximations-and-optimizations/Critical-Points/file2_Traces_and_Tangent.gif?raw=true) +

+

+ +file3_Tangent_plane_at_extrema_of_a_function + +![file3_Tangent_plane_at_extrema_of_a_function](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.gif?raw=true) +

+

+ +file4_Types_of_critical_points + +![file4_Types_of_critical_points](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/approximations-and-optimizations/Critical-Points/file4_Types_of_critical_points.gif?raw=true) +

+

+ +file5_f(x,y)=(y-x)(1-2x-3y) + +![file5_f(x,y)=(y-x)(1-2x-3y)](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/approximations-and-optimizations/Critical-Points/file5_f(x%2Cy)%3D(y-x)(1-2x-3y).gif?raw=true) +

+

-- cgit From 6c1c19388c3c24c5a0b91ac82272e015a004484c Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 04:56:35 +0530 Subject: Rename FSF-2020/approximations-and-optimizations/The-Second-Derivative-Test/file1_Second_order_partial_derivatives.py to FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file1_Second_order_partial_derivatives.py --- .../file1_Second_order_partial_derivatives.py | 78 ++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file1_Second_order_partial_derivatives.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file1_Second_order_partial_derivatives.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file1_Second_order_partial_derivatives.py new file mode 100644 index 0000000..84052cc --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file1_Second_order_partial_derivatives.py @@ -0,0 +1,78 @@ +from manimlib.imports import* + +#---- graphs of second-order partial derivatives of a function +class SurfacesAnimation(ThreeDScene): + def construct(self): + + axes = ThreeDAxes() + x_label = TextMobject('$x$').shift([5,0.5,0]) #---- x axis + y_label = TextMobject('$y$').shift([0.5,4,0]).rotate(-4.5) #---- y axis + + #---- surface of function: f(x,y) = (x^2+y^2)^2 + surface_f = ParametricSurface( + lambda u, v: np.array([ + u, + v, + ((u**2)+(v**2))**2 + ]),v_min=-1,v_max=1,u_min=-1,u_max=1,checkerboard_colors=[GREEN_D, GREEN_E]).scale(1) + + #---- surface of second-order partial derivative f_xx + surface_fxx = ParametricSurface( + lambda u, v: np.array([ + u, + v, + (3*u**2)+(v**2) + ]),v_min=-1,v_max=1,u_min=-1,u_max=1,checkerboard_colors=[YELLOW_D, YELLOW_E]).shift([0,0,0]).scale(0.6) + + #---- surface of second-order partial derivative f_yy + surface_fyy = ParametricSurface( + lambda u, v: np.array([ + u, + v, + (u**2)+(3*v**2) + ]),v_min=-1,v_max=1,u_min=-1,u_max=1,checkerboard_colors=[PURPLE_D, PURPLE_E]).scale(0.6).shift([0,0,0]) + + #---- surface of second-order partial derivative f_xy = f_yx + surface_fxy = ParametricSurface( + lambda u, v: np.array([ + u, + v, + 8*u*v + ]),v_min=-1,v_max=1,u_min=-1,u_max=1,checkerboard_colors=[TEAL_D, TEAL_E]).scale(0.6) + + f_text= TextMobject("$f(x,y) = (x^2+y^2)^2$",color = GREEN).scale(0.7).to_corner(UL) + + fxx_text= TextMobject("$f_{xx} = 12x^2+4y^2$ (Concavity along x axis)",color = YELLOW).scale(0.5).to_corner(UL) + + fyy_text= TextMobject("$f_{yy} = 4x^2+12y^2$(Concavity along y axis)",color = PURPLE).scale(0.5).to_corner(UL) + + fxy_text= TextMobject("$f_{xy} = f_{yx} = 8xy$ (Twisting of the function)",color = TEAL).scale(0.5).to_corner(UL) + + + self.set_camera_orientation(phi = 40 * DEGREES, theta = 45 * DEGREES) + self.begin_ambient_camera_rotation(rate = 0.1) + self.add_fixed_in_frame_mobjects(f_text) + self.add(axes) + self.add(x_label) + self.add(y_label) + self.wait(1) + self.play(Write(surface_f)) + self.wait(2) + self.play(FadeOut(f_text)) + + + self.play(ReplacementTransform(surface_f,surface_fxx)) + + self.add_fixed_in_frame_mobjects(fxx_text) + self.wait(2) + self.play(FadeOut(fxx_text)) + + self.play(ReplacementTransform(surface_fxx,surface_fyy)) + self.add_fixed_in_frame_mobjects(fyy_text) + self.wait(2) + self.play(FadeOut(fyy_text)) + + self.play(ReplacementTransform(surface_fyy,surface_fxy)) + self.move_camera(phi = 35 * DEGREES, theta = 80 * DEGREES) + self.add_fixed_in_frame_mobjects(fxy_text) + self.wait(2) -- cgit From 9f8a0bc5d0ccec1a1260d7922e5fdc6c44d1f3e5 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 04:57:43 +0530 Subject: Rename FSF-2020/approximations-and-optimizations/The-Second-Derivative-Test/file2_Degenerate_Hessian_Matrix.py to FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file2_Degenerate_Hessian_Matrix.py --- .../file2_Degenerate_Hessian_Matrix.py | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file2_Degenerate_Hessian_Matrix.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file2_Degenerate_Hessian_Matrix.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file2_Degenerate_Hessian_Matrix.py new file mode 100644 index 0000000..c1e3516 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file2_Degenerate_Hessian_Matrix.py @@ -0,0 +1,52 @@ +from manimlib.imports import* + +class firstscene(Scene): + def construct(self): + + h_text = TextMobject("Degenerate Hessian Matrix", color = RED).scale(1).shift(UP) + + + f_text = TextMobject("$f(x,y) = 2x^3+y^3$", color = TEAL).scale(1).to_corner(UL) + c_text = TextMobject("Critical Point: $(0,0)$", color = TEAL).scale(1).next_to(f_text).shift(DOWN+4.3*LEFT) + m_text = TextMobject("\\begin{equation*} D_2(x,y)= \\begin{vmatrix} 12x\\space & 0\\space \\\\ 0 & 6y \\end{vmatrix} \\end{equation*}",color = YELLOW) + d_text = TextMobject("\\begin{equation*} D_2(0,0)= \\begin{vmatrix} 0 \\space & 0\\space \\\\ 0 & 0 \\end{vmatrix} \\end{equation*}",color = PURPLE) + + + t_text = TextMobject("$D_2 = 0$(Inconclusive)", color = TEAL).scale(1).shift(2*DOWN) + + self.play(ShowCreation(h_text)) + self.wait(1) + self.play(FadeOut(h_text)) + self.wait(1) + self.play(ShowCreation(f_text)) + self.wait(1) + self.play(ShowCreation(c_text)) + self.wait(1) + self.play(ShowCreation(m_text)) + self.wait(2) + self.play(ReplacementTransform(m_text,d_text)) + self.wait(1) + self.play(ShowCreation(t_text)) + self.wait(2) + + +class SecondScene(ThreeDScene): + def construct(self): + axes = ThreeDAxes() + + f = ParametricSurface( + lambda u, v: np.array([ + u, + v, + (2*u**3)+v**3 + ]),v_min=-1,v_max=1,u_min=-1,u_max=1,checkerboard_colors=[TEAL_C,YELLOW_D,BLUE_E], + resolution=(20, 20)).scale(1) + + self.set_camera_orientation(phi=25 * DEGREES,theta = 80*DEGREES) + self.begin_ambient_camera_rotation(rate=0.1) + + f_text = TextMobject("$f(x,y) = 2x^3+y^3$",color = ORANGE).shift(2*DOWN+2*RIGHT).scale(0.8) + self.add_fixed_in_frame_mobjects(f_text) + self.add(axes) + self.play(Write(f)) + self.wait(2) -- cgit From 622bc30da5bb6691861b8ef27d4b95f4d125cdf4 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 04:58:37 +0530 Subject: Rename FSF-2020/approximations-and-optimizations/The-Second-Derivative-Test/file3_Nondegenerate_Hessian_Matrix.py to FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file3_Nondegenerate_Hessian_Matrix.py --- .../file3_Nondegenerate_Hessian_Matrix.py | 145 +++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file3_Nondegenerate_Hessian_Matrix.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file3_Nondegenerate_Hessian_Matrix.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file3_Nondegenerate_Hessian_Matrix.py new file mode 100644 index 0000000..3056842 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file3_Nondegenerate_Hessian_Matrix.py @@ -0,0 +1,145 @@ +from manimlib.imports import* + +class firstScene(Scene): + def construct(self): + + e_text = TextMobject("Case 3: One positive and one negative eigenvalue", color = YELLOW).scale(1).shift(3*UP+1*LEFT) + f_text = TextMobject("$f(x,y) = x^2-2y^2-2x$").scale(0.8).next_to(e_text).shift(6*LEFT+DOWN) + c_text = TextMobject("Critical Point: $(1,0)$").scale(0.8).next_to(f_text).shift(DOWN+4*LEFT) + d_text = TextMobject("\\begin{equation*} D_2(1,0)= \\begin{vmatrix} 2 \\space & 0\\space \\\\ 0 & -4 \\end{vmatrix} \\end{equation*}",color = GREEN).scale(0.9) + + t_text = TextMobject("$D_2 = -8<0$ (Saddle Point)", color = BLUE).scale(0.9).shift(2*DOWN) + + self.play(ShowCreation(e_text)) + self.wait(1) + self.play(ShowCreation(f_text)) + self.wait(1) + self.play(ShowCreation(c_text)) + self.wait(1) + self.play(ShowCreation(d_text)) + self.wait(1) + self.play(ShowCreation(t_text)) + self.wait(2) + +class SaddlePoint(ThreeDScene): + def construct(self): + axes = ThreeDAxes() + f = ParametricSurface( + lambda u, v: np.array([ + u, + v, + u**2-2*v**2-2*u + ]),v_min=-1,v_max=1,u_min=-1,u_max=1,checkerboard_colors=[RED_C,PURPLE_D,YELLOW_E], + resolution=(20, 20)).scale(1) + + self.set_camera_orientation(phi=35 * DEGREES,theta=80*DEGREES) + self.begin_ambient_camera_rotation(rate=0.4) + + f_text = TextMobject("$f(x,y) = x^2-2y^2-2x$",color = GREEN).shift(2*DOWN+2*RIGHT).scale(0.8) + self.add_fixed_in_frame_mobjects(f_text) + self.add(axes) + self.play(Write(f)) + self.wait(3) + + +class secondScene(Scene): + def construct(self): + + h_text = TextMobject("NonDegenerate Hessian Matrix", color = GREEN).scale(1).shift(UP) + e_text = TextMobject("Case 1: Two positive eigenvalues", color = PINK).scale(1).shift(3*UP+2*LEFT) + f_text = TextMobject("$f(x,y) = 2x^2+3y^2-2yx$",color = TEAL).scale(0.8).next_to(e_text).shift(6*LEFT+DOWN) + c_text = TextMobject("Critical Point: $(0,0)$",color = TEAL).scale(0.8).next_to(f_text).shift(DOWN+4.5*LEFT) + d_text = TextMobject("\\begin{equation*} D_2(0,0)= \\begin{vmatrix} 4 \\space & -2\\space \\\\ -2 & 6 \\end{vmatrix} \\end{equation*}",color = PINK).scale(0.9) + + t_text = TextMobject("$D_2 = 20>0$ (Relative Maxima or Relative Minima)", color = YELLOW).scale(0.9).shift(1*DOWN) + tm_text = TextMobject("$D_1 = \\frac{\\partial^2 f}{\\partial x^2} =4 >0$ (Relative Minima)", color = YELLOW).scale(0.9).shift(2*DOWN) + + + self.play(ShowCreation(h_text)) + self.wait(1) + self.play(FadeOut(h_text)) + self.wait(1) + self.play(ShowCreation(e_text)) + self.wait(1) + self.play(ShowCreation(f_text)) + self.wait(1) + self.play(ShowCreation(c_text)) + self.wait(1) + self.play(ShowCreation(d_text)) + self.wait(1) + self.play(ShowCreation(t_text)) + self.wait(1) + self.play(ShowCreation(tm_text)) + self.wait(2) + self.play(FadeOut(e_text),FadeOut(f_text),FadeOut(c_text),FadeOut(d_text),FadeOut(t_text),FadeOut(tm_text)) + +class Minima(ThreeDScene): + def construct(self): + axes = ThreeDAxes() + f = ParametricSurface( + lambda u, v: np.array([ + u, + v, + 2*u**2+3*v**2-2*v*u + ]),v_min=-1,v_max=1,u_min=-1,u_max=1,checkerboard_colors=[BLUE_C,YELLOW_D,GREEN_E], + resolution=(20, 20)).scale(1) + + self.set_camera_orientation(phi=10 * DEGREES,theta=90*DEGREES) + self.begin_ambient_camera_rotation(rate=0.2) + + f_text = TextMobject("$f(x,y) = 2x^2+3y^2-2yx$",color = PURPLE).shift(2*DOWN+3*RIGHT).scale(0.8) + self.add_fixed_in_frame_mobjects(f_text) + self.add(axes) + self.play(Write(f)) + self.wait(2) + + +class thirdScene(Scene): + def construct(self): + + + e_text = TextMobject("Case 2: Two negative eigenvalues", color = RED).scale(1).shift(3*UP+2*LEFT) + f_text = TextMobject("$f(x,y) = -x^2-4y^2$",color = BLUE).scale(0.8).next_to(e_text).shift(6*LEFT+DOWN) + c_text = TextMobject("Critical Point: $(0,0)$",color = BLUE).scale(0.8).next_to(f_text).shift(DOWN+3.8*LEFT) + d_text = TextMobject("\\begin{equation*} D_2(0,0)= \\begin{vmatrix} -2 \\space & 0\\space \\\\ 0 & -8 \\end{vmatrix} \\end{equation*}",color = TEAL).scale(0.9) + + t_text = TextMobject("$D_2 = 16>0$ (Relative Maxima or Relative Minima)" ).scale(0.9).shift(1*DOWN) + tm_text = TextMobject("$D_1 = \\frac{\\partial^2 f}{\\partial x^2} =-2 <0$ (Relative Maxima)").scale(0.9).shift(2*DOWN) + + + self.play(ShowCreation(e_text)) + self.wait(1) + self.play(ShowCreation(f_text)) + self.wait(1) + self.play(ShowCreation(c_text)) + self.wait(1) + self.play(ShowCreation(d_text)) + self.wait(1) + self.play(ShowCreation(t_text)) + self.wait(1) + self.play(ShowCreation(tm_text)) + self.wait(2) + self.play(FadeOut(e_text),FadeOut(f_text),FadeOut(c_text),FadeOut(d_text),FadeOut(t_text),FadeOut(tm_text)) + + +class Maxima(ThreeDScene): + def construct(self): + axes = ThreeDAxes() + f = ParametricSurface( + lambda u, v: np.array([ + u, + v, + -u**2-4*v**2 + ]),v_min=-1,v_max=1,u_min=-1,u_max=1,checkerboard_colors=[BLUE_C,PURPLE_D,TEAL_E], + resolution=(20, 20)).scale(1) + + self.set_camera_orientation(phi=75 * DEGREES) + self.begin_ambient_camera_rotation(rate=0.4) + + f_text = TextMobject("$f(x,y) = -x^2-4y^2$",color = YELLOW).shift(2*DOWN+3*RIGHT).scale(0.8) + self.add_fixed_in_frame_mobjects(f_text) + self.add(axes) + self.play(Write(f)) + self.wait(1) + self.move_camera(phi=30*DEGREES,theta=45*DEGREES,run_time=5) + self.wait(2) -- cgit From 3bd06348ce843694c7af3883da101bfdb89a09f5 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 04:59:24 +0530 Subject: Rename FSF-2020/approximations-and-optimizations/The-Second-Derivative-Test/file4_Contour_Diagram.py to FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file4_Contour_Diagram.py --- .../file4_Contour_Diagram.py | 120 +++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file4_Contour_Diagram.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file4_Contour_Diagram.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file4_Contour_Diagram.py new file mode 100644 index 0000000..d3084e2 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file4_Contour_Diagram.py @@ -0,0 +1,120 @@ +from manimlib.imports import* + +#---- contour diagram animation +class ContourDiagram(ThreeDScene): + def construct(self): + + heading = TextMobject("CONTOUR DIAGRAM", color = YELLOW).scale(1) + + axes = ThreeDAxes() + label_x = TextMobject("$x$").shift([5.5,-0.5,0]) #---- x axis + label_y = TextMobject("$y$").shift([-0.5,5.5,0]).rotate(-4.5) #---- y axis + + #---- surface of a paraboloid + surface = ParametricSurface( + lambda u, v: np.array([ + np.cos(v)*u, + np.sin(v)*u, + u**2 + ]),v_min = -2, v_max = 2, u_min = -2, u_max = 2, checkerboard_colors = [GREEN_B,GREEN_C,GREEN_D,GREEN_E]).shift([0,0,0]).scale(0.5) + + #---- first contour projection + contour1 = ParametricSurface( + lambda u, v: np.array([ + np.cos(TAU * v), + np.sin(TAU * v), + 2*(1 - 2.5*u) + ])).fade(0.5).scale(0.21).shift([0,0,1.01]) + + #---- first contour line + c_1 = Circle(color = BLUE).scale(0.21).shift([0,0,0]).rotate(0.1,DOWN) + + #------------------------------------------------- + + #---- second contour projection + contour2 = ParametricSurface( + lambda u, v: np.array([ + np.cos(TAU * v), + np.sin(TAU * v), + 2*(1 - 1.6*u) + ])).fade(0.5).scale(0.41).shift([0,0,0.3]).set_color(RED) + + #---- second contour line + c_2 = Circle(color = RED).scale(0.41).shift([0,0,0]).rotate(0.1,DOWN) + + #------------------------------------------------- + + #---- third contour projection + contour3 = ParametricSurface( + lambda u, v: np.array([ + np.cos(TAU * v), + np.sin(TAU * v), + 2*(1 - 1.5*u) + ])).fade(0.5).scale(0.61).shift([0,0,0.4]).set_color(YELLOW) + + #---- third contour line + c_3 = Circle(color = YELLOW).scale(0.61).shift([0,0,0]) + + #------------------------------------------------- + + #---- fourth contour projection + contour4 = ParametricSurface( + lambda u, v: np.array([ + np.cos(TAU * v), + np.sin(TAU * v), + 2*(1 - 1.5*u) + ])).fade(0.7).scale(0.81).shift([0,0,0.7]).set_color(PINK) + + #---- fourth contour line + c_4 = Circle(color = PINK).scale(0.81).shift([0,0,0]) + + #------------------------------------------------- + + #---- fifth contour projection + contour5 = ParametricSurface( + lambda u, v: np.array([ + np.cos(TAU * v), + np.sin(TAU * v), + 2*(1 - 1.5*u) + ])).fade(0.7).scale(1.01).shift([0,0,1]).set_color(PURPLE) + + #---- fifth contour line + c_5 = Circle(color = PURPLE).scale(1.01).shift([0,0,0]) + + c_text= TextMobject("Contour Lines").scale(0.5).shift(2*DOWN) + s = Square().scale(1.3) + + self.set_camera_orientation(phi = 75 * DEGREES, theta = 10 * DEGREES) + self.add_fixed_in_frame_mobjects(heading) + self.wait(1) + self.play(FadeOut(heading)) + self.wait(1) + self.add(axes) + self.add(label_x) + self.add(label_y) + self.play(Write(surface)) + self.wait(1) + self.add(contour1) + self.wait(1) + self.play(Write(c_1)) + self.play(ReplacementTransform(contour1,contour2)) + self.wait(1) + self.play(Write(c_2)) + self.play(ReplacementTransform(contour2,contour3)) + self.wait(1) + self.play(Write(c_3)) + self.play(ReplacementTransform(contour3,contour4)) + self.wait(1) + self.play(Write(c_4)) + self.play(ReplacementTransform(contour4,contour5)) + self.wait(1) + self.play(Write(c_5)) + self.wait(1) + self.play(FadeOut(contour5),FadeOut(axes),FadeOut(label_x),FadeOut(label_y),FadeOut(surface),FadeOut(contour5),FadeOut(contour4),FadeOut(contour3),FadeOut(contour2),FadeOut(contour1)) + self.wait(1) + self.move_camera(phi=0 * DEGREES,theta= 90*DEGREES) + self.wait(1) + self.add_fixed_in_frame_mobjects(c_text) + self.wait(1) + self.play(ShowCreation(s),FadeOut(c_text)) + self.wait(1) -- cgit From f61bef8de2ee952f3dbb73fd148024931426e427 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 05:01:05 +0530 Subject: Rename FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.py to FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.py --- .../file1_Tangent_Plane.py | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.py new file mode 100644 index 0000000..4c17f90 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.py @@ -0,0 +1,50 @@ +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) -- cgit From 38fc15ed3749f7bf9140a45e7c5f210b3d4fc3c5 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 05:01:53 +0530 Subject: Rename FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.py to FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.py --- ...e2_Tangent_plane_approximation_visualization.py | 74 ++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.py new file mode 100644 index 0000000..d1ecf8c --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.py @@ -0,0 +1,74 @@ +from manimlib.imports import* + +#---- tangent plane is parallel to the x-y plane +class MaximaScene(ThreeDScene): + def construct(self): + + axes = ThreeDAxes().scale(1.2) + label_x= TextMobject("$x$").shift([5.4,-0.5,0]) #---- x axis + label_y= TextMobject("$y$").shift([-0.5,5.2,0]).rotate(-4.5) #---- y axis + + #---- graph of the function + s = ParametricSurface( + lambda u, v: np.array([ + 1.5*np.cos(u)*np.cos(v), + 1.5*np.cos(u)*np.sin(v), + 1.5*np.sin(u) + ]),u_min=0,u_max=PI,v_min=PI,v_max=2*PI,checkerboard_colors=[BLUE_B,BLUE_C,BLUE_D,BLUE_E]).scale(1.5).shift([-0.8,0.5,1.5]) + + d1 = Dot([0.2,2.01,2.24],color = '#800000').rotate(1.1,LEFT) #---- point(x_0,y_0) + d1_copy = Dot([1.1,2.2,-0.45],color = '#800000') #---- projection of point(x_0,y_0) on x-y plane + d1_text = TextMobject("$(x_0,y_0)$",color = "#8B0000").scale(0.4).shift(1.3*RIGHT+1.1*UP) + + d2 = Dot([1.1,2.2,2.7],color = '#800000').rotate(1,LEFT) #---- point(x,y) + d2_copy = Dot([0.1,1.95,0.4],color = '#800000') #---- projection of point(x,y) on x-y plane + d2_text = TextMobject("$(x,y)$",color = "#8B0000").scale(0.4).shift(0.6*RIGHT+0.8*UP) + + t_plane = Rectangle(color = PURPLE, fill_opacity=0.3).scale(0.4).rotate(1,LEFT).shift([1.1,2.5,2.9]) #---- tangent plane + + t_text= TextMobject("Tangent Plane",color = RED).scale(0.5).shift(0.3*RIGHT+1.3*UP).rotate(math.radians(5),LEFT) + + l1 = Line([1.1,2.2,2.6],[1.1,2.2,-0.45]).fade(0.2) + l2 = Line([0.1,1.95,2.05],[0.1,1.95,0.4]).fade(0.2) + + a1 = Line([0.1,1.95,0.4],[1.1,2.2,-0.45],color ="#00FF7F") + a_x = Line([0.1,1.95,0.4],[1.7,1.95,0.4],color ="#9400D3") + a_y = Line([0.1,1.95,0.4],[0.1,2.75,0.4],color ="#8B4513") + a2 = Line([1.7,1.95,0.4],[1.7,2.75,0.4]) + a3 = Line([0.1,2.75,0.4],[1.7,2.75,0.4]) + + #---- transition of tangent plane + + t2_plane = Rectangle(color = PURPLE, fill_opacity=0.3).scale(0.4).rotate(1,LEFT).shift([1.1,2.5,2]) + t3_plane = Rectangle(color = PURPLE, fill_opacity=0.3).scale(0.4).rotate(math.radians(180),LEFT).shift([1.1,2.5,2]) + t4_plane = Rectangle(color = PURPLE, fill_opacity=0.3).scale(0.4).rotate(math.radians(180),LEFT).shift([0.9,2.35,0.4]) + + #------------------------------------------- + self.set_camera_orientation(phi = 50 * DEGREES, theta = 45 * DEGREES) + self.wait(1) + self.add(axes) + self.add(label_x) + self.add(label_y) + self.play(Write(s)) + self.wait(1) + self.play(Write(d1)) + self.add_fixed_in_frame_mobjects(d1_text) + self.play(ShowCreation(t_plane)) + self.add_fixed_in_frame_mobjects(t_text) + self.wait(1) + self.play(FadeOut(t_text),Write(d2)) + self.add_fixed_in_frame_mobjects(d2_text) + self.wait(1) + self.play(Write(l1),Write(l2)) + self.play(Write(d2_copy),Write(d1_copy)) + self.wait(1) + self.play(Write(a1),Write(a_x),Write(a_y)) + self.wait(1) + self.play(Write(a2),Write(a3)) + self.wait(1) + self.play(ReplacementTransform(t_plane,t2_plane)) + self.wait(1) + self.play(ReplacementTransform(t2_plane,t3_plane)) + self.wait(1) + self.play(ReplacementTransform(t3_plane,t4_plane)) + self.wait(1) -- cgit From 1cd25dcc113d8834a50ca29fbc16b8fe97529056 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 05:02:47 +0530 Subject: Rename FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file3_non_differentiable_function.py to FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_non_differentiable_function.py --- .../file3_non_differentiable_function.py | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_non_differentiable_function.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_non_differentiable_function.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_non_differentiable_function.py new file mode 100644 index 0000000..13bd73e --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_non_differentiable_function.py @@ -0,0 +1,30 @@ +from manimlib.imports import* +import math + +#---- tangent plane does not exists for f(x,y): sqrt(x**2+y**2) at origin + +class TangenttoSurface(ThreeDScene): + def construct(self): + axes = ThreeDAxes() + + #----f(x,y): sqrt(x**2+y**2) + p = ParametricSurface( + lambda u, v: np.array([ + u, + v, + math.sqrt(u**2+v**2) + ]),v_min = -1,v_max = 1, u_min = -1, u_max = 1, checkerboard_colors = [RED_C,TEAL_D], + resolution = (20, 20)).scale(1) + + self.set_camera_orientation(phi = 75 * DEGREES) + + d = Dot([0,0,0],color = '#800000') #----critical point + d_text = TextMobject("$(0,0)$").scale(0.5).shift(0.2*DOWN) + f_text = TextMobject("$f$ is not differentiable at origin").scale(0.5).to_corner(UL) + + self.begin_ambient_camera_rotation(rate=0.1) + self.add(axes) + self.play(Write(p),Write(d)) + self.add_fixed_in_frame_mobjects(d_text) + self.add_fixed_in_frame_mobjects(f_text) + self.wait(2) -- cgit From a8a11ea17285b594f0017a6e7f86a43679312730 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 05:03:34 +0530 Subject: Rename FSF-2020/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent plane_at_critical_points.py to FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent plane_at_critical_points.py --- .../file4_Tangent plane_at_critical_points.py | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent plane_at_critical_points.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent plane_at_critical_points.py b/FSF-2020/calculus-of-several-variables/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/calculus-of-several-variables/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) -- cgit From 6cb42c9f196cdc4c29671a4d5dbccaf1ebcc780e Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 05:10:35 +0530 Subject: Add files via upload --- .../file1_Critical_Point_of_a_function.gif | Bin 0 -> 8077401 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file1_Critical_Point_of_a_function.gif (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file1_Critical_Point_of_a_function.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file1_Critical_Point_of_a_function.gif new file mode 100644 index 0000000..ca3989c Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file1_Critical_Point_of_a_function.gif differ -- cgit From dea86496011a0c1e907f04a0c998f67a120a95b6 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 05:11:15 +0530 Subject: Add files via upload --- .../Critical-Points/file2_Traces_and_Tangent.gif | Bin 0 -> 2552938 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file2_Traces_and_Tangent.gif (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file2_Traces_and_Tangent.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file2_Traces_and_Tangent.gif new file mode 100644 index 0000000..84acf2e Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file2_Traces_and_Tangent.gif differ -- cgit From b902d20de6d51e29dddaaf8b7f2623f22ac2ef05 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 05:12:08 +0530 Subject: Add files via upload --- .../file3_Tangent_plane_at_extrema_of_a_function.gif | Bin 0 -> 2198637 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.gif (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.gif new file mode 100644 index 0000000..14fb318 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.gif differ -- cgit From 0ce6295d88d64bca989c79d6f92e2c12f8c02bc3 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 05:12:50 +0530 Subject: Add files via upload --- .../file4_Types_of_critical_points.gif | Bin 0 -> 3864765 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file4_Types_of_critical_points.gif (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file4_Types_of_critical_points.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file4_Types_of_critical_points.gif new file mode 100644 index 0000000..91e7084 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file4_Types_of_critical_points.gif differ -- cgit From 23d5769f486b79619bbef9da101fd08e299d59fe Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 05:13:41 +0530 Subject: Add files via upload --- .../Critical-Points/file5_f(x,y)=(y-x)(1-2x-3y).gif | Bin 0 -> 1522415 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file5_f(x,y)=(y-x)(1-2x-3y).gif (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file5_f(x,y)=(y-x)(1-2x-3y).gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file5_f(x,y)=(y-x)(1-2x-3y).gif new file mode 100644 index 0000000..4bc92f8 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file5_f(x,y)=(y-x)(1-2x-3y).gif differ -- cgit From f2e7374ca9dcb5803490067da9cd937de2acc838 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 05:15:06 +0530 Subject: Update README.md --- .../approximations-and-optimizations/Critical-Points/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/README.md b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/README.md index f0747bb..5bd9cc5 100644 --- a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/README.md +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/README.md @@ -3,30 +3,30 @@ file1_Critical_Point_of_a_function -![file1_Critical_Point_of_a_function](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/approximations-and-optimizations/Critical-Points/file1_Critical_Point_of_a_function.gif?raw=true) +![file1_Critical_Point_of_a_function](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file1_Critical_Point_of_a_function.gif?raw=true)



file2_Traces_and_Tangent -![file2_Traces_and_Tangent](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/approximations-and-optimizations/Critical-Points/file2_Traces_and_Tangent.gif?raw=true) +![file2_Traces_and_Tangent](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file2_Traces_and_Tangent.gif?raw=true)



file3_Tangent_plane_at_extrema_of_a_function -![file3_Tangent_plane_at_extrema_of_a_function](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.gif?raw=true) +![file3_Tangent_plane_at_extrema_of_a_function](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file3_Tangent_plane_at_extrema_of_a_function.gif?raw=true)



file4_Types_of_critical_points -![file4_Types_of_critical_points](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/approximations-and-optimizations/Critical-Points/file4_Types_of_critical_points.gif?raw=true) +![file4_Types_of_critical_points](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file4_Types_of_critical_points.gif?raw=true)



file5_f(x,y)=(y-x)(1-2x-3y) -![file5_f(x,y)=(y-x)(1-2x-3y)](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/approximations-and-optimizations/Critical-Points/file5_f(x%2Cy)%3D(y-x)(1-2x-3y).gif?raw=true) +![file5_f(x,y)=(y-x)(1-2x-3y)](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical-Points/file5_f(x%2Cy)%3D(y-x)(1-2x-3y).gif?raw=true)



-- cgit From 122266d4f63a332fae6874f0ee4f374d63fe74a0 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 05:16:38 +0530 Subject: Add files via upload --- .../file1_Tangent_Plane.gif | Bin 0 -> 827096 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.gif (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.gif new file mode 100644 index 0000000..2b8bf5f Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.gif differ -- cgit From 4bf7207eae112e03423d463b8f2ae179ef64fdf7 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 05:17:53 +0530 Subject: Add files via upload --- ...file2_Tangent_plane_approximation_visualization.gif | Bin 0 -> 946542 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.gif (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.gif new file mode 100644 index 0000000..d23405d Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.gif differ -- cgit From dc445ffca6bb7d90bb067ef43af3b69933e05210 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 05:21:15 +0530 Subject: Update and rename file3_non_differentiable_function.py to file3_Non_Differentiable_Function.py --- .../file3_Non_Differentiable_Function.py | 47 ++++++++++++++++++++++ .../file3_non_differentiable_function.py | 30 -------------- 2 files changed, 47 insertions(+), 30 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_Non_Differentiable_Function.py delete mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_non_differentiable_function.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_Non_Differentiable_Function.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_Non_Differentiable_Function.py new file mode 100644 index 0000000..79d0948 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_Non_Differentiable_Function.py @@ -0,0 +1,47 @@ +from manimlib.imports import* +import math + +#---- tangent plane does not exists for f(x,y): sqrt(x**2+y**2) at origin + +class TangenttoSurface(ThreeDScene): + def construct(self): + axes = ThreeDAxes().rotate(2.3) + axes2 = ThreeDAxes().scale(2).rotate(2.3).shift([0,0,1.3]) + + #----f(x,y): sqrt(x**2+y**2) + p = ParametricSurface( + lambda u, v: np.array([ + u, + v, + -math.sqrt(u**2+v**2) + ]),v_min = -1,v_max = 1, u_min = -1, u_max = 1, checkerboard_colors = [RED_C,TEAL_D], + resolution = (20, 20)).scale(1) + + #----size increased of f(x,y): sqrt(x**2+y**2) + p2 = ParametricSurface( + lambda u, v: np.array([ + u, + v, + -math.sqrt(u**2+v**2) + ]),v_min = -1,v_max = 1, u_min = -1, u_max = 1, checkerboard_colors = [RED_C,TEAL_D], + resolution = (20, 20)).scale(3).shift([0,0,0]) + + self.set_camera_orientation(phi = 75 * DEGREES,theta = 40*DEGREES) + + d = Dot([0,0,0],color = '#800000') #---- critical point + d2 = Dot([0,0,1.5],color = '#800000').scale(2) #---- size increased of critical point + + f_text = TextMobject("$f$ is not differentiable at origin,because the surface").scale(0.5).to_corner(UL) + f2_text = TextMobject("is not flat when zoomed in at the origin.").scale(0.5).to_corner(UL).shift(0.5*DOWN) + + self.add(axes) + self.wait(1) + self.play(Write(p),Write(d)) + self.wait(1) + self.move_camera(phi = 50 * DEGREES,theta = 40*DEGREES) + self.wait(1) + self.play(ReplacementTransform(axes,axes2),ReplacementTransform(p,p2),ReplacementTransform(d,d2)) + self.wait(1) + self.add_fixed_in_frame_mobjects(f_text) + self.add_fixed_in_frame_mobjects(f2_text) + self.wait(2) diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_non_differentiable_function.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_non_differentiable_function.py deleted file mode 100644 index 13bd73e..0000000 --- a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_non_differentiable_function.py +++ /dev/null @@ -1,30 +0,0 @@ -from manimlib.imports import* -import math - -#---- tangent plane does not exists for f(x,y): sqrt(x**2+y**2) at origin - -class TangenttoSurface(ThreeDScene): - def construct(self): - axes = ThreeDAxes() - - #----f(x,y): sqrt(x**2+y**2) - p = ParametricSurface( - lambda u, v: np.array([ - u, - v, - math.sqrt(u**2+v**2) - ]),v_min = -1,v_max = 1, u_min = -1, u_max = 1, checkerboard_colors = [RED_C,TEAL_D], - resolution = (20, 20)).scale(1) - - self.set_camera_orientation(phi = 75 * DEGREES) - - d = Dot([0,0,0],color = '#800000') #----critical point - d_text = TextMobject("$(0,0)$").scale(0.5).shift(0.2*DOWN) - f_text = TextMobject("$f$ is not differentiable at origin").scale(0.5).to_corner(UL) - - self.begin_ambient_camera_rotation(rate=0.1) - self.add(axes) - self.play(Write(p),Write(d)) - self.add_fixed_in_frame_mobjects(d_text) - self.add_fixed_in_frame_mobjects(f_text) - self.wait(2) -- cgit From 56c7beddac5a11140e75713d8ea6227180f5b6b5 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 05:22:00 +0530 Subject: Add files via upload --- .../file3_Non_Differentiable_Function.gif | Bin 0 -> 708466 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_Non_Differentiable_Function.gif (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_Non_Differentiable_Function.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_Non_Differentiable_Function.gif new file mode 100644 index 0000000..7581a33 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_Non_Differentiable_Function.gif differ -- cgit From 6ee18b418db6a504346f247df3acb15fdc40fb71 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 05:23:45 +0530 Subject: Rename file4_Tangent plane_at_critical_points.py to file4_Tangent_plane_at_extrema_and_saddle_point.py --- .../file4_Tangent plane_at_critical_points.py | 62 ---------------------- ...e4_Tangent_plane_at_extrema_and_saddle_point.py | 62 ++++++++++++++++++++++ 2 files changed, 62 insertions(+), 62 deletions(-) delete mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent plane_at_critical_points.py create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent_plane_at_extrema_and_saddle_point.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent plane_at_critical_points.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent plane_at_critical_points.py deleted file mode 100644 index d129213..0000000 --- a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent plane_at_critical_points.py +++ /dev/null @@ -1,62 +0,0 @@ -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) diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent_plane_at_extrema_and_saddle_point.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent_plane_at_extrema_and_saddle_point.py new file mode 100644 index 0000000..d129213 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent_plane_at_extrema_and_saddle_point.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) -- cgit From 7ac13a747b847c10aefab6a3d440e8b21ae3d98a Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 06:57:29 +0530 Subject: Add files via upload --- .../file1_Second_order_partial_derivatives.gif | Bin 0 -> 3166332 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file1_Second_order_partial_derivatives.gif (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file1_Second_order_partial_derivatives.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file1_Second_order_partial_derivatives.gif new file mode 100644 index 0000000..3471e4d Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file1_Second_order_partial_derivatives.gif differ -- cgit From 0d176c3c509a0438b0a11c6e50c71cbc9b146007 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 06:58:33 +0530 Subject: Add files via upload --- .../file4_Contour_Diagram.gif | Bin 0 -> 1150777 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file4_Contour_Diagram.gif (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file4_Contour_Diagram.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file4_Contour_Diagram.gif new file mode 100644 index 0000000..129fedc Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file4_Contour_Diagram.gif differ -- cgit From 336667599163bc51997ba45ff4bf7f793bb60573 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 07:02:18 +0530 Subject: Add files via upload --- ...ile4_Tangent plane_at_extrema_and_saddle_point.gif | Bin 0 -> 2513197 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent plane_at_extrema_and_saddle_point.gif (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent plane_at_extrema_and_saddle_point.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent plane_at_extrema_and_saddle_point.gif new file mode 100644 index 0000000..cfe054b Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent plane_at_extrema_and_saddle_point.gif differ -- cgit From 697d32d369da41e60dfe9a00a25b72192357a251 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 07:07:33 +0530 Subject: Add files via upload --- .../file2_Degenerate_Hessian_Matrix.gif | Bin 0 -> 3202838 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file2_Degenerate_Hessian_Matrix.gif (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file2_Degenerate_Hessian_Matrix.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file2_Degenerate_Hessian_Matrix.gif new file mode 100644 index 0000000..d49cdd5 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file2_Degenerate_Hessian_Matrix.gif differ -- cgit From 6c53bdbff8ed1cd0541c9ce4a1de9ecda09c1bb0 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 07:16:10 +0530 Subject: Create file1_Visualization_of_dz.py --- .../file1_Visualization_of_dz.py | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file1_Visualization_of_dz.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file1_Visualization_of_dz.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file1_Visualization_of_dz.py new file mode 100644 index 0000000..a097a96 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file1_Visualization_of_dz.py @@ -0,0 +1,53 @@ +from manimlib.imports import* + + +class firstScene(ThreeDScene): + + def construct(self): + + axes = ThreeDAxes().rotate(1.571) + surface = ParametricSurface( + lambda u, v: np.array([ + u, + v, + u**2+v**2 + ]),u_min=-1,u_max=1, v_min=-1,v_max=1).set_color("#FF69B4").fade(0.6).scale(2).shift(3*UP+1*LEFT) + + d = Dot([1.4,1.75,1],color = '#00FFFF').rotate(1.571,UP) + d2 = Dot([2,2,1],color = '#00FFFF').rotate(1.571,UP) + + p1 = TextMobject("$P_1$",color ='#ADFF2F').scale(0.6).shift(2*RIGHT+1*UP) + p2 = TextMobject("$P_2$",color = '#ADFF2F').scale(0.6).shift(2.6*RIGHT+0.9*UP) + + l = DashedLine(color = '#800000').rotate(1.571,UP).scale(1).shift(1.7*UP+1.6*RIGHT) + l2 = DashedLine(color = '#800000').rotate(1.571,UP).scale(0.8).shift(2.26*UP+1.2*RIGHT) + + l_text = TextMobject("$(x_1,y_1)$",color = '#ADFF2F').scale(0.6).shift(2*RIGHT+1.6*DOWN) + l2_text = TextMobject("$(x_2,y_2)$",color = '#ADFF2F').scale(0.6).shift(2.7*RIGHT+1.2*DOWN) + + a = Arrow(color = '#FFFACD').scale(0.7).rotate(1.38,RIGHT).shift(2.5*LEFT+3.1*UP) + + a_text = TextMobject("$dz$",color='#800000').scale(0.5).shift(2.3*RIGHT+0.5*UP) + + plane = Rectangle(color = '#E6E6FA',fill_opacity = 1).scale(3).shift(1*RIGHT+3*UP).fade(0.9) + + label = TextMobject("$z = f(x,y)$").scale(0.6).shift(3.5*RIGHT+1.8*UP) + + self.add(axes) + self.set_camera_orientation(phi=75*DEGREES,theta=-10*DEGREES) + self.wait(1) + self.play(Write(plane)) + self.play(Write(surface)) + self.add_fixed_in_frame_mobjects(label) + self.wait(1) + self.play(ShowCreation(l),ShowCreation(l2),Write(d),Write(d2)) + self.wait(1) + self.add_fixed_in_frame_mobjects(p1) + self.add_fixed_in_frame_mobjects(p2) + self.wait(1) + self.add_fixed_in_frame_mobjects(l_text) + self.add_fixed_in_frame_mobjects(l2_text) + self.play(ShowCreation(a)) + self.wait(1) + self.add_fixed_in_frame_mobjects(a_text) + self.wait(2) -- cgit From 375032b863947e3eb39c805ce1e79d12fad98141 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 07:16:33 +0530 Subject: Add files via upload --- .../file3_Nondegenerate_Hessian_Matrix.gif | Bin 0 -> 8724439 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file3_Nondegenerate_Hessian_Matrix.gif (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file3_Nondegenerate_Hessian_Matrix.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file3_Nondegenerate_Hessian_Matrix.gif new file mode 100644 index 0000000..2b0acb3 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file3_Nondegenerate_Hessian_Matrix.gif differ -- cgit From 2c72a6e97be61b9f6f8230951b90918ef654c695 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 07:18:42 +0530 Subject: Create file2_Differentials.py --- .../Total-Differential/file2_Differentials.py | 72 ++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file2_Differentials.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file2_Differentials.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file2_Differentials.py new file mode 100644 index 0000000..b40be70 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file2_Differentials.py @@ -0,0 +1,72 @@ +from manimlib.imports import* + + +class firstScene(ThreeDScene): + + def construct(self): + + axes = ThreeDAxes() + + s = Rectangle(color = '#00FF7F',fill_opacity=0.3).shift(2.3*UP+3.9*LEFT).scale(1).rotate(0.2,UP) #----surface z = f(x,y) + + label_y = TextMobject("$y$").shift(5*RIGHT+0.4*DOWN).rotate(1.571) + label_x = TextMobject("$x$").shift(-0.1*UP+5.6*RIGHT).scale(0.5) + + plane = Rectangle(color = '#E6E6FA',fill_opacity = 1).scale(3).shift(-1*RIGHT+3*UP).fade(0.9) + + d = Dot([1,2,1],color = '#9400D3').rotate(1.571,UP) + d2 = Dot([2,2.9,1],color = '#9400D3').rotate(1.571,UP) + + p1 = TextMobject("$P_1$",color ='#ADFF2F').scale(0.6).shift(2*RIGHT+1*UP) + p2 = TextMobject("$P_2$",color = '#ADFF2F').scale(0.6).shift(2.6*RIGHT+0.4*UP) + + + l1 = DashedLine(color = '#00BFFF').scale(1.6).shift(3.5*UP+3.25*LEFT).rotate(1.571) + l2 = DashedLine(color = '#00BFFF').scale(1).shift(4*UP+2*LEFT).rotate(1.571) + + label_dz= TextMobject("$dz$").scale(0.4).shift(5.3*RIGHT+0.4*UP) + + + l3 = Line(color = '#FFDAB9').scale(0.8).shift(1.95*UP+0.7*RIGHT).rotate(1.571,DOWN).fade(0.7) + l4 = Line(color = '#FFDAB9').scale(0.6).shift(2.86*UP+0.9*RIGHT).rotate(1.571,DOWN).fade(0.7) + + line_y1 = DashedLine(color = '#00BFFF').scale(1.3).shift(0.82*UP+3.25*RIGHT).rotate(1.571) + line_y2 = DashedLine(color = '#00BFFF').scale(1.7).shift(1.2*UP+2.8*RIGHT).rotate(1.571) + + label_dy= TextMobject("$dy$").scale(0.6).shift(3*RIGHT+0.8*DOWN).rotate(math.radians(90)) + + line_x1 = DashedLine(color = '#00BFFF').scale(1.5).shift(2.2*UP+1.6*RIGHT).rotate(1.571,RIGHT) + line_x2 = DashedLine(color = '#00BFFF').scale(1.2).shift(2.9*UP+1.6*RIGHT).rotate(1.571,RIGHT) + + label_dx= TextMobject("$dx$").scale(0.4).shift(-0.4*UP+2.5*RIGHT) + + label = TextMobject("$f(x,y)$").scale(0.6).shift(4*RIGHT+3*UP) + + + self.add(axes) + self.set_camera_orientation(phi=75*DEGREES,theta=10*DEGREES) + self.play(Write(plane)) + self.play(ShowCreation(label_y)) + self.add_fixed_in_frame_mobjects(label_x) + self.play(Write(s)) + self.add_fixed_in_frame_mobjects(label) + self.wait(1) + self.play(Write(d),Write(d2)) + self.add_fixed_in_frame_mobjects(p1) + self.add_fixed_in_frame_mobjects(p2) + self.wait(1) + self.play(Write(l1)) + self.play(Write(l2)) + self.add_fixed_in_frame_mobjects(label_dz) + self.wait(1) + self.play(Write(l3)) + self.play(Write(l4)) + self.wait(1) + self.play(Write(line_y1)) + self.play(Write(line_y2)) + self.play(ShowCreation(label_dy)) + self.wait(1) + self.play(Write(line_x1)) + self.play(Write(line_x2)) + self.add_fixed_in_frame_mobjects(label_dx) + self.wait(1) -- cgit From 382ba54a0a80bc2e60187f94b225e2d9deef5cb9 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 07:20:16 +0530 Subject: Create file3_Total_differential_of_z.py --- .../file3_Total_differential_of_z.py | 91 ++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file3_Total_differential_of_z.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file3_Total_differential_of_z.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file3_Total_differential_of_z.py new file mode 100644 index 0000000..b29a7a3 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file3_Total_differential_of_z.py @@ -0,0 +1,91 @@ +from manimlib.imports import* + +class firstScene(ThreeDScene): + def construct(self): + axes = ThreeDAxes().fade(0.5) + plane = Rectangle(color = '#E6E6FA',fill_opacity = 1).scale(3).shift(-1*RIGHT+3*UP).fade(0.9) + label_x = TextMobject("$x$").shift(5*RIGHT+0.4*DOWN).rotate(1.571) + label_y = TextMobject("$y$").shift(0.3*DOWN+5.6*RIGHT).scale(0.5) + label_z = TextMobject("$z$").shift(3.5*UP+0.2*LEFT).scale(0.5) + + s1 = Square(color = '#00FF00',fill_opacity=0.4).shift([1,1,0]) + s2 = Square(color = '#00FF00',fill_opacity=0.4).shift([1,1,3]).scale(0.95) + + l1 = Line([2,0,3],[2,0,0],color = '#FFFACD') + l2 = Line([0,2,3],[0,2,0],color = '#FFFACD') + l3 = Line([2,1.95,3],[2,2,0],color = '#FFFACD') + + d1 = Dot([2,0,1.5],color = '#FFD700').rotate(1.571,UP) + d1_text = TextMobject("$P1$").scale(0.4).shift(1.2*LEFT+1.1*UP) + + d2 = Dot([0,2,3],color = '#FFD700').rotate(1.571,UP) + d2_text = TextMobject("$P2$").scale(0.4).shift(2.3*RIGHT+3.1*UP) + + d3 = Dot([2,2,2],color = '#FFD700').rotate(1.571,UP) + d3_text = TextMobject("$Q$").scale(0.4).shift([1.6,-1,0]+2.5*UP) + + s3 = Square().shift([1,1,1.5]).scale(0.95) + s4 = Square().shift([1,1,2]).scale(0.95) + + m1_line = DashedLine([2,0,1.5],[2,2,2],color = '#87CEEB') + m2_line = DashedLine([2,2,2],[0,2,3],color = '#87CEEB') + + dx_line = Line([2,2,0],[4,2,0],color = '#00FF7F') + dy_line = Line([2,2,0],[2,4,0],color = '#00FF7F') + + dx = DashedLine([3.5,0,0],[3.5,2,0],color = '#87CEEB') + dy = DashedLine([0,3.5,0],[2,3.5,0],color = '#87CEEB') + + dx_text = TextMobject("$dx$").scale(0.8).shift([4,1,0]).rotate(1.571) + dy_text = TextMobject("$dy$").scale(0.8).shift([1,3.8,0]).rotate(math.radians(180)) + + parx_line = Line([0,2,1.5],[0,5,1.5],color = '#00FF7F') + parm_line = Line([0,2,2],[0,5,2],color = '#00FF7F') + pary_line = Line([0,2.1,3],[0,5,3],color = '#00FF7F') + + delx = DashedLine([0,4,2],[0,4,1.5],color = '#F0F8FF') + dely = DashedLine([0,4,3],[0,4,2],color = '#FAEBD7') + + dely_text = TextMobject("$\\frac{\\partial z}{\\partial y}dy$").shift(4.6*RIGHT+2.3*UP).scale(0.4) + delx_text = TextMobject("$\\frac{\\partial z}{\\partial x}dx$").shift(4.6*RIGHT+1.4*UP).scale(0.4) + + + self.set_camera_orientation(phi=75*DEGREES,theta=20*DEGREES) + self.add(axes) + self.play(Write(plane)) + self.play(ShowCreation(label_x)) + self.add_fixed_in_frame_mobjects(label_y) + self.add_fixed_in_frame_mobjects(label_z) + self.wait(1) + self.play(Write(s2)) + self.wait(1) + self.play(Write(l1),Write(l2),Write(l3)) + self.wait(1) + self.play(Write(s1)) + self.wait(1) + self.play(ShowCreation(d1)) + self.add_fixed_in_frame_mobjects(d1_text) + self.play(ShowCreation(d2)) + self.add_fixed_in_frame_mobjects(d2_text) + self.wait(1) + self.play(ShowCreation(d3)) + self.add_fixed_in_frame_mobjects(d3_text) + self.play(ShowCreation(m1_line)) + self.play(ShowCreation(m2_line)) + self.wait(1) + self.play(ShowCreation(dx_line),ShowCreation(dx),ShowCreation(dx_text)) + self.wait(1) + self.play(ShowCreation(dy_line),ShowCreation(dy),ShowCreation(dy_text)) + self.wait(2) + self.play(Write(s3)) + self.play(Write(s4)) + self.wait(1) + self.play(ShowCreation(parx_line),ShowCreation(parm_line),ShowCreation(pary_line)) + self.wait(1) + self.play(ShowCreation(dely)) + self.add_fixed_in_frame_mobjects(dely_text) + self.wait(1) + self.play(ShowCreation(delx)) + self.add_fixed_in_frame_mobjects(delx_text) + self.wait(1) + -- cgit From a423cd75c192f771764e95da3ec562dd06bb1779 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 07:22:16 +0530 Subject: Create file4_total_differential_change.py --- .../file4_total_differential_change.py | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file4_total_differential_change.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file4_total_differential_change.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file4_total_differential_change.py new file mode 100644 index 0000000..78e41a2 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file4_total_differential_change.py @@ -0,0 +1,54 @@ +from manimlib.imports import* + + +class firstScene(ThreeDScene): + + def construct(self): + + axes = ThreeDAxes() + + s = Rectangle(color = '#F08080',fill_opacity=1).fade(0.7).shift(1.9*UP+5*LEFT).scale(0.9)#----surface z = f(x,y) + + s2= Rectangle(color = '#F08080',fill_opacity=1).fade(0.7).shift(2.4*UP+3.1*RIGHT).scale(0.6) #----reflection of the surface on the x-y plane + + l1 = DashedLine(color = '#AFEEEE').rotate(1.571,UP).scale(1).shift(1.53*UP+1.5*RIGHT) + l2 = DashedLine(color = '#AFEEEE').rotate(1.571,UP).scale(1).shift(2.9*UP+1.4*RIGHT) + l3 = DashedLine(color = '#AFEEEE').rotate(1.571,UP).scale(1).shift(1.5*UP-1.6*RIGHT) + l4 = DashedLine(color = '#AFEEEE').rotate(1.571,UP).scale(1).shift(2.9*UP-1.75*RIGHT) + + + l1_text = TextMobject("$(x+\\triangle x,y)$").shift(RIGHT+1.7*DOWN).scale(0.4) + l2_text = TextMobject("$(x+\\triangle x,y+\\triangle y)$").shift(3*RIGHT+1.8*DOWN).scale(0.4) + l3_text = TextMobject("$f(x,y)$").shift(1.6*RIGHT+1.5*UP).scale(0.4) + l4_text = TextMobject("$(x,y+\\triangle y)$").shift(3.5*RIGHT+0.7*DOWN).scale(0.4) + + label_x = TextMobject("$x$").shift(5*RIGHT+0.4*DOWN) + label_y = TextMobject("$y$").shift(5*UP-0.6*RIGHT) + + self.add(axes) + self.set_camera_orientation(phi=75*DEGREES,theta=10*DEGREES) + self.wait(1) + self.play(ShowCreation(label_x),ShowCreation(label_y)) + self.play(Write(s)) + self.wait(1) + self.add_fixed_in_frame_mobjects(l3_text) + self.wait(1) + self.play(Write(l3)) + self.wait(1) + self.play(Write(l1)) + self.add_fixed_in_frame_mobjects(l1_text) + self.wait(1) + self.play(Write(l2)) + self.add_fixed_in_frame_mobjects(l2_text) + self.wait(1) + self.play(Write(l4)) + self.add_fixed_in_frame_mobjects(l4_text) + self.wait(1) + self.play(Write(s2)) + self.wait(1) + + + + + + -- cgit From 2100c05f63318542f26cbbe7fb3786635504be32 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 07:24:17 +0530 Subject: Create file5_Total_differential_approximation.py --- .../file5_Total_differential_approximation.py | 48 ++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file5_Total_differential_approximation.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file5_Total_differential_approximation.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file5_Total_differential_approximation.py new file mode 100644 index 0000000..83017ed --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file5_Total_differential_approximation.py @@ -0,0 +1,48 @@ +from manimlib.imports import* + + +class firstScene(ThreeDScene): + + def construct(self): + + axes = ThreeDAxes().rotate(1.571) + surface = ParametricSurface( + lambda u, v: np.array([ + np.sin(u), + v, + -u**2-v + ]),u_min=-1,u_max=1, v_min=-1,v_max=1).set_color("#00008B").scale(2).shift(3.8*UP+2*LEFT) + + d = Dot([1.4,1.75,1],color = '#00FFFF').rotate(1.571,UP) + d2 = Dot([2,2,1],color = '#00FFFF').rotate(1.571,UP) + + l = DashedLine(color = '#800000').rotate(1.571,UP).scale(1).shift(1.7*UP+1.6*RIGHT) + l2 = DashedLine(color = '#800000').rotate(1.571,UP).scale(0.8).shift(2.26*UP+1.2*RIGHT) + + l_text = TextMobject("$(x_1,y_1)$",color = '#ADFF2F').scale(0.6).shift(2*RIGHT+1.6*DOWN) + l2_text = TextMobject("$(x_2,y_2)$",color = '#ADFF2F').scale(0.6).shift(2.7*RIGHT+1.2*DOWN) + + plane = Rectangle(color = '#E6E6FA',fill_opacity = 1).scale(3).shift(1*RIGHT+3*UP).fade(0.9) + + tangentplane = Rectangle(color = '#E6E6FA',fill_opacity = 1).scale(1.1).shift(2*LEFT+3.4*UP).fade(0.5).rotate(0.8,RIGHT) + tangentplane_text = TextMobject("Tangent Plane").scale(0.4).shift(3*RIGHT+1*UP) + + label = TextMobject("$z = f(x,y)$").scale(0.6).shift(4*RIGHT+3*UP) + + + self.add(axes) + self.set_camera_orientation(phi=75*DEGREES,theta=-10*DEGREES) + self.wait(1) + self.play(Write(plane)) + self.wait(1) + self.play(Write(surface)) + self.add_fixed_in_frame_mobjects(label) + self.wait(1.5) + self.play(ShowCreation(l),ShowCreation(l2),Write(d),Write(d2)) + self.wait(1) + self.add_fixed_in_frame_mobjects(l_text) + self.add_fixed_in_frame_mobjects(l2_text) + self.wait(1) + self.play(Write(tangentplane)) + self.add_fixed_in_frame_mobjects(tangentplane_text) + self.wait(2) -- cgit From d48776b46313ba46965c7414600536b48e846a6d Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 07:27:33 +0530 Subject: Add files via upload --- .../Total-Differential/file1_Visualization_of_dz.gif | Bin 0 -> 558983 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file1_Visualization_of_dz.gif (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file1_Visualization_of_dz.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file1_Visualization_of_dz.gif new file mode 100644 index 0000000..e00a946 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file1_Visualization_of_dz.gif differ -- cgit From 2a0e8cc2544adf192218b58b153d7569a34e7a5b Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 07:29:52 +0530 Subject: Add files via upload --- .../Total-Differential/file2_Differentials.gif | Bin 0 -> 576535 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file2_Differentials.gif (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file2_Differentials.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file2_Differentials.gif new file mode 100644 index 0000000..620b49e Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file2_Differentials.gif differ -- cgit From afda4b2757055fcba6c036f44dd4dae08b9e8370 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 07:31:46 +0530 Subject: Add files via upload --- .../file3_Total_differential_of_z.gif | Bin 0 -> 732678 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file3_Total_differential_of_z.gif (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file3_Total_differential_of_z.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file3_Total_differential_of_z.gif new file mode 100644 index 0000000..5aae2a1 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file3_Total_differential_of_z.gif differ -- cgit From c9ab65f4fcda26f2be6dd60628e072f544e894c6 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 07:33:18 +0530 Subject: Add files via upload --- .../file4_total_differential_change.gif | Bin 0 -> 300675 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file4_total_differential_change.gif (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file4_total_differential_change.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file4_total_differential_change.gif new file mode 100644 index 0000000..f2227a8 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file4_total_differential_change.gif differ -- cgit From 988fbb80727496b4839dfe5c7036bff1d848eff2 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 07:34:42 +0530 Subject: Add files via upload --- .../file5_Total_differential_approximation.gif | Bin 0 -> 423652 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file5_Total_differential_approximation.gif (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file5_Total_differential_approximation.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file5_Total_differential_approximation.gif new file mode 100644 index 0000000..4f4627d Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file5_Total_differential_approximation.gif differ -- cgit From 2c882380322e86d894bb1c36e7aac00839f205ae Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 08:15:49 +0530 Subject: Create file1_Extrema_over_g(x,y)=k.py --- .../file1_Extrema_over_g(x,y)=k.py | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file1_Extrema_over_g(x,y)=k.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file1_Extrema_over_g(x,y)=k.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file1_Extrema_over_g(x,y)=k.py new file mode 100644 index 0000000..17f31ac --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file1_Extrema_over_g(x,y)=k.py @@ -0,0 +1,53 @@ +from manimlib.imports import* + +class firstScene(ThreeDScene): + def construct(self): + axes = ThreeDAxes() + surface = ParametricSurface( + lambda u, v: np.array([ + u, + v, + u**2+v**2+u**3-v**3 + ]),u_min=-0.5,u_max=0.5, v_min=-0.5,v_max=0.5).scale(5).shift([0,1,2.5]).set_color('#F0FFFF').fade(0.4) + + c = Circle().set_color('#FF00FF').shift([-0.4,0,1.5]).rotate(1.9,UP).scale(0.7) + + minima = Dot(color = '#4169E1').shift([-0.5,0.5,1]).rotate(1.571,UP) + maxima = Dot(color = '#4169E1').shift([0.1,0,2.2]).rotate(1.571,UP) + + l1 = DashedLine([-0.5,0.5,0.9],[-0.5,0.5,0],color = '#F08080') + l2 = DashedLine([0.1,0,2.1],[0.1,0,0],color = '#F08080') + + c2 = Circle(fill_opacity= 0.5).shift([-0.3,0.2,0]).scale(0.4) + + minima_refl = Dot(color = '#4682B4').shift([-0.5,0.5,0]).rotate(1.571,UP) + maxima_refl = Dot(color = '#4682B4').shift([0.1,0,0]).rotate(1.571,UP) + + max_text = TextMobject("maximum over $g(x,y)=k$",color = '#FFA074').shift([-1.7,0,0]).scale(0.5).shift(2.2*UP) + min_text = TextMobject("minimum over $g(x,y)=k$",color = '#FFA074').shift([2.5,0.5,1]).scale(0.5).shift(0.5*UP) + label_f = TextMobject("$z=f(x,y)$",color = '#8A2BE2').scale(0.5).shift(3*UP+3*RIGHT) + label_g = TextMobject("$g(x,y)=k$",color = '#8A2BE2').scale(0.5).shift(2*RIGHT) + + + self.add(axes) + self.set_camera_orientation(phi=75*DEGREES,theta=45*DEGREES) + self.play(Write(surface)) + self.add_fixed_in_frame_mobjects(label_f) + self.wait(2) + self.play(Write(c)) + self.wait(1) + self.play(Write(maxima)) + self.add_fixed_in_frame_mobjects(max_text) + self.wait(1) + self.play(Write(minima)) + self.add_fixed_in_frame_mobjects(min_text) + self.wait(1) + self.play(ShowCreation(l1),ShowCreation(l2)) + self.play(Write(c2)) + self.add_fixed_in_frame_mobjects(label_g) + self.wait(1) + self.play(Write(maxima_refl)) + self.play(Write(minima_refl)) + self.wait(1) + + -- cgit From e21e7a8b9ad0c4ee941be780252e01f1cf0fe4dc Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 08:17:08 +0530 Subject: Create file2_Geometric_Proof.py --- .../Lagrange-Multipliers/file2_Geometric_Proof.py | 68 ++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Geometric_Proof.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Geometric_Proof.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Geometric_Proof.py new file mode 100644 index 0000000..4374ff7 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Geometric_Proof.py @@ -0,0 +1,68 @@ +from manimlib.imports import* + +class firstScene(ThreeDScene): + def construct(self): + axes = ThreeDAxes().scale(0.7).rotate(math.radians(180)) + surface = ParametricSurface( + lambda u, v: np.array([ + 1*np.sin(u)*np.cos(v), + 1*np.sin(u)*np.sin(v), + -1*np.sin(u)*np.sin(u)+2 + ]),u_min=0,u_max=PI/2,v_min=0,v_max=2*PI,checkerboard_colors=[GREEN_C, GREEN_E]).scale(1).shift([-1.5,-1.5,0]) + + d = Dot([-2,-2.55,0],color = '#800000') + a_df = Arrow(color = '#00FFFF').rotate(-2).shift(3.2*DOWN+2.3*LEFT) #---- f parallel to g + a_dg = Arrow(color = '#FF00FF').scale(0.8).shift(3.2*DOWN+2.3*LEFT).rotate(-2) #---- f parallel to g + + b_df = Arrow(color = '#00FFFF').rotate(1.1).shift(0.82*LEFT+0.15*UP) #---- f parallel to g + b_dg = Arrow(color = '#FF00FF').scale(0.6).rotate(-2).shift(1.43*LEFT+1.1*DOWN) #---- f parallel to g + + + qd = Dot(color = '#800000').shift(1.2*LEFT+0.6*DOWN) + + l1 = Line([-1,-3.1,0],[-4,-3.1,0],color = PINK).rotate(-0.3).fade(0.6) + l2 = Line([-0.9,-2.9,0],[-4,-2.9,0],color = PINK).rotate(-0.3).fade(0.6) + l3= Line([-0.8,-2.7,0],[-4,-2.7,0],color = PINK).rotate(-0.3).fade(0.6) + l4= Line([-0.7,-2.45,0],[-4,-2.45,0],color = PINK).rotate(-0.3).fade(0.6) + l5= Line([-0.6,-2.2,0],[-4,-2.25,0],color = PINK).rotate(-0.3).fade(0.6) + l6 = Line([-0.5,-2,0],[-4,-2,0],color = PINK).rotate(-0.3).fade(0.6) + l7 = Line([-0.4,-1.8,0],[-4,-1.8,0],color = PINK).rotate(-0.3).fade(0.6) + l8 = Line([-0.3,-1.6,0],[-4,-1.6,0],color = PINK).rotate(-0.3).fade(0.6) + l9= Line([-0.2,-1.4,0],[-4,-1.4,0],color = PINK).rotate(-0.3).fade(0.6) + l10= Line([-0.1,-1.2,0],[-4,-1.2,0],color = PINK).rotate(-0.3).fade(0.6) + l11 = Line([-0,-1,0],[-4,-1,0],color = PINK).rotate(-0.3).fade(0.6) + l12 = Line([-0,-0.8,0],[-4,-0.8,0],color = PINK).rotate(-0.3).fade(0.6) + l13= Line([-0,-0.55,0],[-4,-0.55,0],color = PINK).rotate(-0.3).fade(0.6) + l14= Line([-0,-0.35,0],[-4,-0.35,0],color = PINK).rotate(-0.3).fade(0.6) + l15= Line([-0.,-0.15,0],[-4,-0.15,0],color = PINK).rotate(-0.3).fade(0.6) + + level_Curve = VGroup(l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15) + + rel_text = TextMobject("$\\nabla f = \\lambda \\nabla g$",color = TEAL).shift([3,3.2,0]).scale(0.5) + + f_text = TextMobject("$\\nabla f$",color = '#800000').shift([1,1,0]).scale(0.5) + g_text = TextMobject("$\\nabla g$").shift([1.2,-0.8,0]).scale(0.5) + + p_text= TextMobject("$P$").shift([1.8,2.6,0]).scale(0.5) + + + + self.add(axes) + self.set_camera_orientation(phi=0 * DEGREES, theta = 90*DEGREES) + self.play(Write(surface)) + self.wait(1) + self.play(ShowCreation(level_Curve)) + self.wait(1) + self.play(ShowCreation(a_df),ShowCreation(a_dg),Write(d)) + self.wait(1) + self.add_fixed_in_frame_mobjects(rel_text) + self.add_fixed_in_frame_mobjects(p_text) + self.wait(1) + self.play(Write(qd)) + self.wait(1) + self.play(ShowCreation(b_df)) + self.play(ShowCreation(b_dg)) + self.wait(1) + self.add_fixed_in_frame_mobjects(f_text) + self.add_fixed_in_frame_mobjects(g_text) + self.wait(1) -- cgit From 3c5b714525c48f088bda1371cea7257ac7fb6e72 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 08:18:20 +0530 Subject: Create file3_Optimizing_function_w.r.t_one_constraint.py --- ...le3_Optimizing_function_w.r.t_one_constraint.py | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file3_Optimizing_function_w.r.t_one_constraint.py (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file3_Optimizing_function_w.r.t_one_constraint.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file3_Optimizing_function_w.r.t_one_constraint.py new file mode 100644 index 0000000..bf75dd8 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file3_Optimizing_function_w.r.t_one_constraint.py @@ -0,0 +1,29 @@ +from manimlib.imports import* + +class firstScene(ThreeDScene): + def construct(self): + axes = ThreeDAxes() + cylinder = ParametricSurface( + lambda u, v: np.array([ + np.cos(TAU * v), + np.sin(TAU * v), + 2 * (u) + ]),checkerboard_colors=[YELLOW_C,YELLOW_D,YELLOW_E] + ).fade(0.4) #Resolution of the surfaces + + plane = ParametricSurface( + lambda u, v: np.array([ + u, + v, + u+v + ]),checkerboard_colors=[TEAL_C,TEAL_D,TEAL_E] + ).scale(2.5) + self.add(axes) + self.set_camera_orientation(phi=75*DEGREES,theta=45*DEGREES) + self.play(Write(cylinder)) + self.play(Write(plane)) + self.wait(1) + self.begin_ambient_camera_rotation(rate=0.7) + self.wait(5) + self.move_camera(phi=35*DEGREES,theta=-45*DEGREES) + self.wait(2) -- cgit From 5daed5a560b208dab38019f1f1e0be359e18c93e Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 08:20:21 +0530 Subject: Add files via upload --- .../file1_Extrema_over_g(x,y)=k.gif | Bin 0 -> 499796 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file1_Extrema_over_g(x,y)=k.gif (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file1_Extrema_over_g(x,y)=k.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file1_Extrema_over_g(x,y)=k.gif new file mode 100644 index 0000000..1e1782e Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file1_Extrema_over_g(x,y)=k.gif differ -- cgit From ab7570549a8ad1c2b654c3590265c5518ce2ed57 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 08:21:58 +0530 Subject: Add files via upload --- .../Lagrange-Multipliers/file2_Geometric_Proof.gif | Bin 0 -> 419262 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Geometric_Proof.gif (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Geometric_Proof.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Geometric_Proof.gif new file mode 100644 index 0000000..b22afb3 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Geometric_Proof.gif differ -- cgit From c50ab89a445f3748b96eb99904484a08edf19390 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Wed, 24 Jun 2020 08:23:21 +0530 Subject: Add files via upload --- ...file3_Optimizing_function_w.r.t_one_constraint.gif | Bin 0 -> 2177236 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file3_Optimizing_function_w.r.t_one_constraint.gif (limited to 'FSF-2020/calculus-of-several-variables') diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file3_Optimizing_function_w.r.t_one_constraint.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file3_Optimizing_function_w.r.t_one_constraint.gif new file mode 100644 index 0000000..9602283 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file3_Optimizing_function_w.r.t_one_constraint.gif differ -- cgit