Exemplo n.º 1
0
    def finite_analog(self, left_mob, arrow, right_mob):
        self.clear()
        self.add(left_mob, arrow, right_mob)
        ex = TextMobject("\\times")
        ex.highlight(RED)
        # ex.shift(arrow.get_center())
        middle = TexMobject("\\sum_{n=0}^N 2^n \\equiv -1 \\mod 2^{N+1}")
        finite_analog = TextMobject("Finite analog")
        finite_analog.scale(0.8)
        brace = Brace(middle, UP)
        finite_analog.next_to(brace, UP)
        new_left = left_mob.copy().to_edge(LEFT)
        new_right = right_mob.copy().to_edge(RIGHT)
        left_arrow, right_arrow = [
            Arrow(mob1.get_right()[0] * RIGHT,
                  mob2.get_left()[0] * RIGHT,
                  buff=0)
            for mob1, mob2 in [(new_left, middle), (middle, new_right)]
        ]
        for mob in ex, middle:
            mob.sort_points(np.linalg.norm)

        self.play(GrowFromCenter(ex))
        self.wait()
        self.play(Transform(left_mob, new_left),
                  Transform(arrow.copy(), left_arrow),
                  DelayByOrder(Transform(ex, middle)),
                  Transform(arrow, right_arrow),
                  Transform(right_mob, new_right))
        self.play(GrowFromCenter(brace), ShimmerIn(finite_analog))
        self.wait()
        self.equivalence(left_mob, left_arrow,
                         Mobject(middle, brace, finite_analog))
Exemplo n.º 2
0
    def construct(self):
        definition = TexMobject([
            "\\text{HC}(", "x", ")",
            "=\\lim_{n \\to \\infty}\\text{PHC}_n(", "x", ")"
        ])
        definition.to_edge(UP)
        definition.split()[1].highlight(BLUE)
        definition.split()[-2].highlight(BLUE)
        intro = TextMobject("Three things need to be proven")
        prove_that = TextMobject("Prove that HC is $\\dots$")
        prove_that.scale(0.7)
        prove_that.to_edge(LEFT)
        items = TextMobject([
            "\\begin{enumerate}",
            "\\item Well-defined: ",
            "Points on Pseudo-Hilbert-curves really do converge",
            "\\item A Curve: ",
            "HC is continuous",
            "\\item Space-filling: ",
            "Each point in the unit square is an output of HC",
            "\\end{enumerate}",
        ]).split()
        items[1].highlight(GREEN)
        items[3].highlight(YELLOW_C)
        items[5].highlight(MAROON)
        Mobject(*items).to_edge(RIGHT)

        self.add(definition)
        self.play(ShimmerIn(intro))
        self.wait()
        self.play(Transform(intro, prove_that))
        for item in items[1:-1]:
            self.play(ShimmerIn(item))
            self.wait()
Exemplo n.º 3
0
    def construct(self):
        scale_factor = 0.9
        grid = Grid(4, 4, point_thickness = 1)
        curve = HilbertCurve(order = 2)
        for mob in grid, curve:
            mob.scale(scale_factor)
        words = TextMobject("""
            Sequence of curves is stable 
            $\\leftrightarrow$ existence of limit curve
        """, size = "\\normal")
        words.scale(1.25)
        words.to_edge(UP)

        self.add(curve, grid)
        self.dither()
        for n in range(3, 7):
            if n == 5:
                self.play(ShimmerIn(words))
            new_grid = Grid(2**n, 2**n, point_thickness = 1)
            new_curve = HilbertCurve(order = n)
            for mob in new_grid, new_curve:
                mob.scale(scale_factor)
            self.play(
                ShowCreation(new_grid),
                Animation(curve)
            )
            self.remove(grid)
            grid = new_grid
            self.play(Transform(curve, new_curve))
            self.dither()
Exemplo n.º 4
0
    def construct(self):
        definition = TexMobject([
            "\\text{HC}(", "x", ")",
            "=\\lim_{n \\to \\infty}\\text{PHC}_n(", "x", ")"
        ])
        definition.to_edge(UP)
        definition.split()[1].highlight(BLUE)
        definition.split()[-2].highlight(BLUE)
        intro = TextMobject("Three things need to be proven")
        prove_that = TextMobject("Prove that HC is $\\dots$")
        prove_that.scale(0.7)
        prove_that.to_edge(LEFT)
        items = TextMobject([
            "\\begin{enumerate}",
            "\\item Well-defined: ",
            "Points on Pseudo-Hilbert-curves really do converge",
            "\\item A Curve: ",
            "HC is continuous",
            "\\item Space-filling: ",
            "Each point in the unit square is an output of HC",
            "\\end{enumerate}",
        ]).split()
        items[1].highlight(GREEN)
        items[3].highlight(YELLOW_C)
        items[5].highlight(MAROON)
        Mobject(*items).to_edge(RIGHT)

        self.add(definition)
        self.play(ShimmerIn(intro))
        self.dither()
        self.play(Transform(intro, prove_that))
        for item in items[1:-1]:
            self.play(ShimmerIn(item))
            self.dither()
