diff options
Diffstat (limited to 'FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives')
9 files changed, 70 insertions, 31 deletions
diff --git a/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/Partial_Derivatives_Quiz.pdf b/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/Partial_Derivatives_Quiz.pdf Binary files differnew file mode 100644 index 0000000..12559d8 --- /dev/null +++ b/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/Partial_Derivatives_Quiz.pdf diff --git a/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/file2_partial_deriv_hill.py b/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/file2_partial_deriv_hill.py index bfb7687..cd24859 100644 --- a/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/file2_partial_deriv_hill.py +++ b/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/file2_partial_deriv_hill.py @@ -17,7 +17,7 @@ class Hill(ThreeDScene): u,
0,
2 - u*u
- ]),color=RED_E,t_min=-1.2,t_max=1.2,
+ ]),color=RED_E,t_min=0,t_max=1.2,
)
func_y =ParametricFunction(
@@ -25,7 +25,7 @@ class Hill(ThreeDScene): 0,
u,
2 - 1.5*u*u
- ]),color=PINK,t_min=-1.2,t_max=1.2,
+ ]),color=PINK,t_min=0,t_max=1.2,
)
self.set_camera_orientation(phi=60 * DEGREES, theta = 0*DEGREES)
@@ -51,18 +51,29 @@ class Hill(ThreeDScene): text_x[1].set_color(PINK)
- slope_text_x = TexMobject("Slope =", "{\\partial", "f", "\\over", "\\partial", "x}").scale(0.6).move_to(2*UP + 3.5*RIGHT)
+ slope_text_x = TexMobject("Slope =", "{\\partial", "f", "\\over", "\\partial", "x}", "=").scale(0.6).move_to(2*UP + 3.5*RIGHT)
slope_text_x[0].set_color(BLUE_E)
slope_text_x.set_color_by_tex("\\partial",YELLOW_C)
slope_text_x.set_color_by_tex("f",RED_E)
slope_text_x[5].set_color(PINK)
- self.add_fixed_in_frame_mobjects(text_x, slope_text_x)
+ number_x = DecimalNumber(0,color=RED_C).scale(0.7).next_to(slope_text_x, RIGHT)
+
+ prev_x_x = 0.01
+ prev_x_z = 2
+
+ self.add_fixed_in_frame_mobjects(text_x, slope_text_x, number_x)
dot_x = Dot().rotate(PI/2).set_color(YELLOW_E)
alpha_x = ValueTracker(0)
vector_x = self.get_tangent_vector(alpha_x.get_value(),func_x,scale=1.5)
dot_x.add_updater(lambda m: m.move_to(vector_x.get_center()))
+ number_x.add_updater(lambda m: m.set_value((dot_x.get_center()[2] - prev_x_z)/(dot_x.get_center()[0] - prev_x_x)))
+ number_x.add_updater(lambda m: self.add_fixed_in_frame_mobjects(m))
+
+ prev_x_x = (dot_x.get_center()[0])
+ prev_x_z = (dot_x.get_center()[2])
+
self.play(
ShowCreation(func_x),
GrowFromCenter(dot_x),
@@ -76,27 +87,39 @@ class Hill(ThreeDScene): self.add(vector_x,dot_x)
- self.play(alpha_x.increment_value, 1, run_time=10, rate_func=linear)
+ self.play(alpha_x.increment_value, 1, run_time=3, rate_func=linear)
#self.move_camera(phi=60 * DEGREES, theta = 0*DEGREES)
- self.play(FadeOut(vector_x), FadeOut(dot_x), FadeOut(func_x), FadeOut(text_x), FadeOut(slope_text_x))
+ self.play(FadeOut(number_x), FadeOut(vector_x), FadeOut(dot_x), FadeOut(func_x), FadeOut(text_x), FadeOut(slope_text_x))
text_y = TextMobject("Slope of the hill along", r"$y$", "axis", color = YELLOW_C).scale(0.6).move_to(2.7*UP + 3.5*RIGHT)
text_y[1].set_color(RED_C)
- slope_text_y = TexMobject("Slope =", "{\\partial", "f", "\\over", "\\partial", "x}").scale(0.6).move_to(2*UP + 3.5*RIGHT)
+ slope_text_y = TexMobject("Slope =", "{\\partial", "f", "\\over", "\\partial", "y}").scale(0.6).move_to(2*UP + 3.5*RIGHT)
slope_text_y[0].set_color(BLUE_E)
slope_text_y.set_color_by_tex("\\partial",YELLOW_C)
slope_text_y.set_color_by_tex("f",PINK)
slope_text_y[5].set_color(RED_C)
- self.add_fixed_in_frame_mobjects(text_y, slope_text_y)
+ number_y = DecimalNumber(0,color=RED_C).scale(0.7).next_to(slope_text_y, RIGHT)
+
+ prev_y_x = 0.01
+ prev_y_z = 2
+
+ self.add_fixed_in_frame_mobjects(text_y, slope_text_y, number_y)
dot_y = Dot().rotate(PI/2).set_color(BLUE_E)
alpha_y = ValueTracker(0)
vector_y = self.get_tangent_vector(alpha_y.get_value(),func_y,scale=1.5)
dot_y.add_updater(lambda m: m.move_to(vector_y.get_center()))
+ number_y.add_updater(lambda m: m.set_value((dot_y.get_center()[2] - prev_y_z)/(dot_y.get_center()[0] - prev_y_x)))
+ number_y.add_updater(lambda m: self.add_fixed_in_frame_mobjects(m))
+
+ prev_y_x = (dot_y.get_center()[0])
+ prev_y_z = (dot_y.get_center()[2])
+
+
self.play(
ShowCreation(func_y),
GrowFromCenter(dot_y),
@@ -109,8 +132,8 @@ class Hill(ThreeDScene): )
self.add(vector_y,dot_y)
- self.play(alpha_y.increment_value, 1, run_time=10, rate_func=linear)
- self.play(FadeOut(vector_y), FadeOut(dot_y), FadeOut(func_y), FadeOut(text_y), FadeOut(slope_text_y))
+ self.play(alpha_y.increment_value, 1, run_time=3, rate_func=linear)
+ self.play(FadeOut(number_y), FadeOut(vector_y), FadeOut(dot_y), FadeOut(func_y), FadeOut(text_y), FadeOut(slope_text_y))
self.wait(2)
def get_tangent_vector(self, proportion, curve, dx=0.001, scale=1):
diff --git a/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/file3_partial_deriv_defn.py b/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/file3_partial_deriv_defn.py index a25ca56..2b60e16 100644 --- a/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/file3_partial_deriv_defn.py +++ b/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/file3_partial_deriv_defn.py @@ -54,7 +54,7 @@ class PartialDeriv(ThreeDScene): plane2 = Polygon(np.array([0,-2.2,-2.5]),np.array([0,2.2,-2.5]),np.array([0,2.2,2.5]),np.array([0,-2.2,2.5]),np.array([0,-2.2,-2.5]), color = BLUE, fill_color = BLUE, fill_opacity = 0.2)
plane2_text = TextMobject(r"$x = 0$", color = BLUE_C).move_to(2*UP + 3.2*RIGHT)
- surface_eqn = TextMobject("Surface", r"$z = 2- x^2 -y^2$", color = YELLOW_C).scale(0.6).move_to(np.array([3*LEFT +3*UP]))
+ surface_eqn = TextMobject("Surface", r"$z = f(x,y) = 2 - x^2 - y^2$", color = YELLOW_C).scale(0.6).move_to(np.array([3*LEFT +3*UP]))
surface_eqn[0].set_color(PINK)
dot1 =Sphere(radius=0.08).move_to(np.array([-1,0,1]))
diff --git a/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/file4_partial_deriv_example.py b/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/file4_partial_deriv_example.py index 5712a62..0a5832d 100644 --- a/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/file4_partial_deriv_example.py +++ b/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/file4_partial_deriv_example.py @@ -35,8 +35,8 @@ class PartialDerivX(ThreeDScene): plane = Polygon(np.array([-2.2,0,-2.5]),np.array([2.2,0,-2.5]),np.array([2.2,0,2.5]),np.array([-2.2,0,2.5]),np.array([-2.2,0,-2.5]), color = GREEN, fill_color = GREEN, fill_opacity = 0.2)
plane_text = TextMobject(r"$y = 0$", color = GREEN_C).move_to(2*UP + 3*RIGHT)
- surface_eqn = TextMobject("Surface", r"$z = 2- x^2 -y^2$", color = PINK).scale(0.6).move_to(np.array([3*LEFT +3*UP]))
- surface_eqn[0].set_color(BLUE_C)
+ surface_eqn = TextMobject("Surface", r"$z = f(x,y) = 2 - x^2 - y^2$", color = BLUE_C).scale(0.6).move_to(np.array([3*LEFT +3*UP]))
+ surface_eqn[0].set_color(PINK)
line = Line(np.array([-2,0,0]), np.array([2,0,0]), color = RED_C)
@@ -104,7 +104,7 @@ class PartialDerivX(ThreeDScene): '''
for i in np.arange(-2,2,0.2):
- self.play(ReplacementTransform(Line(np.array([i,0,0]), np.array([i,0,-i*i + 2]), color = GREEN_C), Line(np.array([i+0.2,0,0]), np.array([i+0.2,0,-(i+0.2)**2 + 2]), color = GREEN_C)))
+ self.play(ReplacementTransform(Line(np.array([i,0,0]), np.array([i,0,-i*i + 2]), color = GREEN_C), Line(np.array([i+0.2,0,0]), np.array([i+0.2,0,-(i+0.2)**2 + 2]), color = GREEN_C)))
#self.wait()
'''
@@ -160,8 +160,8 @@ class PartialDerivY(ThreeDScene): plane = Polygon(np.array([0,-2.2,-2.5]),np.array([0,2.2,-2.5]),np.array([0,2.2,2.5]),np.array([0,-2.2,2.5]),np.array([0,-2.2,-2.5]), color = BLUE, fill_color = BLUE, fill_opacity = 0.2)
plane_text = TextMobject(r"$x = 0$", color = BLUE_C).move_to(2*UP + 3*RIGHT)
- surface_eqn = TextMobject("Surface", r"$z = 2- x^2 -y^2$", color = PINK).scale(0.6).move_to(np.array([3*LEFT +3*UP]))
- surface_eqn[0].set_color(BLUE_C)
+ surface_eqn = TextMobject("Surface", r"$z = f(x,y) = 2 - x^2 - y^2$", color = BLUE_C ).scale(0.6).move_to(np.array([3*LEFT +3*UP]))
+ surface_eqn[0].set_color(PINK)
line = Line(np.array([0,-2,0]), np.array([0,2,0]), color = RED_C)
@@ -223,7 +223,7 @@ class PartialDerivY(ThreeDScene): '''
for i in np.arange(-2,2,0.2):
- self.play(ReplacementTransform(Line(np.array([0,i,0]), np.array([0,i,-i*i + 2]), color = BLUE_C), Line(np.array([0,i+0.2,0]), np.array([0,i+0.2,-(i+0.2)**2 + 2]), color = BLUE_C)))
+ self.play(ReplacementTransform(Line(np.array([0,i,0]), np.array([0,i,-i*i + 2]), color = BLUE_C), Line(np.array([0,i+0.2,0]), np.array([0,i+0.2,-(i+0.2)**2 + 2]), color = BLUE_C)))
#self.wait()
'''
diff --git a/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/file7_partial_deriv_clariant_rule.py b/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/file7_partial_deriv_clariant_rule.py index 313c6cd..b48f172 100644 --- a/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/file7_partial_deriv_clariant_rule.py +++ b/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/file7_partial_deriv_clariant_rule.py @@ -12,9 +12,13 @@ class ClariantRule(ThreeDScene): ]),u_min=0,u_max=PI,v_min=0,v_max=2*PI, color = BLUE_C, fill_color = BLUE_C, fill_opacity = 0.1,
resolution=(15, 32)).scale(1)
-
- function_copy1 = function.copy()
- function_copy2 = function.copy()
+ function_x = ParametricSurface(
+ lambda u, v: np.array([
+ 3.5*np.sin(u)*np.cos(v),
+ 3.5*np.sin(u)*np.sin(v),
+ -4*3.5*3.5*3.5*np.sin(u)*np.sin(u)*np.sin(u)*(2*np.sin(v)*np.sin(v))*np.exp(1 - 3.5*3.5*np.sin(u)*np.sin(u))
+ ]),u_min=0,u_max=PI,v_min=0,v_max=2*PI, color = BLUE_C, fill_color = BLUE_C, fill_opacity = 0.1,
+ resolution=(15, 32)).scale(1)
func_x =ParametricFunction(
lambda u : np.array([
@@ -38,8 +42,11 @@ class ClariantRule(ThreeDScene): plane_y = Polygon(np.array([0,-3.5,-3]),np.array([0,3.5,-3]),np.array([0,3.5,3]),np.array([0,-3.5,3]),np.array([0,-3.5,-3]), color = GREEN_E, fill_color = GREEN_B, fill_opacity = 0.1)
plane_text_y = TextMobject(r"$x = 0$", color = GREEN_C).move_to(np.array([0,4,2.7])).scale(0.7)
- surface_eqn = TextMobject("Surface", r"$z = (x^2 + 3y^2)e^{(1 - x^2 - y^2)}$", color = YELLOW_C).scale(0.6).move_to(np.array([4.6*LEFT+3.5*UP]))
+ surface_eqn = TextMobject("Surface", r"$z = f(x,y) = (x^2 + 3y^2)e^{(1 - x^2 - y^2)}$", color = YELLOW_C).scale(0.6).move_to(np.array([4.1*LEFT+3.8*UP]))
surface_eqn[0].set_color(BLUE_C)
+ number_plane = NumberPlane()
+
+ line = Line(np.array([0,-1,3]), np.array([0,-1,-3]), color = PURPLE)
self.set_camera_orientation(phi=60 * DEGREES, theta = 45*DEGREES)
@@ -54,15 +61,20 @@ class ClariantRule(ThreeDScene): self.add_fixed_orientation_mobjects(axis[1])
self.play(ShowCreation(function))
+ self.wait()
+ self.play(ShowCreation(number_plane))
self.add_fixed_in_frame_mobjects(surface_eqn)
- self.play(ShowCreation(plane_x), ShowCreation(plane_y))
+ self.play(ShowCreation(plane_x), ShowCreation(plane_y), ShowCreation(line))
self.add_fixed_orientation_mobjects(plane_text_x, plane_text_y)
- self.play(ShowCreation(func_x), ShowCreation(func_y))
+ self.move_camera(phi=0* DEGREES,theta=45*DEGREES)
+ self.wait(3)
+ self.move_camera(phi=60* DEGREES,theta=45*DEGREES)
+ #self.play(ShowCreation(func_x), ShowCreation(func_y))
- dot_x = Dot().rotate(PI/2).set_color(YELLOW_E)
+ dot_x = Dot().rotate(PI/2).set_color(YELLOW_C)
alpha_x = ValueTracker(0)
vector_x = self.get_tangent_vector(alpha_x.get_value(),func_x,scale=1.5)
dot_x.add_updater(lambda m: m.move_to(vector_x.get_center()))
@@ -92,17 +104,21 @@ class ClariantRule(ThreeDScene): )
self.add(vector_x,dot_x)
- self.play(alpha_x.increment_value, 1, run_time=10, rate_func=linear)
+ self.play(alpha_x.increment_value, 1, run_time=5, rate_func=linear)
self.add(vector_y,dot_y)
- self.play(alpha_y.increment_value, 1, run_time=10, rate_func=linear)
+ self.play(alpha_y.increment_value, 1, run_time=5, rate_func=linear)
self.wait(2)
-
-
-
-
+
-
+ def get_tangent_vector(self, proportion, curve, dx=0.001, scale=1):
+ coord_i = curve.point_from_proportion(proportion)
+ coord_f = curve.point_from_proportion(proportion + dx)
+ reference_line = Line(coord_i,coord_f)
+ unit_vector = reference_line.get_unit_vector() * scale
+ vector = Line(coord_i - unit_vector, coord_i + unit_vector, color = ORANGE, buff=0)
+ return vector
+
diff --git a/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/gifs/file2_partial_deriv_hill.gif b/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/gifs/file2_partial_deriv_hill.gif Binary files differindex 3c758ff..d74ac4d 100644 --- a/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/gifs/file2_partial_deriv_hill.gif +++ b/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/gifs/file2_partial_deriv_hill.gif diff --git a/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/gifs/file3_partial_deriv_defn.gif b/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/gifs/file3_partial_deriv_defn.gif Binary files differindex c66b3fa..4dd1eee 100644 --- a/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/gifs/file3_partial_deriv_defn.gif +++ b/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/gifs/file3_partial_deriv_defn.gif diff --git a/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/gifs/file4_partial_deriv_example.gif b/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/gifs/file4_partial_deriv_example.gif Binary files differindex d2bf541..32cce4c 100644 --- a/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/gifs/file4_partial_deriv_example.gif +++ b/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/gifs/file4_partial_deriv_example.gif diff --git a/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/gifs/file7_partial_deriv_clariant_rule.gif b/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/gifs/file7_partial_deriv_clariant_rule.gif Binary files differindex 32d5e92..ca5beda 100644 --- a/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/gifs/file7_partial_deriv_clariant_rule.gif +++ b/FSF-2020/calculus-of-several-variables/multivariable-functions-and-paritial-derivatives/partial-derivatives/gifs/file7_partial_deriv_clariant_rule.gif |