Пример #1
0
    def setup(self):
        self.shift = 1.1
        shift = self.shift

        self.omega1 = Omega1()
        self.omega1.shift(shift * UP)
        self.omega1_brace = BraceDesc(self.omega1, "\\omega_1", UP)
        self.add(self.omega1, self.omega1_brace)

        # countable subset

        omega = OrdinalOmega(x1=-2)
        omega.stretch(0.5, 1)
        omega.next_to(self.omega1[1])
        self.count_subset = VGroup(
            self.omega1[1][0],
            LimitSubOrdinal([subord[0] for subord in self.omega1[1][1:]]),
        ).copy()
        self.count_subset.add(omega)
        self.al_count_subset = VGroup(self.omega1[1][:3]).copy()
        self.shifted_count_subset = self.count_subset.copy()
        VGroup(self.al_count_subset,
               self.shifted_count_subset).shift(2 * shift * DOWN)
        omega.stretch_in_place(0, 1)

        self.count_brace = BraceText(self.al_count_subset, "spočetná")
Пример #2
0
    def setup(self):
        self.shift = 1.1
        shift = self.shift

        self.omega = OrdinalOmega()
        self.omega_brace = BraceDesc(self.omega, "\\omega", UP)
        self.omega.set_color(BLUE)

        self.add(self.omega, self.omega_brace)

        # finite subset

        self.subset_fin = VGroup(self.omega[2:30:3]).copy()
        self.al_subset_fin = VGroup(self.omega[:len(self.subset_fin)]).copy()
        self.shifted_subset_fin = self.subset_fin.copy()
        VGroup(self.al_subset_fin, self.shifted_subset_fin).shift(shift * DOWN)

        self.brace_fin = BraceText(self.al_subset_fin, "konečná")

        # infinite subset

        self.subset_inf = LimitSubOrdinal(
            [bar for i, bar in enumerate(self.omega) if is_prime(i)]).copy()
        self.al_subset_inf = self.omega.copy()
        self.shifted_subset_inf = self.subset_inf.copy()
        self.subset_inf.shift(shift * UP)
        VGroup(self.al_subset_inf, self.shifted_subset_inf).shift(shift * DOWN)
        self.brace_inf = BraceText(self.al_subset_inf, "stejná")
Пример #3
0
    def construct(self):

        omega = OrdinalOmega()
        omega_brace = BraceDesc(omega, "\\omega", UP)
        self.add(omega_brace)
        omega, _ = self.play_infinite_supremum(waits=(4, 5.1))
        fin_index = 12
        bar = omega[fin_index].copy()
        bar.highlight(YELLOW)
        arrow = Arrow(
            bar.get_edge_center(DOWN) + DOWN,
            bar.get_edge_center(DOWN),
        )
        label = TextMobject("konečný ordinál").next_to(arrow, DOWN)

        self.wait_to(16)
        self.play(
            ShowCreation(bar),
            ShowCreation(arrow),
            FadeIn(label),
        )

        finite_brace = Brace(VGroup(omega[:fin_index]), DOWN)
        brace_label = label.copy()
        finite_brace.put_at_tip(brace_label)

        self.wait_to(20.3)
        self.play(
            GrowFromCenter(finite_brace),
            ReplacementTransform(label, brace_label),
        )

        terminal_segment_brace = BraceText(
            Line(omega[fin_index + 1].get_center() + DOWN,
                 omega.get_edge_center(RIGHT)), "nekonečno")
        self.wait_to(25.5)
        self.play(terminal_segment_brace.creation_anim())

        self.wait_to(41)
        self.play(
            FadeOut(
                VGroup(
                    finite_brace,
                    brace_label,
                    terminal_segment_brace,
                    bar,
                    arrow,
                )))
Пример #4
0
    def construct(self):

        negatives = VGroup(*[self.number_tex(-n) for n in range(9)])
        positives = VGroup(*[self.number_tex(n) for n in range(9)])
        negatives.shift(UP)

        neg_brace = BraceDesc(negatives, "\\aleph_0", UP)
        pos_brace = BraceDesc(positives, "\\aleph_0", DOWN)

        self.play(ShowCreation(negatives))
        self.play(neg_brace.creation_anim())
        self.dither()

        self.play(ShowCreation(positives))
        self.play(pos_brace.creation_anim())
        self.dither()

        self.play(
            positives.shift,
            UP,
            pos_brace.shift,
            UP,
        )
        self.remove(positives[0])
        self.play(
            FadeOut(pos_brace),
            neg_brace.shift_brace,
            VGroup(negatives, negatives[-1].copy().move_to(positives[-1])),
        )
        self.dither()

        return
        conversation = Conversation(self)
        conversation.add_bubble("Hey, what happened to the merged zero?")
        self.dither()
        conversation.add_bubble("The size is still countable infinite.")
        self.dither()
