avm99963 | 9597015 | 2020-12-15 10:45:07 +0100 | [diff] [blame^] | 1 | #!/usr/bin/env python |
| 2 | |
| 3 | from manimlib.imports import * |
| 4 | |
| 5 | def 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 | |
| 11 | def create_image(source, scale=2.5): |
| 12 | img = ImageMobject(source) |
| 13 | img.scale(scale) |
| 14 | return img |
| 15 | |
| 16 | def create_label(img, desc): |
| 17 | label = TextMobject(desc) |
| 18 | label.scale(0.7) |
| 19 | label.next_to(img, DOWN) |
| 20 | return label |
| 21 | |
| 22 | class 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 | |
| 35 | vieta1 = TexMobject("a_{n-1} = ", "\\alpha_1", " + \ldots + ", "\\alpha_n") |
| 36 | vieta1_i, vieta1_alpha1, vieta1_plus, vieta1_alphan = vieta1.split() |
| 37 | |
| 38 | vietamore = TexMobject("\\vdots") |
| 39 | |
| 40 | vieta2 = TexMobject("a_0 = ", "\\alpha_1", " \cdot \ldots \cdot ", "\\alpha_n") |
| 41 | vieta2_i, vieta2_alpha1, vieta2_prod, vieta2_alphan = vieta2.split() |
| 42 | |
| 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)") |
| 44 | general_vieta_desc = TextMobject("Fòrmules de Viète") |
| 45 | |
| 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( |
| 80 | Write(vieta1), |
| 81 | Transform(alpha_pol, vieta1_alpha1), |
| 82 | Transform(alpha_pol2, vieta1_alphan) |
| 83 | ) |
| 84 | self.wait(1.5) |
| 85 | |
| 86 | self.play(FadeIn(vietamore)) |
| 87 | self.play( |
| 88 | Write(vieta2), |
| 89 | Transform(alpha_pol3, vieta2_alpha1), |
| 90 | Transform(alpha_pol4, vieta2_alphan) |
| 91 | ) |
| 92 | self.wait(1.5) |
| 93 | |
| 94 | self.play(Transform(vietas, general_vieta)) |
| 95 | self.wait(1.5) |
| 96 | |
| 97 | self.play( |
| 98 | FadeIn(framebox), |
| 99 | FadeInFrom(general_vieta_desc, UP) |
| 100 | ) |
| 101 | self.wait(1.5) |
| 102 | |
| 103 | class LucaPacioli(Scene): |
| 104 | def construct(self): |
| 105 | title = get_title() |
| 106 | self.add(title) |
| 107 | self.wait(1.5) |
| 108 | |
| 109 | luca = create_image("img/pacioli.jpg") |
| 110 | luca.to_edge(LEFT, buff=1) |
| 111 | luca_desc = create_label(luca, "Luca Pacioli (c. 1445-1509)") |
| 112 | |
| 113 | suma = create_image("img/suma.png") |
| 114 | suma.to_edge(RIGHT, buff=1) |
| 115 | suma_desc = create_label(suma, "\\textit{Summa de arithmetica} (1494)") |
| 116 | |
| 117 | self.play( |
| 118 | FadeIn(luca), |
| 119 | FadeInFrom(luca_desc, UP) |
| 120 | ) |
| 121 | self.wait(1.5) |
| 122 | |
| 123 | self.play( |
| 124 | FadeIn(suma), |
| 125 | FadeInFrom(suma_desc, UP) |
| 126 | ) |
| 127 | self.wait(1.5) |
| 128 | |
| 129 | cardano = create_image("img/cardano.jpg") |
| 130 | cardano.to_edge(LEFT, buff=1) |
| 131 | cardano_desc = create_label(cardano, "Girolamo Cardano (1501-1576)") |
| 132 | |
| 133 | arsmagna = create_image("img/arsmagna.png") |
| 134 | arsmagna.to_edge(RIGHT, buff=1) |
| 135 | arsmagna_desc = create_label(arsmagna, "\\textit{Ars Magna} (1545)") |
| 136 | |
| 137 | cardano_cita = TextMobject("``Differentia aequationum verarum et fictarui \\\\ semper est numerus quadrato''") |
| 138 | cardano_cita.scale(0.825) |
| 139 | cardano_cita.next_to(cardano, RIGHT) |
| 140 | |
| 141 | self.play( |
| 142 | FadeOut(suma), |
| 143 | FadeOut(suma_desc), |
| 144 | FadeOut(luca), |
| 145 | FadeIn(cardano), |
| 146 | Transform(luca_desc, cardano_desc) |
| 147 | ) |
| 148 | self.remove(luca_desc) |
| 149 | self.add(cardano_desc) |
| 150 | self.wait(1.5) |
| 151 | |
| 152 | self.play( |
| 153 | FadeIn(arsmagna), |
| 154 | FadeInFrom(arsmagna_desc, UP) |
| 155 | ) |
| 156 | self.wait(1.5) |
| 157 | |
| 158 | self.play( |
| 159 | FadeOut(arsmagna), |
| 160 | FadeOut(arsmagna_desc), |
| 161 | Write(cardano_cita) |
| 162 | ) |
| 163 | self.wait(1.5) |
| 164 | |
| 165 | viete = create_image("img/viete.jpeg") |
| 166 | viete.to_edge(LEFT, buff=1) |
| 167 | viete_desc = create_label(viete, "François Viète (1540-1603)") |
| 168 | |
| 169 | self.play( |
| 170 | FadeOut(cardano_cita), |
| 171 | FadeOut(cardano), |
| 172 | FadeIn(viete), |
| 173 | Transform(cardano_desc, viete_desc) |
| 174 | ) |
| 175 | self.remove(cardano_desc) |
| 176 | self.add(viete_desc) |
| 177 | self.wait(1.5) |
| 178 | |
| 179 | girard = create_image("img/girard.jpg") |
| 180 | girard.to_edge(LEFT, buff=1) |
| 181 | girard_desc = create_label(girard, "Albert Girard (1595-1632)") |
| 182 | |
| 183 | self.play( |
| 184 | FadeOut(viete), |
| 185 | FadeIn(girard), |
| 186 | Transform(viete_desc, girard_desc) |
| 187 | ) |
| 188 | self.remove(viete_desc) |
| 189 | self.add(girard_desc) |
| 190 | self.wait(1.5) |
| 191 | |
| 192 | primer = TextMobject("Primer teorema de polinomis simètrics, \\\\ sense saber-ho") |
| 193 | primer.scale(0.825) |
| 194 | primer.next_to(girard, RIGHT) |
| 195 | |
| 196 | self.play(Write(primer)) |
| 197 | self.wait(1.5) |
| 198 | |
| 199 | invention = create_image("img/inventionnouvelle.png", 2) |
| 200 | invention.to_edge(RIGHT, buff=1) |
| 201 | invention_desc = create_label(invention, "\\textit{Invention nouvelle en l'algèbre} (1629)") |
| 202 | |
| 203 | self.play( |
| 204 | FadeOut(primer), |
| 205 | FadeIn(invention), |
| 206 | FadeInFrom(invention_desc, UP) |
| 207 | ) |
| 208 | self.wait(1.5) |
| 209 | |
| 210 | factions = create_image("img/factions.png", 1) |
| 211 | factions.to_edge(RIGHT, buff=1) |
| 212 | |
| 213 | self.play( |
| 214 | FadeOut(invention), |
| 215 | FadeIn(factions), |
| 216 | ApplyMethod(invention_desc.next_to, factions, DOWN) |
| 217 | ) |
| 218 | self.wait(1.5) |
| 219 | |
| 220 | sommes = create_image("img/sommepuissances.png") |
| 221 | sommes.to_edge(RIGHT, buff=1) |
| 222 | |
| 223 | self.play( |
| 224 | FadeOut(factions), |
| 225 | FadeIn(sommes), |
| 226 | ApplyMethod(invention_desc.next_to, sommes, DOWN) |
| 227 | ) |
| 228 | self.wait(1.5) |
| 229 | |
| 230 | sommes2 = create_image("img/sommepuissances2.png", 1) |
| 231 | sommes2.to_edge(RIGHT, buff=1) |
| 232 | sommes2_desc = create_label(sommes2, "\\textit{A Short Account of the History of Symmetric} \\\\ \\textit{Functions of Roots of Equations}, \\\\ H. Gray Funkhouser (1930).") |
| 233 | |
| 234 | self.play( |
| 235 | FadeOut(sommes), |
| 236 | FadeIn(sommes2), |
| 237 | Transform(invention_desc, sommes2_desc) |
| 238 | ) |
| 239 | self.remove(invention_desc) |
| 240 | self.add(sommes2_desc) |
| 241 | self.wait(1.5) |
| 242 | |
| 243 | notthesame = TexMobject("\\sum_{i < j} \\alpha_i \\alpha_j \\neq \\sum_{i} \\alpha_i^2") |
| 244 | notthesame.next_to(girard, RIGHT).shift(1*RIGHT) |
| 245 | |
| 246 | self.play( |
| 247 | FadeOut(sommes2), |
| 248 | FadeOut(sommes2_desc), |
| 249 | Write(notthesame) |
| 250 | ) |
| 251 | self.wait(1.5) |
| 252 | |
| 253 | waring = create_image("img/waring.jpg") |
| 254 | waring.to_edge(LEFT, buff=1) |
| 255 | waring_desc = create_label(waring, "Edward Waring (1736-1798)") |
| 256 | |
| 257 | self.play( |
| 258 | FadeOut(notthesame), |
| 259 | FadeOut(girard), |
| 260 | FadeIn(waring), |
| 261 | Transform(girard_desc, waring_desc) |
| 262 | ) |
| 263 | self.remove(girard_desc) |
| 264 | self.add(waring_desc) |
| 265 | self.wait(1.5) |
| 266 | |
| 267 | class EdwardWaring(Scene): |
| 268 | def construct(self): |
| 269 | title = get_title() |
| 270 | self.add(title) |
| 271 | |
| 272 | waring = create_image("img/waring.jpg") |
| 273 | waring.to_edge(LEFT, buff=1) |
| 274 | waring_desc = create_label(waring, "Edward Waring (1736-1798)") |
| 275 | |
| 276 | self.add(waring) |
| 277 | self.add(waring_desc) |
| 278 | |
| 279 | th1 = TextMobject("Teorema 1. ", "???").set_color(GRAY) |
| 280 | th2 = TextMobject("Teorema 2. ???").set_color(GRAY) |
| 281 | th3 = TextMobject("Teorema 3. ", "???").set_color(GRAY) |
| 282 | |
| 283 | th1.shift(1*UP) |
| 284 | th3.shift(1*DOWN) |
| 285 | |
| 286 | teoremes = VGroup(th1, th2, th3) |
| 287 | teoremes.next_to(waring, RIGHT).shift(1*RIGHT) |
| 288 | |
| 289 | self.play( |
| 290 | FadeInFrom(th1, UP), |
| 291 | FadeIn(th2), |
| 292 | FadeInFrom(th3, DOWN) |
| 293 | ) |
| 294 | self.wait(1.5) |
| 295 | |
| 296 | th1_pre, th1_question = th1.split() |
| 297 | th1_text = TexMobject("\\sum_{i} \\alpha_i^k = f_k(a_i) \\quad \\forall k \\in \\mathbb{N}") |
| 298 | th1_text.scale(0.8) |
| 299 | th1_text.next_to(th1_pre) |
| 300 | |
| 301 | self.play( |
| 302 | Transform(th1_question, th1_text), |
| 303 | ApplyMethod(th1_pre.set_color, WHITE) |
| 304 | ) |
| 305 | self.wait(1.5) |
| 306 | |
| 307 | th3_pre, th3_question = th3.split() |
| 308 | th3_text = TextMobject("Precursor al Teo. Fonamental \\\\ dels Polinomis Simètrics") |
| 309 | th3_text.scale(0.7) |
| 310 | th3_text.next_to(th3_pre) |
| 311 | |
| 312 | self.play( |
| 313 | Transform(th3_question, th3_text), |
| 314 | ApplyMethod(th3_pre.set_color, WHITE) |
| 315 | ) |
| 316 | self.wait(1.5) |
| 317 | |
| 318 | meditationes = create_image("img/meditationes.png") |
| 319 | meditationes.to_edge(RIGHT, buff=2) |
| 320 | meditationes_desc = create_label(meditationes, "\\textit{Meditationes Algebraicae} (1770).") |
| 321 | |
| 322 | self.play( |
| 323 | FadeOut(th1), |
| 324 | FadeOut(th2), |
| 325 | FadeOut(th3), |
| 326 | FadeIn(meditationes), |
| 327 | FadeInFrom(meditationes_desc, UP) |
| 328 | ) |
| 329 | self.wait(1.5) |
| 330 | |
| 331 | conjectura = VGroup( |
| 332 | TextMobject("$n$ es pot escriure com a màxim com a suma de:"), |
| 333 | TextMobject("$\\cdot$ 4 quadrats"), |
| 334 | TextMobject("$\\cdot$ 9 cubs"), |
| 335 | TextMobject("$\\cdot$ 19 biquadrats"), |
| 336 | TextMobject("$\\cdot$ en general, $m$ potències k-èssimes positives, \\\\ essent $m$ depenent de $k$ ($\\forall k \\in \\mathbb{N}$)"), |
| 337 | ) |
| 338 | conjectura.scale(0.8) |
| 339 | conjectura.arrange(DOWN, buff = MED_LARGE_BUFF, aligned_edge = LEFT) |
| 340 | conjectura.to_edge(RIGHT, buff=0.75) |
| 341 | |
| 342 | self.play( |
| 343 | FadeOut(meditationes), |
| 344 | Write(conjectura) |
| 345 | ) |
| 346 | self.wait(1.5) |