diff options
author | Vaishnavi | 2020-06-24 04:56:35 +0530 |
---|---|---|
committer | GitHub | 2020-06-24 04:56:35 +0530 |
commit | 6c1c19388c3c24c5a0b91ac82272e015a004484c (patch) | |
tree | 0d534a170a6e5f87972e0dfb32c22e2a3300ac62 /FSF-2020/approximations-and-optimizations/The-Second-Derivative-Test | |
parent | efcd9e6b2bc7865523cf428827829d0430450a3a (diff) | |
download | FSF-mathematics-python-code-archive-6c1c19388c3c24c5a0b91ac82272e015a004484c.tar.gz FSF-mathematics-python-code-archive-6c1c19388c3c24c5a0b91ac82272e015a004484c.tar.bz2 FSF-mathematics-python-code-archive-6c1c19388c3c24c5a0b91ac82272e015a004484c.zip |
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
Diffstat (limited to 'FSF-2020/approximations-and-optimizations/The-Second-Derivative-Test')
-rw-r--r-- | FSF-2020/approximations-and-optimizations/The-Second-Derivative-Test/file1_Second_order_partial_derivatives.py | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/FSF-2020/approximations-and-optimizations/The-Second-Derivative-Test/file1_Second_order_partial_derivatives.py b/FSF-2020/approximations-and-optimizations/The-Second-Derivative-Test/file1_Second_order_partial_derivatives.py deleted file mode 100644 index 84052cc..0000000 --- a/FSF-2020/approximations-and-optimizations/The-Second-Derivative-Test/file1_Second_order_partial_derivatives.py +++ /dev/null @@ -1,78 +0,0 @@ -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) |