From 71517eb42c1899541ba8f3d6c15dae10a2b4e671 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Tue, 28 Jul 2020 00:55:42 +0530 Subject: Update README.md --- .../approximations-and-optimizations/Lagrange-Multipliers/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/README.md b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/README.md index 903eaed..c9b7a17 100644 --- a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/README.md +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/README.md @@ -7,9 +7,7 @@



-file2_Constraint_circle_with_contour_plot_of_the_surface_x^2+y^2+x^3-y^3 - -![file2_Constraint_circle_with_contour_plot_of_the_surface_x^2+y^2+x^3-y^3](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Constraint_circle_with_contour_plot_of_the_surface_x%5E2%2By%5E2%2Bx%5E3-y%5E3.gif?raw=true) +



-- cgit From d70c002230a8c48b158045b96578912cbf2e61a4 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Tue, 28 Jul 2020 00:56:02 +0530 Subject: Delete file2_Constraint_circle_with_contour_plot_of_the_surface_x^2+y^2+x^3-y^3.gif --- ...th_contour_plot_of_the_surface_x^2+y^2+x^3-y^3.gif | Bin 1810502 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Constraint_circle_with_contour_plot_of_the_surface_x^2+y^2+x^3-y^3.gif diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Constraint_circle_with_contour_plot_of_the_surface_x^2+y^2+x^3-y^3.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Constraint_circle_with_contour_plot_of_the_surface_x^2+y^2+x^3-y^3.gif deleted file mode 100644 index d8e03fd..0000000 Binary files a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Constraint_circle_with_contour_plot_of_the_surface_x^2+y^2+x^3-y^3.gif and /dev/null differ -- cgit From 7f730f692dd8cf53b2f4d7e2e0f760ae8078de89 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Tue, 28 Jul 2020 00:56:50 +0530 Subject: Update file2_Constraint_circle_with_contour_plot_of_the_surface_x^2+y^2+x^3-y^3.py --- ..._contour_plot_of_the_surface_x^2+y^2+x^3-y^3.py | 121 +++++++++++++++------ 1 file changed, 87 insertions(+), 34 deletions(-) diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Constraint_circle_with_contour_plot_of_the_surface_x^2+y^2+x^3-y^3.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Constraint_circle_with_contour_plot_of_the_surface_x^2+y^2+x^3-y^3.py index bbbf238..2ef7897 100644 --- a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Constraint_circle_with_contour_plot_of_the_surface_x^2+y^2+x^3-y^3.py +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Constraint_circle_with_contour_plot_of_the_surface_x^2+y^2+x^3-y^3.py @@ -1,47 +1,105 @@ from manimlib.imports import* import math as m -#---- contour plot of the surface with constraint circle -class ContourScene(ThreeDScene): +class Contourplots(ThreeDScene): def construct(self): - axes = ThreeDAxes().scale(0.7).rotate(m.radians(180)).fade(0.6) + axes = ThreeDAxes().scale(0.7).rotate(math.radians(180)).fade(0.6) label_x = TextMobject("$x$").shift(4*LEFT).fade(0.4) #---- x axis - label_y = TextMobject("$y$").shift(3.2*DOWN+0.2*RIGHT).rotate(m.radians(180)).fade(0.4) #---- y axis + label_y = TextMobject("$y$").shift(3.5*DOWN+0.2*RIGHT).rotate(math.radians(180)).fade(0.4) #---- y axis - #---- surface of the function f(x,y) = x^2+y^2+x^3-y^3 + #---- surface of the function 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,-0.5,2.5]).set_color(TEAL).fade(0.5) - + ]),u_min=-0.5,u_max=0.5, v_min=-0.5,v_max=0.5).scale(6).shift([0,0,2.5]).set_color(TEAL).fade(0.5) - #---- contour plots of the surface of the function + #---- contour plots + curve1 = ParametricSurface( + lambda u, v: np.array([ + u*0.4, + m.exp(m.sin(v**2)), + -v*2.2 + ]),v_min =-1.3 , v_max =1.3, u_min = -0.1, u_max = 0.1).scale(0.8).shift([0,-2.65,0]).set_color("#800000").rotate(1.2,DOWN) - c0 = Circle(color = '#800000').scale(0.5).shift([0,-0.5,0]) - c1 = Circle(color = '#800000').scale(1).shift([0,-0.5,0]) - c2 = Circle(color = '#800000').scale(1.5).shift([0,-0.5,0]) - c3 = Circle(color = '#800000').scale(2).shift([0,-0.5,0]) - c4 = Circle(color = '#800000').scale(2.5).shift([0,-0.5,0]) + curve2 = ParametricSurface( + lambda u, v: np.array([ + u*0.4, + m.exp(m.sin(v**2)), + -v*2.2 + ]),v_min =-1.3 , v_max =1.3, u_min = -0.1, u_max = 0.1).scale(0.9).shift([0,-3,0]).set_color("#800000").rotate(1.2,DOWN) - #---- constraint circle - circle = Circle(color='#FF00FF',fill_opacity=0.3).shift([-0.5,-1.2,1.5]).rotate(1.9,UP).scale(0.8) - circle2 = Circle(color='#FF00FF',fill_opacity=0.3).shift([0.74,0.95,1.5]).rotate(1.9,UP).scale(0.8) + curve3 = ParametricSurface( + lambda u, v: np.array([ + u*0.4, + m.exp(m.sin(v**2)), + -v*2.2 + ]),v_min =-1.3 , v_max =1.3 , u_min = -0.1, u_max = 0.1).scale(1).shift([0,-3.5,0]).set_color("#800000").rotate(1.2,DOWN) + + curve4 = ParametricSurface( + lambda u, v: np.array([ + u*0.4, + m.exp(m.sin(v**2)), + -v*2.2 + ]),v_min =-1.3 , v_max =1.3 , u_min = -0.1, u_max = 0.1).scale(1.1).shift([0,-4,0]).set_color("#800000").rotate(1.2,DOWN) + + curve5 = ParametricSurface( + lambda u, v: np.array([ + u*0.4, + -m.exp(m.sin(v**2)), + v*2.2 + ]),v_min =-1.3 , v_max =1.3, u_min = -0.1, u_max = 0.1).scale(0.9).shift([0,3,0]).set_color("#800000").rotate(1.2,DOWN) + + curve6 = ParametricSurface( + lambda u, v: np.array([ + u*0.4, + -m.exp(m.sin(v**2)), + v*2.2 + ]),v_min =-1.3 , v_max =1.3, u_min = -0.1, u_max = 0.1).scale(1).shift([0,3.5,0]).set_color("#800000").rotate(1.2,DOWN) + + curve7 = ParametricSurface( + lambda u, v: np.array([ + u*0.4, + -m.exp(m.sin(v**2)), + v*2.2 + ]),v_min =-1.3 , v_max =1.3, u_min = -0.1, u_max = 0.1).scale(1.1).shift([0,4,0]).set_color("#800000").rotate(1.2,DOWN) + + curve8 = ParametricSurface( + lambda u, v: np.array([ + u*0.4, + -m.exp(m.sin(v**2)), + v*2.2 + ]),v_min =-1.3 , v_max =1.3, u_min = -0.1, u_max = 0.1).scale(0.8).shift([0,2.65,0]).set_color("#800000").rotate(1.2,DOWN) - maxima = Dot(color = '#4169E1').shift([0.7,0.15,1.5]) #---- point of maxima - minima = Dot(color = '#4169E1').shift([0.8,1.7,1.5]) #---- point of minima + #--------------- + + #---- label contours + label_c1 = TextMobject("4",color = '#FFA074').shift([0.2,3,0.5]).scale(0.5).rotate(m.radians(180)) + label_c2 = TextMobject("3",color = '#FFA074').shift([0.2,2.4,0.5]).scale(0.5).rotate(m.radians(180)) + label_c3 = TextMobject("2",color = '#FFA074').shift([0.2,1.9,0.5]).scale(0.5).rotate(m.radians(180)) + label_c4 = TextMobject("1",color = '#FFA074').shift([0.2,1.4,0.5]).scale(0.5).rotate(m.radians(180)) + label_c5 = TextMobject("1",color = '#FFA074').shift([0.2,-1.5,0.5]).scale(0.5).rotate(m.radians(180)) + label_c6 = TextMobject("2",color = '#FFA074').shift([0.2,-2,0.5]).scale(0.5).rotate(m.radians(180)) + label_c7 = TextMobject("3",color = '#FFA074').shift([0.2,-2.5,0.5]).scale(0.5).rotate(m.radians(180)) + label_c8 = TextMobject("4",color = '#FFA074').shift([0.2,-3,0.5]).scale(0.5).rotate(m.radians(180)) + + contourplot = VGroup(curve1,curve2,curve3,curve4,curve5,curve6,curve7,curve8,label_c1,label_c2,label_c3,label_c4,label_c5,label_c6,label_c7,label_c8) + - min_text = TextMobject("minimum over $g(x,y)=k$",color = '#FFA074').scale(0.6).shift([-2,0.16,1.5]) - max_text = TextMobject("maximum over $g(x,y)=k$",color = '#FFA074').shift([-2.3,-2.6,1.5]).scale(0.6).shift(0.5*UP) + circle = Circle(color='#FF00FF',fill_opacity=0.3).shift([-0.5,-1.2,1.5]).rotate(1.9,UP).scale(0.8) + circle2 = 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).set_color('#FF00FF').scale(0.6).shift([1.2,2,-3]).scale(1.24) + maxima = Dot(color = '#4169E1').shift([0.7,1.2,1.5]) + minima = Dot(color = '#4169E1').shift([1.4,2.2,1.5]) - #---- labelling contour curves - label_c0 = TextMobject("1",color = '#FFA074').shift([0.2,0.1,0.5]).scale(0.5) - label_c1 = TextMobject("2",color = '#FFA074').shift([0.2,-0.6,0.5]).scale(0.5) - label_c2 = TextMobject("3",color = '#FFA074').shift([0.2,-1.1,0.5]).scale(0.5) - label_c3 = TextMobject("4",color = '#FFA074').shift([0.2,-1.6,0.5]).scale(0.5) - label_c4 = TextMobject("5",color = '#FFA074').shift([0.2,-2.1,0.5]).scale(0.5) + min_text = TextMobject("minimum over $g(x,y)=k$",color = '#FFA074').scale(0.6).shift([-2.2,-1,1.5]) + max_text = TextMobject("maximum over $g(x,y)=k$",color = '#FFA074').shift([-2.3,-2.6,1.5]).scale(0.6) self.set_camera_orientation(phi=75 * DEGREES, theta = 45*DEGREES) @@ -56,15 +114,10 @@ class ContourScene(ThreeDScene): self.wait(1) self.move_camera(phi=0 * DEGREES, theta = 90*DEGREES) self.wait(1) - self.play(Write(c0),Write(c1),Write(c2),Write(c3),Write(c4)) - self.play(FadeOut(surface)) - self.add_fixed_in_frame_mobjects(label_c0) - self.add_fixed_in_frame_mobjects(label_c1) - self.add_fixed_in_frame_mobjects(label_c2) - self.add_fixed_in_frame_mobjects(label_c3) - self.add_fixed_in_frame_mobjects(label_c4) + self.add(contourplot) + self.play(FadeOut(surface)) self.wait(1) - self.play(Write(circle2)) + self.add(circle2) self.wait(1) self.play(Write(minima),Write(maxima)) self.add_fixed_in_frame_mobjects(max_text) -- cgit From 7e23b6b62363c67ad499e006187c0607bf98b198 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Tue, 28 Jul 2020 01:00:29 +0530 Subject: Add files via upload --- ...th_contour_plot_of_the_surface_x^2+y^2+x^3-y^3.gif | Bin 0 -> 1927505 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Constraint_circle_with_contour_plot_of_the_surface_x^2+y^2+x^3-y^3.gif diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Constraint_circle_with_contour_plot_of_the_surface_x^2+y^2+x^3-y^3.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Constraint_circle_with_contour_plot_of_the_surface_x^2+y^2+x^3-y^3.gif new file mode 100644 index 0000000..d4c4bd6 Binary files /dev/null and b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Constraint_circle_with_contour_plot_of_the_surface_x^2+y^2+x^3-y^3.gif differ -- cgit From 0cc8a544920e5c711599b8661e03889b7a4da765 Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Tue, 28 Jul 2020 01:03:06 +0530 Subject: Update README.md --- .../approximations-and-optimizations/Lagrange-Multipliers/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/README.md b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/README.md index c9b7a17..f985f6c 100644 --- a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/README.md +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/README.md @@ -7,7 +7,8 @@



- +file2_Constraint_circle_with_contour_plot_of_the_surface_x^2+y^2+x^3-y^3 + ![file2_Constraint_circle_with_contour_plot_of_the_surface_x^2+y^2+x^3-y^3](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Constraint_circle_with_contour_plot_of_the_surface_x%5E2%2By%5E2%2Bx%5E3-y%5E3.gif?raw=true)



-- cgit From e4b4e1b7ea1ce287da638cf1e4d4f329a86fd67d Mon Sep 17 00:00:00 2001 From: Vaishnavi Date: Tue, 28 Jul 2020 01:03:23 +0530 Subject: Update README.md --- .../approximations-and-optimizations/Lagrange-Multipliers/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/README.md b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/README.md index f985f6c..b6bf4e0 100644 --- a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/README.md +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/README.md @@ -8,6 +8,7 @@

file2_Constraint_circle_with_contour_plot_of_the_surface_x^2+y^2+x^3-y^3 + ![file2_Constraint_circle_with_contour_plot_of_the_surface_x^2+y^2+x^3-y^3](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Constraint_circle_with_contour_plot_of_the_surface_x%5E2%2By%5E2%2Bx%5E3-y%5E3.gif?raw=true)



-- cgit