Exemplo n.º 5
0
    def construct(self):
        scale_factor = 0.9
        grid = Grid(4, 4, stroke_width=1)
        curve = HilbertCurve(order=2)
        for mob in grid, curve:
            mob.scale(scale_factor)
        words = TextMobject("""
            Sequence of curves is stable 
            $\\leftrightarrow$ existence of limit curve
        """,
                            size="\\normal")
        words.scale(1.25)
        words.to_edge(UP)

        self.add(curve, grid)
        self.wait()
        for n in range(3, 7):
            if n == 5:
                self.play(ShimmerIn(words))
            new_grid = Grid(2**n, 2**n, stroke_width=1)
            new_curve = HilbertCurve(order=n)
            for mob in new_grid, new_curve:
                mob.scale(scale_factor)
            self.play(ShowCreation(new_grid), Animation(curve))
            self.remove(grid)
            grid = new_grid
            self.play(Transform(curve, new_curve))
            self.wait()
Exemplo n.º 6
0
    def construct(self):
        names = [
            "Johann_Bernoulli2", "Jacob_Bernoulli",
            "Gottfried_Wilhelm_von_Leibniz", "Newton"
        ]
        guys = [ImageMobject(name, invert=False) for name in names]
        johann = guys[0]
        johann.scale(0.8)
        pensive_johann = johann.copy()
        pensive_johann.scale(0.25)
        pensive_johann.to_corner(DOWN + LEFT)
        comparitive_johann = johann.copy()
        template = Square(side_length=2)
        comparitive_johann.replace(template)
        comparitive_johann.shift(UP + LEFT)
        greater_than = TexMobject(">")
        greater_than.next_to(comparitive_johann)
        for guy, name in zip(guys, names)[1:]:
            guy.replace(template)
            guy.next_to(greater_than)
            name_mob = TextMobject(name.replace("_", " "))
            name_mob.scale(0.5)
            name_mob.next_to(guy, DOWN)
            guy.name_mob = name_mob
            guy.sort_points(lambda p: np.dot(p, DOWN + RIGHT))
        bubble = ThoughtBubble(initial_width=12)
        bubble.stretch_to_fit_height(6)
        bubble.ingest_submobjects()
        bubble.pin_to(pensive_johann)
        bubble.shift(DOWN)
        point = Point(johann.get_corner(UP + RIGHT))
        upper_point = Point(comparitive_johann.get_corner(UP + RIGHT))
        lightbulb = ImageMobject("Lightbulb", invert=False)
        lightbulb.scale(0.1)
        lightbulb.sort_points(np.linalg.norm)
        lightbulb.next_to(upper_point, RIGHT)

        self.add(johann)
        self.wait()
        self.play(Transform(johann, pensive_johann),
                  Transform(point, bubble),
                  run_time=2)
        self.remove(point)
        self.add(bubble)
        weakling = guys[1]
        self.play(FadeIn(comparitive_johann), ShowCreation(greater_than),
                  FadeIn(weakling))
        self.wait(2)
        for guy in guys[2:]:
            self.play(DelayByOrder(Transform(weakling, upper_point)))
            self.play(FadeIn(guy), ShimmerIn(guy.name_mob))
            self.wait(3)
            self.remove(guy.name_mob)
            weakling = guy
        self.play(FadeOut(weakling), FadeOut(greater_than))
        self.play(ShowCreation(lightbulb))
        self.wait()
        self.play(FadeOut(comparitive_johann), FadeOut(lightbulb))
        self.play(ApplyMethod(Mobject(johann, bubble).scale, 10, run_time=3))
Exemplo n.º 7
0
    def discontinuous_point(self):
        point_description = TextMobject("Point where the function jumps")
        point_description.shift(3 * RIGHT)
        discontinuous_at_A = TextMobject("``Discontinuous at A''",
                                         size="\\Large")
        discontinuous_at_A.shift(2 * UP).to_edge(LEFT)
        text = TextMobject("""
            Circle around ouput \\\\ 
            points can never \\\\
            be smaller than \\\\
            the jump
        """)
        text.scale(0.75)
        text.shift(3.5 * RIGHT)

        input_value = 0.5
        input_radius = 0.04
        vary_circles = VaryCircles(
            self,
            input_value,
            input_radius,
            run_time=5,
        )
        for dot in self.input_dot, self.output_dot:
            dot.center()
        kwargs = {
            "rate_func": lambda t: interpolate(0.45, input_value, smooth(t))
        }
        self.play(Homotopy(self.input_homotopy, self.input_dot, **kwargs),
                  Homotopy(self.output_homotopy, self.output_dot, **kwargs))
        discontinuous_arrow = Arrow(discontinuous_at_A, self.input_dot)
        arrow = Arrow(point_description,
                      self.output_dot,
                      buff=0.05,
                      color=self.output_color)
        self.play(ShimmerIn(point_description), ShowCreation(arrow))
        self.dither()
        self.remove(point_description, arrow)

        tup = self.get_circles_and_points(input_value - input_radius,
                                          input_value + input_radius)
        input_circle, input_points, output_circle, output_points = tup
        input_points_copy = input_points.copy()
        self.play(ShowCreation(input_circle))
        self.play(ShowCreation(input_points))
        self.play(Transform(input_points_copy, output_points), run_time=2)
        self.play(ShowCreation(output_circle))
        self.dither()
        self.play(ShimmerIn(text))
        self.remove(input_circle, input_points, output_circle,
                    input_points_copy)
        self.play(vary_circles)
        self.dither()
        self.play(ShimmerIn(discontinuous_at_A),
                  ShowCreation(discontinuous_arrow))
        self.dither(3)
        self.remove(vary_circles.mobject, discontinuous_at_A,
                    discontinuous_arrow)
