Exemple #1
0
    def construct(self):
        words = TextMobject([
            "One does not simply define the limit \\\\ \
            of a sequence of", "curves", "\\dots"
        ])
        top_words = TextMobject(["curves", "are functions"]).to_edge(UP)
        curves1 = words.split()[1]
        curves2 = top_words.split()[0]
        words.ingest_submobjects()
        number = TexMobject("0.27")
        pair = TexMobject("(0.53, 0.02)")
        pair.next_to(number, buff=2)
        arrow = Arrow(number, pair)
        Mobject(number, arrow, pair).center().shift(UP)
        number_line = UnitInterval()
        number_line.stretch_to_fit_width(5)
        number_line.to_edge(LEFT).shift(DOWN)
        grid = Grid(4, 4).scale(0.4)
        grid.next_to(number_line, buff=2)
        low_arrow = Arrow(number_line, grid)

        self.play(ShimmerIn(words))
        self.dither()
        self.play(FadeOut(words), ApplyMethod(curves1.replace, curves2),
                  ShimmerIn(top_words.split()[1]))
        self.dither()
        self.play(FadeIn(number))
        self.play(ShowCreation(arrow))
        self.play(FadeIn(pair))
        self.dither()
        self.play(ShowCreation(number_line))
        self.play(ShowCreation(low_arrow))
        self.play(ShowCreation(grid))
        self.dither()
Exemple #2
0
    def add_arrows(self, true_length = False):
        if not hasattr(self, "function"):
            raise Exception("Must run use_function first")
        points = self.get_points(self.arrow_spacing)
        points = filter(
            lambda p : np.linalg.norm(self.function(p)) > 0.01,
            points
        )
        angles = map(angle_of_vector, map(self.function, points))
        prototype = Arrow(
            ORIGIN, RIGHT*self.arrow_spacing/2.,
            color = self.arrow_color, 
            tip_length = 0.1,
            buff = 0
        )
        arrows = []
        for point in points:
            arrow = prototype.copy()
            output = self.function(point)
            if true_length:
                arrow.scale(np.linalg.norm(output))
            arrow.rotate(angle_of_vector(output))
            arrow.shift(point)
            arrows.append(arrow)
        self.arrows = Mobject(*arrows)

        self.play(ShowCreation(self.arrows))
        self.dither()
Exemple #3
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)
Exemple #4
0
    def construct(self, order):
        if order == 2:
            result_tex = "(0.125, 0.75)"
        elif order == 3:
            result_tex = "(0.0758,  0.6875)"

        phc, arg, result = TexMobject([
            "\\text{PHC}_%d"%order, 
            "(0.3)", 
            "= %s"%result_tex
        ]).to_edge(UP).split()
        function = TextMobject("Function", size = "\\normal")
        function.shift(phc.get_center()+DOWN+2*LEFT)
        function_arrow = Arrow(function, phc)

        line = Line(5*LEFT, 5*RIGHT)
        curve = HilbertCurve(order = order)
        line.match_colors(curve)
        grid = Grid(2**order, 2**order)
        grid.fade()
        for mob in curve, grid:
            mob.scale(0.7)
        index = int(0.3*line.get_num_points())
        dot1 = Dot(line.points[index])
        arrow1 = Arrow(arg, dot1, buff = 0.1)
        dot2 = Dot(curve.points[index])
        arrow2 = Arrow(result.get_bottom(), dot2, buff = 0.1)

        self.add(phc)
        self.play(
            ShimmerIn(function),
            ShowCreation(function_arrow)
        )
        self.wait()
        self.remove(function_arrow, function)
        self.play(ShowCreation(line))
        self.wait()
        self.play(
            ShimmerIn(arg),
            ShowCreation(arrow1),
            ShowCreation(dot1)
        )
        self.wait()
        self.remove(arrow1)
        self.play(
            FadeIn(grid),            
            Transform(line, curve),
            Transform(dot1, dot2),
            run_time = 2
        )
        self.wait()
        self.play(
            ShimmerIn(result),
            ShowCreation(arrow2)
        )
        self.wait()