Пример #5
0
    def construct(self):
        #self.force_skipping()

        self.cur_color = WHITE
        self.number_mul = 1
        self.make_numbers(num_num=14)
        self.numbers.to_corner(UP + LEFT)
        self.numbers.shift(1.5 * RIGHT)
        self.add(self.numbers)

        even, _, even_spaced, even_arranged = self.make_subset(
            lambda n: 2 * n, 3)
        odd, _, odd_spaced, odd_arranged = self.make_subset(
            lambda n: 2 * n + 1, 2)

        odd_arranged.highlight(YELLOW)
        even_arranged.highlight(RED)

        self.play(
            Transform(even, even_spaced),
            Transform(odd, odd_spaced),
        )
        self.play(
            Transform(even, even_arranged),
            Transform(odd, odd_arranged),
        )
        self.dither()

        colors = color_gradient([YELLOW, GREEN, BLUE], 6)
        ori_numbers = self.numbers
        self.numbers = even
        self.number_mul = 2
        self.cur_color = RED

        table = [odd]

        for index, color in enumerate(colors[1:]):
            subodd, _, _, subodd_arranged \
                = self.make_subset(lambda n: 2*n+1, 0)
            table += [subodd]
            subeven, _, subeven_spaced, subeven_arranged \
                = self.make_subset(lambda n: 2*n, 1)
            self.remove(self.numbers)
            self.add(subodd, subeven)
            subodd_arranged.highlight(color)

            self.play(Transform(subeven, subeven_spaced))
            if False and index < 2:
                self.play(Transform(subeven, subeven_arranged))
                self.dither()
                self.play(Transform(subodd, subodd_arranged))
                self.dither()
            else:
                self.play(
                    Transform(subeven, subeven_arranged),
                    Transform(subodd, subodd_arranged),
                )

            self.number_mul *= 2
            self.numbers = subeven

        missing_zero = ori_numbers[0].copy().highlight(RED)
        self.play(Write(missing_zero))
        self.remove(ori_numbers[0])
        ori_numbers.save_state()
        ori_numbers.remove(ori_numbers[0])
        self.play(missing_zero.behind_edge, DOWN)
        self.dither()

        h_brace = BraceDesc(odd, "\\aleph_0", UP)
        h_brace.desc.highlight(YELLOW)
        v_brace = BraceDesc(VGroup(odd, subeven), "\\aleph_0", LEFT)
        v_brace.desc.highlight(BLUE)
        v_brace.shift(0.2 * LEFT)
        self.play(
            FadeOut(ori_numbers),
            h_brace.creation_anim(),
        )
        self.dither()
        self.play(v_brace.creation_anim())

        self.dither()

        prod_formula = TexMobject("\\aleph_0", "\\cdot", "\\aleph_0",
                                  " = \\aleph_0")
        prod_formula[0].highlight(BLUE)
        prod_formula[2].highlight(YELLOW)
        prod_formula.to_corner(LEFT + UP)
        self.play(
            ReplacementTransform(v_brace.desc[0].copy(), prod_formula[0]),
            ReplacementTransform(h_brace.desc[0].copy(), prod_formula[2]),
        )
        self.play(Write(VGroup(prod_formula[1], prod_formula[3])))
        self.dither()

        table_but_first_column = VGroup(*[VGroup(*row[1:]) for row in table])
        self.play(
            FadeOut(VGroup(h_brace, v_brace, prod_formula)),
            table_but_first_column.set_fill,
            None,
            0.4,
        )

        formula_r_ori = None
        for i, row in enumerate(table[:4]):
            formula_r = TexMobject("2^{" + str(i) + "}=")
            formula_r.highlight(
                rgb_to_color(row[0].family_members_with_points()[0].fill_rgb))
            formula_r.next_to(row[0], LEFT, buff=0.3, aligned_edge=DOWN)

            if formula_r_ori is None: self.play(Write(formula_r))
            else: self.play(ReplacementTransform(formula_r_ori, formula_r))
            self.dither()

            formula_r_ori = formula_r

        formula_r = TexMobject("2^r=")
        formula_r.shift(formula_r_ori[0].get_center() -
                        formula_r[0].get_center())
        formula_r.highlight(BLUE)
        formula_r[-1].set_fill(opacity=0)
        formula_r.to_edge(DOWN)
        self.play(ReplacementTransform(formula_r_ori, formula_r))
        self.dither()

        self.play(table_but_first_column.set_fill, None, 1)
        table_but_first_row = VGroup(*table[1:])
        self.play(table_but_first_row.set_fill, None, 0.4)
        self.dither()

        formula_c = TexMobject("(2c+1)")
        formula_c.to_edge(UP)
        formula_c.highlight(YELLOW)
        self.play(Write(formula_c))
        self.dither()
        self.play(table_but_first_row.set_fill, None, 1)

        show_r = 3
        show_c = 5

        show_circ = Circle(radius=0.45)
        show_circ.highlight(GREEN)
        show_circ.move_to(table[show_r][show_c])

        show_r_circ = show_circ.copy()
        show_r_circ.move_to(table[show_r][0], coor_mask=X_MASK)
        show_r_circ.highlight(BLUE)

        show_c_circ = show_circ.copy()
        show_c_circ.move_to(table[0][show_c], coor_mask=Y_MASK)
        show_c_circ.highlight(YELLOW)

        self.play(ShowCreation(show_circ))
        self.play(ShowCreation(show_c_circ))
        self.play(ShowCreation(show_r_circ))
        self.dither()

        formula_prod = TexMobject("2^r", '\\cdot', "(2c+1)", "-1")
        formula_prod.to_corner(UP + LEFT)
        formula_prod[0].highlight(BLUE)
        formula_prod[2].highlight(YELLOW)

        self.play(
            FadeIn(formula_prod[1]),
            ReplacementTransform(formula_r.copy(), formula_prod[0]),
            ReplacementTransform(formula_c.copy(), formula_prod[2]),
        )
        self.dither()
        self.play(
            FadeOut(
                VGroup(formula_r, formula_c, show_circ, show_c_circ,
                       show_r_circ)))
        self.dither()

        pairs_table = VGroup(*[
            VGroup(*[self.pair_tex(r, c, mob) for c, mob in enumerate(row)])
            for r, row in enumerate(table)
        ])
        table = VGroup(*table)

        for row in table:
            for num in row:
                num.submobjects = [VGroup(digit) for digit in num.submobjects]

        self.revert_to_original_skipping_status()
        self.dither()
        self.play(ReplacementTransform(table, pairs_table))
        self.dither()

        h_shift = RIGHT * (table[0][1].get_center() - table[0][0].get_center())
        table = pairs_table
        table_dest = table.copy()
        for r, row in enumerate(table_dest):
            for c, num in enumerate(row):
                num.shift(h_shift * ((2**r) * (2 * c + 1) - 1 - c))
        self.play(Transform(table, table_dest))

        table_dest = table.copy()
        for row in table_dest:
            for num in row:
                num.move_to(2 * DOWN, coor_mask=Y_MASK)
        self.play(Transform(table, table_dest))
        self.dither()

        pairs_row = VGroup(*it.chain(*table))
        pairs_row.submobjects.sort(key=lambda mob: mob.get_center()[0])

        ori_numbers.restore()
        ori_numbers.shift(pairs_row[0].get_center() -
                          ori_numbers[1].get_center())
        ori_numbers.shift(2 * UP)
        self.add(ori_numbers)
        matching = VGroup(*[
            Line(num.get_edge_center(DOWN), pair.get_edge_center(UP), buff=0.2)
            for num, pair in zip(ori_numbers[1:], pairs_row)
        ])
        self.play(
            ShowCreation(ori_numbers),
            ShowCreation(matching),
        )
        self.dither()

        matching.add(matching[-1].copy())
        matching[-1].shift(h_shift)

        general_pair = TexMobject("r,c")
        general_pair[0].highlight(BLUE)
        general_pair[2].highlight(YELLOW)
        visible_formula_prod = VGroup(*formula_prod[:3])
        general_pair.move_to(visible_formula_prod)
        general_pair.shift(2 * DOWN)
        general_matching = Line(general_pair.get_edge_center(UP),
                                visible_formula_prod.get_edge_center(DOWN),
                                buff=0.2)
        self.play(FadeIn(general_pair))
        self.play(ShowCreation(general_matching))
        self.dither()

        self.play(Write(formula_prod[-1]))
        self.play(VGroup(matching, pairs_row).shift, -h_shift)
        self.dither()