Exemplo n.º 8
0
    def construct(self):
        logo = MirekOlsakLogo(self.camera)
        series_title = TextMobject(self.series_str).to_edge(UP)
        self.add(series_title)
        chapter_title = TextMobject(self.chapter_str)
        chapter_title.scale(1.4)

        self.play(Write(chapter_title))
        self.play(ShowCreation(logo))
        self.dither(self.dither_time)
        self.play(FadeOut(VGroup(series_title, chapter_title, logo)))
Exemplo n.º 9
0
    def add_title(self):
        title = TextMobject("Clicky Stuffs")
        title.scale(1.5)
        title.to_edge(UP, buff = MED_SMALL_BUFF)

        randy, morty = Randolph(), Mortimer()
        for pi, vect in (randy, LEFT), (morty, RIGHT):
            pi.scale_to_fit_height(title.get_height())
            pi.change_mode("thinking")
            pi.look(DOWN)
            pi.next_to(title, vect, buff = MED_LARGE_BUFF)
        self.add_foreground_mobjects(title, randy, morty)
Exemplo n.º 10
0
    def construct(self):
        name = TextMobject("Steven Strogatz")
        name.to_edge(UP)
        contributions = TextMobject("Frequent Contributions")
        contributions.scale(0.5).to_edge(RIGHT).shift(2 * UP)
        books_word = TextMobject("Books")
        books_word.scale(0.5).to_edge(LEFT).shift(2 * UP)
        radio_lab, sci_fri, cornell, book2, book3, book4 = [
            ImageMobject(filename, invert=False, filter_color=WHITE)
            for filename in [
                "radio_lab",
                "science_friday",
                "cornell",
                "strogatz_book2",
                "strogatz_book3",
                "strogatz_book4",
            ]
        ]
        book1 = ImageMobject("strogatz_book1", invert=False)
        nyt = ImageMobject("new_york_times")
        logos = [radio_lab, nyt, sci_fri]
        books = [book1, book2, book3, book4]

        sample_size = Square(side_length=2)
        last = contributions
        for image in logos:
            image.replace(sample_size)
            image.next_to(last, DOWN)
            last = image
        sci_fri.scale_in_place(0.9)
        shift_val = 0
        sample_size.scale(0.75)
        for book in books:
            book.replace(sample_size)
            book.next_to(books_word, DOWN)
            book.shift(shift_val * (RIGHT + DOWN))
            shift_val += 0.5
        sample_size.scale(2)
        cornell.replace(sample_size)
        cornell.next_to(name, DOWN)

        self.add(name)
        self.play(FadeIn(cornell))
        self.play(ShimmerIn(books_word))
        for book in books:
            book.shift(5 * LEFT)
            self.play(ApplyMethod(book.shift, 5 * RIGHT))
        self.play(ShimmerIn(contributions))
        for logo in logos:
            self.play(FadeIn(logo))
        self.dither()
Exemplo n.º 11
0
    def construct(self):
        name = TextMobject("Steven Strogatz")
        name.to_edge(UP)
        contributions = TextMobject("Frequent Contributions")
        contributions.scale(0.5).to_edge(RIGHT).shift(2*UP)
        books_word = TextMobject("Books")
        books_word.scale(0.5).to_edge(LEFT).shift(2*UP)
        radio_lab, sci_fri, cornell, book2, book3, book4 = [
            ImageMobject(filename, invert = False, filter_color = WHITE)
            for filename in [
                "radio_lab",
                "science_friday",
                "cornell",
                "strogatz_book2",
                "strogatz_book3",
                "strogatz_book4",
            ]
        ]
        book1 = ImageMobject("strogatz_book1", invert = False)
        nyt = ImageMobject("new_york_times")
        logos = [radio_lab, nyt, sci_fri]
        books = [book1, book2, book3, book4]

        sample_size = Square(side_length = 2)
        last = contributions        
        for image in logos:
            image.replace(sample_size)
            image.next_to(last, DOWN)
            last = image
        sci_fri.scale_in_place(0.9)
        shift_val = 0
        sample_size.scale(0.75)
        for book in books:
            book.replace(sample_size)
            book.next_to(books_word, DOWN)
            book.shift(shift_val*(RIGHT+DOWN))
            shift_val += 0.5
        sample_size.scale(2)
        cornell.replace(sample_size)
        cornell.next_to(name, DOWN)

        self.add(name)
        self.play(FadeIn(cornell))
        self.play(ShimmerIn(books_word))
        for book in books:
            book.shift(5*LEFT)
            self.play(ApplyMethod(book.shift, 5*RIGHT))
        self.play(ShimmerIn(contributions))
        for logo in logos:
            self.play(FadeIn(logo))
        self.dither()
