1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
# -*- coding: utf-8 -*-
import sys, os
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from manim import *
from tiktok import *
class Nines(TikTok):
NAME = "nueves"
def construct(self):
self.prepare()
chip = self.chip("Matemática que enoja", C_PINK)
# --- the number ---
with self.beat(0) as b:
head = Text("0,", font=FONT, font_size=110, weight=BOLD, color=WHITE)
nines = VGroup(*[Text("9", font=FONT, font_size=110, weight=BOLD, color=AMBER)
for _ in range(6)])
dots = Text("…", font=FONT, font_size=110, weight=BOLD, color=AMBER)
num = VGroup(head, *nines, dots).arrange(RIGHT, buff=0.06)
self.fit(num, 8.0).move_to(UP * 4.5)
b.play(FadeIn(chip, shift=DOWN * 0.3), run_time=0.45)
b.play(FadeIn(head), run_time=0.3)
b.play(LaggedStart(*[FadeIn(n, shift=DOWN * 0.25) for n in nines],
lag_ratio=0.5), run_time=1.1)
b.play(Write(dots), run_time=0.4)
# --- it equals 1 ----
with self.beat(1) as b:
eq = MathTex("=", color=WHITE).scale(2.2).move_to(UP * 2.4)
one = MathTex("1", color=C_GREEN).scale(3.2).next_to(eq, DOWN, buff=0.35)
b.play(Write(eq), run_time=0.4)
b.play(FadeIn(one, scale=0.5), run_time=0.5)
b.play(Flash(one, color=C_GREEN, line_length=0.5, num_lines=16, flash_radius=1.1),
run_time=0.7)
equals = VGroup(eq, one)
# --- the objection ---
with self.beat(2) as b:
bubble = RoundedRectangle(corner_radius=0.35, width=7.4, height=1.5,
stroke_color=C_GRAY, stroke_width=4,
fill_color="#151C2E", fill_opacity=1).move_to(UP * 0.9)
obj = self.fit(Text("«pero le falta un poquito»", font=FONT, font_size=42,
weight=BOLD, color=C_GRAY), 6.9).move_to(bubble)
b.play(FadeOut(equals), run_time=0.3)
b.play(FadeIn(bubble), Write(obj), run_time=1.0)
# --- tell me how much ---
with self.beat(3) as b:
q = MathTex(r"1 - 0{,}999\ldots \;=\; ?", color=WHITE).scale(1.6).move_to(UP * 1.5)
q[0][-1].set_color(C_PINK)
b.play(FadeOut(VGroup(bubble, obj)), run_time=0.3)
b.play(Write(q), run_time=1.1)
b.play(Indicate(q[0][-1], color=C_PINK, scale_factor=1.6), run_time=0.8)
# --- the number line: no room in between ---
line = Line(LEFT * 3.4, RIGHT * 3.4, stroke_width=7, color="#3A4766").move_to(UP * 0.55)
dA = Dot(line.get_left() + RIGHT * 1.4, radius=0.15, color=AMBER)
dB = Dot(line.get_right(), radius=0.15, color=C_GREEN)
lA = MathTex("0{,}999\\ldots", color=AMBER).scale(1.0).next_to(dA, DOWN, buff=0.45)
lB = MathTex("1", color=C_GREEN).scale(1.4).next_to(dB, DOWN, buff=0.45)
with self.beat(4) as b:
b.play(FadeOut(q), run_time=0.25)
b.play(Create(line), run_time=0.5)
b.play(FadeIn(dA), FadeIn(dB), Write(lA), Write(lB), run_time=0.8)
brace = Brace(Line(dA.get_center(), dB.get_center()), UP, color=C_PINK, buff=0.15)
ask = Text("¿qué número entra acá?", font=FONT, font_size=34,
weight=BOLD, color=C_PINK).next_to(brace, UP, buff=0.2)
self.fit(ask, 7.5)
b.play(GrowFromCenter(brace), FadeIn(ask), run_time=0.8)
gap = VGroup(brace, ask)
with self.beat(5) as b:
b.play(dA.animate.move_to(dB.get_center()),
lA.animate.next_to(dB, DOWN, buff=0.45).shift(LEFT * 1.3),
FadeOut(gap), run_time=1.2)
none = Text("nada: es el mismo punto", font=FONT, font_size=40,
weight=BOLD, color=C_GREEN).move_to(DOWN * 1.9)
b.play(Flash(dB, color=C_GREEN, line_length=0.6, num_lines=18, flash_radius=1.2),
FadeIn(self.fit(none, 7.8), shift=UP * 0.2), run_time=0.9)
line_m = VGroup(line, dA, dB, lA, lB, none)
# --- the proof ---------
with self.beat(6) as b:
p1 = MathTex(r"\frac{1}{3} = 0{,}333\ldots", color=WHITE).scale(1.9).move_to(UP * 3.7)
b.play(FadeOut(VGroup(line_m, num, head, dots, *nines)), run_time=0.45)
b.play(Write(p1), run_time=1.1)
with self.beat(7) as b:
x3 = Text("× 3", font=FONT, font_size=60, weight=BOLD, color=AMBER).move_to(UP * 1.75)
ar = VGroup(
Arrow(UP * 2.75 + LEFT * 2.1, UP * 0.75 + LEFT * 2.1, buff=0, color=AMBER, stroke_width=8),
Arrow(UP * 2.75 + RIGHT * 2.1, UP * 0.75 + RIGHT * 2.1, buff=0, color=AMBER, stroke_width=8),
)
b.play(FadeIn(x3, scale=0.6), run_time=0.5)
b.play(*[GrowArrow(a) for a in ar], run_time=0.7)
with self.beat(8) as b:
p2 = MathTex(r"\frac{3}{3} = 0{,}999\ldots", color=WHITE).scale(1.9).move_to(DOWN * 0.55)
p2[0][0].set_color(C_GREEN); p2[0][2].set_color(C_GREEN)
b.play(Write(p2), run_time=1.3)
b.play(Circumscribe(p2, color=C_SKY, buff=0.3, stroke_width=6), run_time=0.9)
with self.beat(9) as b:
final = MathTex(r"1 = 0{,}999\ldots", color=C_GREEN).scale(2.3).move_to(DOWN * 2.6)
b.play(FadeOut(VGroup(x3, ar)), run_time=0.3)
b.play(TransformFromCopy(p2, final), run_time=1.2)
b.play(Flash(final, color=C_GREEN, line_length=0.7, num_lines=22, flash_radius=2.2),
run_time=0.9)
with self.beat(10) as b:
b.play(FadeOut(VGroup(p1, p2)), run_time=0.4)
count_txt = self.fit(Text("¿te convencí?", font=FONT, font_size=72, weight=BOLD,
color=AMBER), 7.9).move_to(UP * 2.2)
sub = Text("escribilo en los comentarios", font=FONT, font_size=40,
color=C_GRAY).next_to(count_txt, DOWN, buff=0.4)
b.play(Write(count_txt), run_time=0.8)
b.play(FadeIn(sub, shift=UP * 0.2), run_time=0.5)
self.finish()
|