A community-maintained Python framework for creating mathematical animations.
Heat equation scenes up to ShowPartialDerivativeSymbols
Grant Sanderson814c9d1252f9
diff --git a/active_projects/ode/all_part2_scenes.py b/active_projects/ode/all_part2_scenes.pyindex 718d0c9ec..3961f4da2 100644--- a/active_projects/ode/all_part2_scenes.py+++ b/active_projects/ode/all_part2_scenes.py@@ -38,6 +38,7 @@ ALL_SCENE_CLASSES = [ShowCubeFormation,CompareInputsOfGeneralCaseTo1D,ContrastXChangesToTChanges,+ ShowPartialDerivativeSymbols,TransitionToTempVsTime,ShowNewton,ShowCupOfWater,diff --git a/active_projects/ode/part2/heat_equation.py b/active_projects/ode/part2/heat_equation.pyindex 9f0fcbb99..49be19765 100644--- a/active_projects/ode/part2/heat_equation.py+++ b/active_projects/ode/part2/heat_equation.py@@ -1023,6 +1023,7 @@ class ContrastXChangesToTChanges(TalkThrough1DHeatGraph):plane = self.input_planeplane_copy = plane.copy()plane_copy.set_color(BLUE_E)+ plane_copy.shift(SMALL_BUFF * 0.5 * OUT)plane_copy1 = plane_copy.copy()plane_copy1.stretch(0.01, 1, about_edge=DOWN)diff --git a/active_projects/ode/part2/wordy_scenes.py b/active_projects/ode/part2/wordy_scenes.pyindex 7312b67ec..64ca7bf94 100644--- a/active_projects/ode/part2/wordy_scenes.py+++ b/active_projects/ode/part2/wordy_scenes.py@@ -11,6 +11,105 @@ class TodaysTargetWrapper(Scene):pass+class ShowPartialDerivativeSymbols(Scene):+ def construct(self):+ t2c = {+ "{x}": GREEN,+ "{t}": PINK,+ }+ d_derivs, del_derivs = VGroup(*[+ VGroup(*[+ TexMobject(+ "{" + sym, "T", "\\over", sym, var + "}",+ "(", "{x}", ",", "{t}", ")",+ ).set_color_by_tex_to_color_map(t2c)+ for var in ("{x}", "{t}")+ ])+ for sym in ("d", "\\partial")+ ])+ dTdx, dTdt = d_derivs+ delTdelx, delTdelx = del_derivs+ dels = VGroup(*it.chain(*[+ del_deriv.get_parts_by_tex("\\partial")+ for del_deriv in del_derivs+ ]))++ dTdx.to_edge(UP)+ self.play(FadeInFrom(dTdx, DOWN))+ self.wait()+ self.play(ShowCreationThenFadeAround(dTdx[3:5]))+ self.play(ShowCreationThenFadeAround(dTdx[:2]))+ self.wait()++ dTdt.move_to(dTdx)+ self.play(+ dTdx.next_to, dTdt, RIGHT, {"buff": 1.5},+ dTdx.set_opacity, 0.5,+ FadeInFromDown(dTdt)+ )+ self.wait()++ for m1, m2 in zip(d_derivs, del_derivs):+ m2.move_to(m1)++ pd_words = TextMobject("Partial derivatives")+ pd_words.next_to(del_derivs, DOWN, MED_LARGE_BUFF)++ self.play(+ Write(pd_words),+ dTdx.set_opacity, 1,+ run_time=1,+ )+ self.wait()+ self.play(+ ReplacementTransform(d_derivs, del_derivs)+ )+ self.play(+ LaggedStartMap(+ ShowCreationThenFadeAround,+ dels,+ surrounding_rectangle_config={+ "color": BLUE,+ "buff": 0.5 * SMALL_BUFF,+ "stroke_width": 2,+ }+ )+ )+ self.wait()++ num_words = VGroup(*[+ TextMobject(+ "Change in $T$\\\\caused by {}",+ "$\\partial$", "${}$".format(var),+ arg_separator="",+ ).set_color_by_tex_to_color_map(t2c)+ for var in ("{x}", "{t}")+ ])+ num_words.scale(0.8)+ for word, deriv in zip(num_words, del_derivs):+ num = deriv[:2]+ word.move_to(num, UP)+ word.to_edge(UP, buff=MED_SMALL_BUFF)+ deriv.rect = SurroundingRectangle(+ num,+ buff=SMALL_BUFF,+ stroke_width=2,+ )+ deriv.rect.mob = num+ deriv.rect.add_updater(lambda r: r.move_to(r.mob))++ self.play(+ Write(num_words[1]),+ VGroup(del_derivs, pd_words).shift, DOWN,+ ShowCreation(del_derivs[1].rect),+ )+ self.play(+ Write(num_words[0]),+ ShowCreation(del_derivs[0].rect),+ )+ self.wait()++class WriteHeatEquation(Scene):CONFIG = {"tex_mobject_config": {