diff options
author | Purusharth Saxena | 2020-06-30 02:25:46 +0530 |
---|---|---|
committer | GitHub | 2020-06-30 02:25:46 +0530 |
commit | 95b35efe6166fe145e44314e11e0a7d3ac638874 (patch) | |
tree | 200eb34921deaae1ba440420d852ad3e82c0b839 /FSF-2020/calculus-of-several-variables | |
parent | 8ad6529190a9ee7e3324b71b555c6807c2a8cf15 (diff) | |
parent | 6eaafd2b199661ba0b2221ed8f75bfc4c5e18514 (diff) | |
download | FSF-mathematics-python-code-archive-95b35efe6166fe145e44314e11e0a7d3ac638874.tar.gz FSF-mathematics-python-code-archive-95b35efe6166fe145e44314e11e0a7d3ac638874.tar.bz2 FSF-mathematics-python-code-archive-95b35efe6166fe145e44314e11e0a7d3ac638874.zip |
Merge pull request #43 from vnb09/fsf_tasks
Updated animations
Diffstat (limited to 'FSF-2020/calculus-of-several-variables')
17 files changed, 146 insertions, 67 deletions
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 1e1782e..9d64d50 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 17f31ac..da17aac 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 @@ -1,14 +1,19 @@ from manimlib.imports import* +import math as m -class firstScene(ThreeDScene): +#---- optimizing funtion f(x,y) w.r.t to g(x,y) +class ConstrainedExtrema(ThreeDScene): def construct(self): - axes = ThreeDAxes() + 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 + 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) + ]),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) c = Circle().set_color('#FF00FF').shift([-0.4,0,1.5]).rotate(1.9,UP).scale(0.7) @@ -26,10 +31,11 @@ class firstScene(ThreeDScene): 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) - + label_g = TextMobject("$g(x,y)=k$",color = '#8A2BE2').scale(0.5).shift(2*RIGHT) self.add(axes) + self.add(label_x) + self.add(label_y) self.set_camera_orientation(phi=75*DEGREES,theta=45*DEGREES) self.play(Write(surface)) self.add_fixed_in_frame_mobjects(label_f) @@ -49,5 +55,3 @@ class firstScene(ThreeDScene): self.play(Write(maxima_refl)) self.play(Write(minima_refl)) 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 differdeleted file mode 100644 index b22afb3..0000000 --- a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Lagrange-Multipliers/file2_Geometric_Proof.gif +++ /dev/null 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 4374ff7..2c2a9de 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,8 +1,12 @@ from manimlib.imports import* -class firstScene(ThreeDScene): +#---- visualization of geometric proof of Lagrange multiplier +class GeometricProof(ThreeDScene): def construct(self): - axes = ThreeDAxes().scale(0.7).rotate(math.radians(180)) + axes = ThreeDAxes().scale(0.7).rotate(math.radians(180)) + label_x = TextMobject("$x$").shift(4*RIGHT).fade(0.4) #---- x axis + label_y = TextMobject("$y$").shift(3.2*DOWN+0.2*RIGHT).rotate(math.radians(180)).fade(0.4) #---- y axis + surface = ParametricSurface( lambda u, v: np.array([ 1*np.sin(u)*np.cos(v), @@ -11,15 +15,16 @@ class firstScene(ThreeDScene): ]),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 + 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 - 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 + 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 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) @@ -36,19 +41,36 @@ class firstScene(ThreeDScene): 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) + #---- 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) + l4_text = TextMobject("$w=$ 14").rotate(math.radians(180)).scale(0.4).shift(1.97*DOWN+4.36*LEFT) + l5_text = TextMobject("$w=$ 13").rotate(math.radians(180)).scale(0.4).shift(1.74*DOWN+4.36*LEFT) + l6_text = TextMobject("$w=$ 12").rotate(math.radians(180)).scale(0.4).shift(1.5*DOWN+4.36*LEFT) + l7_text = TextMobject("$w=$ 11").rotate(math.radians(180)).scale(0.4).shift(1.26*DOWN+4.36*LEFT) + l8_text = TextMobject("$w=$ 10").rotate(math.radians(180)).scale(0.4).shift(1.05*DOWN+4.36*LEFT) + l9_text = TextMobject("$w=$ 9").rotate(math.radians(180)).scale(0.4).shift(0.8*DOWN+4.32*LEFT) + l10_text = TextMobject("$w=$ 8").rotate(math.radians(180)).scale(0.4).shift(0.6*DOWN+4.32*LEFT) + l11_text = TextMobject("$w=$ 7").rotate(math.radians(180)).scale(0.4).shift(0.4*DOWN+4.32*LEFT) + l12_text = TextMobject("$w=$ 6").rotate(math.radians(180)).scale(0.4).shift(0.2*DOWN+4.32*LEFT) + l13_text = TextMobject("$w=$ 5").rotate(math.radians(180)).scale(0.4).shift(-0.02*DOWN+4.32*LEFT) + l14_text = TextMobject("$w=$ 4").rotate(math.radians(180)).scale(0.4).shift(-0.23*DOWN+4.32*LEFT) + l15_text = TextMobject("$w=$ 3").rotate(math.radians(180)).scale(0.4).shift(-0.44*DOWN+4.32*LEFT) + + level_Curve = VGroup(l1,l1_text,l2,l2_text,l3,l3_text,l4,l4_text,l5,l5_text,l6,l6_text,l7,l7_text,l8,l8_text,l9,l9_text,l10,l10_text,l11,l11_text,l12,l12_text,l13,l13_text,l14,l14_text,l15,l15_text) + 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.wait(1) self.play(ShowCreation(level_Curve)) @@ -61,8 +83,8 @@ class firstScene(ThreeDScene): 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.wait(1) + self.play(ShowCreation(b_dg)) self.add_fixed_in_frame_mobjects(g_text) self.wait(1) diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/README.md b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/README.md index e9cc918..96b32bf 100644 --- a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/README.md +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/README.md @@ -19,3 +19,9 @@ <br/></br> <br/></br> +<tab>file4_Contour_Diagram + +![file4_Contour_Diagram](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file4_Contour_Diagram.gif?raw=true) +<br/></br> +<br/></br> + diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file3_Degenerate_Hessian_Matrix.gif b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file3_Degenerate_Hessian_Matrix.gif Binary files differindex 36fd25c..5aae300 100644 --- a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file3_Degenerate_Hessian_Matrix.gif +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file3_Degenerate_Hessian_Matrix.gif diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file3_Degenerate_Hessian_Matrix.py b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file3_Degenerate_Hessian_Matrix.py index 732ef4f..9310553 100644 --- a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file3_Degenerate_Hessian_Matrix.py +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/The-Second-Derivative-Test/file3_Degenerate_Hessian_Matrix.py @@ -17,22 +17,13 @@ class DegenerateHessian(ThreeDScene): lambda u, v: np.array([ u, v, - -4*u**3-v**3 - ]),u_min = -0.8, u_max = 0.8, v_min = -0.8, v_max = 0.8).set_color(TEAL).shift([0,1,0]).scale(1.3) - - #---- function f(x,y) - zoom_surface = ParametricSurface( - lambda u, v: np.array([ - u, - v, - -4*u**3-v**3 - ]),u_min = -0.8, u_max = 0.8, v_min = -0.8, v_max = 0.8).set_color(TEAL).shift([0,1,0]).scale(2.5) + -u**4-v**4 + ]),u_min = -0.8, u_max = 0.8, v_min = -0.8, v_max = 0.8).set_color(TEAL).shift([0,0,-0.5]).scale(2) f_text= TextMobject("surface of the function").to_corner(UL).scale(0.5) - d = Dot(color = "#800000").shift([0,1,0]) #---- critical point - d2 = Dot(color = "#800000").shift([0,0.7,0]) #---- critical point - plane = Rectangle(color = YELLOW,fill_opacity= 0.3).shift([0,0.6,0]).rotate(m.radians(90)).scale(0.4) + d = Dot(color = "#800000").shift([0,0,-0.5]) #---- critical point + plane = Square(color = YELLOW,fill_opacity= 0.2).shift([0,0,-0.5]).scale(1.3) self.set_camera_orientation(phi = 70*DEGREES, theta = 45*DEGREES) self.add_fixed_in_frame_mobjects(heading) @@ -49,8 +40,6 @@ class DegenerateHessian(ThreeDScene): self.add_fixed_in_frame_mobjects(f_text) self.wait(1) self.play(Write(d)) - self.wait(1) - self.play(ReplacementTransform(f_surface,zoom_surface),ReplacementTransform(d,d2)) - self.wait(2) + self.wait(1) self.play(Write(plane)) self.wait(1) 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 Binary files differindex 129fedc..41068e2 100644 --- 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 diff --git a/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/README.md b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/README.md new file mode 100644 index 0000000..ce4da11 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/README.md @@ -0,0 +1,34 @@ +<h1><div align=”center”><b>SubTopic: Total Differential</b></h1></div> +<br/></br> + +<tab>file1_Visualization_of_dz + +![file1_Visualization_of_dz](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file1_Visualization_of_dz.gif?raw=true) +<br/></br> +<br/></br> + +<tab>file2_Differentials + +![file2_Differentials](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file2_Differentials.gif?raw=true) + +<br/></br> +<br/></br> + +<tab>file3_Total_differential_of_z + +![file3_Total_differential_of_z](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file3_Total_differential_of_z.gif?raw=true) +<br/></br> +<br/></br> + +<tab>file4_total_differential_change + +![file4_total_differential_change](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file4_total_differential_change.gif?raw=true) +<br/></br> +<br/></br> + +<tab>file5_Total_differential_approximation + + ![file5_Total_differential_approximation](https://github.com/vnb09/FSF-mathematics-python-code-archive/blob/fsf_tasks/FSF-2020/calculus-of-several-variables/approximations-and-optimizations/Total-Differential/file5_Total_differential_approximation.gif?raw=true) + +<br/></br> +<br/></br> 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 Binary files differindex e00a946..2e148af 100644 --- 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 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 index a097a96..1fdd0b9 100644 --- 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 @@ -1,11 +1,15 @@ from manimlib.imports import* - -class firstScene(ThreeDScene): +#---- visualization of total differential dz between two points lying on the surface of the function +class differentialdz(ThreeDScene): def construct(self): - axes = ThreeDAxes().rotate(1.571) + 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 + + #---- surface of the funtion f(x,y) surface = ParametricSurface( lambda u, v: np.array([ u, @@ -13,8 +17,8 @@ class firstScene(ThreeDScene): 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) + d = Dot([1.4,1.75,1],color = '#00FFFF').rotate(1.571,UP) #---- point on the surface + d2 = Dot([2,2,1],color = '#00FFFF').rotate(1.571,UP) #---- point on the surface 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) @@ -33,8 +37,10 @@ class firstScene(ThreeDScene): 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.add(axes) + self.add(label_x) + self.add(label_y) self.wait(1) self.play(Write(plane)) self.play(Write(surface)) 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 Binary files differindex 620b49e..6baf271 100644 --- 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 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 index b40be70..1025210 100644 --- 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 @@ -1,16 +1,21 @@ from manimlib.imports import* - -class firstScene(ThreeDScene): - +#---- visualization of the differentials along the axes +class differentials(ThreeDScene): def construct(self): - axes = ThreeDAxes() + axes = ThreeDAxes() + label_x = TextMobject("$x$").shift([5.5,-0.3,0]).fade(0.4) #---- x axis + label_y = TextMobject("$y$").shift([-0.5,5.5,0]).rotate(-4.5).fade(0.4) #---- y axis - 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) + 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").shift([0,2.5,0.3]).scale(1.2) #----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) @@ -27,8 +32,8 @@ class firstScene(ThreeDScene): 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) + l3 = Line(color = '#FFDAB9').scale(0.8).shift(1.95*UP+0.7*RIGHT).rotate(1.571,DOWN).fade(0.2) + l4 = Line(color = '#FFDAB9').scale(0.6).shift(2.86*UP+0.9*RIGHT).rotate(1.571,DOWN).fade(0.2) 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) @@ -43,12 +48,12 @@ class firstScene(ThreeDScene): 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.add(axes) + self.add(label_x) + self.add(label_y) self.play(Write(plane)) - self.play(ShowCreation(label_y)) - self.add_fixed_in_frame_mobjects(label_x) - self.play(Write(s)) + self.play(Write(surface)) self.add_fixed_in_frame_mobjects(label) self.wait(1) self.play(Write(d),Write(d2)) 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 Binary files differindex 5aae2a1..a54d2da 100644 --- 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 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 index b29a7a3..b8d6f96 100644 --- 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 @@ -1,8 +1,16 @@ from manimlib.imports import* -class firstScene(ThreeDScene): +#---- visualization of total differential definition +class totaldifferential(ThreeDScene): def construct(self): axes = ThreeDAxes().fade(0.5) + 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).shift([1,0.8,1.5]).scale(2) + 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) @@ -57,17 +65,19 @@ class firstScene(ThreeDScene): self.add_fixed_in_frame_mobjects(label_y) self.add_fixed_in_frame_mobjects(label_z) self.wait(1) + self.play(Write(surface)) + 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(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(FadeOut(surface)) self.play(ShowCreation(d3)) self.add_fixed_in_frame_mobjects(d3_text) self.play(ShowCreation(m1_line)) @@ -88,4 +98,3 @@ class firstScene(ThreeDScene): self.play(ShowCreation(delx)) self.add_fixed_in_frame_mobjects(delx_text) self.wait(1) - 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 Binary files differindex 4f4627d..ebbf240 100644 --- 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 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 index 83017ed..e7b39bb 100644 --- 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 @@ -1,11 +1,14 @@ from manimlib.imports import* - -class firstScene(ThreeDScene): +#---- approximation value of function between two points using total differentials +class approximation(ThreeDScene): def construct(self): - axes = ThreeDAxes().rotate(1.571) + axes = ThreeDAxes() + label_x = TextMobject("$x$").shift([5.5,-0.3,0]).fade(0.4) #---- x axis + label_y = TextMobject("$y$").shift([-0.5,5.5,0]).rotate(-4.5).fade(0.4) #---- y axis + surface = ParametricSurface( lambda u, v: np.array([ np.sin(u), @@ -29,9 +32,10 @@ class firstScene(ThreeDScene): 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.add(axes) + self.add(label_x) + self.add(label_y) self.wait(1) self.play(Write(plane)) self.wait(1) |