blob: 8e48a97226a1fc6be6643a43b3968f14341e72ff [file] [log] [blame]
avm9996395970152020-12-15 10:45:07 +01001#!/usr/bin/env python
2
3from manimlib.imports import *
4
5def get_title(title_str = "Història"):
6 title = TextMobject(title_str)
7 title.scale(1.5)
8 title.to_edge(UP)
9 return title
10
11def create_image(source, scale=2.5):
12 img = ImageMobject(source)
13 img.scale(scale)
14 return img
15
16def create_label(img, desc):
17 label = TextMobject(desc)
18 label.scale(0.7)
19 label.next_to(img, DOWN)
20 return label
21
22class IntroHistoria(Scene):
23 def construct(self):
24 title = get_title()
25
26 self.play(Write(title))
27 self.wait(1.5)
28
29 pol = TexMobject("p(x) = ", "x^n + a_{n-1} x^{n-1} + \ldots + a_0")
30 pol0, pol1 = pol.split();
31
32 pol2 = TexMobject("\\prod_{i = 1}^n (x - ", "\\alpha_i", ")")
33 pol2_1, alpha_pol, pol2_3 = pol2.split()
34
avm9996398a425b2020-12-16 03:44:33 +010035 vieta1 = TexMobject("a_{n-1} = - (", "\\alpha_1", " + \ldots + ", "\\alpha_n", ")")
36 vieta1_i, vieta1_alpha1, vieta1_plus, vieta1_alphan, vieta1_post = vieta1.split()
avm9996395970152020-12-15 10:45:07 +010037
38 vietamore = TexMobject("\\vdots")
39
avm9996398a425b2020-12-16 03:44:33 +010040 vieta2 = TexMobject("a_0 = (-1)^n \\cdot (", "\\alpha_1", " \cdot \ldots \cdot ", "\\alpha_n", ")")
41 vieta2_i, vieta2_alpha1, vieta2_prod, vieta2_alphan, vieta2_post = vieta2.split()
avm9996395970152020-12-15 10:45:07 +010042
43 general_vieta = TexMobject("(-1)^k a_{n-k} = \\sum_{1 \\le i_1 < i_2 < \\cdots < i_k \\le n} \\left( \\prod_{j=1}^k \\alpha_{i_j} \\right)")
avm9996398a425b2020-12-16 03:44:33 +010044 general_vieta_desc = TextMobject("Fórmules de Viète")
avm9996395970152020-12-15 10:45:07 +010045
46 vietas = VGroup(vieta1, vietamore, vieta2)
47 vietamore.next_to(vieta1, DOWN, buff = 0.4)
48 vieta2.next_to(vietamore, DOWN, buff = 0.4)
49 vietas.next_to(pol, DOWN, buff = 1)
50 flow = VGroup(pol, vietas)
51 flow.center()
52
53 # This should be done after the flow is centered:
54 pol2.next_to(pol0, RIGHT)
55 general_vieta.align_to(vietas, UP)
56 general_vieta_desc.next_to(vietas, DOWN)
57
58 alpha_pol2 = alpha_pol.copy()
59 alpha_pol3 = alpha_pol.copy()
60 alpha_pol4 = alpha_pol.copy()
61
62 framebox = SurroundingRectangle(general_vieta, buff = .15)
63 framebox.set_stroke(WHITE, 4)
64
65 # Animations:
66 self.play(Write(pol))
67 self.wait(1.5)
68
69 self.play(Transform(pol1, pol2))
70 self.wait(1.5)
71
72 self.play(ApplyMethod(
73 alpha_pol.set_color, RED,
74 rate_func = there_and_back,
75 run_time = 2
76 ))
77 self.wait(1.5)
78
79 self.play(
avm9996398a425b2020-12-16 03:44:33 +010080 Write(vieta1,
81 run_time=1),
avm9996395970152020-12-15 10:45:07 +010082 Transform(alpha_pol, vieta1_alpha1),
83 Transform(alpha_pol2, vieta1_alphan)
84 )
85 self.wait(1.5)
86
87 self.play(FadeIn(vietamore))
88 self.play(
avm9996398a425b2020-12-16 03:44:33 +010089 Write(vieta2,
90 run_time=1),
avm9996395970152020-12-15 10:45:07 +010091 Transform(alpha_pol3, vieta2_alpha1),
92 Transform(alpha_pol4, vieta2_alphan)
93 )
94 self.wait(1.5)
95
96 self.play(Transform(vietas, general_vieta))
97 self.wait(1.5)
avm9996398a425b2020-12-16 03:44:33 +010098
avm9996395970152020-12-15 10:45:07 +010099 self.play(
100 FadeIn(framebox),
101 FadeInFrom(general_vieta_desc, UP)
102 )
103 self.wait(1.5)
104
105class LucaPacioli(Scene):
106 def construct(self):
107 title = get_title()
108 self.add(title)
109 self.wait(1.5)
110
111 luca = create_image("img/pacioli.jpg")
112 luca.to_edge(LEFT, buff=1)
113 luca_desc = create_label(luca, "Luca Pacioli (c. 1445-1509)")
114
115 suma = create_image("img/suma.png")
116 suma.to_edge(RIGHT, buff=1)
117 suma_desc = create_label(suma, "\\textit{Summa de arithmetica} (1494)")
118
119 self.play(
120 FadeIn(luca),
121 FadeInFrom(luca_desc, UP)
122 )
123 self.wait(1.5)
124
125 self.play(
126 FadeIn(suma),
127 FadeInFrom(suma_desc, UP)
128 )
129 self.wait(1.5)
130
131 cardano = create_image("img/cardano.jpg")
132 cardano.to_edge(LEFT, buff=1)
133 cardano_desc = create_label(cardano, "Girolamo Cardano (1501-1576)")
134
135 arsmagna = create_image("img/arsmagna.png")
136 arsmagna.to_edge(RIGHT, buff=1)
137 arsmagna_desc = create_label(arsmagna, "\\textit{Ars Magna} (1545)")
138
avm9996398a425b2020-12-16 03:44:33 +0100139 cardano_cita = TextMobject("``Differentia aequationum ", "verarum", " et ", "fictarui", " \\\\ semper est numerus quadrato''")
140 cardano_pre, cardano_v, cardano_et, cardano_f, cardano_post = cardano_cita.split()
avm9996395970152020-12-15 10:45:07 +0100141 cardano_cita.scale(0.825)
142 cardano_cita.next_to(cardano, RIGHT)
143
144 self.play(
145 FadeOut(suma),
146 FadeOut(suma_desc),
147 FadeOut(luca),
148 FadeIn(cardano),
149 Transform(luca_desc, cardano_desc)
150 )
151 self.remove(luca_desc)
152 self.add(cardano_desc)
153 self.wait(1.5)
154
155 self.play(
156 FadeIn(arsmagna),
157 FadeInFrom(arsmagna_desc, UP)
158 )
159 self.wait(1.5)
160
161 self.play(
162 FadeOut(arsmagna),
163 FadeOut(arsmagna_desc),
164 Write(cardano_cita)
165 )
166 self.wait(1.5)
167
avm9996398a425b2020-12-16 03:44:33 +0100168 self.play(ApplyMethod(
169 cardano_v.set_color, RED,
170 rate_func = there_and_back,
171 run_time = 1
172 ))
173 self.play(ApplyMethod(
174 cardano_f.set_color, RED,
175 rate_func = there_and_back,
176 run_time = 1
177 ))
178 self.wait(1.5)
179
avm9996395970152020-12-15 10:45:07 +0100180 viete = create_image("img/viete.jpeg")
181 viete.to_edge(LEFT, buff=1)
182 viete_desc = create_label(viete, "François Viète (1540-1603)")
183
184 self.play(
185 FadeOut(cardano_cita),
186 FadeOut(cardano),
187 FadeIn(viete),
188 Transform(cardano_desc, viete_desc)
189 )
190 self.remove(cardano_desc)
191 self.add(viete_desc)
192 self.wait(1.5)
193
194 girard = create_image("img/girard.jpg")
195 girard.to_edge(LEFT, buff=1)
196 girard_desc = create_label(girard, "Albert Girard (1595-1632)")
197
198 self.play(
199 FadeOut(viete),
200 FadeIn(girard),
201 Transform(viete_desc, girard_desc)
202 )
203 self.remove(viete_desc)
204 self.add(girard_desc)
205 self.wait(1.5)
206
207 primer = TextMobject("Primer teorema de polinomis simètrics, \\\\ sense saber-ho")
208 primer.scale(0.825)
209 primer.next_to(girard, RIGHT)
avm9996398a425b2020-12-16 03:44:33 +0100210
avm9996395970152020-12-15 10:45:07 +0100211 self.play(Write(primer))
212 self.wait(1.5)
213
214 invention = create_image("img/inventionnouvelle.png", 2)
215 invention.to_edge(RIGHT, buff=1)
216 invention_desc = create_label(invention, "\\textit{Invention nouvelle en l'algèbre} (1629)")
217
218 self.play(
219 FadeOut(primer),
220 FadeIn(invention),
221 FadeInFrom(invention_desc, UP)
222 )
223 self.wait(1.5)
224
225 factions = create_image("img/factions.png", 1)
226 factions.to_edge(RIGHT, buff=1)
227
228 self.play(
229 FadeOut(invention),
230 FadeIn(factions),
231 ApplyMethod(invention_desc.next_to, factions, DOWN)
232 )
233 self.wait(1.5)
234
avm9996398a425b2020-12-16 03:44:33 +0100235 factions_tex = TexMobject("\\text{Faction } k = \\sum_{\\{ i_1, \ldots, i_k \\} \\in \\{ 1, 2, \ldots, n \\}} \\alpha_{i_1} \\cdot \\cdots \\cdot \\alpha_{i_k}")
236 factions_tex.scale(0.95)
237 factions_tex.next_to(girard, RIGHT)
238
239 self.play(
240 FadeOut(factions),
241 Write(factions_tex)
242 )
243 self.wait(1.5)
244
245 notthesame = TexMobject("\\sum_{i < j} \\alpha_i \\alpha_j ", "\\neq", " \\sum_{i} \\alpha_i^2")
246 notthesame.next_to(girard, RIGHT).shift(1*RIGHT)
247
248 notthesame2 = TexMobject("\\sum_{i < j < k} \\alpha_i \\alpha_j \\alpha_k ", "\\neq", " \\sum_{i} \\alpha_i^3")
249 notthesame2.next_to(girard, RIGHT).shift(1*RIGHT)
250
251 self.play(Transform(factions_tex, notthesame))
252 self.remove(factions_tex)
253 self.add(notthesame)
254 self.wait(1.5)
255
256 self.play(Transform(notthesame, notthesame2))
257 self.remove(notthesame)
258 self.add(notthesame2)
259 self.wait(1.5)
260
avm9996395970152020-12-15 10:45:07 +0100261 sommes = create_image("img/sommepuissances.png")
262 sommes.to_edge(RIGHT, buff=1)
263
264 self.play(
avm9996398a425b2020-12-16 03:44:33 +0100265 FadeOut(notthesame2),
avm9996395970152020-12-15 10:45:07 +0100266 FadeIn(sommes),
267 ApplyMethod(invention_desc.next_to, sommes, DOWN)
268 )
269 self.wait(1.5)
270
271 sommes2 = create_image("img/sommepuissances2.png", 1)
272 sommes2.to_edge(RIGHT, buff=1)
273 sommes2_desc = create_label(sommes2, "\\textit{A Short Account of the History of Symmetric} \\\\ \\textit{Functions of Roots of Equations}, \\\\ H. Gray Funkhouser (1930).")
274
275 self.play(
276 FadeOut(sommes),
277 FadeIn(sommes2),
278 Transform(invention_desc, sommes2_desc)
279 )
280 self.remove(invention_desc)
281 self.add(sommes2_desc)
282 self.wait(1.5)
283
avm9996395970152020-12-15 10:45:07 +0100284 waring = create_image("img/waring.jpg")
285 waring.to_edge(LEFT, buff=1)
286 waring_desc = create_label(waring, "Edward Waring (1736-1798)")
287
288 self.play(
avm9996398a425b2020-12-16 03:44:33 +0100289 FadeOut(sommes2),
290 FadeOut(sommes2_desc),
avm9996395970152020-12-15 10:45:07 +0100291 FadeOut(girard),
292 FadeIn(waring),
293 Transform(girard_desc, waring_desc)
294 )
295 self.remove(girard_desc)
296 self.add(waring_desc)
297 self.wait(1.5)
298
299class EdwardWaring(Scene):
300 def construct(self):
301 title = get_title()
302 self.add(title)
303
304 waring = create_image("img/waring.jpg")
305 waring.to_edge(LEFT, buff=1)
306 waring_desc = create_label(waring, "Edward Waring (1736-1798)")
307
308 self.add(waring)
309 self.add(waring_desc)
310
311 th1 = TextMobject("Teorema 1. ", "???").set_color(GRAY)
312 th2 = TextMobject("Teorema 2. ???").set_color(GRAY)
313 th3 = TextMobject("Teorema 3. ", "???").set_color(GRAY)
314
315 th1.shift(1*UP)
316 th3.shift(1*DOWN)
317
318 teoremes = VGroup(th1, th2, th3)
319 teoremes.next_to(waring, RIGHT).shift(1*RIGHT)
avm9996398a425b2020-12-16 03:44:33 +0100320
avm9996395970152020-12-15 10:45:07 +0100321 self.play(
322 FadeInFrom(th1, UP),
323 FadeIn(th2),
324 FadeInFrom(th3, DOWN)
325 )
326 self.wait(1.5)
327
328 th1_pre, th1_question = th1.split()
329 th1_text = TexMobject("\\sum_{i} \\alpha_i^k = f_k(a_i) \\quad \\forall k \\in \\mathbb{N}")
330 th1_text.scale(0.8)
331 th1_text.next_to(th1_pre)
332
333 self.play(
334 Transform(th1_question, th1_text),
335 ApplyMethod(th1_pre.set_color, WHITE)
336 )
337 self.wait(1.5)
338
339 th3_pre, th3_question = th3.split()
340 th3_text = TextMobject("Precursor al Teo. Fonamental \\\\ dels Polinomis Simètrics")
341 th3_text.scale(0.7)
342 th3_text.next_to(th3_pre)
343
344 self.play(
345 Transform(th3_question, th3_text),
346 ApplyMethod(th3_pre.set_color, WHITE)
347 )
348 self.wait(1.5)
349
350 meditationes = create_image("img/meditationes.png")
351 meditationes.to_edge(RIGHT, buff=2)
352 meditationes_desc = create_label(meditationes, "\\textit{Meditationes Algebraicae} (1770).")
353
354 self.play(
355 FadeOut(th1),
356 FadeOut(th2),
357 FadeOut(th3),
358 FadeIn(meditationes),
359 FadeInFrom(meditationes_desc, UP)
360 )
361 self.wait(1.5)
362
363 conjectura = VGroup(
364 TextMobject("$n$ es pot escriure com a màxim com a suma de:"),
365 TextMobject("$\\cdot$ 4 quadrats"),
366 TextMobject("$\\cdot$ 9 cubs"),
367 TextMobject("$\\cdot$ 19 biquadrats"),
368 TextMobject("$\\cdot$ en general, $m$ potències k-èssimes positives, \\\\ essent $m$ depenent de $k$ ($\\forall k \\in \\mathbb{N}$)"),
369 )
370 conjectura.scale(0.8)
371 conjectura.arrange(DOWN, buff = MED_LARGE_BUFF, aligned_edge = LEFT)
372 conjectura.to_edge(RIGHT, buff=0.75)
373
374 self.play(
375 FadeOut(meditationes),
376 Write(conjectura)
377 )
378 self.wait(1.5)