Exemple #5
0
    def draw_circles(self):
        input_value = 0.45
        input_radius = 0.04
        for dot in self.input_dot, self.output_dot:
            dot.center()
        kwargs = {
            "rate_func" : lambda t : interpolate(1, input_value, smooth(t))
        }
        self.play(
            Homotopy(self.input_homotopy, self.input_dot, **kwargs),
            Homotopy(self.output_homotopy, self.output_dot, **kwargs)
        )

        A, B = map(Mobject.get_center, [self.input_dot, self.output_dot])
        A_text = TextMobject("A")
        A_text.shift(A+2*(LEFT+UP))
        A_arrow = Arrow(
            A_text, self.input_dot,
            color = self.input_color
        )
        B_text = TextMobject("B")
        B_text.shift(B+2*RIGHT+DOWN)
        B_arrow = Arrow(
            B_text, self.output_dot,
            color = self.output_color
        )
        tup = self.get_circles_and_points(
            input_value-input_radius, 
            input_value+input_radius
        )
        input_circle, input_points, output_circle, output_points = tup

        for text, arrow in [(A_text, A_arrow), (B_text, B_arrow)]:
            self.play(
                ShimmerIn(text),
                ShowCreation(arrow)
            )
            self.wait()
        self.remove(A_text, A_arrow, B_text, B_arrow)
        self.play(ShowCreation(input_circle))
        self.wait()
        self.play(ShowCreation(input_points))
        self.wait()
        input_points_copy = input_points.copy()
        self.play(
            Transform(input_points_copy, output_points),
            run_time = 2
        )
        self.wait()
        self.play(ShowCreation(output_circle))
        self.wait()
        self.wait()
        self.remove(*[
            input_circle, input_points, 
            output_circle, input_points_copy
        ])
Exemple #6
0
    def construct(self):
        val = 0.3
        text = TextMobject([
            "PHC", "$_n", "(", "%3.1f"%val, ")$", 
            " has a ", "limit point ", "as $n \\to \\infty$"
        ])
        func_parts = text.copy().split()[:5]
        Mobject(*func_parts).center().to_edge(UP)
        num_str, val_str = func_parts[1], func_parts[3]
        curve = UnitInterval()
        curve.sort_points(lambda p : p[0])
        dot = Dot().shift(curve.number_to_point(val))
        arrow = Arrow(val_str, dot, buff = 0.1)
        curve.add_numbers(0, 1)

        self.play(ShowCreation(curve))
        self.play(
            ShimmerIn(val_str),
            ShowCreation(arrow),
            ShowCreation(dot)
        )
        self.wait()
        self.play(
            FadeOut(arrow),
            *[
                FadeIn(func_parts[i])
                for i in 0, 1, 2, 4
            ]
        )
        for num in range(2,9):
            new_curve = HilbertCurve(order = num)
            new_curve.scale(0.8)
            new_dot = Dot(new_curve.points[int(val*new_curve.get_num_points())])
            new_num_str = TexMobject(str(num)).replace(num_str)
            self.play(
                Transform(curve, new_curve),
                Transform(dot, new_dot),
                Transform(num_str, new_num_str)
            )
            self.wait()

        text.to_edge(UP)
        text_parts = text.split()
        for index in 1, -1:
            text_parts[index].highlight()
        starters = Mobject(*func_parts + [
            Point(mob.get_center(), stroke_width=1)
            for mob in text_parts[5:]
        ])
        self.play(Transform(starters, text))
        arrow = Arrow(text_parts[-2].get_bottom(), dot, buff = 0.1)
        self.play(ShowCreation(arrow))
        self.wait()