Пример #6
0
    def construct(self):

        #self.force_skipping()

        self.make_numbers()
        self.numbers.to_corner(UP + LEFT)

        even, even_ori, even_spaced, even_arranged = self.make_subset(
            lambda n: 2 * n, 2)
        odd, odd_ori, odd_spaced, odd_arranged = self.make_subset(
            lambda n: 2 * n + 1, 3)

        self.add(self.numbers)

        self.play(Transform(even, even_spaced))
        VGroup(even_ori, even_spaced, even_arranged).highlight(RED)
        self.play(Transform(even, even_arranged))
        self.dither()

        self.play(Transform(odd, odd_spaced))
        VGroup(odd_ori, odd_spaced, odd_arranged).highlight(YELLOW)
        self.play(Transform(odd, odd_arranged))
        self.dither()

        brace = BraceDesc(odd, "\\aleph_0")
        self.play(brace.creation_anim())
        self.dither()

        self.play(
            Transform(even, even_spaced),
            Transform(odd, odd_spaced),
        )
        self.play(
            Transform(even, even_ori),
            Transform(odd, odd_ori),
        )
        self.remove(self.numbers)

        self.dither()
        self.play(
            Transform(even, even_spaced),
            Transform(odd, odd_spaced),
        )
        self.play(
            Transform(even, even_arranged),
            Transform(odd, odd_arranged),
        )
        self.dither()

        even_abstr = VGroup(
            *[Dot(num.get_center(), color=RED) for num in even])
        odd_abstr = VGroup(
            *[Dot(num.get_center(), color=YELLOW) for num in odd])
        self.play(
            Transform(even, even_abstr),
            Transform(odd, odd_abstr),
        )
        self.dither()

        apples_shrinked, apples, apples_spaced, apples_in_set \
            = self.make_fruit_set(Apple().scale(0.6),
                                  even_arranged, even_spaced, even_ori)
        pears_shrinked, pears, pears_spaced, pears_in_set \
            = self.make_fruit_set(Pear().scale(0.6),
                                  odd_arranged, odd_spaced, odd_ori)
        self.play(
            ReplacementTransform(apples_shrinked, apples),
            ReplacementTransform(pears_shrinked, pears),
        )
        self.remove(even, odd)
        self.dither()

        self.play(
            Transform(apples, apples_spaced),
            Transform(pears, pears_spaced),
        )
        self.play(
            Transform(apples, apples_in_set),
            Transform(pears, pears_in_set),
        )
        self.dither()

        sum_formula = TexMobject('\\aleph_0', '+', '\\aleph_0', "=\\aleph_0")
        sum_formula[0].highlight(RED)
        sum_formula[2].highlight(YELLOW)
        sum_formula.shift(BOTTOM / 2)
        self.play(Write(sum_formula))
        self.dither()