Exemplo n.º 12
0
    def construct(self):
        horiz_radius = 5
        vert_radius = 3

        vert_axis = NumberLine(numerical_radius=vert_radius)
        vert_axis.rotate(np.pi / 2)
        vert_axis.shift(horiz_radius * LEFT)
        horiz_axis = NumberLine(numerical_radius=5,
                                numbers_with_elongated_ticks=[])
        axes = Mobject(horiz_axis, vert_axis)
        graph = FunctionGraph(lambda x: 0.4 * (x - 2) * (x + 2) + 3,
                              x_min=-2,
                              x_max=2,
                              density=3 * DEFAULT_POINT_DENSITY_1D)
        graph.stretch_to_fit_width(2 * horiz_radius)
        graph.highlight(YELLOW)
        min_point = Dot(graph.get_bottom())
        nature_finds = TextMobject("Nature finds this point")
        nature_finds.scale(0.5)
        nature_finds.highlight(GREEN)
        nature_finds.shift(2 * RIGHT + 3 * UP)
        arrow = Arrow(nature_finds.get_bottom(), min_point, color=GREEN)

        side_words_start = TextMobject("Parameter describing")
        top_words, last_side_words = [
            map(TextMobject, pair)
            for pair in [("Light's travel time",
                          "Potential energy"), ("path", "mechanical state")]
        ]
        for word in top_words + last_side_words + [side_words_start]:
            word.scale(0.7)
        side_words_start.next_to(horiz_axis, DOWN)
        side_words_start.to_edge(RIGHT)
        for words in top_words:
            words.next_to(vert_axis, UP)
            words.to_edge(LEFT)
        for words in last_side_words:
            words.next_to(side_words_start, DOWN)
        for words in top_words[1], last_side_words[1]:
            words.highlight(RED)

        self.add(axes, top_words[0], side_words_start, last_side_words[0])
        self.play(ShowCreation(graph))
        self.play(ShimmerIn(nature_finds), ShowCreation(arrow),
                  ShowCreation(min_point))
        self.dither()
        self.play(FadeOut(top_words[0]), FadeOut(last_side_words[0]),
                  GrowFromCenter(top_words[1]),
                  GrowFromCenter(last_side_words[1]))
        self.dither(3)
Exemplo n.º 13
0
    def finite_analog(self, left_mob, arrow, right_mob):
        self.clear()
        self.add(left_mob, arrow, right_mob)
        ex = TextMobject("\\times")
        ex.highlight(RED)
        # ex.shift(arrow.get_center())
        middle = TexMobject(
            "\\sum_{n=0}^N 2^n \\equiv -1 \\mod 2^{N+1}"
        )
        finite_analog = TextMobject("Finite analog")
        finite_analog.scale(0.8)
        brace = Brace(middle, UP)
        finite_analog.next_to(brace, UP)
        new_left = left_mob.copy().to_edge(LEFT)
        new_right = right_mob.copy().to_edge(RIGHT)
        left_arrow, right_arrow = [
            Arrow(
                mob1.get_right()[0]*RIGHT,
                mob2.get_left()[0]*RIGHT,
                buff = 0
            )
            for mob1, mob2 in [
                (new_left, middle), 
                (middle, new_right)
            ]
        ]
        for mob in ex, middle:
            mob.sort_points(np.linalg.norm)

        self.play(GrowFromCenter(ex))
        self.dither()
        self.play(
            Transform(left_mob, new_left),
            Transform(arrow.copy(), left_arrow),
            DelayByOrder(Transform(ex, middle)),
            Transform(arrow, right_arrow),
            Transform(right_mob, new_right)
        )
        self.play(
            GrowFromCenter(brace),
            ShimmerIn(finite_analog)
        )
        self.dither()
        self.equivalence(
            left_mob,
            left_arrow, 
            Mobject(middle, brace, finite_analog)
        )
Exemplo n.º 14
0
 def label(self, text, time = 5):
     mob = TextMobject(text)
     mob.scale(1.5)
     mob.to_edge(UP)
     rectangle = region_from_polygon_vertices(*[
         mob.get_corner(vect) + 0.3*vect
         for vect in [
             UP+RIGHT,
             UP+LEFT,
             DOWN+LEFT,
             DOWN+RIGHT
         ]
     ])
     mob.highlight(self.text_color)
     rectangle = MobjectFromRegion(rectangle, "#111111")
     rectangle.point_thickness = 3
     self.add(rectangle, mob)
     self.dither(time)
     self.remove(mob, rectangle)
Exemplo n.º 15
0
    def construct(self):
        words1 = TextMobject(
            "If you watched my video about Hilbert's space-filling curve\\dots"
        )
        words2 = TextMobject(
            "\\dots you might be curious to see what a few other space-filling curves look like."
        )
        words2.scale(0.8)
        for words in words1, words2:
            words.to_edge(UP, buff=0.2)

        self.setup(HilbertCurve)
        self.play(ShimmerIn(words1))
        for x in range(4):
            self.increase_order()
        self.remove(words1)
        self.increase_order(ShimmerIn(words2))
        for x in range(4):
            self.increase_order()
Exemplo n.º 16
0
    def construct(self):
        words1 = TextMobject("""
            But of course, there's no reason we should limit 
            ourselves to filling in squares.
        """)
        words2 = TextMobject("""
            Here's a simple triangle-filling curve I defined
            in a style reflective of a Hilbert curve.
        """)
        words1.to_edge(UP)
        words2.scale(0.8).to_edge(UP, buff=0.2)

        self.setup(TriangleFillingCurve)
        self.play(ShimmerIn(words1))
        for x in range(3):
            self.increase_order()
        self.remove(words1)
        self.add(words2)
        for x in range(5):
            self.increase_order()
Exemplo n.º 17
0
    def construct(self):
        words1 = TextMobject("""
            But of course, there's no reason we should limit 
            ourselves to filling in squares.
        """)
        words2 = TextMobject("""
            Here's a simple triangle-filling curve I defined
            in a style reflective of a Hilbert curve.
        """)
        words1.to_edge(UP)
        words2.scale(0.8).to_edge(UP, buff = 0.2)

        self.setup(TriangleFillingCurve)
        self.play(ShimmerIn(words1))
        for x in range(3):
            self.increase_order()
        self.remove(words1)
        self.add(words2)
        for x in range(5):
            self.increase_order()