Exemple #7
0
    def construct(self):
        grid = get_grid()
        grid.scale_to_fit_width(6)
        grid.to_edge(LEFT)
        freq_line = get_freq_line()
        freq_line.scale_to_fit_width(6)
        freq_line.center().to_edge(RIGHT)
        arrow =  Arrow(grid, freq_line)

        color1, color2 = YELLOW_C, RED
        square_length = 0.01
        dot1 = Dot(color = color1)
        dot1.shift(3*RIGHT)
        dot2 = Dot(color = color2)
        dot2.shift(3.1*RIGHT)
        arrow1 = Arrow(2*RIGHT+UP, dot1, color = color1, buff = 0.1)
        arrow2 = Arrow(4*RIGHT+UP, dot2, color = color2, buff = 0.1)
        dot3, arrow3 = [
            mob.copy().shift(5*LEFT+UP)
            for mob in dot1, arrow1
        ]
        dot4, arrow4 = [
            mob.copy().shift(5*LEFT+0.9*UP)
            for mob in dot2, arrow2
        ]

        self.add(grid, freq_line, arrow)
        self.dither()
        self.play(ApplyMethod(
            arrow.rotate, np.pi, 
            path_func = clockwise_path()
        ))
        self.dither()
        self.play(ShowCreation(arrow1))
        self.add(dot1)
        self.play(ShowCreation(arrow2))
        self.add(dot2)
        self.dither()
        self.remove(arrow1, arrow2)
        self.play(
            Transform(dot1, dot3),
            Transform(dot2, dot4)
        )
        self.play(
            ApplyMethod(grid.fade, 0.8),
            Animation(Mobject(dot3, dot4))
        )
        self.play(ShowCreation(arrow3))
        self.play(ShowCreation(arrow4))
        self.dither()
Exemple #8
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))
Exemple #9
0
    def show_angles(self):
        words = TextMobject("""
            Let's see what happens as we change
            the angle in this seed
        """)
        words.to_edge(UP)
        koch, sharper_koch, duller_koch = curves = [
            CurveClass(order=1)
            for CurveClass in StraightKoch, SharperKoch, DullerKoch
        ]
        arcs = [
            Arc(2 * (np.pi / 2 - curve.angle),
                radius=r,
                start_angle=np.pi + curve.angle).shift(
                    curve.points[curve.get_num_points() / 2])
            for curve, r in zip(curves, [0.6, 0.7, 0.4])
        ]
        theta = TexMobject("\\theta")
        theta.shift(arcs[0].get_center() + 2.5 * DOWN)
        arrow = Arrow(theta, arcs[0])

        self.add(words, koch)
        self.play(ShowCreation(arcs[0]))
        self.play(ShowCreation(arrow), ShimmerIn(theta))
        self.wait(2)
        self.remove(theta, arrow)
        self.play(
            Transform(koch, duller_koch),
            Transform(arcs[0], arcs[2]),
        )
        self.play(
            Transform(koch, sharper_koch),
            Transform(arcs[0], arcs[1]),
        )
        self.clear()
Exemple #10
0
 def add_tip(self):
     start, end = self.main_line.get_start_and_end()
     vect = (end - start)/np.linalg.norm(end-start)
     arrow = Arrow(start, end + MED_SMALL_BUFF*vect, buff = 0)
     tip = arrow.tip
     tip.highlight(self.color)
     self.tip = tip
     self.add(tip)
Exemple #11
0
 def construct(self):
     text = TextMobject("""
         See links in the description for more on
         sight via sound.
     """)
     self.play(ShimmerIn(text))
     self.play(ShowCreation(Arrow(text, 3*DOWN)))
     self.dither(2)
