diff options
author | Purusharth Saxena | 2020-07-05 16:36:13 +0530 |
---|---|---|
committer | GitHub | 2020-07-05 16:36:13 +0530 |
commit | 0b9be2ce679cfd646d95012d4ea0ac1cb2f1aa46 (patch) | |
tree | 95ae4521323d8aa88e703f4ef6f7eff356f750ea /FSF-2020/calculus-of-several-variables | |
parent | 6540bd6042448d196bc0c80cc531182e7e3d9fd5 (diff) | |
parent | 306a7994974670c419b90e0d3127ee31998d2e83 (diff) | |
download | FSF-mathematics-python-code-archive-0b9be2ce679cfd646d95012d4ea0ac1cb2f1aa46.tar.gz FSF-mathematics-python-code-archive-0b9be2ce679cfd646d95012d4ea0ac1cb2f1aa46.tar.bz2 FSF-mathematics-python-code-archive-0b9be2ce679cfd646d95012d4ea0ac1cb2f1aa46.zip |
Merge pull request #47 from vnb09/fsf_tasks
Fsf tasks
Diffstat (limited to 'FSF-2020/calculus-of-several-variables')
20 files changed, 162 insertions, 106 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 new file mode 100644 index 0000000..05ff51d --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/README.md @@ -0,0 +1,20 @@ +<h1><div align=”center”><b>SubTopic: Lagrange Multipliers</b></h1></div> +<br/></br> + +<tab>file1_Extrema_over_g(x,y)=k + +![file1_Extrema_over_g(x,y)=k](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file1_Extrema_over_g(x%2Cy)%3Dk.gif?raw=true) +<br/></br> +<br/></br> + +<tab>file2_Geometric_Proof + +![file2_Geometric_Proof](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Geometric_Proof.gif?raw=true) +<br/></br> +<br/></br> + +<tab>file3_Constraints_g_and_h + +![file3_Constraints_g_and_h](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file3_Constraints_g_and_h.gif?raw=true) +<br/></br> +<br/></br> 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 Binary files differindex 9d64d50..d423943 100644 --- 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 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 index da17aac..a01efb0 100644 --- 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 @@ -5,33 +5,26 @@ import math as m class ConstrainedExtrema(ThreeDScene): def construct(self): axes = ThreeDAxes().fade(0.4) - label_x = TextMobject("$x$").shift([5.5,-0.5,0]).fade(0.4) #---- x axis - label_y = TextMobject("$y$").shift([-0.5,5.5,0]).rotate(-4.5).fade(0.4) #---- y axis + 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 = 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(TEAL).fade(0.4) + ]),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(TEAL).fade(0.2) - c = Circle().set_color('#FF00FF').shift([-0.4,0,1.5]).rotate(1.9,UP).scale(0.7) + c = Circle(color='#FF00FF',fill_opacity=0.3).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) + 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) + max_text = TextMobject("maximum over $g(x,y)=k$",color = '#FFA074').scale(0.6).shift(2.3*UP+2*LEFT) + min_text = TextMobject("minimum over $g(x,y)=k$",color = '#FFA074').shift([2.5,0.5,1]).scale(0.6).shift(0.5*UP) + label_f = TextMobject("$z=f(x,y)$",color=TEAL).scale(0.8).shift(3*UP+3*RIGHT) + label_g = TextMobject("g(x,y)=k",color = PURPLE).scale(0.5).shift(1.5*UP+0.8*LEFT) + self.add(axes) self.add(label_x) @@ -42,16 +35,11 @@ class ConstrainedExtrema(ThreeDScene): self.wait(2) self.play(Write(c)) self.wait(1) + self.add_fixed_in_frame_mobjects(label_g) + 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) + self.wait(1) 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 Binary files differnew file mode 100644 index 0000000..e028a81 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Geometric_Proof.gif 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 index 2c2a9de..2c1d668 100644 --- 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 @@ -1,7 +1,7 @@ from manimlib.imports import* #---- visualization of geometric proof of Lagrange multiplier -class GeometricProof(ThreeDScene): +class firstScene(ThreeDScene): def construct(self): axes = ThreeDAxes().scale(0.7).rotate(math.radians(180)) label_x = TextMobject("$x$").shift(4*RIGHT).fade(0.4) #---- x axis @@ -12,19 +12,18 @@ class GeometricProof(ThreeDScene): 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]) + ]),u_min=0,u_max=PI/2,v_min=0,v_max=2*PI).set_color(GREEN).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 at maxima - a_dg = Arrow(color = '#FF00FF').scale(0.8).shift(3.2*DOWN+2.3*LEFT).rotate(-2) #---- g parallel to f at maxima + 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_dg = Arrow(color = '#00FFFF').rotate(1.1).shift(0.82*LEFT+0.15*UP) #---- g parallel to f at minima - b_df = Arrow(color = '#FF00FF').scale(0.6).rotate(-2).shift(1.43*LEFT+1.1*DOWN) #---- f parallel to g at minima + b_dg = Arrow(color = '#00FFFF').rotate(1.1).shift(0.82*LEFT+0.15*UP) #---- f parallel to g + b_df = 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) - #---- level curves 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) @@ -48,7 +47,6 @@ class GeometricProof(ThreeDScene): p_text= TextMobject("$P$").shift([1.8,2.6,0]).scale(0.5) - #---- labelling of level curves l1_text = TextMobject("$w=$ 17").rotate(math.radians(180)).scale(0.4).shift(2.7*DOWN+4.36*LEFT) l2_text = TextMobject("$w=$ 16").rotate(math.radians(180)).scale(0.4).shift(2.46*DOWN+4.36*LEFT) l3_text = TextMobject("$w=$ 15").rotate(math.radians(180)).scale(0.4).shift(2.2*DOWN+4.36*LEFT) @@ -70,8 +68,9 @@ class GeometricProof(ThreeDScene): self.set_camera_orientation(phi=0 * DEGREES, theta = 90*DEGREES) self.add(axes) self.add(label_x) - self.add(label_y) - self.play(Write(surface)) + self.add(label_y) + self.wait(1) + self.add(surface) self.wait(1) self.play(ShowCreation(level_Curve)) self.wait(1) diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file3_Constraints_g_and_h.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file3_Constraints_g_and_h.gif Binary files differnew file mode 100644 index 0000000..0da30ad --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file3_Constraints_g_and_h.gif diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file3_Constraints_g_and_h.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file3_Constraints_g_and_h.py new file mode 100644 index 0000000..742d6b5 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file3_Constraints_g_and_h.py @@ -0,0 +1,41 @@ +from manimlib.imports import* +import math as m + +class firstScene(ThreeDScene): + def construct(self): + axes = ThreeDAxes() + label_x = TextMobject("$x$").shift([5.5,-0.5,0]).fade(0.4) #---- x axis + label_y = TextMobject("$y$").shift([-0.5,5.5,0]).rotate(-4.5).fade(0.4) #---- y axis + + #---- constraint g(x,y) + cylinder = ParametricSurface( + lambda u, v: np.array([ + np.cos(TAU * u), + np.sin(TAU * u), + 2 * (v) + ]),checkerboard_colors=[YELLOW_C,YELLOW_D,YELLOW_E]).rotate(m.radians(-40),RIGHT).shift([0.5,0.5,0]).scale(0.8) + + #---- constraint h(x,y) + plane = ParametricSurface( + lambda u, v: np.array([ + u, + v, + u+v + ]),checkerboard_colors=[TEAL_C,TEAL_D,TEAL_E]).shift([0,0,0]).rotate(m.radians(-40),RIGHT).scale(2).fade(0.3) + + figure = VGroup(cylinder,plane).rotate(m.radians(-45),DOWN).scale(1.5) + + self.set_camera_orientation(phi=65*DEGREES,theta=45*DEGREES) + self.add(axes) + self.add(label_x) + self.add(label_y) + self.wait(1) + self.play(Write(cylinder)) + self.play(Write(plane)) + self.wait(1) + self.begin_ambient_camera_rotation(rate=0.4) + self.wait(1) + self.wait(1) + self.play(FadeOut(label_x),FadeOut(label_y)) + self.wait(1) + self.wait(1) 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 Binary files differdeleted file mode 100644 index 9602283..0000000 --- a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file3_Optimizing_function_w.r.t_one_constraint.gif +++ /dev/null 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 deleted file mode 100644 index bf75dd8..0000000 --- a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file3_Optimizing_function_w.r.t_one_constraint.py +++ /dev/null @@ -1,29 +0,0 @@ -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) diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical_Points_mcq_questions.pdf b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/MCQ-Questions/Critical_Points_mcq_questions.pdf Binary files differindex 25c4e4d..25c4e4d 100644 --- a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Critical_Points_mcq_questions.pdf +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/MCQ-Questions/Critical_Points_mcq_questions.pdf diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/MCQ-Questions/Lagrange_Multipliers_mcq_questions.pdf b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/MCQ-Questions/Lagrange_Multipliers_mcq_questions.pdf Binary files differnew file mode 100644 index 0000000..3ba7d1c --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/MCQ-Questions/Lagrange_Multipliers_mcq_questions.pdf diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/MCQ-Questions/Tangent_Plane_Approximations_mcq_questions.pdf b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/MCQ-Questions/Tangent_Plane_Approximations_mcq_questions.pdf Binary files differnew file mode 100644 index 0000000..2a77b15 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/MCQ-Questions/Tangent_Plane_Approximations_mcq_questions.pdf diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The_Second_Derivative_Test_MCQ.pdf b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/MCQ-Questions/The_Second_Derivative_Test_mcq_questions.pdf Binary files differindex ca60cbf..ca60cbf 100644 --- a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The_Second_Derivative_Test_MCQ.pdf +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/MCQ-Questions/The_Second_Derivative_Test_mcq_questions.pdf diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/MCQ-Questions/Total_Differential_mcq_questions.pdf b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/MCQ-Questions/Total_Differential_mcq_questions.pdf Binary files differnew file mode 100644 index 0000000..b1a679d --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/MCQ-Questions/Total_Differential_mcq_questions.pdf diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/README.md b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/README.md new file mode 100644 index 0000000..2a274d0 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/README.md @@ -0,0 +1,26 @@ +<h1><div align=”center”><b>SubTopic: Tangent Plane Approximations</b></h1></div> +<br/></br> + +<tab>file1_Tangent_Plane + +![file1_Tangent_Plane](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file1_Tangent_Plane.gif?raw=true) +<br/></br> +<br/></br> + +<tab>file2_Tangent_plane_approximation_visualization + +![file2_Tangent_plane_approximation_visualization](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file2_Tangent_plane_approximation_visualization.gif?raw=true) +<br/></br> +<br/></br> + +<tab>file3_Non_Differentiable_Function + +![file3_Non_Differentiable_Function](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file3_Non_Differentiable_Function.gif?raw=true) +<br/></br> +<br/></br> + +<tab>file4_Tangent_plane_at_extrema_and_saddle_point + +![file4_Tangent_plane_at_extrema_and_saddle_point](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent_plane_at_extrema_and_saddle_point.gif?raw=true) +<br/></br> +<br/></br> 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 index 4c17f90..8efdbd2 100644 --- 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 @@ -1,7 +1,7 @@ from manimlib.imports import* #---- tangent plane is parallel to the surface of the funtion at a point -class firstScene(ThreeDScene): +class tangentplane(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) 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 Binary files differindex d23405d..6d5a67a 100644 --- 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 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 index d1ecf8c..02576d9 100644 --- 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 @@ -1,12 +1,13 @@ from manimlib.imports import* +import math as m -#---- tangent plane is parallel to the x-y plane -class MaximaScene(ThreeDScene): +#---- tangent plane approximation visualization +class ApproximationScene(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 + axes = ThreeDAxes().scale(1.2).fade(0.7) + label_x= TextMobject("$x$").shift([5.4,-0.5,0]).fade(0.7) #---- x axis + label_y= TextMobject("$y$").shift([-0.5,5.2,0]).rotate(-4.5).fade(0.7) #---- y axis #---- graph of the function s = ParametricSurface( @@ -14,61 +15,71 @@ class MaximaScene(ThreeDScene): 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]) - + ]),u_min=0,u_max=PI,v_min=PI,v_max=2*PI,checkerboard_colors=[BLUE_B,BLUE_C,BLUE_D,BLUE_E]).shift([0,1,2.4]).scale(1.3) + 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) + d1_copy = Dot([0.2,2.01,0],color = '#800000') #---- projection of point(x_0,y_0) on x-y plane - 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) + d1_text = TextMobject("$f(x_0,y_0)$",color=ORANGE).scale(0.5).shift([0.2,2.01,2.3]) + d1_copy_text = TextMobject("$(x_0,y_0)$",color=ORANGE).scale(0.5).shift([0.2,2.01,0],4.1*DOWN) - t_plane = Rectangle(color = PURPLE, fill_opacity=0.3).scale(0.4).rotate(1,LEFT).shift([1.1,2.5,2.9]) #---- tangent plane + d2 = Dot([2,2.6,3.5],color = '#800000').rotate(1,LEFT) #---- point(x,y) + d2_copy = Dot([2,2.6,0],color = '#800000') #---- projection of point(x,y) on x-y plane - t_text= TextMobject("Tangent Plane",color = RED).scale(0.5).shift(0.3*RIGHT+1.3*UP).rotate(math.radians(5),LEFT) + d2_text = TextMobject("$f(x,y)$",color=ORANGE).scale(0.5).shift([0.8,1.4,1.5]) + d2_copy_text = TextMobject("$(x,y)$",color=ORANGE).scale(0.5).shift([0.8,1.4,0],2.4*DOWN) - 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) + l1 = Line([0.2,2.01,2.21],[0.2,2.01,0],color= YELLOW).fade(0.2) + l2 = Line([2,2.6,3.4],[2,2.6,0],color= YELLOW).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 + t_plane = Rectangle(color = PURPLE, fill_opacity=0.3).scale(0.6).rotate(m.radians(45),LEFT).shift([1.1,2.5,3.1]) #---- tangent plane + t_text= TextMobject("Tangent Plane",color = PINK).scale(0.5).shift(0.3*RIGHT+2.6*UP).rotate(math.radians(5),LEFT) + + a1 = Line([0.2,2.01,0],[2,2.6,0],color ="#00FF7F") + a_x = Line([0.2,2.01,0],[2,2.01,0],color ="#9400D3") + a_y = Line([0.2,2.01,0],[0.2,2.6,0],color ="#8B4513") + a2 = Line([2,2.01,0],[2,2.6,0]) + a3 = Line([0.2,2.6,0],[2,2.6,0]) + + ax_text = TextMobject("$f_x (x_0 , y_0 )(x – x_0 ) $").scale(0.5).shift(DOWN+0.8*LEFT).rotate(0.4) + ay_text = TextMobject("$ f_y (x_0 , y_0 )(y – y_0 ) $").scale(0.5).shift(0.8*DOWN+2.7*RIGHT).rotate(-0.6) + a1_text = TextMobject("$f_x (x_0 , y_0 )(x – x_0 ) + f_y (x_0 , y_0 )(y – y_0 )$ ").scale(0.4).rotate(0.7).shift(1.7*DOWN+0.6*RIGHT) + + lines = VGroup(a1,a_y,a_x,a2,a3,d1_copy,d2_copy) - 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.set_camera_orientation(phi = 60 * DEGREES, theta = 55 * 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.play(Write(d2)) self.add_fixed_in_frame_mobjects(d1_text) - self.play(ShowCreation(t_plane)) + self.wait(1) + self.play(Write(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.play(Write(d1)) + self.add_fixed_in_frame_mobjects(d2_text) + self.wait(1) + self.play(Write(l1),Write(d1_copy)) + self.add_fixed_in_frame_mobjects(d2_copy_text) + self.wait(1) + self.play(Write(l2),Write(d2_copy)) + self.add_fixed_in_frame_mobjects(d1_copy_text) + self.wait(2) + self.play(FadeOut(d1_text),FadeOut(d1_copy_text),FadeOut(d2_text),FadeOut(d2_copy_text),FadeOut(t_text)) self.wait(1) - self.play(Write(l1),Write(l2)) - self.play(Write(d2_copy),Write(d1_copy)) + self.play(Write(a1),Write(a_x),Write(a_y),Write(a2),Write(a3)) self.wait(1) - self.play(Write(a1),Write(a_x),Write(a_y)) + self.play(FadeOut(s),FadeOut(d1),FadeOut(d2),FadeOut(l1),FadeOut(l2),FadeOut(t_plane),FadeOut(label_x),FadeOut(label_y)) self.wait(1) - self.play(Write(a2),Write(a3)) - self.wait(1) - self.play(ReplacementTransform(t_plane,t2_plane)) + lines.scale(2) + axes.scale(1.5) self.wait(1) - self.play(ReplacementTransform(t2_plane,t3_plane)) + self.add_fixed_in_frame_mobjects(ax_text) + self.add_fixed_in_frame_mobjects(ay_text) + self.add_fixed_in_frame_mobjects(a1_text) self.wait(1) - self.play(ReplacementTransform(t3_plane,t4_plane)) - 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.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent plane_at_extrema_and_saddle_point.gif Binary files differdeleted file mode 100644 index cfe054b..0000000 --- a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent plane_at_extrema_and_saddle_point.gif +++ /dev/null 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 Binary files differnew file mode 100644 index 0000000..3fe7992 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Tangent-Plane-Approximations/file4_Tangent_plane_at_extrema_and_saddle_point.gif |