Exemplo n.º 18
0
    def construct(self):
        words1 = TextMobject(
            "If you watched my video about Hilbert's space-filling curve\\dots"
        )
        words2 = TextMobject(
            "\\dots you might be curious to see what a few other space-filling curves look like."
        )
        words2.scale(0.8)
        for words in words1, words2:
            words.to_edge(UP, buff = 0.2)

        self.setup(HilbertCurve)
        self.play(ShimmerIn(words1))
        for x in range(4):
            self.increase_order()
        self.remove(words1)
        self.increase_order(
            ShimmerIn(words2)
        )
        for x in range(4):
            self.increase_order()
Exemplo n.º 19
0
    def construct(self):
        horiz_radius = 5
        vert_radius = 3

        vert_axis = NumberLine(numerical_radius = vert_radius)
        vert_axis.rotate(np.pi/2)
        vert_axis.shift(horiz_radius*LEFT)
        horiz_axis = NumberLine(
            numerical_radius = 5,
            numbers_with_elongated_ticks = []
        )
        axes = Mobject(horiz_axis, vert_axis)
        graph = FunctionGraph(
            lambda x : 0.4*(x-2)*(x+2)+3,
            x_min = -2,
            x_max = 2,
            density = 3*DEFAULT_POINT_DENSITY_1D
        )
        graph.stretch_to_fit_width(2*horiz_radius)
        graph.highlight(YELLOW)
        min_point = Dot(graph.get_bottom())
        nature_finds = TextMobject("Nature finds this point")
        nature_finds.scale(0.5)
        nature_finds.highlight(GREEN)
        nature_finds.shift(2*RIGHT+3*UP)
        arrow = Arrow(
            nature_finds.get_bottom(), min_point, 
            color = GREEN
        )

        side_words_start = TextMobject("Parameter describing")
        top_words, last_side_words = [
            map(TextMobject, pair)
            for pair in [
                ("Light's travel time", "Potential energy"),
                ("path", "mechanical state")
            ]
        ]
        for word in top_words + last_side_words + [side_words_start]:
            word.scale(0.7)
        side_words_start.next_to(horiz_axis, DOWN)
        side_words_start.to_edge(RIGHT)
        for words in top_words:
            words.next_to(vert_axis, UP)
            words.to_edge(LEFT)
        for words in last_side_words:
            words.next_to(side_words_start, DOWN)
        for words in top_words[1], last_side_words[1]:
            words.highlight(RED)

        self.add(
            axes, top_words[0], side_words_start, 
            last_side_words[0]
        )
        self.play(ShowCreation(graph))
        self.play(
            ShimmerIn(nature_finds),
            ShowCreation(arrow),
            ShowCreation(min_point)
        )
        self.dither()
        self.play(
            FadeOut(top_words[0]), 
            FadeOut(last_side_words[0]),
            GrowFromCenter(top_words[1]), 
            GrowFromCenter(last_side_words[1])
        )
        self.dither(3)
Exemplo n.º 20
0
    def construct(self):
        clock = Circle(radius=2, color=WHITE)
        clock.add(Dot(ORIGIN))
        ticks = Mobject(*[
            Line(1.8 * vect, 2 * vect, color=GREY)
            for vect in compass_directions(12)
        ])
        clock.add(ticks)
        hour_hand = Line(ORIGIN, UP)
        minute_hand = Line(ORIGIN, 1.5 * UP)
        clock.add(hour_hand, minute_hand)
        clock.to_corner(UP + RIGHT)
        hour_hand.get_center = lambda: clock.get_center()
        minute_hand.get_center = lambda: clock.get_center()

        solution = ImageMobject("Newton_brachistochrone_solution2",
                                use_cache=False)
        solution.stroke_width = 3
        solution.highlight(GREY)
        solution.scale_to_fit_width(5)
        solution.to_corner(UP + RIGHT)
        newton = ImageMobject("Old_Newton", invert=False)
        newton.scale(0.8)
        phil_trans = TextMobject("Philosophical Transactions")
        rect = Rectangle(height=6, width=4.5, color=WHITE)
        rect.to_corner(UP + RIGHT)
        rect.shift(DOWN)
        phil_trans.scale_to_fit_width(0.8 * rect.get_width())
        phil_trans.next_to(Point(rect.get_top()), DOWN)
        new_solution = solution.copy()
        new_solution.scale_to_fit_width(phil_trans.get_width())
        new_solution.next_to(phil_trans, DOWN, buff=1)
        not_newton = TextMobject("-Totally not by Newton")
        not_newton.scale_to_fit_width(2.5)
        not_newton.next_to(new_solution, DOWN, aligned_edge=RIGHT)
        phil_trans.add(rect)

        newton_complaint = TextMobject([
            "``I do not love to be", " \\emph{dunned} ",
            "and teased by foreigners''"
        ],
                                       size="\\small")
        newton_complaint.to_edge(UP, buff=0.2)
        dunned = newton_complaint.split()[1]
        dunned.highlight()
        dunned_def = TextMobject(
            "(old timey term for making \\\\ demands on someone)")
        dunned_def.scale(0.7)
        dunned_def.next_to(phil_trans, LEFT)
        dunned_def.shift(2 * UP)
        dunned_arrow = Arrow(dunned_def, dunned)

        johann = ImageMobject("Johann_Bernoulli2", invert=False)
        johann.scale(0.4)
        johann.to_edge(LEFT)
        johann.shift(DOWN)
        johann_quote = TextMobject("``I recognize the lion by his claw''")
        johann_quote.next_to(johann, UP, aligned_edge=LEFT)

        self.play(ApplyMethod(newton.to_edge, LEFT))
        self.play(ShowCreation(clock))
        kwargs = {"axis": OUT, "rate_func": smooth}
        self.play(Rotating(hour_hand, radians=-2 * np.pi, **kwargs),
                  Rotating(minute_hand, radians=-12 * 2 * np.pi, **kwargs),
                  run_time=5)
        self.wait()
        self.clear()
        self.add(newton)
        clock.ingest_submobjects()
        self.play(Transform(clock, solution))
        self.remove(clock)
        self.add(solution)
        self.wait()
        self.play(FadeIn(phil_trans), Transform(solution, new_solution))
        self.wait()
        self.play(ShimmerIn(not_newton))
        phil_trans.add(solution, not_newton)
        self.wait()
        self.play(*map(ShimmerIn, newton_complaint.split()))
        self.wait()
        self.play(ShimmerIn(dunned_def), ShowCreation(dunned_arrow))
        self.wait()
        self.remove(dunned_def, dunned_arrow)
        self.play(FadeOut(newton_complaint))
        self.remove(newton_complaint)
        self.play(FadeOut(newton), GrowFromCenter(johann))
        self.remove(newton)
        self.wait()
        self.play(ShimmerIn(johann_quote))
        self.wait()