Exemple #12
0
    def construct(self):
        val = 0.7
        text = TexMobject([
            "\\text{HC}(", "x", ")",
            "=\\lim_{n \\to \\infty}\\text{PHC}_n(", "x", ")"
        ])
        text.to_edge(UP)
        x1 = text.split()[1]
        x2 = text.split()[-2]
        x2.highlight(BLUE)
        explanation = TextMobject("Actual Hilbert curve function")
        exp_arrow = Arrow(explanation, text.split()[0])
        curve = UnitInterval()
        dot = Dot(curve.number_to_point(val))
        x_arrow = Arrow(x1.get_bottom(), dot, buff = 0)
        curve.sort_points(lambda p : p[0])
        curve.add_numbers(0, 1)

        self.add(*text.split()[:3])
        self.play(
            ShimmerIn(explanation),
            ShowCreation(exp_arrow)
        )
        self.wait()
        self.remove(explanation, exp_arrow)
        self.play(ShowCreation(curve))
        self.play(
            ApplyMethod(x1.highlight, BLUE),
            ShowCreation(x_arrow), 
            ShowCreation(dot)
        )
        self.wait()
        self.remove(x_arrow)
        limit = Mobject(*text.split()[3:]).ingest_submobjects()
        limit.stroke_width = 1
        self.play(ShimmerIn(limit))
        for num in range(1, 9):
            new_curve = HilbertCurve(order = num)
            new_curve.scale(0.8)
            new_dot = Dot(new_curve.points[int(val*new_curve.get_num_points())])
            self.play(
                Transform(curve, new_curve),
                Transform(dot, new_dot),
            )
Exemple #13
0
    def construct(self):
        time_line = get_time_line()
        time_line.shift(-time_line.number_to_point(1900))
        hilbert_curve = HilbertCurve(order = 3)
        peano_curve = PeanoCurve(order = 2)
        for curve in hilbert_curve, peano_curve:
            curve.scale(0.5)
        hilbert_curve.to_corner(DOWN+RIGHT)
        peano_curve.to_corner(UP+LEFT)
        squares = Mobject(*[
            Square(side_length=3, color=WHITE).replace(curve)
            for curve in hilbert_curve, peano_curve
        ])


        self.add(time_line)
        self.dither()
        for year, curve, vect, text in [
            (1890, peano_curve, UP, "Peano Curve"), 
            (1891, hilbert_curve, DOWN, "Hilbert Curve"),
            ]:
            point = time_line.number_to_point(year)
            point[1] = 0.2
            arrow = Arrow(point+2*vect, point, buff = 0.1)
            arrow.gradient_highlight(curve.start_color, curve.end_color)
            year_mob = TexMobject(str(year))
            year_mob.next_to(arrow, vect)
            words = TextMobject(text)
            words.next_to(year_mob, vect)

            self.play(
                ShowCreation(arrow), 
                ShimmerIn(year_mob),
                ShimmerIn(words)
            )
            self.play(ShowCreation(curve))
            self.dither()
        self.play(ShowCreation(squares))
        self.dither()
        self.play(ApplyMethod(
            Mobject(*self.mobjects).shift, 20*(DOWN+RIGHT)
        ))
Exemple #14
0
    def construct(self):
        time_line = get_time_line()
        time_line.shift(-time_line.number_to_point(1900))
        hilbert_curve = HilbertCurve(order = 3)
        peano_curve = PeanoCurve(order = 2)
        for curve in hilbert_curve, peano_curve:
            curve.scale(0.5)
        hilbert_curve.to_corner(DOWN+RIGHT)
        peano_curve.to_corner(UP+LEFT)
        squares = Mobject(*[
            Square(side_length=3, color=WHITE).replace(curve)
            for curve in hilbert_curve, peano_curve
        ])


        self.add(time_line)
        self.wait()
        for year, curve, vect, text in [
            (1890, peano_curve, UP, "Peano Curve"), 
            (1891, hilbert_curve, DOWN, "Hilbert Curve"),
            ]:
            point = time_line.number_to_point(year)
            point[1] = 0.2
            arrow = Arrow(point+2*vect, point, buff = 0.1)
            arrow.gradient_highlight(curve.start_color, curve.end_color)
            year_mob = TexMobject(str(year))
            year_mob.next_to(arrow, vect)
            words = TextMobject(text)
            words.next_to(year_mob, vect)

            self.play(
                ShowCreation(arrow), 
                ShimmerIn(year_mob),
                ShimmerIn(words)
            )
            self.play(ShowCreation(curve))
            self.wait()
        self.play(ShowCreation(squares))
        self.wait()
        self.play(ApplyMethod(
            Mobject(*self.mobjects).shift, 20*(DOWN+RIGHT)
        ))
