-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathlebesgue.py
145 lines (135 loc) · 5.23 KB
/
lebesgue.py
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
from manimlib.imports import *
############################
### NÚMERO DE LEBESGE ######
############################
class NumLebesgue(Scene):
def construct(self):
grid = NumberPlane()
###Texto
titulo = TextMobject("""Lema del N\\'{u}mero de Lebesgue""")
titulo.scale(1.2)
t_1 = TextMobject("""Sea $X \\subset \\mathbb{R}^{n}$ compacto""").move_to(
3 * UP
)
t_2 = TextMobject("y $\\mathcal{F}$ una cubierta abierta de $X$").move_to(
3 * UP
)
t_3 = TextMobject("$\\implies \\exists$ $\\epsilon > 0$").move_to(3 * UP)
t_4 = TextMobject("tal que $\\forall$ $x \in X$").move_to(3 * UP)
t_5 = TextMobject("$\\exists$ $U \\in \\mathcal{F}$").move_to(3 * UP)
t_6 = TextMobject("tal que $B(x, \\epsilon) \\subseteq U$").move_to(3 * UP)
t_7 = TextMobject(" \\textquestiondown Puedes probarlo formalmente?")
###Dibujos
Conjunto_Cubierto = SVGMobject("Topologia_SVGs/Lebesgue.svg").scale(2)
X = Conjunto_Cubierto[0].set_color(GREEN).next_to(t_1, 5 * DOWN)
cover = Conjunto_Cubierto[1:7].next_to(t_2, 2 * DOWN)
colors = it.cycle([YELLOW, RED, PURPLE, PINK, BLUE, TEAL, WHITE])
for i in range(len(cover)):
color = next(colors)
cover[i].set_fill(color, opacity=0.4).set_stroke(color, 0.5)
line = Line(np.array([1, 0, 0]), np.array([1.27, 0, 0])).move_to((1, -0.8, 0))
brace = Brace(line, UP)
epsilon = TextMobject("$\\epsilon$").next_to(brace, UP)
dot = Dot((0, 0, 0), color=WHITE, radius=0.05).move_to(line, LEFT)
x = TextMobject("$x_1$").next_to(dot, LEFT)
U1 = TextMobject("$U_1$").next_to(cover[5], RIGHT)
U3 = TextMobject("$U_2$").next_to(cover[1], LEFT)
U4 = TextMobject("$U_3$").next_to(cover[0], LEFT)
U5 = TextMobject("$U_4$").next_to(cover[4], RIGHT)
circle = Circle(
radius=0.2, fill_color=RED, color=RED, fill_opacity=0.8
).move_to(dot)
line3 = Line(np.array([1, 0, 0]), np.array([1.27, 0, 0])).move_to(
(-0.85, -0.75, 0)
)
dot3 = Dot((0, 0, 0), color=WHITE, radius=0.05).move_to(line3, LEFT)
x3 = TextMobject("$x_2$").next_to(dot3, LEFT)
circle3 = Circle(
radius=0.2, fill_color=RED, color=RED, fill_opacity=0.8
).move_to(dot3)
line4 = Line(np.array([1, 0, 0]), np.array([1.27, 0, 0])).move_to((-1.7, 1, 0))
dot4 = Dot((0, 0, 0), color=WHITE, radius=0.05).move_to(line4, LEFT)
x4 = TextMobject("$x_3$").next_to(dot4, DOWN)
circle4 = Circle(
radius=0.2, fill_color=RED, color=RED, fill_opacity=0.8
).move_to(dot4)
line5 = Line(np.array([1, 0, 0]), np.array([1.27, 0, 0])).move_to(
(-0.55, 1.2, 0)
)
dot5 = Dot((0, 0, 0), color=WHITE, radius=0.05).move_to(line5, LEFT)
x5 = TextMobject("$x_4$").next_to(dot5, UP)
circle5 = Circle(
radius=0.2, fill_color=RED, color=RED, fill_opacity=0.8
).move_to(dot5)
###Grupos
Group_1 = VGroup(t_1, X)
Group_2 = VGroup(line, brace, epsilon)
Group_3 = VGroup(dot, dot3, dot4, dot5, x, x3, x4, x5)
Group_4 = VGroup(line, brace, epsilon, dot, dot3, dot4, dot5, x, x3, x4, x5)
Group_5 = VGroup(
line,
line3,
line4,
line5,
brace,
epsilon,
dot,
dot3,
dot4,
dot5,
x,
x3,
x4,
x5,
cover,
X,
t_6,
circle,
circle3,
circle4,
circle5,
U1,
U3,
U4,
U5,
)
Group_6 = VGroup(x, x3, x4, x5)
Group_7 = VGroup(line3, line4, line5)
# animación
self.play(Write(titulo))
self.wait(2)
self.play(ReplacementTransform(titulo, Group_1))
self.wait(4)
self.play(ReplacementTransform(t_1, t_2))
self.play(FadeIn(cover))
self.wait(2)
self.play(ReplacementTransform(t_2, t_3))
self.play(FadeIn(Group_2))
self.play(FadeOut(brace))
self.play(FadeOut(epsilon))
self.add(Group_3)
self.play(ReplacementTransform(t_3, t_4))
self.play(FadeIn(Group_7))
self.wait(2.2)
self.play(FadeOut(Group_6))
self.play(ReplacementTransform(t_4, t_5))
self.play(DrawBorderThenFill(cover[5].set_stroke(WHITE, 1)))
self.add(U1)
self.play(DrawBorderThenFill(cover[1].set_stroke(WHITE, 1)))
self.add(U3)
self.play(DrawBorderThenFill(cover[0].set_stroke(WHITE, 1)))
self.add(U4)
self.play(DrawBorderThenFill(cover[4].set_stroke(WHITE, 1)))
self.add(U5)
self.wait(3)
self.play(ReplacementTransform(t_5, t_6))
self.play(DrawBorderThenFill(circle))
self.play(DrawBorderThenFill(circle3))
self.play(DrawBorderThenFill(circle4))
self.play(DrawBorderThenFill(circle5))
self.play(FadeIn(Group_4))
self.wait(4)
self.wait(4)
self.play(ReplacementTransform(Group_5, t_7))
self.wait(3)
self.play(FadeOut(t_7))