Exemplo n.º 21
0
    def construct(self):
        names = [
            "Johann_Bernoulli2",
            "Jacob_Bernoulli",
            "Gottfried_Wilhelm_von_Leibniz",
            "Newton"
        ]
        guys = [
            ImageMobject(name, invert = False)
            for name in names
        ]
        johann = guys[0]
        johann.scale(0.8)
        pensive_johann = johann.copy()
        pensive_johann.scale(0.25)
        pensive_johann.to_corner(DOWN+LEFT)
        comparitive_johann = johann.copy()
        template = Square(side_length = 2)
        comparitive_johann.replace(template)
        comparitive_johann.shift(UP+LEFT)
        greater_than = TexMobject(">")
        greater_than.next_to(comparitive_johann)
        for guy, name in zip(guys, names)[1:]:
            guy.replace(template)
            guy.next_to(greater_than)
            name_mob = TextMobject(name.replace("_", " "))
            name_mob.scale(0.5)
            name_mob.next_to(guy, DOWN)
            guy.name_mob = name_mob
            guy.sort_points(lambda p : np.dot(p, DOWN+RIGHT))
        bubble = ThoughtBubble(initial_width = 12)
        bubble.stretch_to_fit_height(6)
        bubble.ingest_submobjects()
        bubble.pin_to(pensive_johann)
        bubble.shift(DOWN)
        point = Point(johann.get_corner(UP+RIGHT))
        upper_point = Point(comparitive_johann.get_corner(UP+RIGHT))
        lightbulb = ImageMobject("Lightbulb", invert = False)
        lightbulb.scale(0.1)
        lightbulb.sort_points(np.linalg.norm)
        lightbulb.next_to(upper_point, RIGHT)

        self.add(johann)
        self.dither()
        self.play(
            Transform(johann, pensive_johann),
            Transform(point, bubble),
            run_time = 2
        )
        self.remove(point)
        self.add(bubble)
        weakling = guys[1]        
        self.play(
            FadeIn(comparitive_johann),
            ShowCreation(greater_than),
            FadeIn(weakling)
        )
        self.dither(2)
        for guy in guys[2:]:
            self.play(DelayByOrder(Transform(
                weakling, upper_point
            )))
            self.play(
                FadeIn(guy),
                ShimmerIn(guy.name_mob)
            )
            self.dither(3)
            self.remove(guy.name_mob)
            weakling = guy
        self.play(FadeOut(weakling), FadeOut(greater_than))
        self.play(ShowCreation(lightbulb))
        self.dither()
        self.play(FadeOut(comparitive_johann), FadeOut(lightbulb))
        self.play(ApplyMethod(
            Mobject(johann, bubble).scale, 10,
            run_time = 3
        ))