Exemple #15
0
    def construct(self):
        all_points = TextMobject("$f$ is continuous at every input point")
        continuous = TextMobject("$f$ is continuous")
        all_points.shift(UP)
        continuous.shift(DOWN)
        arrow = Arrow(all_points, continuous)

        self.play(ShimmerIn(all_points))
        self.play(ShowCreation(arrow))
        self.play(ShimmerIn(continuous))
        self.wait()
Exemple #16
0
    def construct(self):
        freq_line = get_freq_line()

        self.add(freq_line)
        self.dither()
        for tex, vect in zip(["20 Hz", "20{,}000 Hz"], [LEFT, RIGHT]):
            tex_mob = TextMobject(tex)
            tex_mob.to_edge(vect)
            tex_mob.shift(UP)
            arrow = Arrow(tex_mob, freq_line.get_edge_center(vect))
            self.play(ShimmerIn(tex_mob), ShowCreation(arrow))
        self.dither()
Exemple #17
0
    def construct(self):
        top_words = TextMobject("Different pixel-frequency association")
        bottom_words = TextMobject("Need to relearn sight-via-sound")
        top_words.shift(UP)
        bottom_words.shift(DOWN)
        arrow = Arrow(top_words, bottom_words)

        self.play(ShimmerIn(top_words))
        self.dither()
        self.play(ShowCreation(arrow))
        self.play(ShimmerIn(bottom_words))
        self.dither()
Exemple #18
0
    def construct(self):
        mathy, bubble = get_mathy_and_bubble()
        squiggle_mouth = mathy.mouth.copy()
        squiggle_mouth.apply_function(
            lambda (x, y, z) : (x, y+0.02*np.sin(50*x), z)
        )
        bubble.ingest_submobjects()        
        bubble.write("Why not use a Hilbert curve \\textinterrobang ")
        words1 = bubble.content
        bubble.write("So, it's not one curve but an infinite family of curves \\dots")
        words2 = bubble.content
        bubble.write("Well, no, it \\emph{is} just one thing, but I need \\\\ \
                      to tell you about a certain infinite family first.")
        words3 =  bubble.content
        description = TextMobject("Mathematician friend", size = "\\small")
        description.next_to(mathy, buff = 2)
        arrow = Arrow(description, mathy)

        self.add(mathy)
        self.play(
            ShowCreation(arrow),
            ShimmerIn(description)
        )
        self.dither()
        point = Point(bubble.get_tip())
        self.play(
            Transform(point, bubble),
        )
        self.remove(point)
        self.add(bubble)
        self.play(ShimmerIn(words1))
        self.dither()
        self.remove(description, arrow)
        self.play(
            Transform(mathy.mouth, squiggle_mouth),
            ApplyMethod(mathy.arm.wag, 0.2*RIGHT, LEFT),
        )
        self.remove(words1)
        self.add(words2)
        self.dither(2)
        self.remove(words2)
        self.add(words3)
        self.dither(2)
        self.play(
            ApplyPointwiseFunction(
                lambda p : 15*p/np.linalg.norm(p),
                bubble
            ),
            ApplyMethod(mathy.shift, 5*(DOWN+LEFT)),
            FadeOut(words3),
            run_time = 3
        )
Exemple #19
0
    def construct(self):
        old_newton = ImageMobject("Old_Newton", invert=False)
        old_newton.scale(0.8)
        self.add(old_newton)
        self.freeze_background()

        words = TextMobject("Note the displeasure")
        words.to_corner(UP + RIGHT)
        face_point = 1.8 * UP + 0.5 * LEFT
        arrow = Arrow(words.get_bottom(), face_point)

        self.play(ShimmerIn(words))
        self.play(ShowCreation(arrow))
        self.wait()
