Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
3.4 kB
2
Indexable
Never
class OnePointSevenD(Scene):
    def construct(self):
        s21 = Tex(r'''$
                \Delta(W) = \left\{
                    \begin{array}{ll}
                        0 & \quad \text{if} \, s \notin W, t \notin W \\
                        \Phi_{\text{tot}}(F) & \quad \text{if} \, s \in W, t \notin W \\
                        -\Phi_{\text{tot}}(F) & \quad \text{if} \, s \notin W, t \in W \\
                        0 & \quad \text{if} \, s \in W, t \in W
                    \end{array}
                \right.
                $''', font_size=tex_font_size).to_edge(LEFT).to_edge(UP)

        # part i
        s22 = Tex(r"1. Let $W' \subset V$ where $s \notin W'$ and $t \notin W'$", font_size=tex_font_size).next_to(s21, DOWN, MED_LARGE_BUFF).to_edge(LEFT)
        s23 = Tex(r"$\Delta(W) = \Delta(W') = 0$ from (iii)", font_size=tex_font_size).next_to(s22, DOWN).to_edge(LEFT)

        # part ii
        s24 = Tex(r"2. If $W = W' \cup {s}$", font_size=tex_font_size).to_edge(RIGHT).to_edge(UP)
        s25 = Tex(r"$\Delta(W) = \Delta(W' \cup {s})$", font_size=tex_font_size).next_to(s24, DOWN).to_edge(RIGHT)
        s26 = Tex(r"$= \Delta(W') + \Sigma_{v \in V}f_{sv} - \Sigma_{u \in V}f_{us}$", font_size=tex_font_size).next_to(s25, DOWN).to_edge(RIGHT)
        s27 = Tex(r"$= 0 + \Phi_{in}(F)$", font_size=tex_font_size).next_to(s26, DOWN).to_edge(RIGHT)
        s28 = Tex(r"$= \Phi_{tot}$", font_size=tex_font_size).next_to(s27, DOWN).to_edge(RIGHT)

        # part iii
        s29 = Tex(r"3. If $W = W' \cup {t}$", font_size=tex_font_size).next_to(s22, DOWN, LARGE_BUFF).to_edge(LEFT)
        s30 = Tex(r"$\Delta(W) = \Delta(W' \cup {t})$", font_size=tex_font_size).next_to(s29, DOWN).to_edge(LEFT)
        s31 = Tex(r"$= \Delta(W') + \Sigma_{v \in V}f_{tv} - \Sigma_{u \in V}f_{ut}$", font_size=tex_font_size).next_to(s30, DOWN).to_edge(LEFT)
        s32 = Tex(r"$= 0 - \Phi_{out}(F)$ by (iii)", font_size=tex_font_size).next_to(s31, DOWN).to_edge(LEFT)
        s33 = Tex(r"$= -\Phi_{tot}$", font_size=tex_font_size).next_to(s32, DOWN).to_edge(LEFT)

        # part iv
        s34 = Tex(r"4. If $W = W' \cup {s, t}$", font_size=tex_font_size).next_to(s28, DOWN, LARGE_BUFF).to_edge(RIGHT)
        s35 = Tex(r"$\Delta(W) = \Delta((W' \cup {s}) \cup {t})$", font_size=tex_font_size).next_to(s34, DOWN).to_edge(RIGHT)
        s36 = Tex(r"$= \Delta(W' \cup {s}) + \Sigma_{v \in V}f_{tv} - \Sigma{u \in V}f_{ut}$ by (ii)", font_size=tex_font_size).next_to(s35, DOWN).to_edge(RIGHT)
        s37 = Tex(r"$= \Phi_{in}(F) - \Phi_{out}(F)$", font_size=tex_font_size).next_to(s36, DOWN).to_edge(RIGHT)
        s38 = Tex(r"$= \Phi_{tot}(F) - \Phi_{tot}(F)$ by definition of $\Phi_{tot}(F)$", font_size=tex_font_size).next_to(s37, DOWN).to_edge(RIGHT)
        s39 = Tex(r"$= 0$", font_size=tex_font_size).next_to(s38, DOWN).to_edge(RIGHT)

        animations = [
            Write(s21),
            Write(s22),
            Write(s23),
            Write(s24),
            Write(s25),
            Write(s26),
            Write(s27),
            Write(s28),
            Write(s29),
            Write(s30),
            Write(s31),
            Write(s32),
            Write(s33),
            Write(s34),
            Write(s35),
            Write(s36),
            Write(s37),
            Write(s38),
            Write(s39)
        ]

        self.play(AnimationGroup(*animations, lag_ratio=2))