Пример #7
0
    def construct(self):

        self.h_space = 2
        self.colors = color_gradient(
            [YELLOW, GREEN, BLUE, DARK_BLUE, DARK_GRAY], 20)

        numbers = self.make_numbers()
        self.play(
            ShowCreation(numbers[0]),
            ShowCreation(numbers[1]),
        )
        brace = BraceDesc(numbers[0], "\\aleph_0", DOWN)
        brace.next_to(numbers[1], DOWN, coor_mask=Y_MASK, buff=0.3)
        self.play(brace.creation_anim())

        skip = False
        denominator = 2
        parts = []
        while True:
            parts.append(numbers[0].copy())
            self.add(parts[-1])
            self.play(VGroup(numbers, brace).shift, 0.9 * DOWN)
            self.remove(numbers)
            if denominator == 6: break
            numbers = self.make_numbers(denominator, numbers)
            ori_numbers = self.make_numbers(denominator - 1, numbers)
            if skip:
                offset = (len(ori_numbers[1]) // 2 + 1) % 2
                for label in ori_numbers[1][offset::2]:
                    label.set_fill(opacity=0)
            if denominator == 4: skip = True
            if skip:
                offset = (len(numbers[1]) // 2 + 1) % 2
                for label in numbers[1][offset::2]:
                    label.set_fill(opacity=0)

            self.play(ReplacementTransform(ori_numbers, numbers))
            denominator += 1

        self.dither()
        self.remove(brace, numbers)

        while denominator < len(self.colors) + 1:
            part = self.make_dots(denominator)
            part.move_to(parts[-1])
            part.shift(0.5 * DOWN)
            parts.append(part)
            denominator += 1

        parts.reverse()
        parts = VGroup(*parts)
        parts_dest = parts.copy()
        for part in parts_dest:
            part.center()
        self.play(Transform(parts, parts_dest), run_time=2)
        self.dither()

        rationals = TexMobject('|', "\\text{Rational Numbers}",
                               "| = \\aleph_0")
        rationals.shift(0.5 * DOWN - rationals[1].get_edge_center(UP))
        self.play(Write(rationals[1]))
        self.dither()

        dots7 = self.make_dots(7)
        dots7.shift(2 * DOWN)
        center = len(dots7) // 2
        pi_dot = dots7[center + 22]
        pi_label = TexMobject("\\frac{22}{7}")
        pi_label.next_to(pi_dot, DOWN)
        self.play(Write(pi_label))
        self.dither()
        self.play(ShowCreation(dots7))
        self.play(FocusOn2(pi_dot, scale=3))
        dots7.remove(pi_dot)
        self.play(FadeOut(dots7))
        self.play(VGroup(pi_dot, pi_label).shift, 2 * UP)
        self.dither()

        self.play(FadeOut(VGroup(pi_dot, pi_label)))
        self.play(Write(VGroup(rationals[0], rationals[2])))

        conversation1 = Conversation(self)
        conversation1.add_bubble("Are all sets countable?")
        self.dither()
        conversation2 = Conversation(self, start_answer=True)
        conversation2.add_bubble("Of course not.")
        self.dither()

        self.prepare_overall_picture()
        self.overall_picture.to_edge(UP, buff=0.4)
        self.overall_picture.remove(self.uncountable_brace)
        self.play(FadeIn(self.overall_picture))
        self.dither()
        self.play(self.uncountable_brace.creation_anim())
        self.dither()
        real_size = TexMobject("|\\mathbb R|")
        real_size.set_color(GREEN)
        real_size.next_to(self.sizes, buff=1)
        self.play(Write(real_size))
        self.dither()
Пример #8
0
    def construct(self):
        self.prepare_overall_picture()
        self.subtitle.to_edge(UP)
        self.add(self.subtitle)
        self.overall_picture.remove(self.finite_brace, self.infinite_brace)
        self.overall_picture.next_to(self.subtitle,
                                     DOWN,
                                     buff=0.5,
                                     coor_mask=Y_MASK)
        real_size = TexMobject("|\\mathbb R|")
        real_size.set_color(GREEN)
        real_size.next_to(self.sizes, buff=1)
        self.sizes.add(real_size)
        self.play(FadeIn(self.sizes))
        self.play(self.countable_brace.creation_anim())
        self.play(self.uncountable_brace.creation_anim())

        ordinal_bg = OrdinalFiniteProd(OrdinalOmega, 3, x1=8)
        ordinal_bg.shift(2 * DOWN)
        ordinals_title = TextMobject("Ordinály")
        ordinals_title.next_to(ordinal_bg, UP, aligned_edge=LEFT, buff=0.3)
        ordinal = VGroup(ordinal_bg[0], VGroup(*ordinal_bg[1][:3])).copy()
        ordinal_bg.set_color(DARK_GREY)
        self.wait_to(3.7)
        self.play(FadeIn(ordinal_bg), FadeIn(ordinals_title))
        self.play(ShowCreation(ordinal[0]))
        self.play(ShowCreation(ordinal[1]))
        self.dither()
        self.wait_to(11.5)
        self.play(FadeOut(self.overall_picture))

        card_sum = TexMobject("\\aleph_0 + \\aleph_0 = \\aleph_0")
        card_prod = TexMobject("\\aleph_0\\cdot\\aleph_0 = \\aleph_0")
        card_sum.next_to(self.subtitle, DOWN)
        card_prod.next_to(card_sum, DOWN)
        card_prod.shift(
            (card_sum[-1].get_center() - card_prod[-1].get_center()) * X_MASK)
        self.play(Write(card_sum))
        self.wait_to(17.7)
        self.play(Write(card_prod))

        ordinal_dest = ordinal.copy()
        ordinal_bg_dest = ordinal_bg.copy()
        ordinals_title_dest = ordinals_title.copy()
        VGroup(ordinal_bg_dest, ordinal_dest,
               ordinals_title_dest).shift(0.7 * UP)
        ord_type_brace = BraceDesc(ordinal_dest, "\\omega+3")
        self.wait_to(22)
        self.play(
            Transform(ordinal_bg, ordinal_bg_dest),
            Transform(ordinal, ordinal_dest),
            Transform(ordinals_title, ordinals_title_dest),
            ord_type_brace.creation_anim(),
        )
        bar = ordinal_bg[1][3].copy()
        bar.set_color(BLUE)
        pointer = TrianglePointer(color=BLUE).next_to(bar, UP)
        index_label = ord_type_brace.desc.copy()
        index_label.set_color(BLUE)
        index_label.next_to(pointer, UP)
        self.wait_to(29.5)
        self.play(
            ShowCreation(bar),
            FadeIn(pointer),
            FadeIn(index_label),
        )
        self.wait_to(36.5)
Пример #9
0
    def construct(self):

        #self.force_skipping()
        supremum = Supremum.construct(self, fast_play=True)  # 2

        self.wait_to(3)
        omega1_brace = BraceDesc(supremum, "\\omega_1", UP)
        self.play(omega1_brace.creation_anim())

        omega1 = Omega1()
        omega1_src = omega1.copy()
        omega1_src[0].highlight(BLACK)
        omega1_src[1].next_to(supremum, buff=0)
        omega1_src[1].add_to_back(*supremum.submobjects)

        self.wait_to(6.5)
        self.play(
            ReplacementTransform(omega1_src, omega1),
            omega1_brace.shift_brace,
            omega1,
        )
        self.revert_to_original_skipping_status()

        countable_point = Dot(2 * RIGHT)
        countable_point.set_color(YELLOW)
        countable_arrow = Arrow(
            countable_point.get_center() + DOWN,
            countable_point.get_center(),
        )
        countable_label = TextMobject("spočetný ordinál")
        countable_label.next_to(countable_arrow, DOWN)

        brace = Brace(
            Line(omega1.get_corner(LEFT + DOWN), countable_point.get_center()),
            DOWN)
        brace_label = countable_label.copy()
        brace.put_at_tip(brace_label)

        self.wait_to(9)
        self.play(
            FadeIn(countable_label),
            FadeIn(countable_point),
            ShowCreation(countable_arrow),
        )
        self.wait_to(11.5)
        self.play(
            GrowFromCenter(brace),
            ReplacementTransform(countable_label, brace_label),
        )
        self.wait_to(24.5)

        uncountable_brace = Brace(omega1, DOWN)
        uncountable_label = TextMobject("nespočetný ordinál")
        uncountable_brace.put_at_tip(uncountable_label)
        brace_label.add_to_back(brace_label[0].copy(), brace_label[0].copy())

        self.play(
            Transform(brace, uncountable_brace),
            Transform(brace_label, uncountable_label),
        )
        self.remove(brace_label)
        brace_label = TextMobject("nespočetný", "ordinál")
        brace.put_at_tip(brace_label)
        self.add(brace_label)

        uncountable_brace = Brace(
            Line(countable_point.get_center() + DOWN,
                 omega1[0].get_edge_center(RIGHT)), DOWN)
        uncountable_label = TextMobject("nespočetno", "ordinál")
        uncountable_brace.put_at_tip(uncountable_label)
        uncountable_label[1].highlight(BLACK)
        uncountable_label.shift(uncountable_label.get_center() -
                                uncountable_label[0].get_center())

        self.wait_to(46)
        self.play(
            Transform(brace, uncountable_brace),
            Transform(brace_label, uncountable_label),
        )
        self.wait_to(56)

        omega = OrdinalOmega()
        self.play(
            FadeOut(
                VGroup(
                    omega1,
                    brace,
                    brace_label,
                    countable_point,
                    countable_arrow,
                )),
            omega1_brace.change_brace_desc,
            omega,
            "\\omega",
        )
Пример #10
0
    def construct(self, fast_play=False):
        #self.force_skipping()
        omega = OrdinalOmega()
        omega_plus_5 = OrdinalSum(OrdinalOmega, 0.75,
                                  lambda **kwargs: OrdinalFinite(5, **kwargs))
        omega_times_3 = OrdinalFiniteProd(OrdinalOmega, 3)
        omega_pow_3 = make_ordinal_power(3, q=(0.7, 0.84, 0.84))
        ordinals = VGroup(omega, omega_plus_5, omega_times_3, omega_pow_3)
        ordinals.stretch(0.4, 1)
        ordinals.arrange_submobjects(DOWN, aligned_edge=LEFT, center=False)
        ordinals.shift(-Y_MASK * ordinals.get_center())
        dots = TexMobject("\\vdots")
        dots.next_to(ordinals, DOWN)

        if fast_play:
            self.add(ordinals, dots)
        else:
            self.play(ShowCreation(omega))
            self.wait_to(6)
            self.play(ShowCreation(omega_plus_5))
            self.wait_to(7.3)
            self.play(ShowCreation(omega_times_3))
            self.wait_to(8.7)
            self.play(ShowCreation(omega_pow_3))
            self.play(FadeIn(dots))

        result = OrdinalFiniteProd(OrdinalOmega, 5, x1=8)
        result_stretched = result.copy()
        result_stretched.stretch(
            omega[0].get_height() / result_stretched[0][0].get_height(), 1)

        al_omega = result_stretched[0].copy()
        al_omega.shift(omega[0].get_center() - al_omega[0].get_center())

        al_omega_plus_5 = VGroup(result_stretched[0].copy())
        al_omega_plus_5.shift(omega_plus_5[0][0].get_center() -
                              al_omega_plus_5[0][0].get_center())
        al_five = omega_plus_5[1].copy()
        for bar, dest in zip(al_five, result[1]):
            bar.move_to(dest, coor_mask=X_MASK)
        al_omega_plus_5.add(al_five)

        al_omega_times_3 = VGroup(*result_stretched[:3]).copy()
        al_omega_times_3.shift(omega_times_3[0][0].get_center() -
                               al_omega_times_3[0][0].get_center())

        result_in_pow_3 = result_stretched.copy()
        result_in_pow_3.shift(omega_pow_3[0][0][0].get_center() -
                              result_in_pow_3[0][0].get_center())
        al_omega_pow_3 = omega_pow_3.copy()
        al_omega_pow_3.next_to(result_in_pow_3, buff=0)
        al_omega_pow_3[0].add_to_back(*result_in_pow_3.submobjects)

        al_ordinals = VGroup(al_omega, al_omega_plus_5, al_omega_times_3,
                             al_omega_pow_3)
        if not fast_play: self.wait_to(17.5)
        self.play(ReplacementTransform(ordinals, al_ordinals))

        al_ordinals.remove(al_omega_pow_3)
        al_ordinals.add(result_in_pow_3)
        result_bottom = result.copy()
        result_bottom.stretch(0, 1)
        result_bottom = VGroup(*[result_bottom.copy() for _ in range(5)])
        result_bottom.arrange_submobjects(DOWN, buff=0.3, center=False)
        result_bottom.to_edge(DOWN, buff=0)
        al_ordinals.add(result_bottom)

        mrg_omega = result[0].copy()
        mrg_omega_plus_5 = VGroup(result[0], VGroup(*result[1][:5])).copy()
        mrg_omega_times_3 = VGroup(*result[:3]).copy()
        mrg_ordinals = VGroup(
            mrg_omega,
            mrg_omega_plus_5,
            mrg_omega_times_3,
            result.copy(),
            VGroup(result.copy()),
        )
        if not fast_play: self.wait_to(19)
        self.play(
            FadeOut(dots),
            ReplacementTransform(al_ordinals, mrg_ordinals),
        )

        self.remove(mrg_ordinals)
        self.add(result)
        if fast_play: return result
        brace = BraceDesc(result, "\\omega_1", UP)
        self.wait_to(20.2)
        self.play(brace.creation_anim())
        self.wait_to(22)

        conversation = Conversation(self)
        conversation.add_bubble(
            "Ale podle kapitoly 5 si nemůžeme vzít všechny ordinály.")
        self.wait_to(29.5)
        conversation.add_bubble("To ne, ale všechny spočetné můžeme.")
        self.wait_to(39)

        self.add_foreground_mobjects(conversation.dialog)
        self.play(FadeOut(VGroup(brace, result)))

        omega = OrdinalOmega()
        omega.shift(2 * UP)
        self.play(ShowCreation(omega))
        self.wait_to(48.5)
        self.play(FadeOut(conversation.dialog))
Пример #11
0
    def construct(self):

        num = 5
        ordinals_cnt_base = OrdinalFiniteProd(OrdinalOmega,
                                              num,
                                              x1=-4 + num * 2.5)

        ordinals_cnt = VGroup(
            [VGroup(ordinals_cnt_base[:i]).copy() for i in range(1, num + 1)])
        ordinals_cnt.save_state()
        ordinals_cnt.arrange_submobjects(DOWN, center=False, coor_mask=Y_MASK)
        ordinals_cnt.to_edge(UP)

        self.play(ShowCreation(ordinals_cnt))

        #self.wait_to(7)
        self.dither()
        self.play(ordinals_cnt.restore)

        self.remove(ordinals_cnt)
        self.add(ordinals_cnt_base)

        omega1 = Omega1()
        brace = BraceDesc(omega1, "\\omega_1", DOWN)

        omega1.line.save_state()
        omega1.line.behind_edge(RIGHT)

        omega1_bars_src = make_ordinal_power(2)
        omega1_bars_src.next_to(ordinals_cnt_base)
        omega1_bars_src.add_to_back(*ordinals_cnt_base)

        brace.desc.highlight(BLUE)
        brace.save_state()
        brace.shift_brace(omega1_bars_src)
        brace.highlight(BLACK)

        self.play(
            brace.restore,
            omega1.line.restore,
            ReplacementTransform(omega1_bars_src, omega1.bars),
        )

        #self.wait_to(11)
        self.dither()

        aleph1 = TexMobject("\\aleph_1", "=|", "\omega_1", "|")
        aleph1[2].highlight(BLUE)
        aleph1[0].highlight(RED)
        aleph1.shift(brace.desc.get_center() - aleph1[2].get_center())
        aleph1.remove(aleph1[2])

        self.play(Write(aleph1))
        #self.wait_to(15)
        self.dither()

        ordinals_a1 = VGroup([omega1.copy() for _ in range(num)])

        aleph1[0].save_state()
        aleph1[0].next_to(omega1, LEFT, coor_mask=X_MASK)
        self.play(
            omega1.to_edge,
            UP,
            FadeOut(VGroup(brace, aleph1[1:])),
            MoveFromSaved(aleph1[0]),
        )
        #self.wait_to(18.5)
        self.dither()
        aleph1 = aleph1[0]

        scale_center = np.array(ordinals_a1[0].line.get_start())
        for i, o in enumerate(ordinals_a1):
            o.line.scale(1 + i * 0.2, about_point=scale_center)

        ordinals_a1_lines_dest = VGroup([o.line for o in ordinals_a1]).copy()
        ordinals_a1_bars_dest = VGroup([o.bars for o in ordinals_a1]).copy()
        ordinals_a1.arrange_submobjects(DOWN, False, coor_mask=Y_MASK)
        ordinals_a1.to_edge(UP)
        ordinals_a1_lines = VGroup([o.line for o in ordinals_a1])
        ordinals_a1_bars = VGroup([o.bars for o in ordinals_a1])

        self.remove(omega1)
        self.add(ordinals_a1[0])
        self.play(FadeIn(VGroup(ordinals_a1[1:])))
        self.play(
            Transform(ordinals_a1_lines, ordinals_a1_lines_dest),
            Transform(ordinals_a1_bars, ordinals_a1_bars_dest),
        )
        self.remove(*ordinals_a1[:-1])
        omega2_src = ordinals_a1[-1]
        omega2 = LongOrdinal(ordinal_end=0.3, line_start=0.2)

        brace = BraceDesc(omega2, "\\omega_2", DOWN)
        brace.desc.highlight(BLUE)
        brace.save_state()
        brace.shift_brace(omega2_src)
        brace.highlight(BLACK)

        self.play(
            brace.restore,
            ReplacementTransform(omega2_src, omega2),
        )

        #self.wait_to(24.5)
        self.dither()

        aleph2 = TexMobject("\\aleph_2", "=|", "\omega_2", "|")
        aleph2[2].highlight(BLUE)
        aleph2[0].highlight(RED)
        aleph2.shift(brace.desc.get_center() - aleph2[2].get_center())
        aleph2.remove(aleph2[2])

        self.play(Write(aleph2))
        #self.wait_to(28)
        self.dither()

        ordinal_fin = OrdinalFinite(7, x1=SPACE_WIDTH + 1).highlight(BLUE)
        ord_labels = VGroup([
            TexMobject("\\omega_{}".format(i + 1)).highlight(BLUE).next_to(
                bar, UP) for i, bar in enumerate(ordinal_fin[:4])
        ])
        card_labels = VGroup([
            TexMobject("\\aleph_{}".format(i + 1)).highlight(RED).next_to(
                bar, DOWN) for i, bar in enumerate(ordinal_fin[:4])
        ])

        self.play(
            FadeOut(VGroup(aleph2[1:], brace, omega2)),
            ReplacementTransform(aleph1, card_labels[0]),
            ReplacementTransform(aleph2[0], card_labels[1]),
        )

        for i, t in enumerate((29, 31, 35.5, 38)):
            #self.wait_to(t)
            self.play(FadeIn(ord_labels[i]), ShowCreation(ordinal_fin[i]))
            if i >= 2: self.play(FadeIn(card_labels[i]))

        #self.wait_to(41)
        self.play(ShowCreation(VGroup(ordinal_fin[4:], rate_func=rush_into)))

        omega = OrdinalOmega().highlight(BLUE)
        omega_src = omega.copy()
        omega_src.next_to(ordinal_fin, buff=1)
        omega_src.add_to_back(*ordinal_fin)

        label1 = VGroup(ord_labels[0], card_labels[0])
        labels_to_fade = VGroup(list(zip(ord_labels[1:], card_labels[1:])))
        labels_to_fade.save_state()
        for l, bar in zip(labels_to_fade, omega[1:4]):
            l.move_to(bar, coor_mask=X_MASK)
            l.highlight(BLACK)

        limit_bar = omega[0].copy().next_to(omega)
        limit_lord = TexMobject("\\omega_\\omega").highlight(BLUE).next_to(
            limit_bar, UP)
        limit_lcard = TexMobject("\\aleph_\\omega").highlight(RED).next_to(
            limit_bar, DOWN)
        limit_g = VGroup(limit_bar, limit_lord, limit_lcard)

        limit_g.next_to(omega, coor_mask=X_MASK)
        limit_g.save_state()
        limit_g.next_to(omega_src, coor_mask=X_MASK)

        self.play(
            MoveFromSaved(labels_to_fade),
            ReplacementTransform(omega_src, omega),
            Animation(label1),
            limit_g.restore,
        )
        self.remove(labels_to_fade)
        #self.wait_to(52)

        plus1_bar = limit_bar.copy()
        plus1_label = TexMobject("\\omega_{\\omega+1}").highlight(
            BLUE).next_to(plus1_bar, UP)
        plus1_g = VGroup(plus1_bar, plus1_label)
        plus1_g.next_to(limit_g, coor_mask=X_MASK, buff=0.5)

        self.play(FadeIn(plus1_label), ShowCreation(plus1_bar))
        #self.wait_to(55)

        omega_pow = make_ordinal_power(2, q=(0.8, 0.9, 0.9)).highlight(BLUE)
        omega_pow_src = omega_pow.copy()
        omega_pow_src.behind_edge(RIGHT)
        omega_pow_src[0].add_to_back(limit_bar, plus1_bar)
        omega_pow_src.add_to_back(omega)

        limit_g.remove(limit_bar)
        limit_g.save_state()
        plus1_label.save_state()

        limit_g.move_to(omega_pow[1][0], coor_mask=X_MASK)
        plus1_label.move_to(omega_pow[1][1], coor_mask=X_MASK).highlight(BLACK)

        pow_bar = limit_bar.copy()
        pow_label = TexMobject("\\omega_{\\omega\\cdot\\omega}").highlight(
            BLUE).next_to(pow_bar, UP)
        pow_g = VGroup(pow_bar, pow_label)
        pow_g.next_to(omega_pow, coor_mask=X_MASK, buff=-.2)
        pow_g.save_state()
        pow_g.next_to(omega_pow_src, coor_mask=X_MASK)

        self.play(
            MoveFromSaved(plus1_label),
            ReplacementTransform(omega_pow_src, omega_pow),
            MoveFromSaved(limit_g),
            pow_g.restore,
        )
        self.remove(plus1_label)

        #self.wait_to(59)
        self.dither()

        labels_to_fade = VGroup(label1, limit_g, pow_label)
        labels_to_fade.save_state()
        labels_to_fade.highlight(BLACK)

        omega1 = Omega1(color=BLUE)
        omega1_bar = pow_bar.copy()
        omega1_label = TexMobject("\\omega_{\\omega_1}").highlight(
            BLUE).next_to(omega1_bar, UP)
        omega1_g = VGroup(omega1_bar, omega1_label)
        omega1_g.shift(omega1.line.get_end() - omega1_bar.get_center())
        omega1_g.add(omega1.line)
        omega1_g.save_state()
        omega1_g.behind_edge(RIGHT)

        limit_g.move_to(omega1.bars[1][0], coor_mask=X_MASK)
        pow_label.move_to(omega1.bars[-1], coor_mask=X_MASK)
        pow_bar.save_state()
        pow_bar.scale(0)
        pow_bar.set_stroke(width=0)
        pow_bar.move_to(omega1.bars[-1])

        self.play(
            MoveFromSaved(labels_to_fade, remover=True),
            omega1_g.restore,
            MoveFromSaved(pow_bar, remover=True),
            ReplacementTransform(omega_pow, omega1.bars),
        )
        #self.wait_to(60+7.5)
        self.dither()

        ordinal_fin = OrdinalFinite(6, x1=SPACE_WIDTH + 1).highlight(BLUE)
        omega1.save_state()
        omega1.stretch_about_point(0, 0, ordinal_fin[0].get_center())

        labels = VGroup([
            TexMobject((i + 1) * "\\omega_{" + "\\omega_1" +
                       (i + 1) * "}").next_to(bar, UP)
            for i, bar in enumerate(ordinal_fin[:3])
        ])
        labels.highlight(BLUE)

        next_bar = VGroup(labels[1], ordinal_fin[1])
        next_bar.save_state()
        next_bar.shift(8 * RIGHT)

        self.play(
            MoveFromSaved(omega1, remover=True),
            next_bar.restore,
            ReplacementTransform(omega1_label, labels[0]),
            ReplacementTransform(omega1_bar, ordinal_fin[0]),
        )
        #self.wait_to(60+11)
        self.play(FadeIn(labels[2]), ShowCreation(ordinal_fin[2]))
        #self.wait_to(60+13)
        self.play(ShowCreation(VGroup(ordinal_fin[3:]), rate_func=rush_into))
        #self.wait_to(60+21.5)
        self.dither(2)

        conversation = Conversation(self)
        conversation.add_bubble("What about the union of all the ordinals?")

        self.play(FadeOut(VGroup(labels, ordinal_fin)),
                  Animation(conversation.dialog))