Exemple #20
0
    def construct(self):
        big_grid_dim = 20.
        small_grid_dim = 6.
        big_grid = Grid(64, 64, height=big_grid_dim, width=big_grid_dim)
        big_grid.to_corner(UP + RIGHT, buff=2)
        small_grid = big_grid.copy()
        small_grid.scale(small_grid_dim / big_grid_dim)
        small_grid.center()
        pixel = MobjectFromRegion(
            region_from_polygon_vertices(
                *0.2 *
                np.array([RIGHT + DOWN, RIGHT + UP, LEFT + UP, LEFT + DOWN])))
        pixel.set_color(WHITE)
        pixel_width = big_grid.width / big_grid.columns
        pixel.scale_to_fit_width(pixel_width)
        pixel.to_corner(UP + RIGHT, buff=2)
        pixel.shift(5 * pixel_width * (2 * LEFT + DOWN))

        freq_line = get_freq_line()
        dot = Dot()
        dot.shift(freq_line.get_center() + 2 * RIGHT)
        string = Line(LEFT, RIGHT, color=GREEN)
        arrow = Arrow(dot, string.get_center())
        vibration_config = {
            "overtones": 1,
            "spatial_period": 2,
        }
        vibration, loud_vibration, quiet_vibration = [
            Vibrate(string.copy(), amplitude=a, **vibration_config)
            for a in [0.5, 1., 0.25]
        ]

        self.add(small_grid)
        self.dither()
        self.play(Transform(small_grid, big_grid))
        self.play(FadeIn(pixel))
        self.dither()
        self.play(FadeOut(small_grid), ShowCreation(freq_line))
        self.remove(small_grid)
        self.play(Transform(pixel, dot), )
        self.dither()
        self.play(ShowCreation(arrow))
        self.play(loud_vibration)
        self.play(TransformAnimations(loud_vibration, quiet_vibration),
                  ApplyMethod(dot.fade, 0.9))
        self.clear()
        self.add(freq_line, dot, arrow)
        self.play(quiet_vibration)
Exemple #21
0
 def vary_circle_sizes(self):
     input_value = 0.45
     radius = 0.04
     vary_circles = VaryCircles(
         self,
         input_value,
         radius,
         run_time=5,
     )
     self.play(vary_circles)
     self.dither()
     text = TextMobject("Function is ``Continuous at A''")
     text.shift(2 * UP).to_edge(LEFT)
     arrow = Arrow(text, self.input_dot)
     self.play(ShimmerIn(text), ShowCreation(arrow))
     self.dither()
     self.remove(vary_circles.mobject, text, arrow)
Exemple #22
0
    def construct(self):
        words = TextMobject("Would this actually work?")
        grid = get_grid()
        grid.scale_to_fit_width(6)
        grid.to_edge(LEFT)
        freq_line = get_freq_line()
        freq_line.scale_to_fit_width(6)
        freq_line.center().to_edge(RIGHT)
        mapping = Mobject(grid, freq_line, Arrow(grid, freq_line))
        mapping.ingest_sub_mobjects()
        lower_left = Point().to_corner(DOWN + LEFT, buff=0)
        lower_right = Point().to_corner(DOWN + RIGHT, buff=0)

        self.add(words)
        self.dither()
        self.play(Transform(words, lower_right),
                  Transform(lower_left, mapping))
        self.dither()
Exemple #23
0
    def construct(self):
        axes = XYZAxes()
        axes.highlight(WHITE)
        plane = NumberPlane()
        vects = [
            Arrow(point, point+(3./27)*(3*x**2-3*y**2)*OUT, color = MAROON_D)
            for x in range(-4, 5, 2)
            for y in range(-5, 5, 2)
            for point in [x*RIGHT + y*UP]
        ]
        everybody = Mobject(axes, plane, *vects)

        self.play(ApplyMethod(
            everybody.rotate, 0.9*np.pi/2, RIGHT
        ))
        self.dither()
        self.play(ApplyMethod(
            everybody.rotate,
            np.pi/2,
            run_time = 5
        ))