Exemplo n.º 22
0
    def construct(self):
        word = TextMobject(["Bra", "chis", "to", "chrone"])
        original_word = word.copy()
        dots = []
        for part in word.split():
            if dots:
                part.next_to(dots[-1], buff = 0.06)
            dot = TexMobject("\\cdot")
            dot.next_to(part, buff = 0.06)
            dots.append(dot)
        dots = Mobject(*dots[:-1])
        dots.shift(0.1*DOWN)
        Mobject(word, dots).center()
        overbrace1 = Brace(Mobject(*word.split()[:-1]), UP)
        overbrace2 = Brace(word.split()[-1], UP)
        shortest = TextMobject("Shortest")
        shortest.next_to(overbrace1, UP)
        shortest.highlight(YELLOW)
        time = TextMobject("Time")
        time.next_to(overbrace2, UP)
        time.highlight(YELLOW)
        chrono_example = TextMobject("""
            As in ``Chronological'' \\\\
            or ``Synchronize''
        """)
        chrono_example.scale(0.5)
        chrono_example.to_edge(RIGHT)
        chrono_example.shift(2*UP)
        chrono_example.highlight(BLUE_D)
        chrono_arrow = Arrow(
            word.get_right(), 
            chrono_example.get_bottom(), 
            color = BLUE_D
        )
        brachy_example = TextMobject("As in . . . brachydactyly?")
        brachy_example.scale(0.5)
        brachy_example.to_edge(LEFT)
        brachy_example.shift(2*DOWN)
        brachy_example.highlight(GREEN)
        brachy_arrow = Arrow(
            word.get_left(),
            brachy_example.get_top(), 
            color = GREEN
        )

        pronunciation = TextMobject(["/br", "e", "kist","e","kr$\\bar{o}$n/"])
        pronunciation.split()[1].rotate_in_place(np.pi)
        pronunciation.split()[3].rotate_in_place(np.pi) 
        pronunciation.scale(0.7)
        pronunciation.shift(DOWN)

        latin = TextMobject(list("Latin"))
        greek = TextMobject(list("Greek"))
        for mob in latin, greek:
            mob.to_edge(LEFT)
        question_mark = TextMobject("?").next_to(greek, buff = 0.1)
        stars = Stars().highlight(BLACK)
        stars.scale(0.5).shift(question_mark.get_center())

        self.play(Transform(original_word, word), ShowCreation(dots))
        self.play(ShimmerIn(pronunciation))
        self.dither()
        self.play(
            GrowFromCenter(overbrace1),
            GrowFromCenter(overbrace2)
        )
        self.dither()
        self.play(ShimmerIn(latin))
        self.play(FadeIn(question_mark))
        self.play(Transform(
            latin, greek,
            path_func = counterclockwise_path()
        ))
        self.dither()
        self.play(Transform(question_mark, stars))
        self.remove(stars)
        self.dither()
        self.play(ShimmerIn(shortest))
        self.play(ShimmerIn(time))
        for ex, ar in [(chrono_example, chrono_arrow), (brachy_example, brachy_arrow)]:
            self.play(
                ShowCreation(ar),
                ShimmerIn(ex)
            )
        self.dither()
Exemplo n.º 23
0
    def construct(self):
        word = TextMobject(["Bra", "chis", "to", "chrone"])
        original_word = word.copy()
        dots = []
        for part in word.split():
            if dots:
                part.next_to(dots[-1], buff=0.06)
            dot = TexMobject("\\cdot")
            dot.next_to(part, buff=0.06)
            dots.append(dot)
        dots = Mobject(*dots[:-1])
        dots.shift(0.1 * DOWN)
        Mobject(word, dots).center()
        overbrace1 = Brace(Mobject(*word.split()[:-1]), UP)
        overbrace2 = Brace(word.split()[-1], UP)
        shortest = TextMobject("Shortest")
        shortest.next_to(overbrace1, UP)
        shortest.highlight(YELLOW)
        time = TextMobject("Time")
        time.next_to(overbrace2, UP)
        time.highlight(YELLOW)
        chrono_example = TextMobject("""
            As in ``Chronological'' \\\\
            or ``Synchronize''
        """)
        chrono_example.scale(0.5)
        chrono_example.to_edge(RIGHT)
        chrono_example.shift(2 * UP)
        chrono_example.highlight(BLUE_D)
        chrono_arrow = Arrow(word.get_right(),
                             chrono_example.get_bottom(),
                             color=BLUE_D)
        brachy_example = TextMobject("As in . . . brachydactyly?")
        brachy_example.scale(0.5)
        brachy_example.to_edge(LEFT)
        brachy_example.shift(2 * DOWN)
        brachy_example.highlight(GREEN)
        brachy_arrow = Arrow(word.get_left(),
                             brachy_example.get_top(),
                             color=GREEN)

        pronunciation = TextMobject(
            ["/br", "e", "kist", "e", "kr$\\bar{o}$n/"])
        pronunciation.split()[1].rotate_in_place(np.pi)
        pronunciation.split()[3].rotate_in_place(np.pi)
        pronunciation.scale(0.7)
        pronunciation.shift(DOWN)

        latin = TextMobject(list("Latin"))
        greek = TextMobject(list("Greek"))
        for mob in latin, greek:
            mob.to_edge(LEFT)
        question_mark = TextMobject("?").next_to(greek, buff=0.1)
        stars = Stars().highlight(BLACK)
        stars.scale(0.5).shift(question_mark.get_center())

        self.play(Transform(original_word, word), ShowCreation(dots))
        self.play(ShimmerIn(pronunciation))
        self.dither()
        self.play(GrowFromCenter(overbrace1), GrowFromCenter(overbrace2))
        self.dither()
        self.play(ShimmerIn(latin))
        self.play(FadeIn(question_mark))
        self.play(Transform(latin, greek, path_func=counterclockwise_path()))
        self.dither()
        self.play(Transform(question_mark, stars))
        self.remove(stars)
        self.dither()
        self.play(ShimmerIn(shortest))
        self.play(ShimmerIn(time))
        for ex, ar in [(chrono_example, chrono_arrow),
                       (brachy_example, brachy_arrow)]:
            self.play(ShowCreation(ar), ShimmerIn(ex))
        self.dither()