Exemple #24
0
 def get_digit_increment_animations(self):
     result = []
     self.number += 1
     is_next_digit = self.is_next_digit()
     if is_next_digit: self.max_place += 1
     new_number_mob = self.get_number_mob(self.number)
     new_number_mob.move_to(self.number_mob, RIGHT)
     if is_next_digit:
         self.add_configuration()
         place = len(new_number_mob.split()) - 1
         result.append(FadeIn(self.dot_templates[place]))
         arrow = Arrow(new_number_mob[place].get_top(),
                       self.dot_templates[place].get_bottom(),
                       color=self.digit_place_colors[place])
         self.arrows.add(arrow)
         result.append(ShowCreation(arrow))
     result.append(
         Transform(self.number_mob,
                   new_number_mob,
                   submobject_mode="lagged_start"))
     return result
Exemple #25
0
    def construct(self):
        left_words = TextMobject("Infinite result")
        right_words = TextMobject("Finite world")
        for words in left_words, right_words:
            words.scale(0.8)
        left_formula = TexMobject("\\sum_{n = 0}^{\\infty} 2^n = -1")
        right_formula = TexMobject("111\\cdots111")
        for formula in left_formula, right_formula:
            formula.add(Brace(formula, UP), )
            formula.ingest_submobjects()
        right_overwords = TextMobject("\\substack{\
                \\text{How computers} \\\\ \
                \\text{represent $-1$}\
            }").scale(1.5)

        left_mobs = [left_words, left_formula]
        right_mobs = [right_words, right_formula]
        for mob in left_mobs:
            mob.to_edge(RIGHT, buff=1)
            mob.shift(SPACE_WIDTH * LEFT)
        for mob in right_mobs:
            mob.to_edge(LEFT, buff=1)
            mob.shift(SPACE_WIDTH * RIGHT)
        arrow = Arrow(left_words, right_words)
        right_overwords.next_to(right_formula, UP)

        self.play(ShimmerIn(left_words))
        self.play(ShowCreation(arrow))
        self.play(ShimmerIn(right_words))
        self.wait()
        self.play(ShimmerIn(left_formula),
                  ApplyMethod(left_words.next_to, left_formula, UP))
        self.wait()
        self.play(ShimmerIn(right_formula),
                  Transform(right_words, right_overwords))
        self.wait()
        self.finite_analog(Mobject(left_formula, left_words), arrow,
                           Mobject(right_formula, right_words))
Exemple #26
0
    def construct(self):
        grid = Grid(64, 64)
        space_region = Region()
        space_mobject = MobjectFromRegion(space_region, DARK_GREY)
        curve = PeanoCurve(order = 5).replace(space_mobject)
        line = Line(5*LEFT, 5*RIGHT)
        line.gradient_highlight(curve.start_color, curve.end_color)
        for mob in grid, space_mobject:
            mob.sort_points(np.linalg.norm)
        infinitely = TextMobject("Infinitely")
        detailed = TextMobject("detailed")
        extending = TextMobject("extending")
        detailed.next_to(infinitely, RIGHT)
        extending.next_to(infinitely, RIGHT)
        Mobject(extending, infinitely, detailed).center()
        arrows = Mobject(*[
            Arrow(2*p, 4*p)
            for theta in np.arange(np.pi/6, 2*np.pi, np.pi/3)
            for p in [rotate_vector(RIGHT, theta)]
        ])

        self.add(grid)
        self.wait()
        self.play(Transform(grid, space_mobject, run_time = 5))
        self.remove(grid)
        self.highlight_region(space_region, DARK_GREY)
        self.wait()
        self.add(infinitely, detailed)
        self.wait()
        self.play(DelayByOrder(Transform(detailed, extending)))
        self.play(ShowCreation(arrows))
        self.wait()
        self.clear()
        self.highlight_region(space_region, DARK_GREY)
        self.play(ShowCreation(line))
        self.play(Transform(line, curve, run_time = 5))
Exemple #27
0
 def get_vector(self, coords, **kwargs):
     point = coords[0]*RIGHT + coords[1]*UP
     arrow = Arrow(ORIGIN, coords, **kwargs)
     return arrow