Exemplo n.º 24
0
    def construct(self):
        clock = Circle(radius = 2, color = WHITE)
        clock.add(Dot(ORIGIN))
        ticks = Mobject(*[
            Line(1.8*vect, 2*vect, color = GREY)
            for vect in compass_directions(12)
        ])
        clock.add(ticks)
        hour_hand = Line(ORIGIN, UP)
        minute_hand = Line(ORIGIN, 1.5*UP)
        clock.add(hour_hand, minute_hand)
        clock.to_corner(UP+RIGHT)
        hour_hand.get_center = lambda : clock.get_center()
        minute_hand.get_center = lambda : clock.get_center()
 
        solution = ImageMobject(
            "Newton_brachistochrone_solution2",
            use_cache = False
        )
        solution.stroke_width = 3
        solution.highlight(GREY)
        solution.scale_to_fit_width(5)
        solution.to_corner(UP+RIGHT)
        newton = ImageMobject("Old_Newton", invert = False)
        newton.scale(0.8)
        phil_trans = TextMobject("Philosophical Transactions")
        rect = Rectangle(height = 6, width = 4.5, color = WHITE)
        rect.to_corner(UP+RIGHT)
        rect.shift(DOWN)
        phil_trans.scale_to_fit_width(0.8*rect.get_width())
        phil_trans.next_to(Point(rect.get_top()), DOWN)
        new_solution = solution.copy()
        new_solution.scale_to_fit_width(phil_trans.get_width())
        new_solution.next_to(phil_trans, DOWN, buff = 1)
        not_newton = TextMobject("-Totally not by Newton")
        not_newton.scale_to_fit_width(2.5)
        not_newton.next_to(new_solution, DOWN, aligned_edge = RIGHT)
        phil_trans.add(rect)

        newton_complaint = TextMobject([
            "``I do not love to be",
            " \\emph{dunned} ",
            "and teased by foreigners''"
        ], size = "\\small")
        newton_complaint.to_edge(UP, buff = 0.2)
        dunned = newton_complaint.split()[1]
        dunned.highlight()
        dunned_def = TextMobject("(old timey term for making \\\\ demands on someone)")
        dunned_def.scale(0.7)
        dunned_def.next_to(phil_trans, LEFT)
        dunned_def.shift(2*UP)
        dunned_arrow = Arrow(dunned_def, dunned)

        johann = ImageMobject("Johann_Bernoulli2", invert = False)
        johann.scale(0.4)
        johann.to_edge(LEFT)
        johann.shift(DOWN)
        johann_quote = TextMobject("``I recognize the lion by his claw''")
        johann_quote.next_to(johann, UP, aligned_edge = LEFT)

        self.play(ApplyMethod(newton.to_edge, LEFT))
        self.play(ShowCreation(clock))
        kwargs = {
            "axis" : OUT,
            "rate_func" : smooth
        }
        self.play(
            Rotating(hour_hand, radians = -2*np.pi, **kwargs),
            Rotating(minute_hand, radians = -12*2*np.pi, **kwargs),
            run_time = 5
        )
        self.dither()
        self.clear()
        self.add(newton)
        clock.ingest_submobjects()
        self.play(Transform(clock, solution))
        self.remove(clock)
        self.add(solution)
        self.dither()
        self.play(
            FadeIn(phil_trans),
            Transform(solution, new_solution)
        )
        self.dither()
        self.play(ShimmerIn(not_newton))
        phil_trans.add(solution, not_newton)
        self.dither()
        self.play(*map(ShimmerIn, newton_complaint.split()))
        self.dither()
        self.play(
            ShimmerIn(dunned_def),
            ShowCreation(dunned_arrow)
        )
        self.dither()
        self.remove(dunned_def, dunned_arrow)
        self.play(FadeOut(newton_complaint))
        self.remove(newton_complaint)
        self.play(
            FadeOut(newton),
            GrowFromCenter(johann)
        )
        self.remove(newton)        
        self.dither()
        self.play(ShimmerIn(johann_quote))
        self.dither()
Exemplo n.º 25
0
    def discontinuous_point(self):
        point_description = TextMobject(
            "Point where the function jumps"
        )
        point_description.shift(3*RIGHT)        
        discontinuous_at_A = TextMobject(
            "``Discontinuous at A''",
            size = "\\Large"
        )
        discontinuous_at_A.shift(2*UP).to_edge(LEFT)
        text = TextMobject("""
            Circle around ouput \\\\ 
            points can never \\\\
            be smaller than \\\\
            the jump
        """)
        text.scale(0.75)
        text.shift(3.5*RIGHT)

        input_value = 0.5
        input_radius = 0.04
        vary_circles = VaryCircles(
            self, input_value, input_radius, 
            run_time = 5,
        )
        for dot in self.input_dot, self.output_dot:
            dot.center()
        kwargs = {
            "rate_func" : lambda t : interpolate(0.45, input_value, smooth(t))
        }
        self.play(
            Homotopy(self.input_homotopy, self.input_dot, **kwargs),
            Homotopy(self.output_homotopy, self.output_dot, **kwargs)
        )
        discontinuous_arrow = Arrow(discontinuous_at_A, self.input_dot)
        arrow = Arrow(
            point_description, self.output_dot,
            buff = 0.05,
            color = self.output_color
        )
        self.play(
            ShimmerIn(point_description),
            ShowCreation(arrow)
        )
        self.dither()
        self.remove(point_description, arrow)

        tup = self.get_circles_and_points(
            input_value-input_radius, 
            input_value+input_radius
        )
        input_circle, input_points, output_circle, output_points = tup
        input_points_copy = input_points.copy()
        self.play(ShowCreation(input_circle))
        self.play(ShowCreation(input_points))
        self.play(
            Transform(input_points_copy, output_points),
            run_time = 2
        )
        self.play(ShowCreation(output_circle))
        self.dither()
        self.play(ShimmerIn(text))
        self.remove(input_circle, input_points, output_circle, input_points_copy)
        self.play(vary_circles)
        self.dither()
        self.play(
            ShimmerIn(discontinuous_at_A),
            ShowCreation(discontinuous_arrow)
        )
        self.dither(3)
        self.remove(vary_circles.mobject, discontinuous_at_A, discontinuous_arrow)