├── Fermats Little Theorem └── fermatscenes.py ├── My Methods └── my_methods.py ├── README.md ├── Radians └── unitcirclescenes.py └── Radical 2020 └── tanint.py /Fermats Little Theorem/fermatscenes.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from manimlib.imports import * 4 | 5 | #python -m manim MITintegral\Fermat\fermatscenes.py Shifts -pl 6 | class Shifts(Scene): 7 | def construct(self): 8 | r_dot=Dot() 9 | b_dot=Dot() 10 | b2_dot=Dot() 11 | 12 | scale=4 13 | 14 | r_dot.set_color(RED) 15 | b_dot.set_color(BLUE) 16 | b2_dot.set_color(BLUE) 17 | 18 | r_dot.scale(scale) 19 | b_dot.scale(scale) 20 | b2_dot.scale(scale) 21 | 22 | r_dot.next_to(b_dot,LEFT,1) 23 | b2_dot.next_to(b_dot,RIGHT,1) 24 | 25 | dots=VGroup(r_dot,b_dot,b2_dot) 26 | 27 | self.play( 28 | ShowCreation(r_dot), 29 | ShowCreation(b_dot), 30 | ShowCreation(b2_dot) 31 | ) 32 | 33 | self.wait(3) 34 | 35 | def shifter(x,y,z): 36 | self.play( 37 | ApplyMethod(x.move_to,y.get_center()), 38 | ApplyMethod(y.move_to,z.get_center()), 39 | Rotating(z,radians=PI,about_point=y.get_center()), 40 | rate_func=smooth,run_time=1.6 41 | ) 42 | 43 | shifter(r_dot,b_dot,b2_dot) 44 | 45 | self.wait(2) 46 | 47 | shifter(b2_dot,r_dot,b_dot) 48 | 49 | self.wait(2) 50 | 51 | shifter(b_dot,b2_dot,r_dot) 52 | 53 | self.wait(2) 54 | 55 | self.play(ApplyMethod(dots.shift,UP*1.5)) 56 | 57 | ##### 58 | #New set of dots 59 | 60 | _r_dot=Dot() 61 | _b_dot=Dot() 62 | _r2_dot=Dot() 63 | 64 | scale=4 65 | 66 | _r_dot.set_color(RED) 67 | _b_dot.set_color(BLUE) 68 | _r2_dot.set_color(RED) 69 | 70 | _r_dot.scale(scale) 71 | _b_dot.scale(scale) 72 | _r2_dot.scale(scale) 73 | 74 | _r_dot.next_to(_b_dot,LEFT,1) 75 | _r2_dot.next_to(_b_dot,RIGHT,1) 76 | 77 | _dots=VGroup(_r_dot,_b_dot,_r2_dot) 78 | 79 | _dots.shift(DOWN) 80 | 81 | self.play( 82 | ShowCreation(_r_dot), 83 | ShowCreation(_b_dot), 84 | ShowCreation(_r2_dot) 85 | ) 86 | 87 | self.wait(3) 88 | 89 | shifter(_r_dot,_b_dot,_r2_dot) 90 | 91 | self.wait(2) 92 | 93 | shifter(_r2_dot,_r_dot,_b_dot) 94 | 95 | self.wait(2) 96 | 97 | shifter(_b_dot,_r2_dot,_r_dot) 98 | 99 | self.wait(2) 100 | 101 | self.play(ApplyMethod(dots.shift,DOWN*0.5)) 102 | 103 | self.wait() 104 | 105 | reds1=Dot(color=RED) 106 | reds2=Dot(color=RED) 107 | reds3=Dot(color=RED) 108 | 109 | blues1=Dot(color=BLUE) 110 | blues2=Dot(color=BLUE) 111 | blues3=Dot(color=BLUE) 112 | 113 | reds=VGroup(reds1,reds2,reds3) 114 | reds.scale(4) 115 | reds1.next_to(reds2,LEFT,1) 116 | reds3.next_to(reds2,RIGHT,1) 117 | 118 | reds.move_to(dots.get_center()+UP*2) 119 | 120 | blues=VGroup(blues1,blues2,blues3) 121 | blues.scale(4) 122 | blues1.next_to(blues2,LEFT,1) 123 | blues3.next_to(blues2,RIGHT,1) 124 | 125 | blues.move_to(_dots.get_center()+DOWN*2) 126 | 127 | self.play(ShowCreation(reds)) 128 | self.wait() 129 | self.play(ShowCreation(blues)) 130 | 131 | self.wait(2) 132 | 133 | self.play(FadeOut(reds),FadeOut(blues)) 134 | 135 | self.wait(2) 136 | 137 | self.play(FadeOut(_dots)) 138 | 139 | self.wait() 140 | 141 | sh11=Dot(color=BLUE) 142 | sh12=Dot(color=RED) 143 | sh13=Dot(color=BLUE) 144 | 145 | sh11.scale(4) 146 | sh12.scale(4) 147 | sh13.scale(4) 148 | 149 | sh11.next_to(sh12,LEFT,1) 150 | sh13.next_to(sh12,RIGHT,1) 151 | 152 | sh1_g=VGroup(sh11,sh12,sh13) 153 | 154 | sh1_g.move_to(ORIGIN+DOWN) 155 | 156 | arr1=TextMobject("$$\\rightarrow$$") 157 | arr1.rotate(about_point=arr1.get_center(),angle=-PI/2) 158 | arr1.scale(1.9) 159 | c_point=VGroup(dots,sh1_g) 160 | arr1.move_to(c_point.get_center()) 161 | 162 | self.wait() 163 | 164 | self.play(ShowCreation(arr1)) 165 | 166 | self.play(ShowCreation(sh1_g)) 167 | 168 | self.wait() 169 | 170 | sh21=Dot(color=BLUE) 171 | sh22=Dot(color=BLUE) 172 | sh23=Dot(color=RED) 173 | 174 | sh21.scale(4) 175 | sh22.scale(4) 176 | sh23.scale(4) 177 | 178 | sh21.next_to(sh22,LEFT,1) 179 | sh23.next_to(sh22,RIGHT,1) 180 | 181 | sh2_g=VGroup(sh21,sh22,sh23) 182 | 183 | sh2_g.move_to(ORIGIN+DOWN*3) 184 | 185 | self.wait() 186 | 187 | arr2=TextMobject("$$\\rightarrow$$") 188 | arr2.rotate(about_point=arr2.get_center(),angle=-PI/2) 189 | arr2.scale(1.9) 190 | c_point=VGroup(sh1_g,sh2_g) 191 | arr2.move_to(c_point.get_center()) 192 | 193 | self.play(ShowCreation(arr2)) 194 | 195 | self.play(ShowCreation(sh2_g)) 196 | 197 | self.wait(4) 198 | 199 | self.play( 200 | FadeOut(arr1), 201 | FadeOut(arr2), 202 | FadeOut(dots), 203 | FadeOut(sh1_g), 204 | FadeOut(sh2_g) 205 | ) 206 | self.wait() 207 | 208 | 209 | #python -m manim MITintegral\Fermat\fermatscenes.py ShiftFour -pl 210 | class ShiftFour(MovingCameraScene): 211 | def setup(self): 212 | MovingCameraScene.setup(self) 213 | def construct(self): 214 | self.camera_frame.scale(1.3) 215 | a=Dot(color=RED) 216 | b=Dot(color=RED) 217 | c=Dot(color=BLUE) 218 | d=Dot(color=BLUE) 219 | 220 | scale=3 221 | 222 | a.scale(scale) 223 | b.scale(scale) 224 | c.scale(scale) 225 | d.scale(scale) 226 | 227 | a.next_to(b,LEFT,1) 228 | c.next_to(b,RIGHT,1) 229 | d.next_to(c,RIGHT,1) 230 | 231 | s_dots=VGroup(a,b,c,d) 232 | 233 | s_dots.move_to(ORIGIN) 234 | 235 | s_dots.shift(UP*3) 236 | 237 | self.play(ShowCreation(s_dots)) 238 | 239 | self.wait() 240 | 241 | arrows=[] 242 | 243 | dots=[] 244 | 245 | def shift_down(a,b,c,d): 246 | scale=3 247 | a_new=Dot(color=d.get_color()) 248 | b_new=Dot(color=a.get_color()) 249 | c_new=Dot(color=b.get_color()) 250 | d_new=Dot(color=c.get_color()) 251 | 252 | a_new.scale(3) 253 | b_new.scale(3) 254 | c_new.scale(3) 255 | d_new.scale(3) 256 | 257 | a_new.move_to(a.get_center()+DOWN*1.8) 258 | b_new.move_to(b.get_center()+DOWN*1.8) 259 | c_new.move_to(c.get_center()+DOWN*1.8) 260 | d_new.move_to(d.get_center()+DOWN*1.8) 261 | 262 | arr=TextMobject("$$\\rightarrow$$") 263 | arr.scale(1.9) 264 | arr.rotate(about_point=arr.get_center(),angle=-PI/2) 265 | f_g=VGroup(b,c,b_new,c_new) 266 | arr.move_to(f_g.get_center()) 267 | 268 | arrows.append(arr) 269 | 270 | dots.append(a_new) 271 | dots.append(b_new) 272 | dots.append(c_new) 273 | dots.append(d_new) 274 | 275 | self.play(ShowCreation(arr)) 276 | self.play( 277 | ShowCreation(a_new), 278 | ShowCreation(b_new), 279 | ShowCreation(c_new), 280 | ShowCreation(d_new) 281 | ) 282 | 283 | 284 | shift_down(a,b,c,d) 285 | 286 | self.wait() 287 | 288 | shift_down(dots[0],dots[1],dots[2],dots[3]) 289 | 290 | self.wait() 291 | 292 | shift_down(dots[4],dots[5],dots[6],dots[7]) 293 | 294 | self.wait() 295 | 296 | shift_down(dots[8],dots[9],dots[10],dots[11]) 297 | 298 | self.wait(2) 299 | 300 | self.play( 301 | FadeOut(dots[12]), 302 | FadeOut(dots[13]), 303 | FadeOut(dots[14]), 304 | FadeOut(dots[15]), 305 | FadeOut(arrows[3]) 306 | ) 307 | 308 | self.wait(3) 309 | 310 | self.play( 311 | FadeOut(a), 312 | FadeOut(b), 313 | FadeOut(c), 314 | FadeOut(d), 315 | FadeOut(dots[0]), 316 | FadeOut(dots[1]), 317 | FadeOut(dots[2]), 318 | FadeOut(dots[3]), 319 | FadeOut(dots[4]), 320 | FadeOut(dots[5]), 321 | FadeOut(dots[6]), 322 | FadeOut(dots[7]), 323 | FadeOut(dots[8]), 324 | FadeOut(dots[9]), 325 | FadeOut(dots[10]), 326 | FadeOut(dots[11]), 327 | FadeOut(arrows[0]), 328 | FadeOut(arrows[1]), 329 | FadeOut(arrows[2]) 330 | ) 331 | 332 | self.wait(2) 333 | 334 | 335 | #python -m manim MITintegral\Fermat\fermatscenes.py ShiftFour2 -pl 336 | class ShiftFour2(MovingCameraScene): 337 | def setup(self): 338 | MovingCameraScene.setup(self) 339 | def construct(self): 340 | self.camera_frame.scale(1.3) 341 | a=Dot(color=RED) 342 | b=Dot(color=BLUE) 343 | c=Dot(color=RED) 344 | d=Dot(color=BLUE) 345 | 346 | scale=3 347 | 348 | a.scale(scale) 349 | b.scale(scale) 350 | c.scale(scale) 351 | d.scale(scale) 352 | 353 | a.next_to(b,LEFT,1) 354 | c.next_to(b,RIGHT,1) 355 | d.next_to(c,RIGHT,1) 356 | 357 | s_dots=VGroup(a,b,c,d) 358 | 359 | s_dots.move_to(ORIGIN) 360 | 361 | s_dots.shift(UP*3) 362 | 363 | self.play(ShowCreation(s_dots)) 364 | 365 | self.wait() 366 | 367 | arrows=[] 368 | 369 | dots=[] 370 | 371 | def shift_down(a,b,c,d): 372 | scale=3 373 | a_new=Dot(color=d.get_color()) 374 | b_new=Dot(color=a.get_color()) 375 | c_new=Dot(color=b.get_color()) 376 | d_new=Dot(color=c.get_color()) 377 | 378 | a_new.scale(3) 379 | b_new.scale(3) 380 | c_new.scale(3) 381 | d_new.scale(3) 382 | 383 | a_new.move_to(a.get_center()+DOWN*1.8) 384 | b_new.move_to(b.get_center()+DOWN*1.8) 385 | c_new.move_to(c.get_center()+DOWN*1.8) 386 | d_new.move_to(d.get_center()+DOWN*1.8) 387 | 388 | arr=TextMobject("$$\\rightarrow$$") 389 | arr.scale(1.9) 390 | arr.rotate(about_point=arr.get_center(),angle=-PI/2) 391 | f_g=VGroup(b,c,b_new,c_new) 392 | arr.move_to(f_g.get_center()) 393 | 394 | arrows.append(arr) 395 | 396 | dots.append(a_new) 397 | dots.append(b_new) 398 | dots.append(c_new) 399 | dots.append(d_new) 400 | 401 | self.play(ShowCreation(arr)) 402 | self.play( 403 | ShowCreation(a_new), 404 | ShowCreation(b_new), 405 | ShowCreation(c_new), 406 | ShowCreation(d_new) 407 | ) 408 | 409 | 410 | shift_down(a,b,c,d) 411 | 412 | self.wait() 413 | 414 | shift_down(dots[0],dots[1],dots[2],dots[3]) 415 | 416 | self.wait() 417 | 418 | self.wait(2) 419 | 420 | self.play( 421 | FadeOut(dots[4]), 422 | FadeOut(dots[5]), 423 | FadeOut(dots[6]), 424 | FadeOut(dots[7]), 425 | FadeOut(arrows[1]) 426 | ) 427 | 428 | self.wait(2) 429 | 430 | self.play( 431 | FadeOut(dots[0]), 432 | FadeOut(dots[1]), 433 | FadeOut(dots[2]), 434 | FadeOut(dots[3]), 435 | FadeOut(arrows[0]) 436 | ) 437 | self.play(ApplyMethod(s_dots.move_to,ORIGIN)) 438 | self.play(ApplyMethod(self.camera_frame.scale,0.5)) 439 | 440 | self.wait(2) 441 | 442 | f_g=VGroup(a,b) 443 | 444 | buff=0.2 445 | box1=Rectangle(height=a.get_height()+buff,width=f_g.get_width()+buff,stroke_color=BLUE) 446 | box1.move_to(f_g.get_center()) 447 | 448 | f_g2=VGroup(c,d) 449 | 450 | box2=Rectangle(height=a.get_height()+buff,width=f_g.get_width()+buff,stroke_color=BLUE) 451 | box2.move_to(f_g2.get_center()) 452 | 453 | self.play(ShowCreation(box1)) 454 | self.wait() 455 | self.play(ShowCreation(box2)) 456 | 457 | self.wait(2) 458 | 459 | g1=VGroup(a,b,box1) 460 | g2=VGroup(c,d,box2) 461 | 462 | g=VGroup(g1,g2) 463 | 464 | angle=ValueTracker(0) 465 | 466 | dist=np.abs(g2.get_center()) 467 | 468 | self.play( 469 | ApplyMethod(g1.move_to,g2.get_center()), 470 | ApplyMethod(g2.move_to,g1.get_center()), 471 | ) 472 | 473 | self.wait(2) 474 | 475 | 476 | 477 | #python -m manim MITintegral\Fermat\fermatscenes.py ShiftNine -pl 478 | class ShiftNine(MovingCameraScene): 479 | def setup(self): 480 | MovingCameraScene.setup(self) 481 | def construct(self): 482 | self.camera_frame.scale(1.3) 483 | a=Dot(color=RED) 484 | b=Dot(color=BLUE) 485 | c=Dot(color=GREEN) 486 | d=Dot(color=RED) 487 | e=Dot(color=BLUE) 488 | f=Dot(color=GREEN) 489 | g=Dot(color=RED) 490 | h=Dot(color=BLUE) 491 | i=Dot(color=GREEN) 492 | 493 | scale=3 494 | 495 | a.scale(scale) 496 | b.scale(scale) 497 | c.scale(scale) 498 | d.scale(scale) 499 | e.scale(scale) 500 | f.scale(scale) 501 | g.scale(scale) 502 | h.scale(scale) 503 | i.scale(scale) 504 | 505 | a.next_to(b,LEFT,1) 506 | c.next_to(b,RIGHT,1) 507 | d.next_to(c,RIGHT,1) 508 | e.next_to(d,RIGHT,1) 509 | f.next_to(e,RIGHT,1) 510 | g.next_to(f,RIGHT,1) 511 | h.next_to(g,RIGHT,1) 512 | i.next_to(h,RIGHT,1) 513 | 514 | s_dots=VGroup(a,b,c,d,e,f,g,h,i) 515 | 516 | s_dots.move_to(ORIGIN) 517 | 518 | s_dots.shift(UP*3) 519 | 520 | self.play(ShowCreation(s_dots)) 521 | 522 | self.wait(2) 523 | 524 | buff=0.2 525 | 526 | f_g=VGroup(a,b,c) 527 | 528 | box1=Rectangle(width=f_g.get_width()+buff,height=f_g.get_height()+buff,color=BLUE) 529 | box1.move_to(f_g.get_center()) 530 | 531 | box2=Rectangle(width=f_g.get_width()+buff,height=f_g.get_height()+buff,color=BLUE) 532 | box2.move_to(ORIGIN+UP*3) 533 | 534 | box3=Rectangle(width=f_g.get_width()+buff,height=f_g.get_height()+buff,color=BLUE) 535 | box3.move_to(UP*3+RIGHT*(ORIGIN-f_g.get_center())) 536 | 537 | self.play(ShowCreation(box1)) 538 | 539 | self.wait() 540 | 541 | self.play(ShowCreation(box2)) 542 | self.play(ShowCreation(box3)) 543 | 544 | self.wait(2) 545 | 546 | self.play( 547 | FadeOut(box1), 548 | FadeOut(box2), 549 | FadeOut(box3) 550 | ) 551 | 552 | arrows=[] 553 | 554 | dots=[] 555 | 556 | def shift_down(a,b,c,d,e,f,g,h,i): 557 | scale=3 558 | a_new=Dot(color=i.get_color()) 559 | b_new=Dot(color=a.get_color()) 560 | c_new=Dot(color=b.get_color()) 561 | d_new=Dot(color=c.get_color()) 562 | e_new=Dot(color=d.get_color()) 563 | f_new=Dot(color=e.get_color()) 564 | g_new=Dot(color=f.get_color()) 565 | h_new=Dot(color=g.get_color()) 566 | i_new=Dot(color=h.get_color()) 567 | 568 | a_new.scale(3) 569 | b_new.scale(3) 570 | c_new.scale(3) 571 | d_new.scale(3) 572 | e_new.scale(3) 573 | f_new.scale(3) 574 | g_new.scale(3) 575 | h_new.scale(3) 576 | i_new.scale(3) 577 | 578 | a_new.move_to(a.get_center()+DOWN*1.8) 579 | b_new.move_to(b.get_center()+DOWN*1.8) 580 | c_new.move_to(c.get_center()+DOWN*1.8) 581 | d_new.move_to(d.get_center()+DOWN*1.8) 582 | e_new.move_to(e.get_center()+DOWN*1.8) 583 | f_new.move_to(f.get_center()+DOWN*1.8) 584 | g_new.move_to(g.get_center()+DOWN*1.8) 585 | h_new.move_to(h.get_center()+DOWN*1.8) 586 | i_new.move_to(i.get_center()+DOWN*1.8) 587 | 588 | arr=TextMobject("$$\\rightarrow$$") 589 | arr.scale(1.9) 590 | arr.rotate(about_point=arr.get_center(),angle=-PI/2) 591 | f_g=VGroup(e,e_new) 592 | arr.move_to(f_g.get_center()) 593 | 594 | arrows.append(arr) 595 | 596 | dots.append(a_new) 597 | dots.append(b_new) 598 | dots.append(c_new) 599 | dots.append(d_new) 600 | dots.append(e_new) 601 | dots.append(f_new) 602 | dots.append(g_new) 603 | dots.append(h_new) 604 | dots.append(i_new) 605 | 606 | self.play(ShowCreation(arr)) 607 | self.play( 608 | ShowCreation(a_new), 609 | ShowCreation(b_new), 610 | ShowCreation(c_new), 611 | ShowCreation(d_new), 612 | ShowCreation(e_new), 613 | ShowCreation(f_new), 614 | ShowCreation(g_new), 615 | ShowCreation(h_new), 616 | ShowCreation(i_new), 617 | ) 618 | 619 | 620 | shift_down(a,b,c,d,e,f,g,h,i) 621 | 622 | self.wait() 623 | 624 | shift_down( 625 | dots[0], 626 | dots[1], 627 | dots[2], 628 | dots[3], 629 | dots[4], 630 | dots[5], 631 | dots[6], 632 | dots[7], 633 | dots[8] 634 | ) 635 | 636 | self.wait() 637 | 638 | shift_down( 639 | dots[9], 640 | dots[10], 641 | dots[11], 642 | dots[12], 643 | dots[13], 644 | dots[14], 645 | dots[15], 646 | dots[16], 647 | dots[17] 648 | ) 649 | 650 | self.wait(3) 651 | 652 | self.play( 653 | FadeOut(dots[18]), 654 | FadeOut(dots[19]), 655 | FadeOut(dots[20]), 656 | FadeOut(dots[21]), 657 | FadeOut(dots[22]), 658 | FadeOut(dots[23]), 659 | FadeOut(dots[24]), 660 | FadeOut(dots[25]), 661 | FadeOut(dots[26]), 662 | FadeOut(arrows[2]) 663 | ) 664 | 665 | self.wait(2) 666 | 667 | self.play(ApplyMethod(self.camera_frame.scale,50),run_time=2) 668 | 669 | self.wait() 670 | 671 | #python -m manim MITintegral\Fermat\fermatscenes.py ShiftFive -pl 672 | class ShiftFive(MovingCameraScene): 673 | def setup(self): 674 | MovingCameraScene.setup(self) 675 | def construct(self): 676 | self.camera_frame.scale(1.3) 677 | a=Dot(color=RED) 678 | b=Dot(color=BLUE) 679 | c=Dot(color=BLUE) 680 | d=Dot(color=RED) 681 | e=Dot(color=BLUE) 682 | 683 | scale=3 684 | 685 | a.scale(scale) 686 | b.scale(scale) 687 | c.scale(scale) 688 | d.scale(scale) 689 | e.scale(scale) 690 | 691 | a.next_to(b,LEFT,1) 692 | c.next_to(b,RIGHT,1) 693 | d.next_to(c,RIGHT,1) 694 | e.next_to(d,RIGHT,1) 695 | 696 | s_dots=VGroup(a,b,c,d,e) 697 | 698 | s_dots.move_to(ORIGIN) 699 | 700 | s_dots.shift(UP*3) 701 | 702 | self.play(ShowCreation(s_dots)) 703 | 704 | self.wait(2) 705 | 706 | buff=0.2 707 | 708 | f_g=VGroup(a,b,c) 709 | 710 | box1=Rectangle(width=f_g.get_width()+buff,height=f_g.get_height()+buff,color=BLUE) 711 | box1.move_to(f_g.get_center()) 712 | 713 | box2=Rectangle(width=f_g.get_width()+buff,height=f_g.get_height()+buff,color=BLUE) 714 | box2.move_to(e.get_center()) 715 | 716 | self.play(ShowCreation(box1)) 717 | 718 | self.wait() 719 | 720 | self.play(ShowCreation(box2)) 721 | 722 | self.wait(2) 723 | 724 | self.play( 725 | FadeOut(box1), 726 | FadeOut(box2), 727 | ) 728 | 729 | f_g=VGroup(a,b) 730 | 731 | box1=Rectangle(width=f_g.get_width()+buff,height=f_g.get_height()+buff,color=BLUE) 732 | box1.move_to(f_g.get_center()) 733 | 734 | f_g=VGroup(c,d) 735 | 736 | box2=Rectangle(width=f_g.get_width()+buff,height=f_g.get_height()+buff,color=BLUE) 737 | box2.move_to(f_g.get_center()) 738 | 739 | self.play(ShowCreation(box1)) 740 | self.play(ShowCreation(box2)) 741 | 742 | self.wait(2) 743 | 744 | self.play( 745 | FadeOut(box1), 746 | FadeOut(box2) 747 | ) 748 | 749 | self.wait(2) 750 | 751 | arrows=[] 752 | 753 | dots=[] 754 | 755 | def shift_down(a,b,c,d,e): 756 | scale=3 757 | a_new=Dot(color=e.get_color()) 758 | b_new=Dot(color=a.get_color()) 759 | c_new=Dot(color=b.get_color()) 760 | d_new=Dot(color=c.get_color()) 761 | e_new=Dot(color=d.get_color()) 762 | 763 | a_new.scale(3) 764 | b_new.scale(3) 765 | c_new.scale(3) 766 | d_new.scale(3) 767 | e_new.scale(3) 768 | 769 | a_new.move_to(a.get_center()+DOWN*1.8) 770 | b_new.move_to(b.get_center()+DOWN*1.8) 771 | c_new.move_to(c.get_center()+DOWN*1.8) 772 | d_new.move_to(d.get_center()+DOWN*1.8) 773 | e_new.move_to(e.get_center()+DOWN*1.8) 774 | 775 | arr=TextMobject("$$\\rightarrow$$") 776 | arr.scale(1.9) 777 | arr.rotate(about_point=arr.get_center(),angle=-PI/2) 778 | f_g=VGroup(c,c_new) 779 | arr.move_to(f_g.get_center()) 780 | 781 | arrows.append(arr) 782 | 783 | dots.append(a_new) 784 | dots.append(b_new) 785 | dots.append(c_new) 786 | dots.append(d_new) 787 | dots.append(e_new) 788 | 789 | self.play(ShowCreation(arr)) 790 | self.play( 791 | ShowCreation(a_new), 792 | ShowCreation(b_new), 793 | ShowCreation(c_new), 794 | ShowCreation(d_new), 795 | ShowCreation(e_new), 796 | ) 797 | 798 | 799 | shift_down(a,b,c,d,e) 800 | 801 | self.wait() 802 | 803 | shift_down( 804 | dots[0], 805 | dots[1], 806 | dots[2], 807 | dots[3], 808 | dots[4] 809 | ) 810 | 811 | self.wait() 812 | 813 | shift_down( 814 | dots[5], 815 | dots[6], 816 | dots[7], 817 | dots[8], 818 | dots[9] 819 | ) 820 | 821 | self.wait() 822 | 823 | shift_down( 824 | dots[10], 825 | dots[11], 826 | dots[12], 827 | dots[13], 828 | dots[14] 829 | ) 830 | 831 | self.wait(2) 832 | 833 | self.play(ApplyMethod(self.camera_frame.scale,50), 834 | rate_func=smooth,run_time=2) 835 | 836 | self.wait() 837 | 838 | #python -m manim MITintegral\Fermat\fermatscenes.py ProbExp -pl 839 | class ProbExp(Scene): 840 | def construct(self): 841 | r1=Dot(color=RED) 842 | r2=Dot(color=RED) 843 | r3=Dot(color=RED) 844 | b1=Dot(color=BLUE) 845 | b2=Dot(color=BLUE) 846 | b3=Dot(color=BLUE) 847 | 848 | scale=4 849 | r1.scale(scale) 850 | r2.scale(scale) 851 | r3.scale(scale) 852 | b1.scale(scale) 853 | b2.scale(scale) 854 | b3.scale(scale) 855 | 856 | buff=.8 857 | 858 | r1.move_to(RIGHT*3.8+UP*2) 859 | r2.next_to(r1,RIGHT,buff) 860 | r3.next_to(r1,DOWN,buff) 861 | b1.next_to(r2,DOWN,buff) 862 | b2.next_to(r3,LEFT,buff) 863 | b3.next_to(r1,LEFT,buff) 864 | 865 | dots=VGroup( 866 | r1, 867 | r2, 868 | r3, 869 | b1, 870 | b2, 871 | b3 872 | ) 873 | 874 | self.play(ShowCreation(dots)) 875 | 876 | self.wait(3) 877 | 878 | box_b=0.2 879 | 880 | box1=Rectangle(width=r1.get_width()+box_b,height=r1.get_height()+box_b) 881 | box2=Rectangle(width=r1.get_width()+box_b,height=r1.get_height()+box_b) 882 | box3=Rectangle(width=r1.get_width()+box_b,height=r1.get_height()+box_b) 883 | 884 | box1.move_to(LEFT*3.7+DOWN*0.8) 885 | box2.next_to(box1,RIGHT,1) 886 | box3.next_to(box2,RIGHT,1) 887 | 888 | boxes=VGroup(box1,box2,box3) 889 | 890 | self.play(ShowCreation(boxes)) 891 | 892 | self.wait(3) 893 | 894 | #markers for dot positions 895 | oo=Dot() 896 | ot=Dot() 897 | oth=Dot() 898 | to=Dot() 899 | tt=Dot() 900 | tth=Dot() 901 | 902 | oo.move_to(r2.get_center()) 903 | ot.move_to(r1.get_center()) 904 | oth.move_to(b3.get_center()) 905 | to.move_to(b1.get_center()) 906 | tt.move_to(r3.get_center()) 907 | tth.move_to(b2.get_center()) 908 | 909 | #move exp takes in three dots 910 | def move_exp(d1,d2,d3): 911 | c1=d1.get_center() 912 | c2=d2.get_center() 913 | c3=d3.get_center() 914 | 915 | self.play(ApplyMethod(d1.move_to,box1.get_center())) 916 | self.play(ApplyMethod(d2.move_to,box2.get_center())) 917 | self.play(ApplyMethod(d3.move_to,box3.get_center())) 918 | self.wait() 919 | self.play( 920 | ApplyMethod(d1.move_to,c1), 921 | ApplyMethod(d2.move_to,c2), 922 | ApplyMethod(d3.move_to,c3) 923 | ) 924 | 925 | move_exp(r1,b2,b3) 926 | 927 | self.wait() 928 | 929 | move_exp(r3,b1,b3) 930 | 931 | self.wait() 932 | 933 | move_exp(r2,r3,r1) 934 | 935 | self.wait(3) 936 | 937 | self.play(ApplyMethod(boxes.move_to,dots.get_center()+DOWN*2.5)) 938 | 939 | self.wait(3) 940 | 941 | self.play(ApplyMethod(box1.set_color,YELLOW)) 942 | self.play(ApplyMethod(box1.set_color,WHITE)) 943 | 944 | self.play(ApplyMethod(r1.move_to,box1.get_center())) 945 | self.wait(0.6) 946 | self.play( 947 | ApplyMethod(r1.move_to,ot.get_center()), 948 | ApplyMethod(b1.move_to,box1.get_center()) 949 | ) 950 | self.wait(0.6) 951 | self.play(ApplyMethod(b1.move_to,to.get_center())) 952 | 953 | self.wait(3) 954 | 955 | rop1=Dot(color=RED) 956 | bop1=Dot(color=BLUE) 957 | 958 | rop1.move_to(LEFT*5+UP*2) 959 | bop1.move_to(LEFT*5+DOWN*2) 960 | 961 | rop1.scale(2) 962 | bop1.scale(2) 963 | 964 | lines=[] 965 | 966 | self.play(ShowCreation(rop1),ShowCreation(bop1)) 967 | 968 | #branch takes in a dot, and the angle and length of the lines 969 | #wished to be created 970 | def branchup(dot,angle,leng): 971 | buf=0.15 972 | up_line=Line( 973 | #from 974 | dot.get_center()+RIGHT*buf*np.cos(angle)+UP*buf*np.sin(angle), 975 | #to 976 | dot.get_center()+RIGHT*buf*np.cos(angle)+UP*buf*np.sin(angle)+RIGHT*leng*np.cos(angle)+UP*leng*np.sin(angle) 977 | ) 978 | red=Dot(color=RED) 979 | red.scale(2) 980 | red.move_to(dot.get_center()+RIGHT*buf*np.cos(angle)+UP*buf*np.sin(angle)+RIGHT*leng*np.cos(angle)+UP*leng*np.sin(angle)+RIGHT*buf*np.cos(angle)+UP*buf*np.sin(angle)) 981 | lines.append(up_line) 982 | self.play(ShowCreation(red),ShowCreation(up_line)) 983 | return red 984 | 985 | def branchdown(dot,angle,leng): 986 | buf=0.15 987 | down_line=Line( 988 | #from 989 | dot.get_center()+RIGHT*buf*np.cos(angle)+DOWN*buf*np.sin(angle), 990 | #to 991 | dot.get_center()+RIGHT*buf*np.cos(angle)+DOWN*buf*np.sin(angle)+RIGHT*leng*np.cos(angle)+DOWN*leng*np.sin(angle) 992 | ) 993 | blue=Dot(color=BLUE) 994 | blue.scale(2) 995 | blue.move_to(dot.get_center()+RIGHT*buf*np.cos(angle)+DOWN*buf*np.sin(angle)+RIGHT*leng*np.cos(angle)+DOWN*leng*np.sin(angle)+RIGHT*buf*np.cos(angle)+DOWN*buf*np.sin(angle)) 996 | lines.append(down_line) 997 | self.play(ShowCreation(blue),ShowCreation(down_line)) 998 | return blue 999 | 1000 | self.wait(2) 1001 | 1002 | self.play(ApplyMethod(box2.set_color,YELLOW)) 1003 | self.play(ApplyMethod(box2.set_color,WHITE)) 1004 | 1005 | self.play(ApplyMethod(r1.move_to,box2.get_center())) 1006 | self.wait(0.6) 1007 | self.play( 1008 | ApplyMethod(r1.move_to,ot.get_center()), 1009 | ApplyMethod(b1.move_to,box2.get_center()) 1010 | ) 1011 | self.wait(0.6) 1012 | self.play(ApplyMethod(b1.move_to,to.get_center())) 1013 | 1014 | rop1_u=branchup(rop1,PI/6,1.4) 1015 | rop1_d=branchdown(rop1,PI/6,1.4) 1016 | 1017 | self.wait(2) 1018 | 1019 | bop1_u=branchup(bop1,PI/6,1.4) 1020 | bop1_d=branchdown(bop1,PI/6,1.4) 1021 | 1022 | self.wait(2) 1023 | 1024 | #### 1025 | #Third round 1026 | 1027 | self.play(ApplyMethod(box3.set_color,YELLOW)) 1028 | self.play(ApplyMethod(box3.set_color,WHITE)) 1029 | 1030 | self.play(ApplyMethod(r1.move_to,box3.get_center())) 1031 | self.wait(0.6) 1032 | self.play( 1033 | ApplyMethod(r1.move_to,ot.get_center()), 1034 | ApplyMethod(b1.move_to,box3.get_center()) 1035 | ) 1036 | self.wait(0.6) 1037 | self.play(ApplyMethod(b1.move_to,to.get_center())) 1038 | 1039 | self.wait(2) 1040 | 1041 | an=PI/9 1042 | l=0.8 1043 | 1044 | rop1_u_u=branchup(rop1_u,an,l) 1045 | rop1_u_d=branchdown(rop1_u,an,l) 1046 | 1047 | rop1_d_u=branchup(rop1_d,an,l) 1048 | rop1_d_d=branchdown(rop1_d,an,l) 1049 | 1050 | bop1_u_u=branchup(bop1_u,an,l) 1051 | bop1_u_d=branchdown(bop1_u,an,l) 1052 | 1053 | bop1_d_u=branchup(bop1_d,an,l) 1054 | bop1_d_d=branchdown(bop1_d,an,l) 1055 | 1056 | self.wait(3) 1057 | 1058 | #separaters 1059 | 1060 | group1=VGroup(rop1,bop1) 1061 | sep1=Rectangle(width=rop1.get_width()+box_b,height=group1.get_height()+box_b,stroke_color=BLUE) 1062 | sep1.move_to(group1.get_center()) 1063 | self.play(ShowCreation(sep1)) 1064 | 1065 | self.wait(2) 1066 | 1067 | two1=TextMobject("2") 1068 | two1.scale(1.7) 1069 | two1.next_to(box1,DOWN*0.5) 1070 | self.play(Write(two1)) 1071 | 1072 | self.wait() 1073 | 1074 | group2=VGroup(rop1_u,bop1_d) 1075 | sep2=Rectangle(width=rop1.get_width()+box_b,height=group2.get_height()+box_b,stroke_color=BLUE) 1076 | sep2.move_to(group2.get_center()) 1077 | self.play(ShowCreation(sep2)) 1078 | 1079 | self.wait(2) 1080 | 1081 | two2=TextMobject("2") 1082 | two2.scale(1.7) 1083 | two2.next_to(box2,DOWN*0.5) 1084 | 1085 | times=TextMobject("$$\\times$$") 1086 | f_g=VGroup(two1,two2) 1087 | times.move_to(f_g.get_center()) 1088 | 1089 | self.play(Write(times),Write(two2)) 1090 | 1091 | self.wait() 1092 | 1093 | group3=VGroup(rop1_u_u,bop1_d_d) 1094 | sep3=Rectangle(width=rop1.get_width()+box_b,height=group3.get_height()+box_b,stroke_color=BLUE) 1095 | sep3.move_to(group3.get_center()) 1096 | self.play(ShowCreation(sep3)) 1097 | 1098 | self.wait(2) 1099 | 1100 | two3=TextMobject("2") 1101 | two3.scale(1.7) 1102 | two3.next_to(box3,DOWN*0.5) 1103 | 1104 | times2=TextMobject("$$\\times$$") 1105 | f_g2=VGroup(two2,two3) 1106 | times2.move_to(f_g2.get_center()) 1107 | 1108 | self.play(Write(times2),Write(two3)) 1109 | 1110 | self.wait(2) 1111 | 1112 | all_=VGroup(two1,two2,two3,times,times2) 1113 | two_cu=TextMobject("$$2^{3}$$") 1114 | two_cu.scale(1.7) 1115 | two_cu.next_to(box2,DOWN,0.6) 1116 | 1117 | self.play(Transform(all_,two_cu)) 1118 | 1119 | self.wait(3) 1120 | 1121 | self.play( 1122 | FadeOut(all_), 1123 | FadeOut(sep1), 1124 | FadeOut(sep2), 1125 | FadeOut(sep3) 1126 | ) 1127 | 1128 | self.wait() 1129 | 1130 | ###################### 1131 | #Fourth box stuff 1132 | 1133 | dist=box3.get_center()-box2.get_center() 1134 | 1135 | self.play(ApplyMethod(boxes.shift,LEFT*dist)) 1136 | 1137 | box4=Rectangle(width=r1.get_width()+box_b,height=r1.get_height()+box_b) 1138 | 1139 | box4.next_to(box3,RIGHT,1) 1140 | 1141 | self.play(ShowCreation(box4)) 1142 | 1143 | self.wait() 1144 | 1145 | self.play(ApplyMethod(box4.set_color,YELLOW)) 1146 | self.play(ApplyMethod(box4.set_color,WHITE)) 1147 | 1148 | self.play(ApplyMethod(r1.move_to,box4.get_center())) 1149 | self.wait(0.6) 1150 | self.play( 1151 | ApplyMethod(r1.move_to,ot.get_center()), 1152 | ApplyMethod(b1.move_to,box4.get_center()) 1153 | ) 1154 | self.wait(0.6) 1155 | self.play(ApplyMethod(b1.move_to,to.get_center())) 1156 | 1157 | self.wait(3) 1158 | 1159 | an=PI/14.5 1160 | l=0.5 1161 | 1162 | rop1_u_u_u=branchup(rop1_u_u,an,l) 1163 | rop1_u_u_d=branchdown(rop1_u_u,an,l) 1164 | 1165 | rop1_u_d_u=branchup(rop1_u_d,an,l) 1166 | rop1_u_d_d=branchdown(rop1_u_d,an,l) 1167 | 1168 | rop1_d_u_u=branchup(rop1_d_u,an,l) 1169 | rop1_d_u_d=branchdown(rop1_d_u,an,l) 1170 | 1171 | rop1_d_d_u=branchup(rop1_d_d,an,l) 1172 | rop1_d_d_d=branchdown(rop1_d_d,an,l) 1173 | 1174 | bop1_u_u_u=branchup(bop1_u_u,an,l) 1175 | bop1_u_u_d=branchdown(bop1_u_u,an,l) 1176 | 1177 | bop1_u_d_u=branchup(bop1_u_d,an,l) 1178 | bop1_u_d_d=branchdown(bop1_u_d,an,l) 1179 | 1180 | bop1_d_u_u=branchup(bop1_d_u,an,l) 1181 | bop1_d_u_d=branchdown(bop1_d_u,an,l) 1182 | 1183 | bop1_d_d_u=branchup(bop1_d_d,an,l) 1184 | bop1_d_d_d=branchdown(bop1_d_d,an,l) 1185 | 1186 | self.wait(2) 1187 | 1188 | two1=TextMobject("2") 1189 | two1.scale(1.7) 1190 | two1.next_to(box2,DOWN*0.5) 1191 | two2=TextMobject("2") 1192 | two2.scale(1.7) 1193 | two2.next_to(box3,DOWN*0.5) 1194 | 1195 | times=TextMobject("$$\\times$$") 1196 | f_g=VGroup(two1,two2) 1197 | times.move_to(f_g.get_center()) 1198 | two3=TextMobject("2") 1199 | two3.scale(1.7) 1200 | two3.next_to(box4,DOWN*0.5) 1201 | 1202 | times2=TextMobject("$$\\times$$") 1203 | f_g2=VGroup(two2,two3) 1204 | times2.move_to(f_g2.get_center()) 1205 | all_=VGroup(two1,two2,two3,times,times2) 1206 | 1207 | two0=TextMobject("2") 1208 | two0.scale(1.7) 1209 | two0.next_to(box1,DOWN*0.5) 1210 | 1211 | times0=TextMobject("$$\\times$$") 1212 | f_g0=VGroup(two0,two1) 1213 | times0.move_to(f_g0.get_center()) 1214 | 1215 | all2_=VGroup( 1216 | two0, 1217 | times0, 1218 | all_ 1219 | ) 1220 | 1221 | self.play(Write(all2_)) 1222 | 1223 | two_f=TextMobject("$$2^{4}$$") 1224 | two_f.scale(1.7) 1225 | f_g3=VGroup(two1,two2) 1226 | two_f.move_to(f_g3.get_center()) 1227 | 1228 | self.wait() 1229 | 1230 | self.play(Transform(all2_,two_f)) 1231 | 1232 | self.wait(3) 1233 | 1234 | self.play(FadeOut(two_f),FadeOut(all2_)) 1235 | 1236 | self.play(FadeOut(box4)) 1237 | 1238 | self.play(ApplyMethod(boxes.shift,RIGHT*dist)) 1239 | 1240 | self.play( 1241 | FadeOut(lines[0]), 1242 | FadeOut(lines[1]), 1243 | FadeOut(lines[2]), 1244 | FadeOut(lines[3]), 1245 | FadeOut(lines[4]), 1246 | FadeOut(lines[5]), 1247 | FadeOut(lines[6]), 1248 | FadeOut(lines[7]), 1249 | FadeOut(lines[8]), 1250 | FadeOut(lines[9]), 1251 | FadeOut(lines[10]), 1252 | FadeOut(lines[11]), 1253 | FadeOut(lines[12]), 1254 | FadeOut(lines[13]), 1255 | FadeOut(lines[14]), 1256 | FadeOut(lines[15]), 1257 | FadeOut(lines[16]), 1258 | FadeOut(lines[17]), 1259 | FadeOut(lines[18]), 1260 | FadeOut(lines[19]), 1261 | FadeOut(lines[20]), 1262 | FadeOut(lines[21]), 1263 | FadeOut(lines[22]), 1264 | FadeOut(lines[23]), 1265 | FadeOut(lines[24]), 1266 | FadeOut(lines[25]), 1267 | FadeOut(lines[26]), 1268 | FadeOut(lines[27]), 1269 | FadeOut(rop1_u), 1270 | FadeOut(rop1_d), 1271 | FadeOut(rop1_u_u), 1272 | FadeOut(rop1_u_d), 1273 | FadeOut(rop1_d_u), 1274 | FadeOut(rop1_d_d), 1275 | FadeOut(rop1_u_u_u), 1276 | FadeOut(rop1_u_d_u), 1277 | FadeOut(rop1_d_u_u), 1278 | FadeOut(rop1_d_d_u), 1279 | FadeOut(rop1_u_u_d), 1280 | FadeOut(rop1_u_d_d), 1281 | FadeOut(rop1_d_u_d), 1282 | FadeOut(rop1_d_d_d), 1283 | FadeOut(bop1_u), 1284 | FadeOut(bop1_d), 1285 | FadeOut(bop1_u_u), 1286 | FadeOut(bop1_u_d), 1287 | FadeOut(bop1_d_u), 1288 | FadeOut(bop1_d_d), 1289 | FadeOut(bop1_u_u_u), 1290 | FadeOut(bop1_u_d_u), 1291 | FadeOut(bop1_d_u_u), 1292 | FadeOut(bop1_d_d_u), 1293 | FadeOut(bop1_u_u_d), 1294 | FadeOut(bop1_u_d_d), 1295 | FadeOut(bop1_d_u_d), 1296 | FadeOut(bop1_d_d_d), 1297 | ) 1298 | 1299 | self.wait(3) 1300 | 1301 | self.play(ApplyMethod(r1.set_color,GREEN),ApplyMethod(b1.set_color,GREEN)) 1302 | 1303 | self.play(ApplyMethod(r2.move_to,box1.get_center())), 1304 | 1305 | self.play( 1306 | ApplyMethod(r2.move_to,oo.get_center()), 1307 | ApplyMethod(b2.move_to,box1.get_center()) 1308 | ) 1309 | 1310 | self.play( 1311 | ApplyMethod(b2.move_to,tth.get_center()), 1312 | ApplyMethod(r1.move_to,box1.get_center()) 1313 | ) 1314 | self.play(ApplyMethod(r1.move_to,ot.get_center())) 1315 | 1316 | self.wait(3) 1317 | 1318 | gop1=Dot(color=GREEN) 1319 | gop1.scale(2) 1320 | ops=VGroup(rop1,bop1) 1321 | gop1.move_to(ops.get_center()) 1322 | 1323 | self.play(ShowCreation(gop1)) 1324 | 1325 | self.wait(2) 1326 | 1327 | def branchmid(dot,angle,leng): 1328 | buf=0.15 1329 | down_line=Line( 1330 | #from 1331 | dot.get_center()+RIGHT*buf*np.cos(angle)+DOWN*buf*np.sin(angle), 1332 | #to 1333 | dot.get_center()+RIGHT*buf*np.cos(angle)+DOWN*buf*np.sin(angle)+RIGHT*leng*np.cos(angle)+DOWN*leng*np.sin(angle) 1334 | ) 1335 | green=Dot(color=GREEN) 1336 | green.scale(2) 1337 | green.move_to(dot.get_center()+RIGHT*buf*np.cos(angle)+DOWN*buf*np.sin(angle)+RIGHT*leng*np.cos(angle)+DOWN*leng*np.sin(angle)+RIGHT*buf*np.cos(angle)+DOWN*buf*np.sin(angle)) 1338 | lines.append(down_line) 1339 | self.play(ShowCreation(green),ShowCreation(down_line)) 1340 | return green 1341 | 1342 | an=PI/8 1343 | l=1.4 1344 | 1345 | rop1_u=branchup(rop1,an,l) 1346 | rop1_m=branchmid(rop1,0,np.cos(an)*l) 1347 | rop1_d=branchdown(rop1,an,l) 1348 | 1349 | gop1_u=branchup(gop1,an,l) 1350 | gop1_m=branchmid(gop1,0,np.cos(an)*l) 1351 | gop1_d=branchdown(gop1,an,l) 1352 | 1353 | bop1_u=branchup(bop1,an,l) 1354 | bop1_m=branchmid(bop1,0,np.cos(an)*l) 1355 | bop1_d=branchdown(bop1,an,l) 1356 | 1357 | self.wait(3) 1358 | 1359 | def branchup(dot,angle,leng): 1360 | buf=0.15 1361 | up_line=Line( 1362 | #from 1363 | dot.get_center()+RIGHT*buf*np.cos(angle)+UP*buf*np.sin(angle), 1364 | #to 1365 | dot.get_center()+RIGHT*buf*np.cos(angle)+UP*buf*np.sin(angle)+RIGHT*leng*np.cos(angle)+UP*leng*np.sin(angle) 1366 | ) 1367 | red=Dot(color=RED) 1368 | red.scale(1) 1369 | red.move_to(dot.get_center()+RIGHT*buf*np.cos(angle)+UP*buf*np.sin(angle)+RIGHT*leng*np.cos(angle)+UP*leng*np.sin(angle)+RIGHT*buf*np.cos(angle)+UP*buf*np.sin(angle)) 1370 | lines.append(up_line) 1371 | self.play(ShowCreation(red),ShowCreation(up_line)) 1372 | return red 1373 | 1374 | def branchdown(dot,angle,leng): 1375 | buf=0.15 1376 | down_line=Line( 1377 | #from 1378 | dot.get_center()+RIGHT*buf*np.cos(angle)+DOWN*buf*np.sin(angle), 1379 | #to 1380 | dot.get_center()+RIGHT*buf*np.cos(angle)+DOWN*buf*np.sin(angle)+RIGHT*leng*np.cos(angle)+DOWN*leng*np.sin(angle) 1381 | ) 1382 | blue=Dot(color=BLUE) 1383 | blue.scale(1) 1384 | blue.move_to(dot.get_center()+RIGHT*buf*np.cos(angle)+DOWN*buf*np.sin(angle)+RIGHT*leng*np.cos(angle)+DOWN*leng*np.sin(angle)+RIGHT*buf*np.cos(angle)+DOWN*buf*np.sin(angle)) 1385 | lines.append(down_line) 1386 | self.play(ShowCreation(blue),ShowCreation(down_line)) 1387 | return blue 1388 | 1389 | def branchmid(dot,angle,leng): 1390 | buf=0.15 1391 | down_line=Line( 1392 | #from 1393 | dot.get_center()+RIGHT*buf*np.cos(angle)+DOWN*buf*np.sin(angle), 1394 | #to 1395 | dot.get_center()+RIGHT*buf*np.cos(angle)+DOWN*buf*np.sin(angle)+RIGHT*leng*np.cos(angle)+DOWN*leng*np.sin(angle) 1396 | ) 1397 | green=Dot(color=GREEN) 1398 | green.scale(1) 1399 | green.move_to(dot.get_center()+RIGHT*buf*np.cos(angle)+DOWN*buf*np.sin(angle)+RIGHT*leng*np.cos(angle)+DOWN*leng*np.sin(angle)+RIGHT*buf*np.cos(angle)+DOWN*buf*np.sin(angle)) 1400 | lines.append(down_line) 1401 | self.play(ShowCreation(green),ShowCreation(down_line)) 1402 | return green 1403 | 1404 | an=PI/18 1405 | l=1 1406 | 1407 | rop1_u_u=branchup(rop1_u,an,l) 1408 | rop1_u_m=branchmid(rop1_u,0,np.cos(an)*l) 1409 | rop1_u_d=branchdown(rop1_u,an,l) 1410 | 1411 | rop1_m_u=branchup(rop1_m,an,l) 1412 | rop1_m_m=branchmid(rop1_m,0,np.cos(an)*l) 1413 | rop1_m_d=branchdown(rop1_m,an,l) 1414 | 1415 | rop1_d_u=branchup(rop1_d,an,l) 1416 | rop1_d_m=branchmid(rop1_d,0,np.cos(an)*l) 1417 | rop1_d_d=branchdown(rop1_d,an,l) 1418 | 1419 | 1420 | gop1_u_u=branchup(gop1_u,an,l) 1421 | gop1_u_m=branchmid(gop1_u,0,np.cos(an)*l) 1422 | gop1_u_d=branchdown(gop1_u,an,l) 1423 | 1424 | gop1_m_u=branchup(gop1_m,an,l) 1425 | gop1_m_m=branchmid(gop1_m,0,np.cos(an)*l) 1426 | gop1_m_d=branchdown(gop1_m,an,l) 1427 | 1428 | gop1_d_u=branchup(gop1_d,an,l) 1429 | gop1_d_m=branchmid(gop1_d,0,np.cos(an)*l) 1430 | gop1_d_d=branchdown(gop1_d,an,l) 1431 | 1432 | 1433 | bop1_u_u=branchup(bop1_u,an,l) 1434 | bop1_u_m=branchmid(bop1_u,0,np.cos(an)*l) 1435 | bop1_u_d=branchdown(bop1_u,an,l) 1436 | 1437 | bop1_m_u=branchup(bop1_m,an,l) 1438 | bop1_m_m=branchmid(bop1_m,0,np.cos(an)*l) 1439 | bop1_m_d=branchdown(bop1_m,an,l) 1440 | 1441 | bop1_d_u=branchup(bop1_d,an,l) 1442 | bop1_d_m=branchmid(bop1_d,0,np.cos(an)*l) 1443 | bop1_d_d=branchdown(bop1_d,an,l) 1444 | 1445 | self.wait(3) 1446 | 1447 | self.play(ShowCreation(sep1)) 1448 | self.wait() 1449 | th1=TextMobject("3") 1450 | th1.scale(1.7) 1451 | th1.next_to(box1,DOWN,0.2) 1452 | self.play(ShowCreation(th1)) 1453 | 1454 | self.wait(2) 1455 | 1456 | sep2_pos=VGroup(rop1_u,bop1_d) 1457 | sep2.move_to(sep2_pos.get_center()) 1458 | self.play(ShowCreation(sep2)) 1459 | self.wait() 1460 | th2=TextMobject("3") 1461 | th2.scale(1.7) 1462 | th2.next_to(box2,DOWN,0.2) 1463 | times2=TextMobject("$$\\times$$") 1464 | f_g4=VGroup(th1,th2) 1465 | times2.move_to(f_g4.get_center()) 1466 | 1467 | self.play(ShowCreation(th2),ShowCreation(times2)) 1468 | 1469 | self.wait(2) 1470 | 1471 | sep3_pos=VGroup(rop1_u_u,bop1_d_d) 1472 | sep3.move_to(sep3_pos.get_center()) 1473 | self.play(ShowCreation(sep3)) 1474 | self.wait() 1475 | th3=TextMobject("3") 1476 | th3.scale(1.7) 1477 | th3.next_to(box3,DOWN,0.2) 1478 | times3=TextMobject("$$\\times$$") 1479 | f_g5=VGroup(th2,th3) 1480 | times3.move_to(f_g5.get_center()) 1481 | self.play(ShowCreation(th3),ShowCreation(times3)) 1482 | 1483 | self.wait(3) 1484 | 1485 | th_cu=TextMobject("$$3^{3}$$") 1486 | th_cu.scale(1.7) 1487 | 1488 | th_cu.next_to(box2,DOWN,0.6) 1489 | 1490 | threes_plus=VGroup(th1,th2,th3,times3,times2) 1491 | 1492 | self.play(Transform(threes_plus,th_cu)) 1493 | 1494 | self.wait(4) 1495 | 1496 | 1497 | #python -m manim MITintegral\Fermat\fermatscenes.py IntroClips -pl 1498 | class IntroClips(Scene): 1499 | def construct(self): 1500 | fermat=TextMobject("Fermat's") 1501 | fermat.scale(1.6) 1502 | little=TextMobject("little") 1503 | little.scale(1.2) 1504 | little.set_color(BLUE) 1505 | theorem=TextMobject("theorem") 1506 | theorem.scale(1.6) 1507 | fermat.next_to(little,LEFT,0.5) 1508 | theorem.next_to(little,RIGHT,0.5) 1509 | 1510 | title=VGroup(fermat,little,theorem) 1511 | title.move_to(ORIGIN) 1512 | 1513 | self.play(Write(title)) 1514 | 1515 | self.wait(4) 1516 | 1517 | self.play(FadeOut(title)) 1518 | 1519 | a=TextMobject("$$a$$") 1520 | po=TextMobject("$$p$$") 1521 | a.scale(2) 1522 | po.scale(2) 1523 | 1524 | pers.sep_exp(a,po) 1525 | po.set_color(BLUE) 1526 | 1527 | th1=VGroup(a,po) 1528 | 1529 | min_a=TextMobject("$$-a$$") 1530 | min_a.scale(2) 1531 | min_a.next_to(th1,RIGHT,0.1) 1532 | min_a.align_to(th1,DOWN) 1533 | 1534 | th=VGroup(th1,min_a) 1535 | 1536 | bar=Line(ORIGIN,RIGHT*(0.2+th.get_width()),stroke_width=3) 1537 | 1538 | bar.next_to(th,DOWN,0.13) 1539 | 1540 | p=TextMobject("$$p$$") 1541 | p.set_color(BLUE) 1542 | 1543 | p.scale(2) 1544 | 1545 | p.next_to(bar,DOWN,0.13) 1546 | 1547 | whole=VGroup(th,bar,p) 1548 | 1549 | whole.move_to(ORIGIN) 1550 | 1551 | po.scale(2) 1552 | 1553 | self.play(Write(po)) 1554 | self.wait() 1555 | self.play(ApplyMethod(po.scale,0.5)) 1556 | 1557 | self.play(Write(a)) 1558 | 1559 | self.wait(2) 1560 | 1561 | self.play(Write(min_a)) 1562 | 1563 | self.wait() 1564 | 1565 | self.play(ShowCreation(bar)) 1566 | 1567 | self.play(Write(p)) 1568 | 1569 | self.wait(3) 1570 | 1571 | self.play(FadeOut(whole)) 1572 | 1573 | self.wait(2) 1574 | 1575 | #The following scene represents how I can call on a personal method from the 1576 | #file: my_methods.py, located in manimlib. NOTE: since the method I am using 1577 | #uses a "self.play" in the function, it must be passed self (and the method must 1578 | #be written to accept self). 1579 | 1580 | #python -m manim MITintegral\Fermat\fermatscenes.py Calling_Method -pl 1581 | class Calling_Method(Scene): 1582 | def construct(self): 1583 | seven=TextMobject("7") 1584 | pers.print_col(self,seven) 1585 | 1586 | self.wait(2) 1587 | 1588 | #python -m manim MITintegral\Fermat\fermatscenes.py test -pl 1589 | class test(Scene): 1590 | def construct(self): 1591 | 1592 | th=TextMobject("$$3$$") 1593 | five=TextMobject("$$5$$") 1594 | 1595 | whole=VGroup(th,five) 1596 | 1597 | whole.scale(3) 1598 | 1599 | 1600 | pers.sep_exp(th,five) 1601 | 1602 | self.play(Write(th),Write(five)) 1603 | 1604 | self.wait(2) 1605 | 1606 | five.set_color(BLUE) 1607 | 1608 | self.wait(3) 1609 | 1610 | #python -m manim MITintegral\Fermat\fermatscenes.py ProbCont -pl 1611 | class ProbCont(Scene): 1612 | def construct(self): 1613 | base=TextMobject("$$\#\mbox{ colors}$$") 1614 | exp=TextMobject("$$\#\mbox{ boxes}$$") 1615 | min_a=TextMobject("$$-a$$") 1616 | exp.set_color(BLUE) 1617 | base.scale(2) 1618 | exp.scale(2) 1619 | 1620 | pers.sep_exp(base,exp) 1621 | 1622 | state=VGroup(base,exp) 1623 | 1624 | self.play(Write(state)) 1625 | 1626 | self.wait(2) 1627 | 1628 | a=TextMobject("$$a$$") 1629 | a.move_to(base.get_center()) 1630 | a.scale(2) 1631 | self.play(Transform(base,a)) 1632 | 1633 | p=TextMobject("$$p$$") 1634 | p.scale(2) 1635 | p.set_color(BLUE) 1636 | 1637 | pers.sep_exp(a,p) 1638 | 1639 | self.wait(2) 1640 | 1641 | self.play(Transform(exp,p)) 1642 | 1643 | self.wait(3) 1644 | 1645 | f_g=VGroup(a,p) 1646 | 1647 | min_a.scale(2) 1648 | 1649 | min_a.next_to(f_g,RIGHT,0.1) 1650 | 1651 | min_a.align_to(f_g,DOWN) 1652 | 1653 | self.play(Write(min_a)) 1654 | 1655 | self.wait(2) 1656 | 1657 | noth=TextMobject("") 1658 | 1659 | all_=VGroup(min_a,base,exp) 1660 | 1661 | self.play(Transform(all_,noth)) 1662 | 1663 | self.wait() 1664 | 1665 | #python -m manim MITintegral\Fermat\fermatscenes.py NoahIntro -pl 1666 | class NoahIntro(MovingCameraScene): 1667 | def setup(self): 1668 | MovingCameraScene.setup(self) 1669 | def construct(self): 1670 | treble=SVGMobject("treble_svg",fill_color=BLUE,fill_opacity=0,stroke_width=3,stroke_color=YELLOW) 1671 | treble.scale(3) 1672 | noah=TextMobject("\\textit{NOAH FORBES}",fill_color=WHITE,stroke_width=4,stroke_color=BLUE,fill_opacity=1) 1673 | #noah.set_color(BLUE) 1674 | noah.shift(DOWN) 1675 | 1676 | music=TextMobject("MUSIC",fill_color=WHITE,stroke_width=2,stroke_color=BLUE) 1677 | music.scale(2) 1678 | notes=TextMobject("NOTES",fill_color=WHITE,stroke_width=2,stroke_color=BLUE) 1679 | notes.scale(2) 1680 | with_=TextMobject("WITH",fill_color=WHITE,stroke_width=2,stroke_color=BLUE) 1681 | with_.shift(UP*0.8) 1682 | with_.scale(1.5) 1683 | 1684 | music.move_to(UP*2+LEFT*3.4) 1685 | notes.move_to(UP*2+RIGHT*3.4) 1686 | 1687 | self.bring_to_back(treble) 1688 | self.remove(treble) 1689 | 1690 | self.wait(2) 1691 | 1692 | self.play(Write(music)) 1693 | self.wait() 1694 | self.play(Write(notes)) 1695 | self.wait() 1696 | self.play(Write(with_)) 1697 | self.add_foreground_mobjects(with_) 1698 | self.wait() 1699 | 1700 | noah.scale(3.7) 1701 | self.wait() 1702 | self.play(ShowCreation(treble)) 1703 | self.wait() 1704 | self.play(Write(noah)) 1705 | self.wait(2) 1706 | 1707 | self.play( 1708 | ApplyMethod(self.camera_frame.scale,0.006) 1709 | ) 1710 | 1711 | self.wait() 1712 | 1713 | #python -m manim MITintegral\Fermat\fermatscenes.py PrimeShifts -pl 1714 | class PrimeShifts(Scene): 1715 | def construct(self): 1716 | r1=Dot(color=RED) 1717 | b1=Dot(color=BLUE) 1718 | r2=Dot(color=RED) 1719 | 1720 | dots=VGroup(r1,b1,r2) 1721 | 1722 | dots.scale(2) 1723 | 1724 | r1.next_to(b1,LEFT) 1725 | r2.next_to(b1,RIGHT) 1726 | 1727 | self.play(ShowCreation(dots)) 1728 | 1729 | self.wait() 1730 | 1731 | #python -m manim MITintegral\Fermat\fermatscenes.py PieceTogether -pl 1732 | class PieceTogether(MovingCameraScene): 1733 | def setup(self): 1734 | MovingCameraScene.setup(self) 1735 | def construct(self): 1736 | 1737 | arr_sc=2.5 1738 | 1739 | self.camera_frame.scale(1.5) 1740 | 1741 | r_dot=Dot(color=RED) 1742 | b_dot=Dot(color=BLUE) 1743 | b2_dot=Dot(color=BLUE) 1744 | 1745 | scale=4 1746 | 1747 | r_dot.scale(scale) 1748 | b_dot.scale(scale) 1749 | b2_dot.scale(scale) 1750 | 1751 | r_dot.next_to(b_dot,LEFT,1) 1752 | b2_dot.next_to(b_dot,RIGHT,1) 1753 | 1754 | dots=VGroup(r_dot,b_dot,b2_dot) 1755 | 1756 | self.play(ShowCreation(dots)) 1757 | 1758 | self.wait(2) 1759 | 1760 | self.play(ApplyMethod(dots.move_to,LEFT*7.5+UP*2)) 1761 | 1762 | r_dot2=Dot(color=RED) 1763 | r2_dot2=Dot(color=RED) 1764 | b_dot2=Dot(color=BLUE) 1765 | 1766 | r_dot2.scale(scale) 1767 | r2_dot2.scale(scale) 1768 | b_dot2.scale(scale) 1769 | 1770 | r_dot2.next_to(r2_dot2,LEFT,1) 1771 | b_dot2.next_to(r2_dot2,RIGHT,1) 1772 | 1773 | _dots=VGroup(r_dot2,r2_dot2,b_dot2) 1774 | 1775 | _dots.move_to(LEFT*7.5+DOWN*2) 1776 | 1777 | self.play(ShowCreation(_dots)) 1778 | 1779 | self.wait(2) 1780 | 1781 | r_dot_u2=Dot(color=BLUE) 1782 | b_dot_u2=Dot(color=RED) 1783 | b2_dot_u2=Dot(color=BLUE) 1784 | 1785 | scale=4 1786 | 1787 | r_dot_u2.scale(scale) 1788 | b_dot_u2.scale(scale) 1789 | b2_dot_u2.scale(scale) 1790 | 1791 | r_dot_u2.next_to(b_dot_u2,LEFT,1) 1792 | b2_dot_u2.next_to(b_dot_u2,RIGHT,1) 1793 | 1794 | dots_u2=VGroup(r_dot_u2,b_dot_u2,b2_dot_u2) 1795 | 1796 | dots_u2.shift(UP*2) 1797 | 1798 | arr_u1=TextMobject("$$\\rightarrow$$") 1799 | arr_u1.scale(arr_sc) 1800 | u_f_g=VGroup(dots,dots_u2) 1801 | arr_u1.move_to(u_f_g.get_center()) 1802 | 1803 | self.play(ShowCreation(arr_u1)) 1804 | 1805 | self.play(ShowCreation(dots_u2)) 1806 | 1807 | self.wait() 1808 | 1809 | r_dot2_d2=Dot(color=BLUE) 1810 | r2_dot2_d2=Dot(color=RED) 1811 | b_dot2_d2=Dot(color=RED) 1812 | 1813 | r_dot2_d2.scale(scale) 1814 | r2_dot2_d2.scale(scale) 1815 | b_dot2_d2.scale(scale) 1816 | 1817 | r_dot2_d2.next_to(r2_dot2_d2,LEFT,1) 1818 | b_dot2_d2.next_to(r2_dot2_d2,RIGHT,1) 1819 | 1820 | _dots_d2=VGroup(r_dot2_d2,r2_dot2_d2,b_dot2_d2) 1821 | 1822 | _dots_d2.move_to(DOWN*2) 1823 | 1824 | arr_d1=TextMobject("$$\\rightarrow$$") 1825 | arr_d1.scale(arr_sc) 1826 | d_f_g=VGroup(_dots,_dots_d2) 1827 | arr_d1.move_to(d_f_g.get_center()) 1828 | 1829 | self.play(ShowCreation(arr_d1)) 1830 | 1831 | self.play(ShowCreation(_dots_d2)) 1832 | 1833 | self.wait(2) 1834 | 1835 | r_dot_u3=Dot(color=BLUE) 1836 | b_dot_u3=Dot(color=BLUE) 1837 | b2_dot_u3=Dot(color=RED) 1838 | 1839 | scale=4 1840 | 1841 | r_dot_u3.scale(scale) 1842 | b_dot_u3.scale(scale) 1843 | b2_dot_u3.scale(scale) 1844 | 1845 | r_dot_u3.next_to(b_dot_u3,LEFT,1) 1846 | b2_dot_u3.next_to(b_dot_u3,RIGHT,1) 1847 | 1848 | dots_u3=VGroup(r_dot_u3,b_dot_u3,b2_dot_u3) 1849 | 1850 | dots_u3.shift(UP*2+RIGHT*(ORIGIN-(dots.get_center()+DOWN*2))) 1851 | 1852 | arr_u2=TextMobject("$$\\rightarrow$$") 1853 | arr_u2.scale(arr_sc) 1854 | u_f_g=VGroup(dots_u2,dots_u3) 1855 | arr_u2.move_to(u_f_g.get_center()) 1856 | 1857 | self.play(ShowCreation(arr_u2)) 1858 | 1859 | self.play(ShowCreation(dots_u3)) 1860 | 1861 | self.wait() 1862 | 1863 | r_dot2_d3=Dot(color=RED) 1864 | r2_dot2_d3=Dot(color=BLUE) 1865 | b_dot2_d3=Dot(color=RED) 1866 | 1867 | r_dot2_d3.scale(scale) 1868 | r2_dot2_d3.scale(scale) 1869 | b_dot2_d3.scale(scale) 1870 | 1871 | r_dot2_d3.next_to(r2_dot2_d3,LEFT,1) 1872 | b_dot2_d3.next_to(r2_dot2_d3,RIGHT,1) 1873 | 1874 | _dots_d3=VGroup(r_dot2_d3,r2_dot2_d3,b_dot2_d3) 1875 | 1876 | _dots_d3.move_to(DOWN*2+RIGHT*(ORIGIN-(dots.get_center()+DOWN*2))) 1877 | 1878 | arr_d2=TextMobject("$$\\rightarrow$$") 1879 | arr_d2.scale(arr_sc) 1880 | d_f_g=VGroup(_dots_d2,_dots_d3) 1881 | arr_d2.move_to(d_f_g.get_center()) 1882 | 1883 | self.play(ShowCreation(arr_d2)) 1884 | 1885 | self.play(ShowCreation(_dots_d3)) 1886 | 1887 | self.wait(3) 1888 | 1889 | buff=0.35 1890 | 1891 | f_g=VGroup(dots,_dots) 1892 | box1=Rectangle(width=dots.get_width()+buff,height=f_g.get_height()+buff,color=BLUE) 1893 | box1.move_to(f_g.get_center()) 1894 | 1895 | box2=Rectangle(width=dots.get_width()+buff,height=f_g.get_height()+buff,color=BLUE) 1896 | box2.move_to(ORIGIN) 1897 | 1898 | box3=Rectangle(width=dots.get_width()+buff,height=f_g.get_height()+buff,color=BLUE) 1899 | box3.move_to(RIGHT*(ORIGIN-f_g.get_center())) 1900 | 1901 | self.play(ShowCreation(box1)) 1902 | self.play(ShowCreation(box2)) 1903 | self.play(ShowCreation(box3)) 1904 | 1905 | self.wait(3) 1906 | 1907 | self.play(FadeOut(box1),FadeOut(box2),FadeOut(box3)) 1908 | 1909 | exr1=Dot(color=RED) 1910 | exr2=Dot(color=RED) 1911 | exr3=Dot(color=RED) 1912 | 1913 | exb1=Dot(color=BLUE) 1914 | exb2=Dot(color=BLUE) 1915 | exb3=Dot(color=BLUE) 1916 | 1917 | exr1.scale(scale) 1918 | exr2.scale(scale) 1919 | exr3.scale(scale) 1920 | exb1.scale(scale) 1921 | exb2.scale(scale) 1922 | exb3.scale(scale) 1923 | 1924 | exr1.next_to(exr2,LEFT,1) 1925 | exr3.next_to(exr2,RIGHT,1) 1926 | 1927 | exb1.next_to(exb2,LEFT,1) 1928 | exb3.next_to(exb2,RIGHT,1) 1929 | 1930 | exr=VGroup(exr1,exr2,exr3) 1931 | exb=VGroup(exb1,exb2,exb3) 1932 | 1933 | exr.shift(LEFT*4+DOWN*4) 1934 | 1935 | exb.shift(RIGHT*4+DOWN*4) 1936 | 1937 | self.play(ShowCreation(exr),ShowCreation(exb)) 1938 | 1939 | self.wait(2) 1940 | 1941 | self.play(FadeOut(exr),FadeOut(exb)) 1942 | 1943 | self.wait(3) 1944 | 1945 | a=TextMobject("$$a$$") 1946 | a.scale(3) 1947 | 1948 | p=TextMobject("$$p$$",color=BLUE) 1949 | p.scale(3) 1950 | 1951 | pers.sep_exp(a,p) 1952 | 1953 | ap=VGroup(a,p) 1954 | min_a=TextMobject("$$-a$$") 1955 | min_a.scale(3) 1956 | min_a.next_to(ap,RIGHT,0.1) 1957 | min_a.align_to(ap,DOWN) 1958 | 1959 | exp=VGroup(a,p,min_a) 1960 | 1961 | exp.move_to(ORIGIN) 1962 | 1963 | self.play(Write(ap)) 1964 | self.wait() 1965 | self.play(Write(min_a)) 1966 | 1967 | self.wait(3) 1968 | 1969 | #python -m manim MITintegral\Fermat\fermatscenes.py IssueFour -pl 1970 | class IssueFour(MovingCameraScene): 1971 | def setup(self): 1972 | MovingCameraScene.setup(self) 1973 | def construct(self): 1974 | 1975 | set1=pers.construct_dots("r","r","b","b",0,0) 1976 | 1977 | self.play(ShowCreation(set1)) 1978 | 1979 | self.wait(2) 1980 | 1981 | self.play(ApplyMethod(set1.scale,0.5)) 1982 | 1983 | self.play(ApplyMethod(set1.move_to,LEFT*5+UP*2)) 1984 | 1985 | self.wait(2) 1986 | 1987 | set2=pers.construct_dots("r","b","r","b",0,0) 1988 | set2.scale(0.5) 1989 | set2.move_to(LEFT*5+UP*1.33333*0.5) 1990 | 1991 | set3=pers.construct_dots("r","r","r","b",0,0) 1992 | set3.scale(0.5) 1993 | set3.move_to(LEFT*5+DOWN*1.3333*0.5) 1994 | 1995 | set4=pers.construct_dots("b","b","b","r",0,0) 1996 | set4.scale(0.5) 1997 | set4.move_to(LEFT*5+DOWN*2) 1998 | 1999 | self.play(ShowCreation(set2)) 2000 | self.play(ShowCreation(set3)) 2001 | self.play(ShowCreation(set4)) 2002 | 2003 | self.wait(3) 2004 | 2005 | #### 2006 | #Row1 2007 | 2008 | set11=pers.construct_dots("b","r","r","b",0,0) 2009 | set11.move_to(UP*2) 2010 | set11.scale(0.5) 2011 | 2012 | arr1=pers.arrow_maker(set1,set11,WHITE) 2013 | 2014 | self.play(ShowCreation(arr1)) 2015 | self.play(ShowCreation(set11)) 2016 | 2017 | self.wait(2) 2018 | 2019 | elli=TextMobject("...") 2020 | elli.scale(4) 2021 | elli.move_to(RIGHT*5+UP*2) 2022 | 2023 | arr11=pers.arrow_maker(set11,elli,WHITE) 2024 | arr11.shift(RIGHT*0.8) 2025 | 2026 | self.play(ShowCreation(arr11)) 2027 | self.play(ShowCreation(elli)) 2028 | 2029 | self.wait(3) 2030 | 2031 | ##### 2032 | #Row 3 2033 | 2034 | set31=pers.construct_dots("b","r","r","r",0,0) 2035 | set31.scale(0.5) 2036 | set31.move_to(DOWN*0.5*1.3333) 2037 | arr3=pers.arrow_maker(set3,set31,WHITE) 2038 | 2039 | self.play(ShowCreation(arr3)) 2040 | self.play(ShowCreation(set31)) 2041 | 2042 | self.wait() 2043 | 2044 | elli3=TextMobject("...") 2045 | elli3.scale(4) 2046 | elli3.move_to(RIGHT*5+DOWN*0.5*1.3333) 2047 | 2048 | arr31=pers.arrow_maker(set31,elli3,WHITE) 2049 | arr31.shift(RIGHT*0.8) 2050 | 2051 | self.play(ShowCreation(arr31)) 2052 | self.play(ShowCreation(elli3)) 2053 | 2054 | ##### 2055 | #Row 4 2056 | 2057 | set41=pers.construct_dots("r","b","b","b",0,0) 2058 | set41.scale(0.5) 2059 | set41.move_to(DOWN*2) 2060 | arr4=pers.arrow_maker(set4,set41,WHITE) 2061 | 2062 | self.play(ShowCreation(arr4)) 2063 | self.play(ShowCreation(set41)) 2064 | 2065 | self.wait() 2066 | 2067 | elli4=TextMobject("...") 2068 | elli4.scale(4) 2069 | elli4.move_to(RIGHT*5+DOWN*2) 2070 | 2071 | arr41=pers.arrow_maker(set41,elli4,WHITE) 2072 | arr41.shift(RIGHT*0.8) 2073 | 2074 | self.play(ShowCreation(arr41)) 2075 | self.play(ShowCreation(elli4)) 2076 | 2077 | self.wait(3) 2078 | 2079 | set21=pers.construct_dots("b","r","b","r",0,0) 2080 | set21.scale(0.5) 2081 | set21.move_to(UP*0.5*1.33333) 2082 | 2083 | arr2=pers.arrow_maker(set2,set21,WHITE) 2084 | 2085 | self.play(ShowCreation(arr2)) 2086 | self.play(ShowCreation(set21)) 2087 | 2088 | self.wait(3) 2089 | 2090 | buff=0.35 2091 | col1=VGroup(set1,set4) 2092 | box1=Rectangle(width=col1.get_width()+buff,height=col1.get_height()+buff,color=BLUE) 2093 | box1.move_to(col1.get_center()) 2094 | 2095 | box2=Rectangle(width=col1.get_width()+buff,height=col1.get_height()+buff,color=BLUE) 2096 | 2097 | box3=Rectangle(width=elli.get_width()+buff,height=elli.get_height()+buff,color=BLUE) 2098 | box3.move_to(elli.get_center()) 2099 | 2100 | ellis=VGroup(elli3,elli4) 2101 | box4=Rectangle(width=ellis.get_width()+buff,height=ellis.get_height()+buff,color=BLUE) 2102 | box4.move_to(ellis.get_center()) 2103 | 2104 | self.play(ShowCreation(box1)) 2105 | self.play(ShowCreation(box2)) 2106 | 2107 | self.wait(2) 2108 | 2109 | self.play(ShowCreation(box3),ShowCreation(box4)) 2110 | 2111 | self.wait(3) 2112 | 2113 | self.play( 2114 | FadeOut(box1), 2115 | FadeOut(box2), 2116 | FadeOut(box3), 2117 | FadeOut(box4) 2118 | ) 2119 | 2120 | self.play( 2121 | ApplyMethod(set1.shift,UP), 2122 | ApplyMethod(set2.shift,UP), 2123 | ApplyMethod(set3.shift,DOWN), 2124 | ApplyMethod(set4.shift,DOWN), 2125 | 2126 | ApplyMethod(set11.shift,UP), 2127 | ApplyMethod(set21.shift,UP), 2128 | ApplyMethod(set31.shift,DOWN), 2129 | ApplyMethod(set41.shift,DOWN), 2130 | 2131 | ApplyMethod(arr1.shift,UP), 2132 | ApplyMethod(arr2.shift,UP), 2133 | ApplyMethod(arr3.shift,DOWN), 2134 | ApplyMethod(arr4.shift,DOWN), 2135 | 2136 | ApplyMethod(arr11.shift,UP), 2137 | ApplyMethod(arr31.shift,DOWN), 2138 | ApplyMethod(arr41.shift,DOWN), 2139 | 2140 | ApplyMethod(elli.shift,UP), 2141 | ApplyMethod(elli3.shift,DOWN), 2142 | ApplyMethod(elli4.shift,DOWN) 2143 | 2144 | ) 2145 | 2146 | self.wait() 2147 | 2148 | a=TextMobject("$$a$$") 2149 | a.scale(3) 2150 | 2151 | p=TextMobject("$$p$$",color=BLUE) 2152 | p.scale(3) 2153 | 2154 | pers.sep_exp(a,p) 2155 | 2156 | ap=VGroup(a,p) 2157 | min_a=TextMobject("$$-a$$") 2158 | min_a.scale(3) 2159 | min_a.next_to(ap,RIGHT,0.1) 2160 | min_a.align_to(ap,DOWN) 2161 | 2162 | exp=VGroup(a,p,min_a) 2163 | 2164 | exp.move_to(ORIGIN) 2165 | 2166 | self.play(Write(ap)) 2167 | self.wait() 2168 | self.play(Write(min_a)) 2169 | 2170 | self.wait(3) 2171 | 2172 | #python -m manim MITintegral\Fermat\fermatscenes.py Primes -pl 2173 | class Primes(MovingCameraScene): 2174 | def setup(self): 2175 | MovingCameraScene.setup(self) 2176 | def construct(self): 2177 | a=TextMobject("$$2,$$") 2178 | b=TextMobject("$$3,$$") 2179 | c=TextMobject("$$5,$$") 2180 | d=TextMobject("$$7,$$") 2181 | e=TextMobject("$$11,$$") 2182 | f=TextMobject("$$13,$$") 2183 | g=TextMobject("$$17,$$") 2184 | h=TextMobject("$$...$$") 2185 | 2186 | scale=2 2187 | a.scale(2) 2188 | b.scale(2) 2189 | c.scale(2) 2190 | d.scale(2) 2191 | e.scale(2) 2192 | f.scale(2) 2193 | g.scale(2) 2194 | h.scale(2) 2195 | 2196 | buff=0.4 2197 | 2198 | b.next_to(a,RIGHT,buff) 2199 | c.next_to(b,RIGHT,buff) 2200 | d.next_to(c,RIGHT,buff) 2201 | e.next_to(d,RIGHT,buff) 2202 | f.next_to(e,RIGHT,buff) 2203 | g.next_to(f,RIGHT,buff) 2204 | h.next_to(g,RIGHT,buff) 2205 | 2206 | group=VGroup(a,b,c,d,e,f,g,h) 2207 | 2208 | group.move_to(ORIGIN) 2209 | 2210 | self.play(Write(a)) 2211 | self.play(Write(b)) 2212 | self.play(Write(c)) 2213 | self.play(Write(d)) 2214 | self.play(Write(e)) 2215 | self.play(Write(f)) 2216 | self.play(Write(g)) 2217 | self.play(Write(h)) 2218 | 2219 | self.wait(2) 2220 | 2221 | i=TextMobject("$$+1$$") 2222 | j=TextMobject("$$+2$$") 2223 | k=TextMobject("$$+2$$") 2224 | l=TextMobject("$$+4$$") 2225 | m=TextMobject("$$+2$$") 2226 | n=TextMobject("$$+4$$") 2227 | 2228 | i.scale(scale) 2229 | j.scale(scale) 2230 | k.scale(scale) 2231 | l.scale(scale) 2232 | m.scale(scale) 2233 | n.scale(scale) 2234 | 2235 | buf=0.3 2236 | 2237 | i.next_to(a,UP,buf) 2238 | j.next_to(b,UP,buf) 2239 | k.next_to(c,UP,buf) 2240 | l.next_to(d,UP,buf) 2241 | m.next_to(e,UP,buf) 2242 | n.next_to(f,UP,buf) 2243 | 2244 | adds=VGroup(i,j,k,l,m,n) 2245 | 2246 | adds.shift(RIGHT*0.15) 2247 | 2248 | self.play(ShowCreation(i)) 2249 | 2250 | self.play(Transform(i,j)) 2251 | self.play(Transform(i,k)) 2252 | adds.shift(RIGHT*0.1) 2253 | self.play(Transform(i,l)) 2254 | self.play(Transform(i,m)) 2255 | self.play(Transform(i,n)) 2256 | 2257 | self.wait(3) 2258 | 2259 | #python -m manim MITintegral\Fermat\fermatscenes.py Test -pl 2260 | class Test(Scene): 2261 | def construct(self): 2262 | dot=Dot() 2263 | dot.move_to(RIGHT+UP) 2264 | grace=0.1 2265 | if pers.abs(dot.get_center())<(np.sqrt(2)+grace) and pers.abs(dot.get_center())>(np.sqrt(2)-grace): 2266 | self.play(ShowCreation(dot)) 2267 | 2268 | self.wait(2) -------------------------------------------------------------------------------- /My Methods/my_methods.py: -------------------------------------------------------------------------------- 1 | from manimlib.constants import * 2 | from manimlib.imports import * 3 | from manimlib.mobject.svg.tex_mobject import SingleStringTexMobject 4 | from manimlib.mobject.types.vectorized_mobject import VMobject 5 | 6 | #This class is my "personal methods", hence the name "pers" 7 | #acces by using pers."method" 8 | class pers(Scene): 9 | 10 | #This method was an early test,it paints and prints a passed mobject 11 | def print_col(self,x): 12 | x.set_color(BLUE) 13 | self.play(ShowCreation(x)) 14 | 15 | #this method is passed two mobjects. it arranges them as if they were exponents 16 | #NOTE: textmobjects must be of equal size when passed 17 | def sep_exp(base,exp): 18 | exp.scale(0.75) 19 | exp.move_to(base.get_center()+UP*0.67*exp.get_height()) 20 | exp.align_to(base,RIGHT) 21 | buff=0.1 22 | exp.shift(RIGHT*(exp.get_width()+buff*exp.get_width())) 23 | return exp 24 | 25 | #Takes between 3 and 6 colors and makes nicely spaced dots of them 26 | #returns the group of dots 27 | #make sure the colors passed ar either "r","g", or "b" 28 | def construct_dots(a,b,c,d,e,f): 29 | 30 | scale=4 31 | 32 | if a=="r": 33 | an=Dot(color=RED) 34 | if a=="g": 35 | an=Dot(color=GREEN) 36 | if a=="b": 37 | an=Dot(color=BLUE) 38 | 39 | if b=="r": 40 | bn=Dot(color=RED) 41 | if b=="g": 42 | bn=Dot(color=GREEN) 43 | if b=="b": 44 | bn=Dot(color=BLUE) 45 | 46 | if c=="r": 47 | cn=Dot(color=RED) 48 | if c=="g": 49 | cn=Dot(color=GREEN) 50 | if c=="b": 51 | cn=Dot(color=BLUE) 52 | 53 | if d=="r": 54 | dn=Dot(color=RED) 55 | if d=="g": 56 | dn=Dot(color=GREEN) 57 | if d=="b": 58 | dn=Dot(color=BLUE) 59 | if d==0: 60 | dn=0 61 | 62 | if e=="r": 63 | en=Dot(color=RED) 64 | if e=="g": 65 | en=Dot(color=GREEN) 66 | if e=="b": 67 | en=Dot(color=BLUE) 68 | if e==0: 69 | en=0 70 | 71 | if f=="r": 72 | fn=Dot(color=RED) 73 | if f=="g": 74 | fn=Dot(color=GREEN) 75 | if f=="b": 76 | fn=Dot(color=BLUE) 77 | if f==0: 78 | fn=0 79 | 80 | an.scale(scale) 81 | bn.scale(scale) 82 | cn.scale(scale) 83 | if dn!=0: 84 | dn.scale(scale) 85 | if en!=0: 86 | en.scale(scale) 87 | if fn!=0: 88 | fn.scale(scale) 89 | 90 | an.next_to(bn,LEFT,1) 91 | cn.next_to(bn,RIGHT,1) 92 | if dn!=0: 93 | dn.next_to(cn,RIGHT,1) 94 | if en!=0: 95 | en.next_to(dn,RIGHT,1) 96 | if fn!=0: 97 | fn.next_to(en,RIGHT,1) 98 | 99 | if fn!=0: 100 | dots=VGroup(an,bn,cn,dn,en,fn) 101 | if fn==0 and en!=0: 102 | dots=VGroup(an,bn,cn,dn,en) 103 | if en==0 and dn!=0: 104 | dots=VGroup(an,bn,cn,dn) 105 | if dn==0: 106 | dots=VGroup(an,bn,cn) 107 | 108 | dots.move_to(ORIGIN) 109 | 110 | return dots 111 | 112 | #Makes an arrow between the centers of x and y (color included) 113 | def arrow_maker(x,y,color): 114 | group=VGroup(x,y) 115 | arrow=TextMobject("$$\\rightarrow$$") 116 | arrow.scale(2) 117 | arrow.set_color(color) 118 | arrow.move_to(group.get_center()) 119 | return arrow 120 | 121 | #Gets modulus of an array 122 | def abs(arr): 123 | length=len(arr) 124 | n=0 125 | tot=0 126 | 127 | x=1 128 | while True: 129 | tot+=np.power(arr[n],2) 130 | n+=1 131 | if n>=length: 132 | break 133 | return np.sqrt(tot) -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # YouTube2020 2 | Manim code for my videos in 2020 3 | 4 | [CHANNEL: https://www.youtube.com/channel/UCc0MkdJxLLKi9i45vxw589w] 5 | 6 | NOTE: my personal methods is stored in the my_methods.py file, and all are listed under the 7 | class called "pers". My code that uses these methods is accessed as pers."method"() 8 | -------------------------------------------------------------------------------- /Radians/unitcirclescenes.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | from manimlib.imports import * 4 | 5 | #python -m manim MITintegral\UnitCircle\unitcirclescenes.py Intro -pl 6 | class Intro(GraphScene): 7 | CONFIG = { 8 | "x_min" : -12, 9 | "x_max" : 12, 10 | "y_min" : -9, 11 | "y_max" : 9, 12 | "x_tick_frequency": 2, 13 | "y_tick_frequency": 2, 14 | "y_axis_height":9, 15 | "x_axis_width":12, 16 | "graph_origin" : ORIGIN, 17 | "function_color" : RED , 18 | "axes_color" : GREEN, 19 | #"x_labeled_nums" :range(-8,8,2), 20 | #"y_labeled_nums" :range(-6,6,2), 21 | "num_graph_anchor_points": 200, 22 | 23 | } 24 | def construct(self): 25 | self.setup_axes(animate=False) 26 | self.x_axis.set_opacity(0) 27 | self.y_axis.set_opacity(0) 28 | 29 | sinlab=TextMobject("$$\sin(x)$$") 30 | sinlab.set_color(BLUE) 31 | coslab=TextMobject("$$\cos(x)$$") 32 | coslab.set_color(RED) 33 | 34 | sinlab.scale(1.5) 35 | coslab.scale(1.5) 36 | 37 | sinlab.move_to(LEFT*2.5+UP*2) 38 | coslab.move_to(RIGHT*2.5+UP*2) 39 | 40 | 41 | sin_graph=self.get_graph(self.sin,x_min=-14,x_max=14,set_color=BLUE) 42 | cos_graph=self.get_graph(self.cos,x_min=-14,x_max=14,stroke_color=RED) 43 | 44 | self.wait() 45 | 46 | self.play(Write(sinlab),Write(coslab)) 47 | 48 | self.play(ShowCreation(sin_graph),run_time=1.8) 49 | self.play(ShowCreation(cos_graph),run_time=1.8) 50 | 51 | self.wait(3) 52 | 53 | self.play( 54 | ApplyMethod(sin_graph.shift,RIGHT*16), 55 | ApplyMethod(cos_graph.shift,RIGHT*16), 56 | FadeOut(sinlab), 57 | FadeOut(coslab), 58 | run_time=2 59 | ) 60 | 61 | self.x_axis.set_opacity(1) 62 | self.y_axis.set_opacity(1) 63 | 64 | self.play( 65 | ShowCreation(self.x_axis),ShowCreation(self.y_axis), 66 | ) 67 | 68 | angle=math.radians(360) 69 | circle=Arc(radius=2,angle=angle) 70 | 71 | self.play(ShowCreation(circle)) 72 | 73 | arrow=Arrow(np.array([0,0,0]),np.array([2*np.sqrt(2)/2,2*np.sqrt(2)/2,0]),buff=0) 74 | 75 | arrow.set_color(BLUE) 76 | 77 | self.play(ShowCreation(arrow)) 78 | 79 | self.wait() 80 | 81 | self.play(Rotating(arrow,radians=PI/2,about_point=ORIGIN),rate=linear,run_time=1) 82 | 83 | self.wait() 84 | 85 | coor=TextMobject("$$(\cos(\\theta),\sin(\\theta))$$") 86 | coor.scale(0.8) 87 | 88 | coor.next_to(arrow,LEFT+UP) 89 | 90 | self.play(Write(coor),sun_time=0.7) 91 | 92 | self.wait(2) 93 | 94 | self.play( 95 | FadeOut(self.x_axis), 96 | FadeOut(self.y_axis), 97 | FadeOut(circle), 98 | FadeOut(arrow), 99 | FadeOut(coor) 100 | ) 101 | 102 | self.wait() 103 | 104 | tri=Polygon(np.array([0,0,0]),np.array([6,0,0]),np.array([6,4,0]),fill_color=BLUE,fill_opacity=0.5) 105 | tri.set_color(BLUE) 106 | 107 | dot_o=Dot() 108 | dot_rad=Dot() 109 | dot_rad.move_to(np.array([2*np.sqrt(13),0,0])) 110 | hypot=TextMobject("hypotenuse") 111 | dots=VGroup(dot_o,dot_rad) 112 | hyp_brac=Brace(dots,UP) 113 | hypot.next_to(hyp_brac,UP) 114 | 115 | total_hyp=VGroup(hypot,hyp_brac) 116 | 117 | total_hyp.rotate(angle=np.arctan(2/3),about_point=ORIGIN) 118 | 119 | degree=np.arctan(2/3) 120 | arc=Arc(radius=1,angle=degree) 121 | 122 | theta=TextMobject("$$\\theta$$") 123 | theta.next_to(arc,RIGHT) 124 | theta.shift(UP*0.15) 125 | 126 | g_tri=VGroup(tri,arc,theta,hyp_brac,hypot) 127 | g_tri.shift(DOWN*1.7+LEFT*3) 128 | 129 | tri.set_color(color=[YELLOW,BLUE]) 130 | 131 | self.play(ShowCreation(tri)) 132 | self.wait() 133 | self.play(ShowCreation(arc),Write(theta),run_time=0.3) 134 | 135 | self.wait(2) 136 | 137 | y=TextMobject("opposite") 138 | ybrac=Brace(tri,RIGHT) 139 | y.next_to(ybrac,RIGHT) 140 | x=TextMobject("adjacent") 141 | xbrac=Brace(tri,DOWN) 142 | x.next_to(xbrac,DOWN) 143 | 144 | self.play(ShowCreation(ybrac),Write(y)) 145 | self.wait() 146 | self.play(ShowCreation(xbrac),Write(x)) 147 | self.wait() 148 | self.play(ShowCreation(hyp_brac),Write(hypot)) 149 | 150 | self.wait(2) 151 | 152 | self.play( 153 | FadeOut(ybrac), 154 | FadeOut(xbrac), 155 | FadeOut(x), 156 | FadeOut(y), 157 | FadeOut(g_tri) 158 | ) 159 | 160 | self.wait() 161 | 162 | ninety=TextMobject("$$90^{\circ}\\rightarrow$$") 163 | ninety_t=TextMobject("$$\\frac{\pi}{2}$$") 164 | ninety_t.set_color(color=[BLUE,YELLOW]) 165 | ninety_t.next_to(ninety,RIGHT,0.2) 166 | 167 | nine_tot=VGroup(ninety,ninety_t) 168 | nine_tot.move_to(ORIGIN) 169 | 170 | one_e=TextMobject("$$180^{\circ}\\rightarrow$$") 171 | one_e_t=TextMobject("$$\pi$$") 172 | one_e_t.next_to(one_e,RIGHT,0.2) 173 | one_e_t.set_color(color=[BLUE,YELLOW]) 174 | 175 | one_tot=VGroup(one_e,one_e_t) 176 | one_tot.move_to(ORIGIN) 177 | 178 | nine_tot.scale(2) 179 | one_tot.scale(2) 180 | 181 | self.play(Write(nine_tot)) 182 | 183 | self.wait(2) 184 | 185 | self.play(Transform(nine_tot,one_tot)) 186 | 187 | self.wait(2) 188 | 189 | self.play(FadeOut(nine_tot)) 190 | 191 | thr_part=TextMobject("Understanding the Unit Circle",stroke_color=BLUE,set_color=BLUE,fill_color=BLUE,fill_opacity=0.7,stroke_width=1.5) 192 | part_1=TextMobject("part 1: understanding radians") 193 | 194 | thr_part.scale(1.6) 195 | 196 | self.play(Write(thr_part)) 197 | self.wait() 198 | self.play(ApplyMethod(thr_part.shift,2*UP)) 199 | self.play(Write(part_1)) 200 | self.play(ApplyMethod(part_1.scale,1.3)) 201 | self.wait(2) 202 | 203 | def sin(self,x): 204 | return 2*np.sin(x/2) 205 | 206 | def cos(self,x): 207 | return 2*np.cos(x/2) 208 | 209 | #python -m manim MITintegral\UnitCircle\unitcirclescenes.py RadiansSc -pl 210 | class RadiansSc(GraphScene): 211 | CONFIG = { 212 | "x_min" : -3, 213 | "x_max" : 3, 214 | "y_min" : -2, 215 | "y_max" : 2, 216 | "x_tick_frequency": 2, 217 | "y_tick_frequency": 2, 218 | "y_axis_height":8, 219 | "x_axis_width":12, 220 | "graph_origin" : ORIGIN, 221 | "function_color" : RED , 222 | "axes_color" : GREEN, 223 | "x_labeled_nums" :range(-2,3,1), 224 | "y_labeled_nums" :range(-1,2,1), 225 | "num_graph_anchor_points": 200, 226 | 227 | } 228 | def construct(self): 229 | angle=math.radians(360) 230 | circle=Arc(radius=2,angle=angle) 231 | 232 | arcangle=Arc(radius=0.7,angle=math.radians(45)) 233 | 234 | self.add(circle) 235 | 236 | self.wait() 237 | 238 | self.setup_axes(animate=True) 239 | 240 | self.bring_to_back(self.x_axis) 241 | self.bring_to_back(self.y_axis) 242 | 243 | self.wait() 244 | 245 | radius=Line(np.array([0,0,0]),self.coords_to_point(np.sqrt(2)/2,np.sqrt(2)/2)) 246 | radius.set_color(RED) 247 | 248 | radius_outside=Line(self.coords_to_point(1.5,0.5),self.coords_to_point(1.5,1.5)) 249 | radius_outside.set_color(RED) 250 | 251 | self.play(ShowCreation(radius)) 252 | 253 | self.wait(2) 254 | 255 | self.play(Transform(radius,radius_outside)) 256 | 257 | self.wait(2) 258 | 259 | len_one=Brace(radius_outside,RIGHT) 260 | len_one_lab=TextMobject("1") 261 | len_one_lab.next_to(len_one,RIGHT) 262 | 263 | self.play(ShowCreation(len_one),Write(len_one_lab)) 264 | 265 | self.wait(2) 266 | 267 | self.play(FadeOut(len_one),FadeOut(len_one_lab)) 268 | 269 | self.wait(2) 270 | 271 | ######################################## 272 | #First radian 273 | 274 | radius_arc=Arc(radius=2,angle=1) 275 | radius_arc.set_color(RED) 276 | 277 | self.play(Transform(radius,radius_arc)) 278 | 279 | self.wait(2) 280 | 281 | #Angle theta for one radian 282 | one_rad=Arc(radius=0.55,angle=1,stroke_opacity=0.7) 283 | one_rad_line=Line(ORIGIN,self.coords_to_point(np.cos(1),np.sin(1))) 284 | one_rad_line_dashed=DashedVMobject(one_rad_line) 285 | 286 | self.play(ShowCreation(one_rad_line_dashed),ShowCreation(one_rad)) 287 | 288 | theta=TextMobject("$$\\theta$$") 289 | 290 | theta.move_to(self.coords_to_point(0.4,0.2)) 291 | theta.scale(0.8) 292 | 293 | self.play(Write(theta)) 294 | 295 | #Theta label 1 296 | theta_is=TextMobject("$$\\theta=1$$") 297 | one_r=TextMobject("radian") 298 | one_r.next_to(theta_is,RIGHT,0.2) 299 | label1=VGroup(theta_is,one_r) 300 | 301 | label1.move_to(RIGHT*3.5+UP*2) 302 | self.play(Write(label1)) 303 | 304 | self.wait(2) 305 | 306 | self.play(FadeOut(theta),FadeOut(one_rad_line_dashed),FadeOut(one_rad),FadeOut(label1)) 307 | 308 | self.wait() 309 | 310 | ################################## 311 | #Second radian 312 | 313 | self.play(ShowCreation(radius_outside)) 314 | 315 | self.wait(2) 316 | 317 | two_radius_arc=Arc(start_angle=1,angle=1,radius=2) 318 | two_radius_arc.set_color(RED) 319 | 320 | self.play(Transform(radius_outside,two_radius_arc)) 321 | 322 | #Angle theta for two radian 323 | two_rad=Arc(radius=0.55,angle=2,stroke_opacity=0.7) 324 | two_rad_line=Line(ORIGIN,self.coords_to_point(np.cos(2),np.sin(2))) 325 | two_rad_line_dashed=DashedVMobject(two_rad_line) 326 | 327 | self.play(ShowCreation(two_rad_line_dashed),ShowCreation(two_rad)) 328 | 329 | theta.move_to(self.coords_to_point(0.22,0.34)) 330 | 331 | self.play(Write(theta)) 332 | 333 | #Theta label 1 334 | theta_is=TextMobject("$$\\theta=2$$") 335 | one_r=TextMobject("radians") 336 | one_r.next_to(theta_is,RIGHT,0.2) 337 | label1=VGroup(theta_is,one_r) 338 | 339 | label1.move_to(RIGHT*3.5+UP*2) 340 | self.play(Write(label1)) 341 | 342 | self.wait(2) 343 | 344 | self.play(FadeOut(theta),FadeOut(two_rad_line_dashed),FadeOut(two_rad),FadeOut(label1)) 345 | 346 | ################################## 347 | #Third radian 348 | 349 | radius_outside_left=Line(self.coords_to_point(-1.5,1.5),self.coords_to_point(-1.5,0.5)) 350 | radius_outside_left.set_color(RED) 351 | 352 | self.play(ShowCreation(radius_outside_left)) 353 | 354 | self.wait(2) 355 | 356 | three_radius_arc=Arc(start_angle=2,angle=1,radius=2) 357 | three_radius_arc.set_color(RED) 358 | 359 | self.play(Transform(radius_outside_left,three_radius_arc)) 360 | 361 | #Angle theta for two radian 362 | three_rad=Arc(radius=0.55,angle=3,stroke_opacity=0.7) 363 | three_rad_line=Line(ORIGIN,self.coords_to_point(np.cos(3),np.sin(3))) 364 | three_rad_line_dashed=DashedVMobject(three_rad_line) 365 | 366 | self.play(ShowCreation(three_rad_line_dashed),ShowCreation(three_rad)) 367 | 368 | theta.move_to(self.coords_to_point(-0.22,0.4)) 369 | 370 | self.play(Write(theta)) 371 | 372 | #Theta label 1 373 | theta_is=TextMobject("$$\\theta=3$$") 374 | one_r=TextMobject("radians") 375 | one_r.next_to(theta_is,RIGHT,0.2) 376 | label1=VGroup(theta_is,one_r) 377 | 378 | label1.move_to(RIGHT*3.5+UP*2) 379 | self.play(Write(label1)) 380 | 381 | self.wait(2) 382 | 383 | extra=Arc(start_angle=PI,angle=(3-PI),radius=2) 384 | extra.set_color(RED) 385 | extra.shift(LEFT*0.3) 386 | 387 | self.play(ShowCreation(extra)) 388 | self.wait() 389 | self.play(ApplyMethod(extra.shift,RIGHT*0.3)) 390 | self.wait() 391 | self.play(ApplyMethod(extra.shift,LEFT*0.3)) 392 | 393 | extra_line=Line(self.coords_to_point(-2,1),self.coords_to_point(-2,1.14159)) 394 | extra_line.set_color(RED) 395 | 396 | self.play(Transform(extra,extra_line)) 397 | 398 | self.wait(2) 399 | 400 | approx=TextMobject("$$\\approx 0.14159...$$") 401 | approx.next_to(extra_line,RIGHT,0.2) 402 | 403 | self.play(Write(approx)) 404 | 405 | self.wait(4) 406 | 407 | three_point=TextMobject("$$\\theta\\approx 3.14...$$") 408 | end_rad=TextMobject("radians") 409 | end_rad.next_to(three_point, RIGHT,0.2) 410 | 411 | post_add=VGroup(three_point,end_rad) 412 | post_add.move_to(theta_is.get_center()+RIGHT*1.3) 413 | 414 | pre_add=VGroup(approx,theta_is,one_r) 415 | 416 | self.remove(extra) 417 | self.add(extra_line) 418 | 419 | extra=Arc(start_angle=PI,angle=(3-PI),radius=2) 420 | extra.set_color(RED) 421 | 422 | fin=Line(ORIGIN,self.coords_to_point(-1,0)) 423 | fin_dashed=DashedVMobject(fin) 424 | 425 | one_eight_arc=Arc(radius=0.55,angle=PI,stroke_opacity=0.7) 426 | 427 | self.play( 428 | Transform(pre_add,post_add), 429 | Transform(extra_line,extra), 430 | Transform(three_rad_line_dashed,fin_dashed), 431 | Transform(three_rad,one_eight_arc) 432 | ) 433 | self.wait(2) 434 | 435 | pi_guy=TextMobject("$$\\theta=\pi$$") 436 | pi_guy.next_to(end_rad,LEFT,0.2) 437 | 438 | pi_tot=VGroup(pi_guy,end_rad) 439 | 440 | self.play(ReplacementTransform(pre_add,pi_tot)) 441 | 442 | self.wait() 443 | 444 | pi_lab=TextMobject("$$\pi$$") 445 | pi_lab.move_to(self.coords_to_point(-1.15,0.13)) 446 | self.play(ShowCreation(pi_lab)) 447 | 448 | self.wait(2) 449 | 450 | ####################################### 451 | #Define the other angles 452 | 453 | #Remake the arc and dashed line 454 | pi_arc=Arc(radius=0.55,angle=PI,stroke_opacity=0.7) 455 | our_line=Line(ORIGIN,self.coords_to_point(-1,0)) 456 | our_line_dashed=DashedVMobject(fin) 457 | 458 | #Replace old stuff with new ones 459 | self.remove(three_rad) 460 | self.remove(three_rad_line_dashed) 461 | self.add(pi_arc) 462 | self.add(our_line_dashed) 463 | 464 | #Define new red arc 465 | outter_arc=Arc(radius=2,angle=PI) 466 | outter_arc.set_color(RED) 467 | 468 | self.remove(radius_outside,radius_outside_left,radius,extra,extra_line) 469 | self.add(outter_arc) 470 | 471 | ################################################## 472 | #Move to pi over two 473 | 474 | pi_guy_new=TextMobject("$$\\theta=\\frac{1}{2}\pi$$") 475 | pi_guy_new.next_to(end_rad,LEFT,0.2) 476 | 477 | start_at=PI 478 | end_at=PI/2 479 | 480 | angle=ValueTracker(start_at) 481 | 482 | corr_term=0 483 | 484 | def arc_update(arc): 485 | new_arc=Arc(radius=0.55,angle=angle.get_value(),stroke_opacity=0.7) 486 | pi_arc.become(new_arc) 487 | 488 | def outter_arc_update(arc): 489 | new_o_arc=Arc(radius=2,angle=angle.get_value(),stroke_color=RED) 490 | outter_arc.become(new_o_arc) 491 | 492 | self.play( 493 | Rotating(our_line_dashed,radians=(end_at-start_at),about_point=ORIGIN), 494 | UpdateFromFunc(pi_arc,arc_update), 495 | UpdateFromFunc(outter_arc,outter_arc_update), 496 | ApplyMethod(theta.move_to,self.coords_to_point(0.35,0.15)), 497 | Transform(pi_guy,pi_guy_new), 498 | angle.set_value,(end_at-corr_term),rate_func=linear,run_time=1 499 | ) 500 | 501 | self.wait() 502 | 503 | ###### 504 | #FIX THIS 505 | pi_lab1=TextMobject("$$\\frac{\pi}{2}$$") 506 | pi_lab1.scale(0.75) 507 | pi_lab1.move_to(self.coords_to_point(0.15,1.26)) 508 | self.play(ShowCreation(pi_lab1)) 509 | 510 | self.wait(2) 511 | 512 | ################################################## 513 | #Move to pi over four 514 | 515 | pi_guy_new=TextMobject("$$\\theta=\\frac{1}{4}\pi$$") 516 | pi_guy_new.next_to(end_rad,LEFT,0.2) 517 | 518 | start_at=PI/2 519 | end_at=PI/4 520 | 521 | angle=ValueTracker(start_at) 522 | 523 | #corr_term=0 524 | 525 | def arc_update(arc): 526 | new_arc=Arc(radius=0.55,angle=angle.get_value(),stroke_opacity=0.7) 527 | pi_arc.become(new_arc) 528 | 529 | def outter_arc_update(arc): 530 | new_o_arc=Arc(radius=2,angle=angle.get_value(),stroke_color=RED) 531 | outter_arc.become(new_o_arc) 532 | 533 | self.play( 534 | Rotating(our_line_dashed,radians=(end_at-start_at),about_point=ORIGIN), 535 | UpdateFromFunc(pi_arc,arc_update), 536 | UpdateFromFunc(outter_arc,outter_arc_update), 537 | Transform(pi_guy,pi_guy_new), 538 | angle.set_value,end_at-corr_term,rate_func=linear,run_time=1 539 | ) 540 | 541 | self.wait() 542 | 543 | pi_lab2=TextMobject("$$\\frac{\pi}{4}$$") 544 | pi_lab2.scale(0.75) 545 | pi_lab2.move_to(self.coords_to_point(np.sqrt(2)/2+0.2,np.sqrt(2)/2+0.2)) 546 | self.play(ShowCreation(pi_lab2)) 547 | 548 | self.wait(2) 549 | 550 | ################################################## 551 | #Move to three pi over four 552 | 553 | pi_guy_new=TextMobject("$$\\theta=\\frac{3}{4}\pi$$") 554 | pi_guy_new.next_to(end_rad,LEFT,0.2) 555 | 556 | start_at=PI/4 557 | end_at=3*PI/4 558 | 559 | angle=ValueTracker(start_at) 560 | 561 | corr_term=0.05 562 | 563 | def arc_update(arc): 564 | new_arc=Arc(radius=0.55,angle=angle.get_value(),stroke_opacity=0.7) 565 | pi_arc.become(new_arc) 566 | 567 | def outter_arc_update(arc): 568 | new_o_arc=Arc(radius=2,angle=angle.get_value(),stroke_color=RED) 569 | outter_arc.become(new_o_arc) 570 | 571 | keeper_un=Line(ORIGIN,self.coords_to_point(np.sqrt(2)/2,np.sqrt(2)/2)) 572 | keeper1=DashedVMobject(keeper_un) 573 | self.add(keeper1) 574 | 575 | self.play( 576 | Rotating(our_line_dashed,radians=(end_at-start_at),about_point=ORIGIN), 577 | UpdateFromFunc(pi_arc,arc_update), 578 | UpdateFromFunc(outter_arc,outter_arc_update), 579 | Transform(pi_guy,pi_guy_new), 580 | angle.set_value,end_at+corr_term,rate_func=linear,run_time=1 581 | ) 582 | 583 | self.wait() 584 | 585 | pi_lab3=TextMobject("$$\\frac{3\pi}{4}$$") 586 | pi_lab3.scale(0.75) 587 | pi_lab3.move_to(self.coords_to_point(-np.sqrt(2)/2-0.2,np.sqrt(2)/2+0.2)) 588 | self.play(ShowCreation(pi_lab3)) 589 | 590 | self.wait(4) 591 | 592 | ################################################## 593 | #Move to pi 594 | 595 | pi_guy_new=TextMobject("$$\\theta=\\frac{4}{4}\pi$$") 596 | pi_guy_new.next_to(end_rad,LEFT,0.2) 597 | 598 | start_at=3*PI/4 599 | end_at=PI 600 | 601 | angle=ValueTracker(start_at) 602 | 603 | ################## 604 | #Redefine the correcting term 605 | corr_term=0.05 606 | 607 | def arc_update(arc): 608 | new_arc=Arc(radius=0.55,angle=angle.get_value(),stroke_opacity=0.7) 609 | pi_arc.become(new_arc) 610 | 611 | def outter_arc_update(arc): 612 | new_o_arc=Arc(radius=2,angle=angle.get_value(),stroke_color=RED) 613 | outter_arc.become(new_o_arc) 614 | 615 | keeper_un=Line(ORIGIN,self.coords_to_point(-np.sqrt(2)/2,np.sqrt(2)/2)) 616 | keeper2=DashedVMobject(keeper_un) 617 | self.add(keeper2) 618 | 619 | self.play( 620 | Rotating(our_line_dashed,radians=(end_at-start_at),about_point=ORIGIN), 621 | UpdateFromFunc(pi_arc,arc_update), 622 | UpdateFromFunc(outter_arc,outter_arc_update), 623 | Transform(pi_guy,pi_guy_new), 624 | angle.set_value,end_at+corr_term,rate_func=linear,run_time=1 625 | ) 626 | 627 | 628 | self.wait(2) 629 | 630 | ################################################## 631 | #Move to five pi over four 632 | 633 | pi_guy_new=TextMobject("$$\\theta=\\frac{5}{4}\pi$$") 634 | pi_guy_new.next_to(end_rad,LEFT,0.2) 635 | 636 | start_at=PI 637 | end_at=5*PI/4 638 | 639 | angle=ValueTracker(start_at) 640 | 641 | #corr_term=0.1 642 | 643 | def arc_update(arc): 644 | new_arc=Arc(radius=0.55,angle=angle.get_value(),stroke_opacity=0.7) 645 | pi_arc.become(new_arc) 646 | 647 | def outter_arc_update(arc): 648 | new_o_arc=Arc(radius=2,angle=angle.get_value(),stroke_color=RED) 649 | outter_arc.become(new_o_arc) 650 | 651 | #keeper_un=Line(ORIGIN,self.coords_to_point(np.sqrt(2)/2,np.sqrt(2)/2)) 652 | #keeper=DashedVMobject(keeper_un) 653 | #self.add(keeper) 654 | 655 | self.play( 656 | Rotating(our_line_dashed,radians=(end_at-start_at),about_point=ORIGIN), 657 | UpdateFromFunc(pi_arc,arc_update), 658 | UpdateFromFunc(outter_arc,outter_arc_update), 659 | Transform(pi_guy,pi_guy_new), 660 | angle.set_value,end_at+corr_term,rate_func=linear,run_time=1 661 | ) 662 | 663 | self.wait() 664 | 665 | pi_lab4=TextMobject("$$\\frac{5\pi}{4}$$") 666 | pi_lab4.scale(0.75) 667 | pi_lab4.move_to(self.coords_to_point(-np.sqrt(2)/2-0.2,-np.sqrt(2)/2-0.2)) 668 | self.play(ShowCreation(pi_lab4)) 669 | 670 | self.wait(2) 671 | 672 | ################################################## 673 | #Move to three pi over two 674 | 675 | pi_guy_new=TextMobject("$$\\theta=\\frac{6}{4}\pi$$") 676 | pi_guy_new.next_to(end_rad,LEFT,0.2) 677 | 678 | start_at=5*PI/4 679 | end_at=3*PI/2 680 | 681 | angle=ValueTracker(start_at) 682 | 683 | #corr_term=0.1 684 | 685 | def arc_update(arc): 686 | new_arc=Arc(radius=0.55,angle=angle.get_value(),stroke_opacity=0.7) 687 | pi_arc.become(new_arc) 688 | 689 | def outter_arc_update(arc): 690 | new_o_arc=Arc(radius=2,angle=angle.get_value(),stroke_color=RED) 691 | outter_arc.become(new_o_arc) 692 | 693 | keeper_un=Line(ORIGIN,self.coords_to_point(-np.sqrt(2)/2,-np.sqrt(2)/2)) 694 | keeper3=DashedVMobject(keeper_un) 695 | self.add(keeper3) 696 | 697 | self.play( 698 | Rotating(our_line_dashed,radians=(end_at-start_at),about_point=ORIGIN), 699 | UpdateFromFunc(pi_arc,arc_update), 700 | UpdateFromFunc(outter_arc,outter_arc_update), 701 | Transform(pi_guy,pi_guy_new), 702 | angle.set_value,end_at+corr_term,rate_func=linear,run_time=1 703 | ) 704 | 705 | self.wait() 706 | 707 | pi_lab5=TextMobject("$$\\frac{6\pi}{4}$$") 708 | pi_lab5.scale(0.75) 709 | pi_lab5.move_to(self.coords_to_point(0.15,-1.26)) 710 | self.play(ShowCreation(pi_lab5)) 711 | 712 | self.wait() 713 | 714 | pi_lab_corr5=TextMobject("$$\\frac{3\pi}{2}$$") 715 | pi_lab_corr5.scale(0.75) 716 | pi_lab_corr5.move_to(self.coords_to_point(0.15,-1.26)) 717 | self.play(Transform(pi_lab5,pi_lab_corr5)) 718 | 719 | self.wait(2) 720 | 721 | ################################################## 722 | #Move to seven pi over four 723 | 724 | pi_guy_new=TextMobject("$$\\theta=\\frac{7}{4}\pi$$") 725 | pi_guy_new.next_to(end_rad,LEFT,0.2) 726 | 727 | start_at=3*PI/2 728 | end_at=7*PI/4 729 | 730 | angle=ValueTracker(start_at) 731 | 732 | #corr_term=0.1 733 | 734 | def arc_update(arc): 735 | new_arc=Arc(radius=0.55,angle=angle.get_value(),stroke_opacity=0.7) 736 | pi_arc.become(new_arc) 737 | 738 | def outter_arc_update(arc): 739 | new_o_arc=Arc(radius=2,angle=angle.get_value(),stroke_color=RED) 740 | outter_arc.become(new_o_arc) 741 | 742 | #keeper_un=Line(ORIGIN,self.coords_to_point(np.sqrt(2)/2,np.sqrt(2)/2)) 743 | #keeper=DashedVMobject(keeper_un) 744 | #self.add(keeper) 745 | 746 | self.play( 747 | Rotating(our_line_dashed,radians=(end_at-start_at),about_point=ORIGIN), 748 | UpdateFromFunc(pi_arc,arc_update), 749 | UpdateFromFunc(outter_arc,outter_arc_update), 750 | Transform(pi_guy,pi_guy_new), 751 | angle.set_value,end_at+corr_term,rate_func=linear,run_time=1 752 | ) 753 | 754 | self.wait() 755 | 756 | pi_lab6=TextMobject("$$\\frac{7\pi}{4}$$") 757 | pi_lab6.scale(0.75) 758 | pi_lab6.move_to(self.coords_to_point(np.sqrt(2)/2+0.2,-np.sqrt(2)/2-0.2)) 759 | self.play(ShowCreation(pi_lab6)) 760 | 761 | self.wait(2) 762 | 763 | ################################################## 764 | #Move to two pi 765 | 766 | pi_guy_new=TextMobject("$$\\theta=\\frac{8}{4}\pi$$") 767 | pi_guy_new.next_to(end_rad,LEFT,0.2) 768 | 769 | start_at=7*PI/4 770 | end_at=2*PI 771 | 772 | angle=ValueTracker(start_at) 773 | 774 | #corr_term=0.1 775 | 776 | def arc_update(arc): 777 | new_arc=Arc(radius=0.55,angle=angle.get_value(),stroke_opacity=0.7) 778 | pi_arc.become(new_arc) 779 | 780 | def outter_arc_update(arc): 781 | new_o_arc=Arc(radius=2,angle=angle.get_value(),stroke_color=RED) 782 | outter_arc.become(new_o_arc) 783 | 784 | keeper_un=Line(ORIGIN,self.coords_to_point(np.sqrt(2)/2,-np.sqrt(2)/2)) 785 | keeper4=DashedVMobject(keeper_un) 786 | self.add(keeper4) 787 | 788 | self.play( 789 | Rotating(our_line_dashed,radians=(end_at-start_at),about_point=ORIGIN), 790 | UpdateFromFunc(pi_arc,arc_update), 791 | UpdateFromFunc(outter_arc,outter_arc_update), 792 | Transform(pi_guy,pi_guy_new), 793 | angle.set_value,end_at+corr_term,rate_func=linear,run_time=1 794 | ) 795 | 796 | self.wait() 797 | 798 | pi_lab7=TextMobject("$$\\frac{8\pi}{4}$$") 799 | pi_lab7.scale(0.75) 800 | pi_lab7.move_to(self.coords_to_point(1.22,0.2)) 801 | self.play(ShowCreation(pi_lab7)) 802 | 803 | self.wait() 804 | 805 | pi_lab_corr7=TextMobject("$$2\pi$$") 806 | pi_lab_corr7.move_to(self.coords_to_point(1.22,0.13)) 807 | self.play(Transform(pi_lab7,pi_lab_corr7)) 808 | 809 | self.wait() 810 | 811 | pi_lab_corr72=TextMobject("$$0$$") 812 | pi_lab_corr72.move_to(self.coords_to_point(1.1,0.13)) 813 | self.play(Transform(pi_lab7,pi_lab_corr72)) 814 | 815 | self.wait(2) 816 | 817 | quarter_labs=VGroup( 818 | pi_lab1, 819 | pi_lab2, 820 | pi_lab3, 821 | pi_lab4, 822 | pi_lab5, 823 | pi_lab6, 824 | ) 825 | 826 | quarter_keepers=VGroup( 827 | keeper1, 828 | keeper2, 829 | keeper3, 830 | keeper4 831 | ) 832 | 833 | self.play( 834 | FadeOut(quarter_labs), 835 | FadeOut(quarter_keepers), 836 | FadeOut(pi_arc), 837 | FadeOut(theta), 838 | FadeOut(our_line_dashed), 839 | FadeOut(pi_tot), 840 | FadeOut(outter_arc) 841 | ) 842 | 843 | self.wait(4) 844 | 845 | #python -m manim MITintegral\UnitCircle\unitcirclescenes.py RadiansSc2 -pl 846 | class RadiansSc2(GraphScene): 847 | CONFIG = { 848 | "x_min" : -3, 849 | "x_max" : 3, 850 | "y_min" : -2, 851 | "y_max" : 2, 852 | "x_tick_frequency": 2, 853 | "y_tick_frequency": 2, 854 | "y_axis_height":8, 855 | "x_axis_width":12, 856 | "graph_origin" : ORIGIN, 857 | "function_color" : RED , 858 | "axes_color" : GREEN, 859 | "x_labeled_nums" :range(-2,3,1), 860 | "y_labeled_nums" :range(-1,2,1), 861 | "num_graph_anchor_points": 200, 862 | 863 | } 864 | def construct(self): 865 | 866 | corr_term=0 867 | 868 | self.setup_axes(animate=False) 869 | circle=Arc(radius=2,angle=2*PI) 870 | self.add(circle) 871 | pi_lab=TextMobject("$$\pi$$") 872 | pi_lab.move_to(self.coords_to_point(-1.15,0.13)) 873 | zero=TextMobject("$$0$$") 874 | zero.move_to(self.coords_to_point(1.1,0.13)) 875 | self.add(pi_lab) 876 | self.add(zero) 877 | self.wait(3) 878 | 879 | upper_arc=Arc(radius=2,angle=PI) 880 | upper_arc.set_color(RED) 881 | 882 | self.play(ShowCreation(upper_arc)) 883 | 884 | third1=Arc(radius=2,angle=PI/3) 885 | third2=Arc(radius=2,start_angle=PI/3,angle=PI/3) 886 | third3=Arc(radius=2,start_angle=2*PI/3,angle=PI/3) 887 | 888 | top_thirds=VGroup(third1,third2,third3) 889 | top_thirds.set_color(RED) 890 | 891 | self.remove(upper_arc) 892 | self.add(top_thirds) 893 | 894 | #distance the thirds should move 895 | dist=0.5 896 | 897 | self.wait(2) 898 | 899 | sep1_un=Line(ORIGIN,self.coords_to_point(0.5,np.sqrt(3)/2)) 900 | sep1=DashedVMobject(sep1_un) 901 | sep2_un=Line(ORIGIN,self.coords_to_point(-0.5,np.sqrt(3)/2)) 902 | sep2=DashedVMobject(sep2_un) 903 | 904 | self.play( 905 | ShowCreation(sep1), 906 | ShowCreation(sep2) 907 | ) 908 | 909 | self.wait() 910 | 911 | self.play( 912 | ApplyMethod(third1.shift,(RIGHT+UP)*dist), 913 | ApplyMethod(third2.shift,UP*np.sqrt(2*np.power(dist,2))), 914 | ApplyMethod(third3.shift,(LEFT+UP)*dist), 915 | ) 916 | self.wait(2) 917 | self.play( 918 | ApplyMethod(third1.shift,(LEFT+DOWN)*dist), 919 | ApplyMethod(third2.shift,DOWN*np.sqrt(2*np.power(dist,2))), 920 | ApplyMethod(third3.shift,(RIGHT+DOWN)*dist), 921 | ) 922 | self.wait(4) 923 | 924 | angle=ValueTracker(0) 925 | 926 | def arc_update(arc): 927 | new_arc=Arc(radius=0.55,angle=angle.get_value(),stroke_opacity=0.7) 928 | pi_arc.become(new_arc) 929 | 930 | def upper_arc_update(arc): 931 | new_o_arc=Arc(radius=2,angle=angle.get_value(),stroke_color=RED) 932 | upper_arc.become(new_o_arc) 933 | 934 | pi_arc=Arc(radius=0.55,angle=angle.get_value(),stroke_opacity=0.7) 935 | 936 | self.add(pi_arc) 937 | 938 | theta=TextMobject("$$\\theta$$") 939 | theta.scale(0.8) 940 | theta.move_to(self.coords_to_point(0.35,0.15)) 941 | 942 | #Pi over 3 943 | self.play( 944 | UpdateFromFunc(pi_arc,arc_update), 945 | ShowCreation(theta), 946 | angle.set_value,PI/3,rate_func=linear,run_time=1 947 | ) 948 | 949 | self.wait() 950 | 951 | pi_th=TextMobject("$$\\frac{\pi}{3}$$") 952 | pi_th.scale(0.75) 953 | pi_th.move_to(self.coords_to_point(0.7,(np.sqrt(3)/2)+0.2)) 954 | 955 | upper_lab=TextMobject("$$\\theta=$$") 956 | upper_lab.move_to(RIGHT*3.2+UP*2) 957 | pi_th_l=TextMobject("$$\\frac{\pi}{3}$$") 958 | radians=TextMobject("radians") 959 | 960 | pi_th_l.next_to(upper_lab,RIGHT,0.2) 961 | radians.next_to(pi_th_l,RIGHT,0.2) 962 | lab_group=VGroup(upper_lab,pi_th_l,radians) 963 | 964 | self.play(ShowCreation(pi_th),ShowCreation(lab_group)) 965 | 966 | self.wait(2) 967 | 968 | #2Pi over 3 969 | 970 | tpi_th=TextMobject("$$\\frac{2\pi}{3}$$") 971 | tpi_th.scale(0.75) 972 | tpi_th.move_to(self.coords_to_point(-0.7,(np.sqrt(3)/2)+0.2)) 973 | 974 | tpi_th_l=TextMobject("$$\\frac{2\pi}{3}$$") 975 | tpi_th_l.next_to(upper_lab,RIGHT,0.2) 976 | 977 | self.play( 978 | UpdateFromFunc(pi_arc,arc_update), 979 | 980 | ShowCreation(tpi_th), 981 | Transform(pi_th_l,tpi_th_l), 982 | ApplyMethod(radians.next_to,tpi_th_l,RIGHT,0.2), 983 | 984 | angle.set_value,2*PI/3,rate_func=linear,run_time=1 985 | ) 986 | 987 | self.wait(2) 988 | 989 | #3Pi over 3 990 | 991 | thpi_th_l=TextMobject("$$\\frac{3\pi}{3}$$") 992 | thpi_th_l.next_to(upper_lab,RIGHT,0.2) 993 | 994 | dashed_un=Line(ORIGIN,self.coords_to_point(-1,0)) 995 | dashed=DashedVMobject(dashed_un) 996 | 997 | self.play( 998 | UpdateFromFunc(pi_arc,arc_update), 999 | Transform(pi_th_l,thpi_th_l), 1000 | ApplyMethod(radians.next_to,thpi_th_l,RIGHT,0.2), 1001 | angle.set_value,PI,rate_func=linear,run_time=1 1002 | ) 1003 | self.play(ShowCreation(dashed)) 1004 | self.wait(2) 1005 | 1006 | #################################### 1007 | #Rest of the angles 1008 | 1009 | corr_term=0.05 1010 | 1011 | #Four############################################ 1012 | self.remove(third1,third2,third3) 1013 | self.add(upper_arc) 1014 | 1015 | fpi_th_l=TextMobject("$$\\frac{4\pi}{3}$$") 1016 | fpi_th_l.next_to(upper_lab,RIGHT,0.2) 1017 | 1018 | self.play( 1019 | UpdateFromFunc(upper_arc,upper_arc_update), 1020 | UpdateFromFunc(pi_arc,arc_update), 1021 | Transform(pi_th_l,fpi_th_l), 1022 | ApplyMethod(radians.next_to,fpi_th_l,RIGHT,0.2), 1023 | Rotating(dashed,about_point=ORIGIN,radians=PI/3), 1024 | angle.set_value,4*PI/3+corr_term,rate_func=linear,run_time=1 1025 | ) 1026 | 1027 | label1=TextMobject("$$\\frac{4\pi}{3}$$") 1028 | label1.scale(0.8) 1029 | label1.move_to(self.coords_to_point(-0.7,-(np.sqrt(3)/2)-0.2)) 1030 | 1031 | self.wait() 1032 | 1033 | self.play(ShowCreation(label1)) 1034 | 1035 | self.wait(3) 1036 | 1037 | #Five############################################ 1038 | 1039 | fipi_th_l=TextMobject("$$\\frac{5\pi}{3}$$") 1040 | fipi_th_l.next_to(upper_lab,RIGHT,0.2) 1041 | 1042 | keeper_un=Line(ORIGIN,self.coords_to_point(-0.5,-np.sqrt(3)/2)) 1043 | keeper=DashedVMobject(keeper_un) 1044 | 1045 | self.add(keeper) 1046 | 1047 | self.play( 1048 | UpdateFromFunc(upper_arc,upper_arc_update), 1049 | UpdateFromFunc(pi_arc,arc_update), 1050 | Transform(pi_th_l,fipi_th_l), 1051 | ApplyMethod(radians.next_to,fipi_th_l,RIGHT,0.2), 1052 | Rotating(dashed,about_point=ORIGIN,radians=PI/3), 1053 | angle.set_value,5*PI/3+corr_term,rate_func=linear,run_time=1 1054 | ) 1055 | 1056 | label2=TextMobject("$$\\frac{5\pi}{3}$$") 1057 | label2.scale(0.8) 1058 | label2.move_to(self.coords_to_point(0.7,-(np.sqrt(3)/2)-0.2)) 1059 | 1060 | self.wait() 1061 | 1062 | self.play(ShowCreation(label2)) 1063 | 1064 | self.wait(3) 1065 | 1066 | #DONE########################### 1067 | 1068 | spi_th_l=TextMobject("$$2\pi$$") 1069 | spi_th_l.next_to(upper_lab,RIGHT,0.2) 1070 | 1071 | keeper_un=Line(ORIGIN,self.coords_to_point(0.5,-np.sqrt(3)/2)) 1072 | keeper1=DashedVMobject(keeper_un) 1073 | 1074 | self.add(keeper1) 1075 | 1076 | self.play( 1077 | UpdateFromFunc(upper_arc,upper_arc_update), 1078 | UpdateFromFunc(pi_arc,arc_update), 1079 | Transform(pi_th_l,spi_th_l), 1080 | ApplyMethod(radians.next_to,spi_th_l,RIGHT,0.2), 1081 | Rotating(dashed,about_point=ORIGIN,radians=PI/3), 1082 | angle.set_value,2*PI+corr_term,rate_func=linear,run_time=1 1083 | ) 1084 | 1085 | self.wait(4) 1086 | 1087 | self.remove(tpi_th_l) 1088 | 1089 | self.play( 1090 | FadeOut(upper_arc), 1091 | FadeOut(keeper), 1092 | FadeOut(keeper1), 1093 | FadeOut(pi_th_l), 1094 | FadeOut(label1), 1095 | FadeOut(label2), 1096 | FadeOut(lab_group), 1097 | FadeOut(sep1), 1098 | FadeOut(sep2), 1099 | FadeOut(dashed), 1100 | FadeOut(theta), 1101 | FadeOut(pi_th), 1102 | FadeOut(tpi_th), 1103 | FadeOut(pi_arc), 1104 | FadeOut(radians), 1105 | FadeOut(upper_lab) 1106 | ) 1107 | 1108 | self.wait(4) 1109 | 1110 | #python -m manim MITintegral\UnitCircle\unitcirclescenes.py RadiansScSix -pl 1111 | class RadiansScSix(GraphScene): 1112 | CONFIG = { 1113 | "x_min" : -3, 1114 | "x_max" : 3, 1115 | "y_min" : -2, 1116 | "y_max" : 2, 1117 | "x_tick_frequency": 2, 1118 | "y_tick_frequency": 2, 1119 | "y_axis_height":8, 1120 | "x_axis_width":12, 1121 | "graph_origin" : ORIGIN, 1122 | "function_color" : RED , 1123 | "axes_color" : GREEN, 1124 | "x_labeled_nums" :range(-2,3,1), 1125 | "y_labeled_nums" :range(-1,2,1), 1126 | "num_graph_anchor_points": 200, 1127 | 1128 | } 1129 | def construct(self): 1130 | 1131 | upper_lab=TextMobject("$$\\theta=$$") 1132 | upper_lab.move_to(RIGHT*3.2+UP*2) 1133 | labt_1=TextMobject("$$\\frac{\pi}{6}$$") 1134 | labt_1.next_to(upper_lab,RIGHT,0.2) 1135 | radians=TextMobject("radians") 1136 | radians.next_to(labt_1,RIGHT,0.2) 1137 | 1138 | corr_term=0 1139 | 1140 | theta=TextMobject("$$\\theta$$") 1141 | theta.scale(0.8) 1142 | 1143 | self.setup_axes(animate=False) 1144 | circle=Arc(radius=2,angle=2*PI) 1145 | self.add(circle) 1146 | pi_lab=TextMobject("$$\pi$$") 1147 | pi_lab.move_to(self.coords_to_point(-1.15,0.13)) 1148 | zero=TextMobject("$$0$$") 1149 | zero.move_to(self.coords_to_point(1.1,0.13)) 1150 | self.add(pi_lab) 1151 | self.add(zero) 1152 | self.wait(3) 1153 | 1154 | #Sixth arcs 1155 | upper_half=Arc(radius=2,angle=PI,stroke_color=RED) 1156 | self.play(ShowCreation(upper_half)) 1157 | 1158 | six1=Arc(radius=2,angle=PI/6,stroke_color=RED) 1159 | six2=Arc(radius=2,start_angle=PI/6,angle=PI/6,stroke_color=RED) 1160 | six3=Arc(radius=2,start_angle=2*PI/6,angle=PI/6,stroke_color=RED) 1161 | six4=Arc(radius=2,start_angle=3*PI/6,angle=PI/6,stroke_color=RED) 1162 | six5=Arc(radius=2,start_angle=4*PI/6,angle=PI/6,stroke_color=RED) 1163 | six6=Arc(radius=2,start_angle=5*PI/6,angle=PI/6,stroke_color=RED) 1164 | 1165 | sixths=VGroup( 1166 | six1, 1167 | six2, 1168 | six3, 1169 | six4, 1170 | six5, 1171 | six6 1172 | ) 1173 | 1174 | self.remove(upper_half) 1175 | self.add(sixths) 1176 | 1177 | #Sixths dividers 1178 | div_un=Line(ORIGIN,self.coords_to_point(np.sqrt(3)/2,0.5)) 1179 | div1=DashedVMobject(div_un) 1180 | div_un=Line(ORIGIN,self.coords_to_point(0.5,np.sqrt(3)/2)) 1181 | div2=DashedVMobject(div_un) 1182 | div_un=Line(ORIGIN,self.coords_to_point(-0.5,np.sqrt(3)/2)) 1183 | div4=DashedVMobject(div_un) 1184 | div_un=Line(ORIGIN,self.coords_to_point(-np.sqrt(3)/2,0.5)) 1185 | div3=DashedVMobject(div_un) 1186 | 1187 | dividers=VGroup(div1,div2,div4,div3) 1188 | 1189 | self.wait(2) 1190 | 1191 | self.play(ShowCreation(dividers)) 1192 | 1193 | self.wait() 1194 | 1195 | #Move sixths 1196 | dist=0.5 1197 | 1198 | self.play( 1199 | ApplyMethod(six1.shift,dist*np.array([np.cos(PI/12),np.sin(PI/12),0])), 1200 | ApplyMethod(six2.shift,dist*np.array([np.cos(PI/12+PI/6),np.sin(PI/12+PI/6),0])), 1201 | ApplyMethod(six3.shift,dist*np.array([np.cos(PI/12+2*PI/6),np.sin(PI/12+2*PI/6),0])), 1202 | ApplyMethod(six4.shift,dist*np.array([np.cos(PI/12+3*PI/6),np.sin(PI/12+3*PI/6),0])), 1203 | ApplyMethod(six5.shift,dist*np.array([np.cos(PI/12+4*PI/6),np.sin(PI/12+4*PI/6),0])), 1204 | ApplyMethod(six6.shift,dist*np.array([np.cos(PI/12+5*PI/6),np.sin(PI/12+5*PI/6),0])), 1205 | ) 1206 | 1207 | self.wait(2) 1208 | 1209 | self.play( 1210 | ApplyMethod(six1.shift,-dist*np.array([np.cos(PI/12),np.sin(PI/12),0])), 1211 | ApplyMethod(six2.shift,-dist*np.array([np.cos(PI/12+PI/6),np.sin(PI/12+PI/6),0])), 1212 | ApplyMethod(six3.shift,-dist*np.array([np.cos(PI/12+2*PI/6),np.sin(PI/12+2*PI/6),0])), 1213 | ApplyMethod(six4.shift,-dist*np.array([np.cos(PI/12+3*PI/6),np.sin(PI/12+3*PI/6),0])), 1214 | ApplyMethod(six5.shift,-dist*np.array([np.cos(PI/12+4*PI/6),np.sin(PI/12+4*PI/6),0])), 1215 | ApplyMethod(six6.shift,-dist*np.array([np.cos(PI/12+5*PI/6),np.sin(PI/12+5*PI/6),0])), 1216 | ) 1217 | 1218 | self.wait(2) 1219 | 1220 | angle=ValueTracker(0) 1221 | 1222 | theta_arc=Arc(radius=0.55,angle=angle.get_value(),stroke_opacity=0.7) 1223 | 1224 | self.add() 1225 | 1226 | theta.move_to(self.coords_to_point(0.35,0.09)) 1227 | 1228 | def theta_update(arc): 1229 | new_theta=Arc(radius=0.55,angle=angle.get_value(),stroke_opacity=0.7) 1230 | theta_arc.become(new_theta) 1231 | 1232 | self.play( 1233 | UpdateFromFunc(theta_arc,theta_update), 1234 | Write(theta), 1235 | angle.set_value,PI/6,rate_func=linear,run_time=1 1236 | ) 1237 | 1238 | self.wait() 1239 | 1240 | self.play(ShowCreation(upper_lab),ShowCreation(labt_1),ShowCreation(radians)) 1241 | 1242 | self.wait() 1243 | 1244 | lab1=TextMobject("$$\\frac{\pi}{6}$$") 1245 | lab1.scale(0.75) 1246 | lab1.move_to(self.coords_to_point(np.sqrt(3)/2+0.2,0.54)) 1247 | self.play(Write(lab1)) 1248 | 1249 | self.wait(2) 1250 | 1251 | ############################################# 1252 | #Move theta to pi over 3 1253 | to_angle=2*PI/6 1254 | 1255 | #Label at the top 1256 | labt_2=TextMobject("$$\\frac{2\pi}{6}$$") 1257 | labt_2.move_to(labt_1.get_center()) 1258 | 1259 | #Label on the circle 1260 | lab2_a=TextMobject("$$\\frac{2\pi}{6}$$") 1261 | lab2_a.move_to(self.coords_to_point(0.5+0.1,0.2+np.sqrt(3)/2)) 1262 | lab2_a.scale(0.75) 1263 | lab2=TextMobject("$$\\frac{\pi}{3}$$") 1264 | lab2.move_to(lab2_a.get_center()) 1265 | lab2.scale(0.75) 1266 | 1267 | self.play( 1268 | UpdateFromFunc(theta_arc,theta_update), 1269 | Transform(labt_1,labt_2), 1270 | ApplyMethod(radians.next_to,labt_2,RIGHT,0.2), 1271 | angle.set_value,to_angle,rate_func=linear,run_time=1 1272 | ) 1273 | 1274 | self.play(Write(lab2_a)) 1275 | self.wait() 1276 | self.play(Transform(lab2_a,lab2)) 1277 | 1278 | self.wait(2) 1279 | 1280 | ############################################# 1281 | #Move theta to pi over 2 1282 | to_angle=PI/2 1283 | 1284 | #Label at the top 1285 | labt_3=TextMobject("$$\\frac{3\pi}{6}$$") 1286 | labt_3.move_to(labt_1.get_center()) 1287 | 1288 | #Label on the circle 1289 | lab3_a=TextMobject("$$\\frac{3\pi}{6}$$") 1290 | lab3_a.move_to(self.coords_to_point(0.15,1.26)) 1291 | lab3_a.scale(0.75) 1292 | lab3=TextMobject("$$\\frac{\pi}{2}$$") 1293 | lab3.move_to(lab3_a.get_center()) 1294 | lab3.scale(0.75) 1295 | 1296 | self.play( 1297 | UpdateFromFunc(theta_arc,theta_update), 1298 | Transform(labt_1,labt_3), 1299 | ApplyMethod(radians.next_to,labt_3,RIGHT,0.2), 1300 | angle.set_value,to_angle,rate_func=linear,run_time=1 1301 | ) 1302 | 1303 | self.play(Write(lab3_a)) 1304 | self.wait() 1305 | self.play(Transform(lab3_a,lab3)) 1306 | 1307 | self.wait(2) 1308 | 1309 | ############################################# 1310 | #Move theta to 2 pi over 3 1311 | to_angle=2*PI/3 1312 | 1313 | #Label at the top 1314 | labt_4=TextMobject("$$\\frac{4\pi}{6}$$") 1315 | labt_4.move_to(labt_1.get_center()) 1316 | 1317 | #Label on the circle 1318 | lab4_a=TextMobject("$$\\frac{4\pi}{6}$$") 1319 | lab4_a.move_to(self.coords_to_point(-0.5-0.1,0.2+np.sqrt(3)/2)) 1320 | lab4_a.scale(0.75) 1321 | lab4=TextMobject("$$\\frac{2\pi}{3}$$") 1322 | lab4.move_to(lab4_a.get_center()) 1323 | lab4.scale(0.75) 1324 | 1325 | self.play( 1326 | UpdateFromFunc(theta_arc,theta_update), 1327 | Transform(labt_1,labt_4), 1328 | ApplyMethod(radians.next_to,labt_4,RIGHT,0.2), 1329 | angle.set_value,to_angle,rate_func=linear,run_time=1 1330 | ) 1331 | 1332 | self.play(Write(lab4_a)) 1333 | self.wait() 1334 | self.play(Transform(lab4_a,lab4)) 1335 | 1336 | self.wait(2) 1337 | 1338 | ############################################# 1339 | #Move theta to 5 pi over 6 1340 | to_angle=5*PI/6 1341 | 1342 | #Label at the top 1343 | labt_5=TextMobject("$$\\frac{5\pi}{6}$$") 1344 | labt_5.move_to(labt_1.get_center()) 1345 | 1346 | #Label on the circle 1347 | lab5_a=TextMobject("$$\\frac{5\pi}{6}$$") 1348 | lab5_a.move_to(self.coords_to_point(-np.sqrt(3)/2-0.2,0.54)) 1349 | lab5_a.scale(0.75) 1350 | lab5=TextMobject("$$\\frac{2\pi}{3}$$") 1351 | lab5.move_to(lab5_a.get_center()) 1352 | lab5.scale(0.75) 1353 | 1354 | self.play( 1355 | UpdateFromFunc(theta_arc,theta_update), 1356 | Transform(labt_1,labt_5), 1357 | ApplyMethod(radians.next_to,labt_5,RIGHT,0.2), 1358 | angle.set_value,to_angle,rate_func=linear,run_time=1 1359 | ) 1360 | 1361 | self.play(Write(lab5_a)) 1362 | 1363 | self.wait(2) 1364 | 1365 | ############################################# 1366 | #Move theta to 2 pi over 3 1367 | to_angle=PI 1368 | 1369 | #Label at the top 1370 | labt_6=TextMobject("$$\\frac{6\pi}{6}$$") 1371 | labt_6.move_to(labt_1.get_center()) 1372 | 1373 | #Label on the circle 1374 | #lab4_a=TextMobject("$$\\frac{4\pi}{6}$$") 1375 | #lab4_a.move_to(self.coords_to_point(-0.5-0.1,0.2+np.sqrt(3)/2)) 1376 | #lab4_a.scale(0.75) 1377 | #lab4=TextMobject("$$\\frac{2\pi}{3}$$") 1378 | #lab4.move_to(lab4_a.get_center()) 1379 | #lab4.scale(0.75) 1380 | 1381 | self.play( 1382 | UpdateFromFunc(theta_arc,theta_update), 1383 | Transform(labt_1,labt_6), 1384 | ApplyMethod(radians.next_to,labt_5,RIGHT,0.2), 1385 | angle.set_value,to_angle,rate_func=linear,run_time=1 1386 | ) 1387 | 1388 | #self.play(Write(lab4_a)) 1389 | #self.wait() 1390 | #self.play(Transform(lab4_a,lab4)) 1391 | 1392 | self.wait(2) 1393 | 1394 | ############################## 1395 | #Add in red arc 1396 | lower_half=Arc(radius=2,start_angle=0,angle=angle.get_value(),stroke_color=RED) 1397 | self.add(lower_half) 1398 | 1399 | def low_update(arc): 1400 | new_low_arc=Arc(radius=2,start_angle=0,angle=angle.get_value(),stroke_color=RED) 1401 | lower_half.become(new_low_arc) 1402 | 1403 | line_un=Line(ORIGIN,self.coords_to_point(-1,0)) 1404 | line=DashedVMobject(line_un) 1405 | self.play(ShowCreation(line)) 1406 | ############################## 1407 | corr_term=0.05 1408 | #Move theta to 7 pi over 6 1409 | to_angle=7*PI/6 1410 | 1411 | #Label at the top 1412 | labt_7=TextMobject("$$\\frac{7\pi}{6}$$") 1413 | labt_7.move_to(labt_1.get_center()) 1414 | 1415 | #Label on the circle 1416 | lab7_a=TextMobject("$$\\frac{7\pi}{6}$$") 1417 | lab7_a.move_to(self.coords_to_point(-np.sqrt(3)/2-0.2,-0.54)) 1418 | lab7_a.scale(0.75) 1419 | #lab7=TextMobject("$$\\frac{2\pi}{3}$$") 1420 | #lab7.move_to(lab4_a.get_center()) 1421 | #lab7.scale(0.75) 1422 | 1423 | self.play( 1424 | #Move theta bit 1425 | UpdateFromFunc(theta_arc,theta_update), 1426 | Transform(labt_1,labt_7), 1427 | ApplyMethod(radians.next_to,labt_7,RIGHT,0.2), 1428 | 1429 | #Move red bit and line 1430 | UpdateFromFunc(lower_half,low_update), 1431 | Rotating(line,about_point=ORIGIN,radians=PI/6), 1432 | 1433 | angle.set_value,to_angle+corr_term,rate_func=linear,run_time=1 1434 | ) 1435 | 1436 | self.play(Write(lab7_a)) 1437 | 1438 | self.wait(2) 1439 | 1440 | ########################################## 1441 | #Move theta to 4 pi over 3 1442 | to_angle=8*PI/6 1443 | 1444 | #Label at the top 1445 | labt_8=TextMobject("$$\\frac{8\pi}{6}$$") 1446 | labt_8.move_to(labt_1.get_center()) 1447 | 1448 | #Label on the circle 1449 | lab8_a=TextMobject("$$\\frac{8\pi}{6}$$") 1450 | lab8_a.move_to(self.coords_to_point(-0.5-0.1,-0.25-np.sqrt(3)/2)) 1451 | lab8_a.scale(0.75) 1452 | lab8=TextMobject("$$\\frac{4\pi}{3}$$") 1453 | lab8.move_to(lab8_a.get_center()) 1454 | lab8.scale(0.75) 1455 | 1456 | #Keeper 1457 | keeper_un=Line(ORIGIN,self.coords_to_point(-np.sqrt(3)/2,-0.5)) 1458 | keeper1=DashedVMobject(keeper_un) 1459 | self.add(keeper1) 1460 | 1461 | self.play( 1462 | #Move theta bit 1463 | UpdateFromFunc(theta_arc,theta_update), 1464 | Transform(labt_1,labt_8), 1465 | ApplyMethod(radians.next_to,labt_8,RIGHT,0.2), 1466 | 1467 | #Move red bit and line 1468 | UpdateFromFunc(lower_half,low_update), 1469 | Rotating(line,about_point=ORIGIN,radians=PI/6), 1470 | 1471 | angle.set_value,to_angle+corr_term,rate_func=linear,run_time=1 1472 | ) 1473 | 1474 | self.play(Write(lab8_a)) 1475 | 1476 | self.wait() 1477 | 1478 | self.play(Transform(lab8_a,lab8)) 1479 | 1480 | self.wait(2) 1481 | 1482 | ########################################## 1483 | #Move theta to 3 pi over 2 1484 | to_angle=3*PI/2 1485 | 1486 | #Label at the top 1487 | labt_9=TextMobject("$$\\frac{9\pi}{6}$$") 1488 | labt_9.move_to(labt_1.get_center()) 1489 | 1490 | #Label on the circle 1491 | lab9_a=TextMobject("$$\\frac{9\pi}{6}$$") 1492 | lab9_a.move_to(self.coords_to_point(0.15,-1.26)) 1493 | lab9_a.scale(0.75) 1494 | lab9=TextMobject("$$\\frac{3\pi}{2}$$") 1495 | lab9.move_to(lab9_a.get_center()) 1496 | lab9.scale(0.75) 1497 | 1498 | #Keeper 1499 | keeper_un=Line(ORIGIN,self.coords_to_point(-0.5,-np.sqrt(3)/2)) 1500 | keeper2=DashedVMobject(keeper_un) 1501 | self.add(keeper2) 1502 | 1503 | self.play( 1504 | #Move theta bit 1505 | UpdateFromFunc(theta_arc,theta_update), 1506 | Transform(labt_1,labt_9), 1507 | ApplyMethod(radians.next_to,labt_9,RIGHT,0.2), 1508 | 1509 | #Move red bit and line 1510 | UpdateFromFunc(lower_half,low_update), 1511 | Rotating(line,about_point=ORIGIN,radians=PI/6), 1512 | 1513 | angle.set_value,to_angle+corr_term,rate_func=linear,run_time=1 1514 | ) 1515 | 1516 | self.play(Write(lab9_a)) 1517 | 1518 | self.wait() 1519 | 1520 | self.play(Transform(lab9_a,lab9)) 1521 | 1522 | self.wait(2) 1523 | 1524 | ########################################## 1525 | #Move theta to 5 pi over 3 1526 | to_angle=5*PI/3 1527 | 1528 | #Label at the top 1529 | labt_10=TextMobject("$$\\frac{10\pi}{6}$$") 1530 | labt_10.move_to(labt_1.get_center()) 1531 | 1532 | #Label on the circle 1533 | lab10_a=TextMobject("$$\\frac{10\pi}{6}$$") 1534 | lab10_a.move_to(self.coords_to_point(+0.5+0.1,-0.25-np.sqrt(3)/2)) 1535 | lab10_a.scale(0.75) 1536 | lab10=TextMobject("$$\\frac{5\pi}{3}$$") 1537 | lab10.move_to(lab10_a.get_center()) 1538 | lab10.scale(0.75) 1539 | 1540 | #Keeper 1541 | #keeper_un=Line(ORIGIN,self.coords_to_point(-0.5,-np.sqrt(3)/2)) 1542 | #keeper2=DashedVMobject(keeper_un) 1543 | #self.add(keeper2) 1544 | 1545 | self.play( 1546 | #Move theta bit 1547 | UpdateFromFunc(theta_arc,theta_update), 1548 | Transform(labt_1,labt_10), 1549 | ApplyMethod(radians.next_to,labt_10,RIGHT,0.2), 1550 | 1551 | #Make theta move appropriately 1552 | ApplyMethod(upper_lab.next_to,labt_10,LEFT,0.2), 1553 | 1554 | #Move red bit and line 1555 | UpdateFromFunc(lower_half,low_update), 1556 | Rotating(line,about_point=ORIGIN,radians=PI/6), 1557 | 1558 | angle.set_value,to_angle+corr_term,rate_func=linear,run_time=1 1559 | ) 1560 | 1561 | self.play(Write(lab10_a)) 1562 | 1563 | self.wait() 1564 | 1565 | self.play(Transform(lab10_a,lab10)) 1566 | 1567 | self.wait(2) 1568 | 1569 | ########################################## 1570 | #Move theta to 11 pi over 6 1571 | to_angle=11*PI/6 1572 | 1573 | #Label at the top 1574 | labt_11=TextMobject("$$\\frac{11\pi}{6}$$") 1575 | labt_11.move_to(labt_1.get_center()) 1576 | 1577 | #Label on the circle 1578 | lab11_a=TextMobject("$$\\frac{11\pi}{6}$$") 1579 | lab11_a.move_to(self.coords_to_point(0.2+np.sqrt(3)/2,-0.6)) 1580 | lab11_a.scale(0.75) 1581 | #lab11=TextMobject("$$\\frac{5\pi}{3}$$") 1582 | #lab11.move_to(lab10_a.get_center()) 1583 | #lab11.scale(0.75) 1584 | 1585 | #Keeper 1586 | keeper_un=Line(ORIGIN,self.coords_to_point(0.5,-np.sqrt(3)/2)) 1587 | keeper3=DashedVMobject(keeper_un) 1588 | self.add(keeper3) 1589 | 1590 | self.play( 1591 | #Move theta bit 1592 | UpdateFromFunc(theta_arc,theta_update), 1593 | Transform(labt_1,labt_11), 1594 | ApplyMethod(radians.next_to,labt_11,RIGHT,0.2), 1595 | 1596 | #Move red bit and line 1597 | UpdateFromFunc(lower_half,low_update), 1598 | Rotating(line,about_point=ORIGIN,radians=PI/6), 1599 | 1600 | angle.set_value,to_angle+corr_term,rate_func=linear,run_time=1 1601 | ) 1602 | 1603 | self.play(Write(lab11_a)) 1604 | 1605 | #self.wait() 1606 | 1607 | #self.play(Transform(lab10_a,lab10)) 1608 | 1609 | self.wait(2) 1610 | 1611 | ########################################## 1612 | #Move theta to 2 pi 1613 | to_angle=2*PI 1614 | 1615 | #Label at the top 1616 | labt_12=TextMobject("$$2\pi$$") 1617 | labt_12.next_to(upper_lab,RIGHT,0.2) 1618 | 1619 | #Label on the circle 1620 | #lab12_a=TextMobject("$$\\frac{12\pi}{6}$$") 1621 | #lab12_a.move_to(self.coords_to_point(1.1,)) 1622 | #lab12_a.scale(0.75) 1623 | #lab11=TextMobject("$$2\pi$$") 1624 | #lab11.move_to(lab10_a.get_center()) 1625 | #lab11.scale(0.75) 1626 | 1627 | #Keeper 1628 | keeper_un=Line(ORIGIN,self.coords_to_point(np.sqrt(3)/2,-0.5)) 1629 | keeper4=DashedVMobject(keeper_un) 1630 | self.add(keeper4) 1631 | 1632 | self.play( 1633 | #Move theta bit 1634 | UpdateFromFunc(theta_arc,theta_update), 1635 | Transform(labt_1,labt_12), 1636 | ApplyMethod(radians.next_to,labt_12,RIGHT,0.2), 1637 | 1638 | 1639 | #Move red bit and line 1640 | UpdateFromFunc(lower_half,low_update), 1641 | Rotating(line,about_point=ORIGIN,radians=PI/6), 1642 | 1643 | angle.set_value,to_angle+corr_term,rate_func=linear,run_time=1 1644 | ) 1645 | 1646 | #self.play(Write(lab11_a)) 1647 | 1648 | #self.wait() 1649 | 1650 | #self.play(Transform(lab10_a,lab10)) 1651 | 1652 | self.wait(4) 1653 | 1654 | ############################ 1655 | #SVG PNG CODE 1656 | #saved in assets in the main manim directory 1657 | #python -m manim MITintegral\UnitCircle\unitcirclescenes.py Pythagoras -pl 1658 | class Pythagoras(GraphScene,MovingCameraScene): 1659 | 1660 | 1661 | def setup(self): 1662 | MovingCameraScene.setup(self) 1663 | 1664 | def construct(self): 1665 | 1666 | 1667 | pyth=ImageMobject("pyth_free") 1668 | pyth.scale(3) 1669 | pyth.move_to(DOWN+RIGHT*3) 1670 | self.play(FadeIn(pyth)) 1671 | self.wait(2) 1672 | 1673 | bubble=SVGMobject("thought_bubble",fill_opacity=0) 1674 | bubble.move_to(LEFT*4.1+UP*2.5) 1675 | bubble.scale(3.2) 1676 | self.play(ShowCreation(bubble)) 1677 | self.wait() 1678 | 1679 | circle=Circle(radius=1,stroke_color=BLUE,fill_color=BLUE,fill_opacity=0.2) 1680 | circle.move_to(LEFT*3.3+UP*1.44) 1681 | 1682 | #Main scale 1683 | circle.scale(1.4) 1684 | self.play(ShowCreation(circle)) 1685 | 1686 | stroke=5 1687 | 1688 | #Quarters 1689 | line1=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1690 | line1.rotate(about_point=LEFT*3.3+UP*1.44,angle=0) 1691 | 1692 | line2=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1693 | line2.rotate(about_point=LEFT*3.3+UP*1.44,angle=PI/2) 1694 | 1695 | line3=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1696 | line3.rotate(about_point=LEFT*3.3+UP*1.44,angle=PI) 1697 | 1698 | line4=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1699 | line4.rotate(about_point=LEFT*3.3+UP*1.44,angle=3*PI/2) 1700 | 1701 | self.wait() 1702 | 1703 | #Play quarters 1704 | self.play( 1705 | ShowCreation(line1), 1706 | ShowCreation(line2), 1707 | ShowCreation(line3), 1708 | ShowCreation(line4), 1709 | ) 1710 | 1711 | self.wait(2) 1712 | 1713 | #Highlights 1714 | 1715 | #90 1716 | self.play( 1717 | ApplyMethod(line1.set_color,YELLOW), 1718 | ApplyMethod(line2.set_color,YELLOW), 1719 | ) 1720 | self.wait() 1721 | self.play( 1722 | ApplyMethod(line1.set_color,WHITE), 1723 | ApplyMethod(line2.set_color,WHITE), 1724 | ) 1725 | 1726 | #180 1727 | self.play( 1728 | ApplyMethod(line1.set_color,YELLOW), 1729 | ApplyMethod(line3.set_color,YELLOW), 1730 | ) 1731 | self.wait() 1732 | self.play( 1733 | ApplyMethod(line1.set_color,WHITE), 1734 | ApplyMethod(line3.set_color,WHITE), 1735 | ) 1736 | 1737 | #270 1738 | self.play( 1739 | ApplyMethod(line1.set_color,YELLOW), 1740 | ApplyMethod(line4.set_color,YELLOW), 1741 | ) 1742 | self.wait() 1743 | self.play( 1744 | ApplyMethod(line1.set_color,WHITE), 1745 | ApplyMethod(line4.set_color,WHITE), 1746 | ) 1747 | 1748 | self.wait(4) 1749 | 1750 | #Twelves 1751 | line5=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1752 | line5.rotate(about_point=LEFT*3.3+UP*1.44,angle=PI/6) 1753 | 1754 | line6=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1755 | line6.rotate(about_point=LEFT*3.3+UP*1.44,angle=PI/3) 1756 | 1757 | line7=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1758 | line7.rotate(about_point=LEFT*3.3+UP*1.44,angle=2*PI/3) 1759 | 1760 | line8=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1761 | line8.rotate(about_point=LEFT*3.3+UP*1.44,angle=5*PI/6) 1762 | 1763 | line9=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1764 | line9.rotate(about_point=LEFT*3.3+UP*1.44,angle=7*PI/6) 1765 | 1766 | line10=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1767 | line10.rotate(about_point=LEFT*3.3+UP*1.44,angle=8*PI/6) 1768 | 1769 | line11=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1770 | line11.rotate(about_point=LEFT*3.3+UP*1.44,angle=10*PI/6) 1771 | 1772 | line12=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1773 | line12.rotate(about_point=LEFT*3.3+UP*1.44,angle=11*PI/6) 1774 | 1775 | self.wait() 1776 | 1777 | self.play( 1778 | ShowCreation(line5), 1779 | ShowCreation(line6), 1780 | ShowCreation(line7), 1781 | ShowCreation(line8), 1782 | ShowCreation(line9), 1783 | ShowCreation(line10), 1784 | ShowCreation(line11), 1785 | ShowCreation(line12), 1786 | ) 1787 | 1788 | #Highlights 1789 | 1790 | self.wait(2) 1791 | 1792 | #30 1793 | self.play( 1794 | ApplyMethod(line1.set_color,YELLOW), 1795 | ApplyMethod(line5.set_color,YELLOW), 1796 | ) 1797 | self.wait() 1798 | self.play( 1799 | ApplyMethod(line1.set_color,WHITE), 1800 | ApplyMethod(line5.set_color,WHITE), 1801 | ) 1802 | 1803 | #60 1804 | self.play( 1805 | ApplyMethod(line1.set_color,YELLOW), 1806 | ApplyMethod(line6.set_color,YELLOW), 1807 | ) 1808 | self.wait() 1809 | self.play( 1810 | ApplyMethod(line1.set_color,WHITE), 1811 | ApplyMethod(line6.set_color,WHITE), 1812 | ) 1813 | 1814 | #90 1815 | self.play( 1816 | ApplyMethod(line1.set_color,YELLOW), 1817 | ApplyMethod(line2.set_color,YELLOW), 1818 | ) 1819 | self.wait() 1820 | self.play( 1821 | ApplyMethod(line1.set_color,WHITE), 1822 | ApplyMethod(line2.set_color,WHITE), 1823 | ) 1824 | 1825 | self.wait(2) 1826 | 1827 | #finals 1828 | o1line=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1829 | o1line.rotate(about_point=LEFT*3.3+UP*1.44,angle=PI/12) 1830 | 1831 | o2line=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1832 | o2line.rotate(about_point=LEFT*3.3+UP*1.44,angle=3*PI/12) 1833 | 1834 | o3line=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1835 | o3line.rotate(about_point=LEFT*3.3+UP*1.44,angle=5*PI/12) 1836 | 1837 | o4line=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1838 | o4line.rotate(about_point=LEFT*3.3+UP*1.44,angle=7*PI/12) 1839 | 1840 | o5line=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1841 | o5line.rotate(about_point=LEFT*3.3+UP*1.44,angle=11*PI/12) 1842 | 1843 | o6line=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1844 | o6line.rotate(about_point=LEFT*3.3+UP*1.44,angle=13*PI/12) 1845 | 1846 | o7line=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1847 | o7line.rotate(about_point=LEFT*3.3+UP*1.44,angle=17*PI/12) 1848 | 1849 | o8line=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1850 | o8line.rotate(about_point=LEFT*3.3+UP*1.44,angle=19*PI/12) 1851 | 1852 | o9line=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1853 | o9line.rotate(about_point=LEFT*3.3+UP*1.44,angle=23*PI/12) 1854 | 1855 | o91line=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1856 | o91line.rotate(about_point=LEFT*3.3+UP*1.44,angle=3*PI/4) 1857 | 1858 | o92line=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1859 | o92line.rotate(about_point=LEFT*3.3+UP*1.44,angle=5*PI/4) 1860 | 1861 | o93line=Line(LEFT*3.3+UP*1.44,LEFT*3.3+UP*1.44+RIGHT*1.4,stroke_width=stroke) 1862 | o93line.rotate(about_point=LEFT*3.3+UP*1.44,angle=7*PI/4) 1863 | 1864 | 1865 | self.play(ShowCreation(o2line)) 1866 | 1867 | self.wait(2) 1868 | 1869 | self.play( 1870 | ShowCreation(o1line), 1871 | ShowCreation(o3line), 1872 | ShowCreation(o4line), 1873 | ShowCreation(o5line), 1874 | ShowCreation(o6line), 1875 | ShowCreation(o7line), 1876 | ShowCreation(o8line), 1877 | ShowCreation(o9line), 1878 | ShowCreation(o91line), 1879 | ShowCreation(o92line), 1880 | ShowCreation(o93line), 1881 | ) 1882 | 1883 | self.wait(4) 1884 | 1885 | opacity=0.25 1886 | 1887 | q_mark=TextMobject("?",fill_color=BLUE,fill_opacity=0.4,stroke_color=BLUE,stroke_width=2) 1888 | q_mark.scale(4) 1889 | q_mark.move_to(LEFT*3.28+UP*1.5) 1890 | 1891 | self.play( 1892 | ApplyMethod(line1.set_opacity,opacity), 1893 | ApplyMethod(line2.set_opacity,opacity), 1894 | ApplyMethod(line3.set_opacity,opacity), 1895 | ApplyMethod(line4.set_opacity,opacity), 1896 | ApplyMethod(line5.set_opacity,opacity), 1897 | ApplyMethod(line6.set_opacity,opacity), 1898 | ApplyMethod(line7.set_opacity,opacity), 1899 | ApplyMethod(line8.set_opacity,opacity), 1900 | ApplyMethod(line9.set_opacity,opacity), 1901 | ApplyMethod(line10.set_opacity,opacity), 1902 | ApplyMethod(line11.set_opacity,opacity), 1903 | ApplyMethod(line12.set_opacity,opacity), 1904 | ApplyMethod(o1line.set_opacity,opacity), 1905 | ApplyMethod(o2line.set_opacity,opacity), 1906 | ApplyMethod(o3line.set_opacity,opacity), 1907 | ApplyMethod(o4line.set_opacity,opacity), 1908 | ApplyMethod(o5line.set_opacity,opacity), 1909 | ApplyMethod(o6line.set_opacity,opacity), 1910 | ApplyMethod(o7line.set_opacity,opacity), 1911 | ApplyMethod(o8line.set_opacity,opacity), 1912 | ApplyMethod(o9line.set_opacity,opacity), 1913 | ApplyMethod(o91line.set_opacity,opacity), 1914 | ApplyMethod(o92line.set_opacity,opacity), 1915 | ApplyMethod(o93line.set_opacity,opacity), 1916 | ApplyMethod(circle.set_opacity,opacity), 1917 | Write(q_mark) 1918 | ) 1919 | 1920 | self.wait(2) 1921 | 1922 | zoom=0.7 1923 | 1924 | self.play( 1925 | self.camera_frame.scale,zoom, 1926 | self.camera_frame.move_to,circle.get_center(), 1927 | FadeOut(bubble), 1928 | ApplyMethod(circle.set_color,WHITE), 1929 | ApplyMethod(circle.set_opacity,1), 1930 | FadeOut(q_mark), 1931 | FadeOut(line1), 1932 | FadeOut(line2), 1933 | FadeOut(line3), 1934 | FadeOut(line4), 1935 | FadeOut(line5), 1936 | FadeOut(line6), 1937 | FadeOut(line7), 1938 | FadeOut(line8), 1939 | FadeOut(line9), 1940 | FadeOut(line10), 1941 | FadeOut(line11), 1942 | FadeOut(line12), 1943 | FadeOut(o1line), 1944 | FadeOut(o2line), 1945 | FadeOut(o3line), 1946 | FadeOut(o4line), 1947 | FadeOut(o5line), 1948 | FadeOut(o6line), 1949 | FadeOut(o7line), 1950 | FadeOut(o8line), 1951 | FadeOut(o9line), 1952 | FadeOut(o91line), 1953 | FadeOut(o92line), 1954 | FadeOut(o93line), 1955 | FadeOut(pyth) 1956 | ) 1957 | 1958 | self.wait() 1959 | 1960 | unit=Arc(radius=2*zoom,angle=2*PI) 1961 | unit.move_to(circle.get_center()) 1962 | self.play(ShowCreation(unit),FadeOut(circle)) 1963 | 1964 | self.wait(4) 1965 | 1966 | angle=ValueTracker(0) 1967 | 1968 | red_arc=Arc(radius=2*zoom,angle=angle.get_value(),stroke_color=RED) 1969 | red_arc.move_to(circle.get_center()) 1970 | 1971 | def arc_update(arc): 1972 | new_arc=Arc(radius=2*zoom,angle=angle.get_value(),arc_center=circle.get_center(),stroke_color=RED) 1973 | red_arc.become(new_arc) 1974 | 1975 | 1976 | self.add(red_arc) 1977 | 1978 | corr_term=0.0 1979 | 1980 | #Move Examples 1981 | 1982 | angle_arm=Line(circle.get_center(),circle.get_center()+RIGHT*1.4) 1983 | dashed_arm=DashedVMobject(angle_arm) 1984 | 1985 | angle_arm_copy=Line(circle.get_center(),circle.get_center()+RIGHT*1.4) 1986 | dashed_arm_copy=DashedVMobject(angle_arm) 1987 | 1988 | self.play(ShowCreation(dashed_arm)) 1989 | self.add(dashed_arm_copy) 1990 | 1991 | move_to=PI/4 1992 | 1993 | self.play( 1994 | UpdateFromFunc(red_arc,arc_update), 1995 | Rotating(dashed_arm,about_point=circle.get_center(),radians=move_to-angle.get_value()), 1996 | angle.set_value,move_to+corr_term,rate_func=smooth,run_time=1 1997 | ) 1998 | 1999 | self.wait() 2000 | 2001 | move_to=2*PI/3 2002 | 2003 | self.play( 2004 | UpdateFromFunc(red_arc,arc_update), 2005 | Rotating(dashed_arm,about_point=circle.get_center(),radians=move_to-angle.get_value()), 2006 | angle.set_value,move_to+corr_term,rate_func=smooth,run_time=1 2007 | ) 2008 | 2009 | self.wait() 2010 | 2011 | move_to=5*PI/4 2012 | 2013 | self.play( 2014 | UpdateFromFunc(red_arc,arc_update), 2015 | Rotating(dashed_arm,about_point=circle.get_center(),radians=move_to-angle.get_value()), 2016 | angle.set_value,move_to+corr_term,rate_func=smooth,run_time=1 2017 | ) 2018 | 2019 | self.wait() 2020 | 2021 | move_to=7*PI/4 2022 | 2023 | self.play( 2024 | UpdateFromFunc(red_arc,arc_update), 2025 | Rotating(dashed_arm,about_point=circle.get_center(),radians=move_to-angle.get_value()), 2026 | angle.set_value,move_to+corr_term,rate_func=smooth,run_time=1 2027 | ) 2028 | 2029 | self.wait() 2030 | 2031 | move_to=0 2032 | 2033 | self.play( 2034 | UpdateFromFunc(red_arc,arc_update), 2035 | Rotating(dashed_arm,about_point=circle.get_center(),radians=move_to-angle.get_value()), 2036 | angle.set_value,move_to-corr_term,rate_func=smooth,run_time=1 2037 | ) 2038 | 2039 | self.wait() 2040 | 2041 | self.play( 2042 | FadeOut(dashed_arm), 2043 | FadeOut(dashed_arm_copy), 2044 | FadeOut(red_arc) 2045 | ) 2046 | 2047 | self.wait(4) 2048 | 2049 | #python -m manim MITintegral\UnitCircle\unitcirclescenes.py Applications -pl 2050 | class Applications(GraphScene,MovingCameraScene): 2051 | CONFIG = { 2052 | "x_min" : -12, 2053 | "x_max" : 12, 2054 | "y_min" : -8, 2055 | "y_max" : 8, 2056 | "x_tick_frequency": 2, 2057 | "y_tick_frequency": 2, 2058 | "y_axis_height":8, 2059 | "x_axis_width":12, 2060 | "graph_origin" : ORIGIN, 2061 | "function_color" : RED , 2062 | "axes_color" : GREEN, 2063 | "num_rects":300, 2064 | "area_opacity":0.6, 2065 | "default_riemann_start_color":BLUE, 2066 | "default_riemann_end_color":GREEN, 2067 | "x_labeled_nums" :range(-12,12,4), 2068 | "y_labeled_nums" :range(-8,8,4), 2069 | "num_graph_anchor_points": 200, 2070 | 2071 | } 2072 | 2073 | def setup(self): 2074 | GraphScene.setup(self) 2075 | MovingCameraScene.setup(self) 2076 | 2077 | def construct(self): 2078 | 2079 | self.setup_axes(animate=False) 2080 | self.x_axis.set_opacity(0) 2081 | self.y_axis.set_opacity(0) 2082 | 2083 | rad=10 2084 | 2085 | arc_swath=self.get_graph(self.arc,x_min=0,x_max=10-0.0001) 2086 | 2087 | arc_area=self.get_area(arc_swath,0,10-0.0001) 2088 | 2089 | b_line_u=Line(ORIGIN,self.coords_to_point(rad,0)) 2090 | b_line=DashedVMobject(b_line_u) 2091 | 2092 | m_line_u=Line(ORIGIN,self.coords_to_point(rad,0)) 2093 | m_line=DashedVMobject(m_line_u) 2094 | 2095 | angle=ValueTracker(0) 2096 | 2097 | arc=Arc(radius=5,angle=angle.get_value(),stroke_color=YELLOW) 2098 | 2099 | t_arc=Arc(radius=1,angle=angle.get_value(),stroke_color=GREY) 2100 | 2101 | 2102 | ############# 2103 | #Shift amount 2104 | ############# 2105 | sh=DOWN+LEFT*2 2106 | ############# 2107 | 2108 | def arc_up(arc): 2109 | n_arc=Arc(radius=5,angle=angle.get_value(),arc_center=sh,stroke_color=YELLOW) 2110 | arc.become(n_arc) 2111 | 2112 | def t_up(arc): 2113 | n_t_arc=Arc(radius=1,angle=angle.get_value(),arc_center=sh,stroke_color=GREY) 2114 | t_arc.become(n_t_arc) 2115 | 2116 | theta=TextMobject("$$\\theta$$") 2117 | theta.shift(1.2*RIGHT+0.5*UP) 2118 | 2119 | r=TextMobject("$$r$$") 2120 | r.next_to(b_line,DOWN,0.2) 2121 | 2122 | ### 2123 | #second shift 2124 | ssh=RIGHT*2+DOWN 2125 | ### 2126 | 2127 | whole=VGroup( 2128 | m_line, 2129 | b_line, 2130 | arc, 2131 | t_arc, 2132 | theta, 2133 | r 2134 | ) 2135 | 2136 | whole.shift(sh) 2137 | 2138 | arc_area.shift(sh+ssh) 2139 | 2140 | self.play(ShowCreation(b_line)) 2141 | self.add(m_line) 2142 | 2143 | self.play( 2144 | UpdateFromFunc(arc,arc_up), 2145 | UpdateFromFunc(t_arc,t_up), 2146 | Rotating(m_line,about_point=ORIGIN+sh,radians=PI/4), 2147 | angle.set_value,PI/4,run_time=1,rate_func=smooth 2148 | ) 2149 | 2150 | self.play(Write(theta)) 2151 | self.wait() 2152 | self.play(Write(r)) 2153 | 2154 | self.wait(2) 2155 | 2156 | radians=TextMobject("radians") 2157 | degrees=TextMobject("degrees") 2158 | 2159 | degrees.move_to(LEFT*5.3+UP*2.8) 2160 | radians.next_to(degrees,RIGHT,1.5) 2161 | radians.shift(UP*0.08) 2162 | 2163 | self.play( 2164 | Write(degrees), 2165 | ApplyMethod(whole.shift,ssh) 2166 | ) 2167 | 2168 | self.wait() 2169 | 2170 | l1=TextMobject("$$L=$$",stroke_color=YELLOW) 2171 | l1.set_color(YELLOW) 2172 | l1.next_to(degrees,DOWN) 2173 | l1.shift(LEFT*0.5+DOWN*0.4) 2174 | l2=TextMobject("$$L=$$",stroke_color=YELLOW) 2175 | l2.set_color(YELLOW) 2176 | l2.move_to(l1.get_center()) 2177 | l2.align_to(radians,LEFT) 2178 | 2179 | l_deg=TextMobject("$$\\frac{\\theta \pi r}{180}$$") 2180 | l_rad=TextMobject("$$\\theta r$$") 2181 | 2182 | l_deg.next_to(l1,RIGHT,0.15) 2183 | l_rad.next_to(l2,RIGHT,0.15) 2184 | 2185 | self.play( 2186 | Write(l1), 2187 | Write(l_deg) 2188 | ) 2189 | 2190 | self.wait(2) 2191 | 2192 | self.play(Write(radians)) 2193 | self.wait() 2194 | self.play(Write(l2),Write(l_rad)) 2195 | 2196 | self.wait(2) 2197 | 2198 | 2199 | self.play(ShowCreation(arc_area)) 2200 | 2201 | self.wait() 2202 | 2203 | a1=TextMobject("$$A=$$") 2204 | a2=TextMobject("$$A=$$") 2205 | a1.set_color(GREEN) 2206 | a2.set_color(GREEN) 2207 | a1.next_to(l1,DOWN,1) 2208 | a2.next_to(l2,DOWN,1) 2209 | 2210 | a_deg=TextMobject("$$\\frac{\\theta\pi r^{2}}{360}$$") 2211 | a_rad=TextMobject("$$\\frac{1}{2}\\theta r^{2}$$") 2212 | 2213 | a_deg.next_to(a1,RIGHT,0.15) 2214 | a_rad.next_to(a2,RIGHT,0.15) 2215 | 2216 | self.play(Write(a1)) 2217 | self.wait() 2218 | self.play(Write(a_deg)) 2219 | self.wait(2) 2220 | self.play(Write(a2)) 2221 | self.wait() 2222 | self.play(Write(a_rad)) 2223 | 2224 | self.wait(4) 2225 | 2226 | self.play( 2227 | self.camera_frame.scale,0.1 2228 | ) 2229 | 2230 | def arc(self,x): 2231 | if x>=10*(np.sqrt(2)/2): 2232 | return np.sqrt(100-x**2) 2233 | if x<10*(np.sqrt(2)/2): 2234 | return x 2235 | 2236 | #python -m manim MITintegral\UnitCircle\unitcirclescenes.py NewIntro -pl 2237 | class NewIntro(MovingCameraScene): 2238 | def setup(self): 2239 | MovingCameraScene.setup(self) 2240 | def construct(self): 2241 | 2242 | angle=ValueTracker(0) 2243 | 2244 | arc=Arc(radius=3,angle=angle.get_value(),stroke_width=9) 2245 | 2246 | arc.set_color(color=[YELLOW,BLUE]) 2247 | 2248 | def arc_up(arc): 2249 | new=Arc(radius=3,angle=angle.get_value(),stroke_width=9) 2250 | new.set_color(color=[YELLOW,BLUE]) 2251 | arc.become(new) 2252 | 2253 | #dot=Dot() 2254 | #dot.scale(1.5) 2255 | #dot.set_color(GREEN) 2256 | #dot.move_to(RIGHT*3) 2257 | 2258 | self.add(arc) 2259 | 2260 | self.play( 2261 | UpdateFromFunc(arc,arc_up), 2262 | #Rotating(dot,about_point=ORIGIN,radians=10*PI), 2263 | angle.set_value,10*PI+0.2,rate_func=linear,run_time=10 2264 | ) 2265 | 2266 | #self.play(FadeOut(dot)) 2267 | 2268 | 2269 | self.play( 2270 | arc.scale,0.4, 2271 | arc.shift,LEFT*4.3 2272 | ) 2273 | 2274 | self.wait() 2275 | 2276 | noth=TextMobject("") 2277 | 2278 | 2279 | sup=TextMobject("Super",fill_color=[YELLOW,BLUE],stroke_color=BLUE,stroke_width=2,fill_opacity=0.8) 2280 | scr=TextMobject("$$Script$$",fill_color=[YELLOW,BLUE],stroke_color=BLUE,stroke_width=2,fill_opacity=0.8) 2281 | 2282 | scr.next_to(sup,RIGHT,0.1) 2283 | 2284 | sup_scr=VGroup(sup,scr) 2285 | 2286 | sup_scr.scale(3) 2287 | 2288 | sup_scr.next_to(arc,RIGHT,0.2) 2289 | sup_scr.shift(DOWN*0.1) 2290 | 2291 | #sup_scr.set_color(color=[YELLOW,BLUE]) 2292 | 2293 | self.play(Write(sup_scr)) 2294 | 2295 | self.wait(2) 2296 | 2297 | logo=VGroup(arc,sup_scr) 2298 | 2299 | self.play( 2300 | Rotating(arc,about_point=arc.get_center(),radians=8*PI), 2301 | self.camera_frame.scale,0.05, 2302 | self.camera_frame.move_to,arc.get_center(),rate_func=smooth,run_time=1 2303 | ) 2304 | 2305 | self.wait(2) 2306 | 2307 | #python -m manim MITintegral\UnitCircle\unitcirclescenes.py Apps2 -pl 2308 | class Apps2(MovingCameraScene): 2309 | def setup(self): 2310 | MovingCameraScene.setup(self) 2311 | def construct(self): 2312 | 2313 | angle=ValueTracker(0) 2314 | 2315 | arc=Arc(radius=3,angle=angle.get_value()) 2316 | 2317 | arc.set_color(color=[YELLOW,BLUE]) 2318 | 2319 | def arc_up(arc): 2320 | new=Arc(radius=3,angle=angle.get_value()) 2321 | new.set_color(color=[YELLOW,BLUE]) 2322 | arc.become(new) 2323 | 2324 | dot=Dot() 2325 | dot.scale(1.5) 2326 | dot.set_color(GREEN) 2327 | dot.move_to(3*RIGHT*np.cos(-PI/24)+3*UP*np.sin(-PI/24)) 2328 | 2329 | time=5 2330 | 2331 | self.add(arc) 2332 | 2333 | self.play(ShowCreation(dot)) 2334 | 2335 | self.play( 2336 | UpdateFromFunc(arc,arc_up), 2337 | Rotating(dot,about_point=ORIGIN,radians=3*PI), 2338 | angle.set_value,3*PI,rate_func=linear,run_time=3 2339 | ) 2340 | 2341 | self.play( 2342 | Rotating(dot,about_point=ORIGIN,radians=time*PI), 2343 | rate_func=linear,run_time=time 2344 | ) 2345 | 2346 | self.play( 2347 | Rotating(dot,about_point=ORIGIN,radians=1*PI), 2348 | self.camera_frame.scale,1.5, 2349 | self.camera_frame.move_to,LEFT*4, 2350 | rate_func=linear,run_time=1 2351 | ) 2352 | 2353 | self.play( 2354 | Rotating(dot,about_point=ORIGIN,radians=3*PI), 2355 | rate_func=linear,run_time=3 2356 | ) 2357 | 2358 | l=TextMobject("$$L$$") 2359 | l.set_color(YELLOW) 2360 | rad=TextMobject("$$=r\\theta$$") 2361 | rad.next_to(l,RIGHT,0.1) 2362 | 2363 | arc_form=VGroup(l,rad) 2364 | arc_form.scale(2.3) 2365 | 2366 | arc_form.shift(LEFT*10+UP*3) 2367 | 2368 | self.play( 2369 | Rotating(dot,about_point=ORIGIN,radians=1*PI), 2370 | Write(arc_form), 2371 | rate_func=linear,run_time=1 2372 | ) 2373 | 2374 | self.play( 2375 | Rotating(dot,about_point=ORIGIN,radians=3*PI), 2376 | rate_func=linear,run_time=3 2377 | ) 2378 | 2379 | v=TextMobject("$$v$$") 2380 | v.set_color(BLUE) 2381 | v.next_to(l,DOWN,2.5) 2382 | v.shift(RIGHT*0.75) 2383 | dd=TextMobject("$$=\\frac{\mathrm{d}L }{\mathrm{d} t}$$") 2384 | dd.next_to(v,RIGHT,0.2) 2385 | v1=VGroup(v,dd) 2386 | v1.scale(2.3) 2387 | 2388 | self.play( 2389 | Rotating(dot,about_point=ORIGIN,radians=1*PI), 2390 | Write(v1), 2391 | rate_func=linear,run_time=1 2392 | ) 2393 | 2394 | self.play( 2395 | Rotating(dot,about_point=ORIGIN,radians=3*PI), 2396 | rate_func=linear,run_time=3 2397 | ) 2398 | 2399 | dd2=TextMobject("$$=r\\frac{\mathrm{d}\\theta }{\mathrm{d} t}$$") 2400 | dd2.scale(2.3) 2401 | dd2.next_to(v,RIGHT,0.3) 2402 | 2403 | self.play( 2404 | Rotating(dot,about_point=ORIGIN,radians=.8*PI), 2405 | Transform(dd,dd2), 2406 | rate_func=linear,run_time=.8 2407 | ) 2408 | 2409 | self.play( 2410 | Rotating(dot,about_point=ORIGIN,radians=3*PI), 2411 | rate_func=linear,run_time=3 2412 | ) 2413 | 2414 | dd3=TextMobject("$$=r\omega$$") 2415 | dd3.scale(2.3) 2416 | dd3.next_to(v,RIGHT,0.3) 2417 | 2418 | self.play( 2419 | Rotating(dot,about_point=ORIGIN,radians=.8*PI), 2420 | Transform(dd,dd3), 2421 | rate_func=linear,run_time=.8 2422 | ) 2423 | 2424 | self.play( 2425 | Rotating(dot,about_point=ORIGIN,radians=10*PI), 2426 | rate_func=linear,run_time=10 2427 | ) 2428 | 2429 | self.wait(2) 2430 | 2431 | #python -m manim MITintegral\UnitCircle\unitcirclescenes.py End -pl 2432 | class End(MovingCameraScene): 2433 | def setup(self): 2434 | MovingCameraScene.setup(self) 2435 | def construct(self): 2436 | circle=Arc(radius=2,angle=2*PI) 2437 | circle.set_color(color=[RED,BLUE]) 2438 | self.play(ShowCreation(circle)) 2439 | 2440 | base_u=Line(ORIGIN,RIGHT*2) 2441 | base=DashedVMobject(base_u) 2442 | 2443 | mase_u=Line(ORIGIN,RIGHT*2) 2444 | mase=DashedVMobject(mase_u) 2445 | 2446 | s=TextMobject("$$\\sin(\\theta)$$") 2447 | s.set_color(BLUE) 2448 | c=TextMobject("$$\\cos(\\theta)$$") 2449 | c.set_color(RED) 2450 | s.move_to(LEFT*4+UP*2.2) 2451 | c.next_to(s,DOWN,0.3) 2452 | 2453 | self.play( 2454 | Write(s), 2455 | Write(c) 2456 | ) 2457 | 2458 | self.play(ShowCreation(base)) 2459 | self.add(mase) 2460 | 2461 | self.play( 2462 | Rotating(mase,about_point=ORIGIN,radians=PI/2), 2463 | rate_func=smooth,run_time=1 2464 | ) 2465 | 2466 | self.wait() 2467 | 2468 | self.play( 2469 | Rotating(mase,about_point=ORIGIN,radians=7*PI/6), 2470 | rate_func=smooth,run_time=1 2471 | ) 2472 | 2473 | self.wait() 2474 | 2475 | self.play( 2476 | Rotating(mase,about_point=ORIGIN,radians=-3*PI/5), 2477 | rate_func=smooth,run_time=1 2478 | ) 2479 | 2480 | self.wait() 2481 | 2482 | self.play( 2483 | Rotating(mase,about_point=ORIGIN,radians=-4*PI/6), 2484 | rate_func=smooth,run_time=1 2485 | ) 2486 | 2487 | self.wait(4) 2488 | 2489 | #python -m manim MITintegral\UnitCircle\unitcirclescenes.py IntroAdd -pl 2490 | class IntroAdd(GraphScene,MovingCameraScene): 2491 | CONFIG = { 2492 | "x_min" : -12, 2493 | "x_max" : 12, 2494 | "y_min" : -9, 2495 | "y_max" : 9, 2496 | "x_tick_frequency": 2, 2497 | "y_tick_frequency": 2, 2498 | "y_axis_height":9, 2499 | "x_axis_width":12, 2500 | "graph_origin" : ORIGIN, 2501 | "function_color" : RED , 2502 | "axes_color" : GREEN, 2503 | #"x_labeled_nums" :range(-8,8,2), 2504 | #"y_labeled_nums" :range(-6,6,2), 2505 | "num_graph_anchor_points": 200, 2506 | 2507 | } 2508 | 2509 | def setup(self): 2510 | GraphScene.setup(self) 2511 | MovingCameraScene.setup(self) 2512 | 2513 | def construct(self): 2514 | 2515 | self.setup_axes(animate=True) 2516 | 2517 | exp_graph=self.get_graph(self.exp,x_min=-12,x_max=12) 2518 | exp_graph.set_color(BLUE) 2519 | 2520 | add=ValueTracker(-10) 2521 | 2522 | start=8 2523 | 2524 | tan_line=Line(self.coords_to_point(start,np.exp((start)/6)),self.coords_to_point(start+add.get_value(),np.exp((start+add.get_value())/6)),stroke_width=3) 2525 | 2526 | tan_line.set_color(RED) 2527 | 2528 | tan_line.scale(30/add.get_value()) 2529 | 2530 | r_dot=Dot() 2531 | r_dot.set_color(YELLOW) 2532 | r_dot.move_to(self.coords_to_point(start,np.exp(start/6))) 2533 | 2534 | l_dot=Dot() 2535 | l_dot.set_color(YELLOW) 2536 | l_dot.move_to(self.coords_to_point(start+add.get_value(),np.exp((start+add.get_value())/6))) 2537 | 2538 | 2539 | 2540 | def line_up(line): 2541 | new_line=Line(self.coords_to_point(start,np.exp((start)/6)),self.coords_to_point(start+add.get_value(),np.exp((start+add.get_value())/6)),stroke_width=3) 2542 | new_line.set_color(RED) 2543 | new_line.scale(30/add.get_value()) 2544 | tan_line.become(new_line) 2545 | 2546 | def dot_up(dot): 2547 | new_dot=Dot() 2548 | new_dot.set_color(YELLOW) 2549 | new_dot.move_to(self.coords_to_point(start+add.get_value(),np.exp((start+add.get_value())/6))) 2550 | l_dot.become(new_dot) 2551 | 2552 | self.play( 2553 | ShowCreation(exp_graph) 2554 | ) 2555 | 2556 | self.wait() 2557 | 2558 | self.play( 2559 | ShowCreation(tan_line), 2560 | ShowCreation(r_dot), 2561 | ShowCreation(l_dot) 2562 | ) 2563 | self.wait() 2564 | 2565 | self.remove(l_dot) 2566 | 2567 | self.play( 2568 | UpdateFromFunc(tan_line,line_up), 2569 | UpdateFromFunc(l_dot,dot_up), 2570 | add.set_value,0.1,rate_func=linear,run_time=3 2571 | ) 2572 | 2573 | self.wait() 2574 | 2575 | calculus=TextMobject("calculus",fill_color=WHITE,fill_opacity=0.5,stroke_color=BLUE,stroke_width=2) 2576 | calculus.move_to(UP*6) 2577 | calculus.scale(3) 2578 | 2579 | self.play( 2580 | self.camera_frame.scale,2, 2581 | self.camera_frame.move_to,LEFT*7+UP*1.5, 2582 | Write(calculus) 2583 | ) 2584 | 2585 | 2586 | self.wait() 2587 | 2588 | arrow=TextMobject("$$\\rightarrow$$",stroke_width=3) 2589 | arrow.move_to(LEFT*7.8) 2590 | arrow.set_color(color=[YELLOW,GREEN]) 2591 | arrow.scale(4) 2592 | 2593 | self.play(Write(arrow)) 2594 | 2595 | self.wait() 2596 | 2597 | circle=Arc(radius=4,angle=2*PI) 2598 | circle.set_color(color=[YELLOW,BLUE]) 2599 | circle.move_to(LEFT*14) 2600 | arm=Arrow(circle.get_center(),circle.get_center()+4.2*RIGHT) 2601 | arm.set_color(BLUE) 2602 | 2603 | unit=TextMobject("unit circle",fill_color=WHITE,fill_opacity=0.5,stroke_color=BLUE,stroke_width=2) 2604 | unit.move_to(circle.get_center()+UP*6) 2605 | unit.scale(3) 2606 | 2607 | self.play( 2608 | ShowCreation(circle), 2609 | Write(unit) 2610 | ) 2611 | 2612 | self.play(ShowCreation(arm)) 2613 | 2614 | self.play( 2615 | Rotating(arm,about_point=circle.get_center(),radians=7*PI), 2616 | run_time=10,rate_func=linear 2617 | ) 2618 | 2619 | def exp(self,x): 2620 | return np.exp(x/6) 2621 | 2622 | #python -m manim MITintegral\UnitCircle\unitcirclescenes.py Thumbnailv1 -ps 2623 | class Thumbnailv1(Scene): 2624 | 2625 | def construct(self): 2626 | 2627 | 2628 | pyth=ImageMobject("divinciman") 2629 | pyth.scale(5.5) 2630 | #pyth.move_to(2*DOWN+RIGHT*5.6) 2631 | 2632 | #pyth.rotate(angle=-PI/10) 2633 | 2634 | what_are=TextMobject("\\textsl{what are}",fill_color=[YELLOW,RED],fill_opacity=.9,stroke_color=WHITE,stroke_width=6) 2635 | radians=TextMobject("\\textbf{RADIANS}",fill_color=[YELLOW,RED],fill_opacity=.9,stroke_color=WHITE,stroke_width=3) 2636 | 2637 | what_are.move_to(UP*2) 2638 | what_are.scale(6.5) 2639 | #radians.move_to(DOWN) 2640 | radians.scale(5.2) 2641 | radians.move_to(DOWN) 2642 | 2643 | #q=TextMobject("?",stroke_width=3,stroke_color=BLUE,stroke_opacity=0.8,fill_color=BLUE,fill_opacity=0.3) 2644 | 2645 | #q.scale(18) 2646 | 2647 | #self.add(q) 2648 | 2649 | self.add(what_are) 2650 | self.add(radians) 2651 | 2652 | self.add(pyth) 2653 | 2654 | self.bring_to_back(pyth) 2655 | 2656 | #python -m manim MITintegral\UnitCircle\unitcirclescenes.py Thumbnailv2 -ps 2657 | class Thumbnailv2(Scene): 2658 | 2659 | def construct(self): 2660 | 2661 | circle=Arc(radius=5,angle=2*PI,stroke_opacity=0.6,stroke_width=10) 2662 | 2663 | circle2=Arc(radius=7,angle=2*PI,stroke_opacity=0.3,stroke_width=10) 2664 | 2665 | #theta=Arc(radius=2,angle=6*PI/3,stroke_width=8,stroke_opacity=0.6,stroke_color=GREY) 2666 | 2667 | circle.set_color(color=[BLUE,YELLOW]) 2668 | circle2.set_color(color=[BLUE,YELLOW]) 2669 | 2670 | thick=12 2671 | 2672 | arm1=DashedLine(ORIGIN,RIGHT*5,stroke_opacity=0.5,stroke_width=thick) 2673 | arm1.rotate(about_point=ORIGIN,angle=0) 2674 | 2675 | arm2=DashedLine(ORIGIN,RIGHT*5,stroke_opacity=0.5,stroke_width=thick) 2676 | arm2.rotate(about_point=ORIGIN,angle=PI/3) 2677 | 2678 | arm3=DashedLine(ORIGIN,RIGHT*5,stroke_opacity=0.5,stroke_width=thick) 2679 | arm3.rotate(about_point=ORIGIN,angle=2*PI/3) 2680 | 2681 | arm4=DashedLine(ORIGIN,RIGHT*5,stroke_opacity=0.5,stroke_width=thick) 2682 | arm4.rotate(about_point=ORIGIN,angle=PI) 2683 | 2684 | arm5=DashedLine(ORIGIN,RIGHT*5,stroke_opacity=0.5,stroke_width=thick) 2685 | arm5.rotate(about_point=ORIGIN,angle=4*PI/3) 2686 | 2687 | arm6=DashedLine(ORIGIN,RIGHT*5,stroke_opacity=0.5,stroke_width=thick) 2688 | arm6.rotate(about_point=ORIGIN,angle=5*PI/3) 2689 | 2690 | what_are=TextMobject("\\textsl{what are}",fill_color=[BLUE,YELLOW],fill_opacity=.9,stroke_color=WHITE,stroke_width=6) 2691 | radians=TextMobject("\\textbf{RADIANS}",fill_color=[YELLOW,RED],fill_opacity=.9,stroke_color=WHITE,stroke_width=3) 2692 | 2693 | what_are.move_to(UP*2) 2694 | what_are.scale(5.5) 2695 | #radians.move_to(DOWN) 2696 | radians.scale(5.2) 2697 | radians.move_to(DOWN*0.8) 2698 | 2699 | #q=TextMobject("?",stroke_width=3,stroke_color=BLUE,stroke_opacity=0.8,fill_color=BLUE,fill_opacity=0.3) 2700 | 2701 | #q.scale(18) 2702 | 2703 | #self.add(q) 2704 | 2705 | self.add( 2706 | arm1, 2707 | arm2, 2708 | arm3, 2709 | arm4, 2710 | arm5, 2711 | arm6 2712 | ) 2713 | 2714 | self.add(circle) 2715 | self.add(circle2) 2716 | 2717 | #self.add(theta) 2718 | 2719 | self.add(what_are) 2720 | self.add(radians) 2721 | -------------------------------------------------------------------------------- /Radical 2020/tanint.py: -------------------------------------------------------------------------------- 1 | from manimlib.imports import * 2 | 3 | #python -m manim MITintegral\tanint\tanint.py OpeningInt -pl 4 | class OpeningInt(Scene): 5 | def construct(self): 6 | int1=TextMobject("$$\int x(1-x)^{2020}dx$$") 7 | mainint=TextMobject("$$\int_{0}^{\\frac{\pi}{2}}\\frac{1}{\\tan^{\sqrt{2020}}(x)+1} dx$$") 8 | int3=TextMobject("$$\int_{0}^{\infty}\\frac{1}{e^{x}+1} dx$$") 9 | int4=TextMobject("$$\int_{0}^{\\frac{\pi}{100}}\\frac{\sin(20x)+\sin(19x)}{\cos(20x)+\cos(19x)} dx$$") 10 | int5=TextMobject("$$\int \cos(\\arctan(x)) dx$$") 11 | int6=TextMobject("$$\int_{-\infty}^{\infty}e^{-2x^{2}-5x-3} dx$$") 12 | int7=TextMobject("$$\int_{0}^{\infty}\\frac{\\tanh(x)}{\exp(x)} dx$$") 13 | int8=TextMobject("$$\int \sqrt{x\sqrt{x\sqrt{x ...}}}dx$$") 14 | 15 | refd1=Dot() 16 | refd2=Dot() 17 | refd3=Dot() 18 | refd4=Dot() 19 | refd5=Dot() 20 | refd6=Dot() 21 | refd7=Dot() 22 | refd8=Dot() 23 | 24 | refd1.move_to(LEFT*6+UP*2.7) 25 | refd2.next_to(refd1,DOWN*6) 26 | refd3.next_to(refd2,DOWN*6) 27 | refd4.next_to(refd3,DOWN*6) 28 | refd5.move_to(RIGHT+UP*2.7) 29 | refd6.next_to(refd5,DOWN*6) 30 | refd7.next_to(refd6,DOWN*6) 31 | refd8.next_to(refd7,DOWN*6) 32 | 33 | int1.next_to(refd1) 34 | mainint.next_to(refd2) 35 | int3.next_to(refd3) 36 | int4.next_to(refd4) 37 | int5.next_to(refd5) 38 | int6.next_to(refd6) 39 | int7.next_to(refd7) 40 | int8.next_to(refd8) 41 | 42 | mit=TextMobject("MIT Integration Bee") 43 | mit.set_color(BLUE) 44 | mit.move_to(UP) 45 | mit.scale(2) 46 | 47 | students=TextMobject("16 students") 48 | students.next_to(mit,DOWN) 49 | students.scale(1.4) 50 | 51 | winner=TextMobject("1 winner") 52 | winner.next_to(students,DOWN) 53 | winner.scale(1.4) 54 | 55 | exam=TextMobject("20 question Qualifying Exam",stroke_width=1,stroke_color=BLUE) 56 | exam.next_to(mit,DOWN*2) 57 | exam.scale(1.6) 58 | 59 | ourfunc=TextMobject("$$\\frac{1}{\\tan^{n}(x)+1}$$") 60 | ourfunc.scale(2) 61 | 62 | circlex=Circle() 63 | circlex.set_color(BLUE) 64 | circlex.scale(0.4) 65 | circlex.shift(DOWN*0.65+RIGHT*0.12) 66 | 67 | self.play(Write(mit)) 68 | self.wait(3) 69 | 70 | 71 | self.wait(3) 72 | 73 | self.play(FadeOut(mit)) 74 | 75 | self.wait() 76 | 77 | self.play(Write(int1),run_time=0.7) 78 | self.play(Write(mainint),run_time=0.7) 79 | self.play(Write(int3),run_time=0.7) 80 | self.play(Write(int4),run_time=0.7) 81 | self.play(Write(int5),run_time=0.7) 82 | self.play(Write(int6),run_time=0.7) 83 | self.play(Write(int7),run_time=0.7) 84 | self.play(Write(int8),run_time=0.7) 85 | 86 | 87 | self.wait(4) 88 | 89 | group=VGroup(int1,int3,int4,int5,int6,int7,int8) 90 | 91 | self.play(FadeOut(group),ApplyMethod(mainint.move_to,np.array([0,0,0]))) 92 | 93 | self.play(ApplyMethod(mainint.scale,2)) 94 | highlight=Rectangle(height=0.8,width=2.3) 95 | highlight.set_color(BLUE) 96 | highlight.shift(DOWN*0.5+LEFT*0.37) 97 | 98 | self.wait(2) 99 | self.play(ShowCreation(highlight)) 100 | self.wait(2) 101 | 102 | group1=VGroup(mainint,highlight) 103 | 104 | self.play(Transform(group1,ourfunc)) 105 | 106 | self.wait(2) 107 | 108 | self.play(ShowCreation(circlex)) 109 | self.wait() 110 | self.play(FadeOut(circlex)) 111 | self.wait(2) 112 | 113 | #python -m manim MITintegral\tanint\tanint.py UnitCircle -pl 114 | class UnitCircle(GraphScene): 115 | CONFIG = { 116 | "x_min" : -3, 117 | "x_max" : 3, 118 | "y_min" : -2, 119 | "y_max" : 2, 120 | "x_tick_frequency": 2, 121 | "y_tick_frequency": 2, 122 | "y_axis_height":8, 123 | "x_axis_width":12, 124 | "graph_origin" : ORIGIN, 125 | "function_color" : RED , 126 | "axes_color" : GREEN, 127 | "x_labeled_nums" :range(-3,3,1), 128 | "y_labeled_nums" :range(-1,2,1), 129 | "num_graph_anchor_points": 200, 130 | 131 | } 132 | def construct(self): 133 | angle=math.radians(360) 134 | arc=Arc(radius=2,angle=angle) 135 | 136 | arcangle=Arc(radius=0.7,angle=math.radians(45)) 137 | 138 | arm=Arrow(np.array([0,0,0]),np.array([2*np.sqrt(2)/2,2*np.sqrt(2)/2,0]),buff=0) 139 | arm.set_color(BLUE) 140 | 141 | #Reference Dot 142 | #REFDOT DECIDES WHERE THE TRACKERS ARE 143 | refd=Dot() 144 | refd.move_to(RIGHT*5+UP*3) 145 | refd2=Dot() 146 | refd2.next_to(refd,DOWN*1.6) 147 | 148 | #Sin Definition 149 | sin_func = lambda x: np.sin(x.get_value()) 150 | 151 | x_value = ValueTracker(PI/4) 152 | 153 | sin_func_value = ValueTracker(sin_func(x_value)) 154 | x_tex = DecimalNumber(x_value.get_value()).add_updater(lambda v: v.set_value(x_value.get_value())) 155 | sin_func_tex = DecimalNumber(sin_func_value.get_value()).add_updater(lambda v: v.set_value(sin_func(x_value))) 156 | 157 | #Sin display 158 | sin_func_tex.next_to(refd,LEFT) 159 | #self.add(sin_func_tex) 160 | 161 | #Cos Definition 162 | cos_func = lambda x: np.cos(x.get_value()) 163 | cos_func_value = ValueTracker(cos_func(x_value)) 164 | x_tex = DecimalNumber(x_value.get_value()).add_updater(lambda v: v.set_value(x_value.get_value())) 165 | cos_func_tex = DecimalNumber(cos_func_value.get_value()).add_updater(lambda v: v.set_value(cos_func(x_value))) 166 | 167 | #Tam Definition 168 | tan_func = lambda x: np.tan(x.get_value()) 169 | tan_func_value = ValueTracker(tan_func(x_value)) 170 | x_tex = DecimalNumber(x_value.get_value()).add_updater(lambda v: v.set_value(x_value.get_value())) 171 | tan_func_tex = DecimalNumber(tan_func_value.get_value()).add_updater(lambda v: v.set_value(tan_func(x_value))) 172 | 173 | #Define Tip Dot 174 | #tip=Dot() 175 | #tip.move_to(np.array([2*np.sqrt(2)/2,2*np.sqrt(2)/2,0])) 176 | 177 | #Origin dot 178 | #odot=Dot() 179 | #odot.move_to(ORIGIN) 180 | 181 | #Cos display 182 | cos_func_tex.next_to(refd2,LEFT) 183 | #self.add(cos_func_tex) 184 | 185 | #Define braces 186 | #singroup=VGroup(tip,odot) 187 | #A BRACE THAT UPDATES (KIND OF) 188 | #sin=Brace(singroup,RIGHT).add_updater(lambda m: m.next_to(singroup,RIGHT),m.scale()) 189 | sin=Brace(arm,RIGHT) 190 | cos=Brace(arm,DOWN) 191 | 192 | sin.set_color(BLUE) 193 | cos.set_color(RED) 194 | 195 | ysinlab=TextMobject("$$\sin(\\theta):$$") 196 | ysinlab.next_to(sin_func_tex,LEFT) 197 | ysinlab.set_color(BLUE) 198 | xcoslab=TextMobject("$$\cos(\\theta):$$") 199 | xcoslab.next_to(cos_func_tex,LEFT) 200 | xcoslab.set_color(RED) 201 | 202 | angletheta=TextMobject("$$\\theta$$") 203 | angletheta.move_to(RIGHT+UP*0.5) 204 | 205 | 206 | self.setup_axes(animate=True) 207 | 208 | #path1=self.get_graph(lambda x: np.sqrt(1-x**2),x_min=np.sqrt(2)/2,x_max=-np.sqrt(2)/2) 209 | 210 | self.play(ShowCreation(arc)) 211 | 212 | x=TextMobject("$$x:$$") 213 | x.next_to(cos_func_tex,LEFT) 214 | x.set_color(RED) 215 | y=TextMobject("$$y:$$") 216 | y.next_to(sin_func_tex,LEFT) 217 | y.set_color(BLUE) 218 | 219 | #Tan display 220 | tan_func_tex.next_to(cos_func_tex,DOWN*2) 221 | tanlab=TextMobject("$$\\tan(\\theta):$$") 222 | tanlab.next_to(tan_func_tex,LEFT) 223 | yoverx=TextMobject("$$\\frac{y}{x}:$$") 224 | yoverx.next_to(tan_func_tex,LEFT) 225 | 226 | bracx=TextMobject("$$x$$") 227 | bracx.next_to(cos,DOWN) 228 | bracx.set_color(RED) 229 | bracy=TextMobject("$$y$$") 230 | bracy.next_to(sin,RIGHT) 231 | bracy.set_color(BLUE) 232 | 233 | infinity=TextMobject("$$\infty$$") 234 | undef=TextMobject("(undef.)") 235 | undef.next_to(infinity,RIGHT,0.2) 236 | repl=VGroup(infinity,undef) 237 | repl.move_to(tan_func_tex.get_center()+RIGHT*0.7) 238 | 239 | #Define Markers for angles 240 | zerodot=Dot() 241 | zerodot.move_to(np.array([2,0,0])) 242 | pifourdot=Dot() 243 | pifourdot.move_to(np.array([2*np.sqrt(2)/2,2*np.sqrt(2)/2,0])) 244 | pitwodot=Dot() 245 | pitwodot.move_to(np.array([0,2,0])) 246 | pithreefourdot=Dot() 247 | pithreefourdot.move_to(np.array([-2*np.sqrt(2)/2,2*np.sqrt(2)/2,0])) 248 | pidot=Dot() 249 | pidot.move_to(np.array([-2,0,0])) 250 | 251 | pifivefourdot=Dot() 252 | pifivefourdot.move_to(np.array([-2*np.sqrt(2)/2,-2*np.sqrt(2)/2,0])) 253 | pithreetwodot=Dot() 254 | pithreetwodot.move_to(np.array([0,-2,0])) 255 | pisevenfourdot=Dot() 256 | pisevenfourdot.move_to(np.array([2*np.sqrt(2)/2,-2*np.sqrt(2)/2,0])) 257 | 258 | #Define Labels for angles 259 | 260 | buff=0.5 261 | 262 | zerolab=TextMobject("$$0$$") 263 | zerolab.scale(0.65) 264 | zerolab.next_to(zerodot,RIGHT*buff+UP*buff) 265 | pifourlab=TextMobject("$$\\frac{\pi}{4}$$") 266 | pifourlab.scale(0.65) 267 | pifourlab.next_to(pifourdot,RIGHT*buff+UP*buff) 268 | pitwolab=TextMobject("$$\\frac{\pi}{2}$$") 269 | pitwolab.scale(0.65) 270 | pitwolab.next_to(pitwodot,RIGHT*buff+UP*buff) 271 | pithreefourlab=TextMobject("$$\\frac{3\pi}{4}$$") 272 | pithreefourlab.scale(0.65) 273 | pithreefourlab.next_to(pithreefourdot,LEFT*buff+UP*buff) 274 | pilab=TextMobject("$$\pi$$") 275 | pilab.scale(0.65) 276 | pilab.next_to(pidot,LEFT*buff+UP*buff) 277 | pifivefourlab=TextMobject("$$\\frac{5\pi}{4}$$") 278 | pifivefourlab.scale(0.65) 279 | pifivefourlab.next_to(pifivefourdot,LEFT*buff+DOWN*buff) 280 | pithreetwolab=TextMobject("$$\\frac{3\pi}{2}$$") 281 | pithreetwolab.scale(0.65) 282 | pithreetwolab.next_to(pithreetwodot,RIGHT*buff+DOWN*buff) 283 | pisevenfourlab=TextMobject("$$\\frac{7\pi}{4}$$") 284 | pisevenfourlab.scale(0.65) 285 | pisevenfourlab.next_to(pisevenfourdot,RIGHT*buff+DOWN*buff) 286 | 287 | 288 | 289 | allrads=VGroup(zerolab,pifourlab,pitwolab,pithreefourlab,pilab,pifivefourlab,pithreetwolab,pisevenfourlab) 290 | 291 | #self.play(ShowCreation(tip)) 292 | #self.play(MoveAlongPath(tip,path1)) 293 | 294 | #NONCOLORED X AND Y LABELS 295 | xnc=TextMobject("$$x:$$") 296 | xnc.next_to(cos_func_tex,LEFT) 297 | ync=TextMobject("$$y:$$") 298 | ync.next_to(sin_func_tex,LEFT) 299 | 300 | self.wait(2) 301 | self.play(ShowCreation(arm)) 302 | self.wait() 303 | self.play(ShowCreation(arcangle),ShowCreation(angletheta)) 304 | self.wait(2) 305 | 306 | self.play( 307 | 308 | Write(allrads) 309 | 310 | ) 311 | 312 | self.wait(2) 313 | self.play(ShowCreation(sin),ShowCreation(ysinlab),ShowCreation(sin_func_tex)) 314 | self.wait(2) 315 | self.play(ShowCreation(cos),ShowCreation(xcoslab),ShowCreation(cos_func_tex)) 316 | self.wait(3) 317 | self.play(Transform(ysinlab,y),Transform(xcoslab,x),ShowCreation(bracy),ShowCreation(bracx)) 318 | self.wait() 319 | self.play(FadeOut(sin),FadeOut(cos),FadeOut(bracx),FadeOut(bracy), 320 | FadeOut(arcangle),FadeOut(angletheta),Transform(ysinlab,ync),Transform(xcoslab,xnc)) 321 | self.wait() 322 | 323 | 324 | self.play( 325 | Rotating(arm,radians=PI/2,about_point=np.array([0,0,0])), 326 | x_value.set_value,(3*PI)/4,rate_func=linear,run_time=2.5 327 | ) 328 | 329 | sin=Brace(arm,LEFT) 330 | sin.set_color(BLUE) 331 | cos=Brace(arm,DOWN) 332 | cos.set_color(RED) 333 | 334 | bracx=TextMobject("$$x$$") 335 | bracx.next_to(cos,DOWN) 336 | bracx.set_color(RED) 337 | bracy=TextMobject("$$y$$") 338 | bracy.next_to(sin,LEFT) 339 | bracy.set_color(BLUE) 340 | 341 | self.play(ShowCreation(sin),Transform(ysinlab,y)) 342 | self.play(ShowCreation(cos),Transform(xcoslab,x)) 343 | self.wait(1.5) 344 | self.play(FadeOut(sin),FadeOut(cos),Transform(ysinlab,ync),Transform(xcoslab,xnc)) 345 | 346 | x_value=ValueTracker((3*PI)/4) 347 | 348 | self.wait(2) 349 | 350 | self.play( 351 | Rotating(arm,radians=-PI/2,about_point=np.array([0,0,0])), 352 | x_value.set_value,PI/4,rate_func=linear,run_time=2.5 353 | ) 354 | 355 | self.wait(2) 356 | 357 | self.play(ShowCreation(tan_func_tex),ShowCreation(tanlab)) 358 | 359 | x_value=ValueTracker(PI/4) 360 | 361 | self.wait(3) 362 | 363 | self.play(Transform(tanlab,yoverx)) 364 | 365 | self.wait() 366 | 367 | #self.play( 368 | # Rotating(arm,radians=PI/2,about_point=np.array([0,0,0])), 369 | # x_value.set_value,(3*PI)/4,rate_func=linear,run_time=10 370 | # ) 371 | 372 | #self.wait(4) 373 | 374 | #x_value=ValueTracker((3*PI)/4) 375 | 376 | #self.play( 377 | # Rotating(arm,radians=-(3*PI)/4,about_point=np.array([0,0,0])), 378 | # x_value.set_value,0,rate_func=linear,run_time=3 379 | # ) 380 | 381 | #self.wait(2) 382 | 383 | self.play( 384 | Rotating(arm,radians=-PI/4,about_point=np.array([0,0,0])), 385 | x_value.set_value,0,rate_func=linear,run_time=3 386 | ) 387 | self.wait(3) 388 | x_value=ValueTracker(0) 389 | 390 | self.play( 391 | Rotating(arm,radians=PI/2,about_point=np.array([0,0,0])), 392 | x_value.set_value,PI/2,rate_func=linear,run_time=3 393 | ) 394 | 395 | self.remove(tan_func_tex) 396 | self.add(repl) 397 | 398 | self.wait(3) 399 | 400 | self.remove(repl) 401 | self.add(tan_func_tex) 402 | 403 | x_value=ValueTracker(PI/2) 404 | 405 | self.play( 406 | Rotating(arm,radians=-PI/4,about_point=np.array([0,0,0])), 407 | x_value.set_value,PI/4,rate_func=linear,run_time=1.2 408 | ) 409 | 410 | self.wait(2) 411 | 412 | x_value=ValueTracker(PI/4) 413 | 414 | self.play( 415 | Rotating(arm,radians=PI/2,about_point=np.array([0,0,0])), 416 | x_value.set_value,(3*PI)/4,rate_func=linear,run_time=2 417 | ) 418 | 419 | self.wait(2) 420 | 421 | x_value=ValueTracker((3*PI)/4) 422 | 423 | self.play( 424 | Rotating(arm,radians=PI/2,about_point=np.array([0,0,0])), 425 | x_value.set_value,(5*PI)/4,rate_func=linear,run_time=2 426 | ) 427 | 428 | self.wait(2) 429 | 430 | x_value=ValueTracker((5*PI)/4) 431 | 432 | self.play( 433 | Rotating(arm,radians=PI/2,about_point=np.array([0,0,0])), 434 | x_value.set_value,(7*PI)/4,rate_func=linear,run_time=2 435 | ) 436 | 437 | self.wait(2) 438 | 439 | x_value=ValueTracker((7*PI)/4) 440 | 441 | self.play( 442 | Rotating(arm,radians=PI/2,about_point=np.array([0,0,0])), 443 | x_value.set_value,(9*PI)/4,rate_func=linear,run_time=2 444 | ) 445 | 446 | self.wait(4) 447 | 448 | #python -m manim MITintegral\tanint\tanint.py NotesOnFunc -pl 449 | class NotesOnFunc(Scene): 450 | def construct(self): 451 | ourfunc=TextMobject("$$f(x)=\\frac{1}{\\tan^{\sqrt{2020}}(x)+1}$$") 452 | vertline=Line(np.array([3,2,0]),np.array([3,-2,0])) 453 | horline=Line(np.array([2,1.5,0]),np.array([4,1.5,0])) 454 | 455 | fofx=TextMobject("$$f(x)$$") 456 | fofx.next_to(horline,UP,0.1) 457 | fofx.shift(0.65*RIGHT) 458 | xout=TextMobject("$$x$$") 459 | xout.next_to(horline,UP,0.1) 460 | xout.shift(0.4*LEFT) 461 | 462 | horline.shift(RIGHT*0.35) 463 | 464 | #Values 465 | #Zero 466 | xzero=TextMobject("$$0$$") 467 | fxzero=TextMobject("$$1$$") 468 | zeroourfunc=TextMobject("$$f(0)=\\frac{1}{\\tan^{\sqrt{2020}}(0)+1}$$") 469 | zeroourfuncup=TextMobject("$$f(0)=\\frac{1}{0+1}$$") 470 | xzero.next_to(xout,DOWN) 471 | fxzero.next_to(fofx,DOWN) 472 | zeroourfunc.shift(LEFT*2) 473 | zeroourfuncup.shift(LEFT*2) 474 | 475 | #pi over four 476 | xpifour=TextMobject("$$\\frac{\pi}{4}$$") 477 | fxpifour=TextMobject("$$\\frac{1}{2}$$") 478 | pifourourfunc=TextMobject("$$f(\\frac{\pi}{4})=\\frac{1}{\\tan^{\sqrt{2020}}(\\frac{\pi}{4})+1}$$") 479 | pifourourfuncup=TextMobject("$$f(\\frac{\pi}{4})=\\frac{1}{1+1}$$") 480 | xpifour.next_to(xzero,DOWN) 481 | fxpifour.next_to(fxzero,DOWN) 482 | pifourourfunc.move_to(zeroourfunc.get_center()) 483 | pifourourfuncup.move_to(zeroourfunc.get_center()) 484 | 485 | #pi over two 486 | xpitwo=TextMobject("$$\\frac{\pi}{2}$$") 487 | fxpitwo=TextMobject("$$\\frac{1}{\infty}$$") 488 | pitwoourfunc=TextMobject("$$f(\\frac{\pi}{2})=\\frac{1}{\\tan^{\sqrt{2020}}(\\frac{\pi}{2})+1}$$") 489 | pitwoourfuncup=TextMobject("$$f(\\frac{\pi}{2})=\\frac{1}{\infty+1}$$") 490 | xpitwo.next_to(xpifour,DOWN*1.8) 491 | fxpitwo.next_to(fxpifour,DOWN) 492 | pitwoourfunc.move_to(zeroourfunc.get_center()) 493 | pitwoourfuncup.move_to(zeroourfunc.get_center()) 494 | 495 | inftyiszero=TextMobject("$$0$$") 496 | inftyiszero.move_to(fxpitwo.get_center()) 497 | 498 | self.play(Write(ourfunc)) 499 | self.wait() 500 | self.play(ApplyMethod(ourfunc.shift,LEFT*2)) 501 | self.wait() 502 | self.play(ShowCreation(vertline),ShowCreation(horline),Write(fofx),Write(xout)) 503 | self.wait(2) 504 | self.play(Write(xzero),Transform(ourfunc,zeroourfunc)) 505 | self.wait() 506 | self.play(Transform(ourfunc,zeroourfuncup)) 507 | self.wait() 508 | self.play(Write(fxzero)) 509 | self.wait() 510 | self.play(Write(xpifour),Transform(ourfunc,pifourourfunc)) 511 | self.wait() 512 | self.play(Transform(ourfunc,pifourourfuncup)) 513 | self.wait() 514 | self.play(Write(fxpifour)) 515 | self.wait() 516 | self.play(Write(xpitwo),Transform(ourfunc,pitwoourfunc)) 517 | self.wait() 518 | self.play(Transform(ourfunc,pitwoourfuncup)) 519 | self.wait() 520 | self.play(Write(fxpitwo)) 521 | self.wait() 522 | self.play(Transform(fxpitwo,inftyiszero)) 523 | self.wait(4) 524 | 525 | #python -m manim MITintegral\tanint\tanint.py GraphGuess -pl 526 | class GraphGuess(GraphScene,MovingCameraScene): 527 | CONFIG = { 528 | "x_min" : -3, 529 | "x_max" : 3, 530 | "y_min" : -2, 531 | "y_max" : 2, 532 | "x_tick_frequency": 1, 533 | "y_tick_frequency": 2, 534 | "y_axis_height":8, 535 | "x_axis_width":12, 536 | "graph_origin" : ORIGIN, 537 | "function_color" : RED , 538 | "axes_color" : GREEN, 539 | "y_labeled_nums" :range(-1,2,1), 540 | "num_graph_anchor_points": 200, 541 | 542 | } 543 | 544 | def setup(self): 545 | GraphScene.setup(self) 546 | MovingCameraScene.setup(self) 547 | 548 | def construct(self): 549 | 550 | 551 | bar1=Line(np.array([2,-10,0]),np.array([2,10,0]),stroke_color=GREEN,stroke_opacity=0.5) 552 | bar2=Line(np.array([4,-10,0]),np.array([4,10,0]),stroke_color=GREEN,stroke_opacity=0.5) 553 | bar3=Line(np.array([-2,-10,0]),np.array([-2,10,0]),stroke_color=GREEN,stroke_opacity=0.5) 554 | bar4=Line(np.array([-4,-10,0]),np.array([-4,10,0]),stroke_color=GREEN,stroke_opacity=0.5) 555 | 556 | bars=VGroup(bar1,bar2,bar3,bar4) 557 | 558 | pi=TextMobject("$$\pi$$") 559 | #pi.scale(0.5) 560 | pi.move_to(np.array([2,0,0])+0.3*UP+0.5*RIGHT) 561 | npi=TextMobject("$$-\pi$$") 562 | #npi.scale(0.5) 563 | npi.move_to(np.array([-2,0,0])+0.3*UP+0.5*RIGHT) 564 | tpi=TextMobject("$$2\pi$$") 565 | #tpi.scale(0.5) 566 | tpi.move_to(np.array([4,0,0])+0.3*UP+0.5*RIGHT) 567 | ntpi=TextMobject("$$-2\pi$$") 568 | #ntpi.scale(0.5) 569 | ntpi.move_to(np.array([-4,0,0])+0.3*UP+0.5*RIGHT) 570 | 571 | labels=VGroup(pi,npi,ntpi,tpi) 572 | 573 | oneup=Line(np.array([-20,2,0]),np.array([20,2,0]),stroke_color=GREEN,stroke_opacity=0.5) 574 | onedown=Line(np.array([-20,-2,0]),np.array([20,-2,0]),stroke_color=GREEN,stroke_opacity=0.5) 575 | cross=VGroup(oneup,onedown) 576 | cross.set_color(GREEN) 577 | 578 | zerodot1=Dot() 579 | zerodot1.move_to(np.array([0,2,0])) 580 | zerodot2=Dot() 581 | zerodot2.move_to(np.array([2,2,0])) 582 | zerodot3=Dot() 583 | zerodot3.move_to(np.array([-2,2,0])) 584 | zerodot4=Dot() 585 | zerodot4.move_to(np.array([4,2,0])) 586 | zerodot5=Dot() 587 | zerodot5.move_to(np.array([-4,2,0])) 588 | 589 | zerodots=VGroup(zerodot1,zerodot2,zerodot3,zerodot4,zerodot5) 590 | zerodots.set_color(BLUE) 591 | 592 | pidot1=Dot() 593 | pidot1.move_to(np.array([1,0,0])) 594 | pidot2=Dot() 595 | pidot2.move_to(np.array([3,0,0])) 596 | pidot3=Dot() 597 | pidot3.move_to(np.array([-1,0,0])) 598 | pidot4=Dot() 599 | pidot4.move_to(np.array([-3,0,0])) 600 | pidot5=Dot() 601 | pidot5.move_to(np.array([5,0,0])) 602 | 603 | pidots=VGroup(pidot1,pidot2,pidot3,pidot4,pidot5) 604 | pidots.set_color(BLUE) 605 | 606 | middot1=Dot() 607 | middot1.move_to(np.array([0.5,1,0])) 608 | middot2=Dot() 609 | middot2.move_to(np.array([2.5,1,0])) 610 | middot3=Dot() 611 | middot3.move_to(np.array([4.5,1,0])) 612 | middot4=Dot() 613 | middot4.move_to(np.array([-1.5,1,0])) 614 | middot5=Dot() 615 | middot5.move_to(np.array([-3.5,1,0])) 616 | 617 | middots=VGroup(middot1,middot2,middot3,middot4,middot5) 618 | middots.set_color(BLUE) 619 | 620 | 621 | 622 | 623 | self.setup_axes(animate=True) 624 | 625 | func_graph_r1=self.get_graph(self.thefunc,x_min=0,x_max=0.5) 626 | func_graph_r2=self.get_graph(self.thefunc,x_min=1,x_max=1.5) 627 | func_graph_r3=self.get_graph(self.thefunc,x_min=2,x_max=2.5) 628 | func_graph_r4=self.get_graph(self.thefunc,x_min=-1,x_max=-0.5) 629 | func_graph_r5=self.get_graph(self.thefunc,x_min=-2,x_max=-1.5) 630 | 631 | func_graph2_r1=self.get_graph(self.thefunc2,x_min=0,x_max=0.5) 632 | func_graph2_r2=self.get_graph(self.thefunc2,x_min=1,x_max=1.5) 633 | func_graph2_r3=self.get_graph(self.thefunc2,x_min=2,x_max=2.5) 634 | func_graph2_r4=self.get_graph(self.thefunc2,x_min=-1,x_max=-0.5) 635 | func_graph2_r5=self.get_graph(self.thefunc2,x_min=-2,x_max=-1.5) 636 | 637 | func_graph3_r1=self.get_graph(self.thefunc3,x_min=0,x_max=0.5) 638 | func_graph3_r2=self.get_graph(self.thefunc3,x_min=1,x_max=1.5) 639 | func_graph3_r3=self.get_graph(self.thefunc3,x_min=2,x_max=2.5) 640 | func_graph3_r4=self.get_graph(self.thefunc3,x_min=-1,x_max=-0.5) 641 | func_graph3_r5=self.get_graph(self.thefunc3,x_min=-2,x_max=-1.5) 642 | 643 | func_graph4_r1=self.get_graph(self.thefunc4,x_min=0,x_max=0.5) 644 | func_graph4_r2=self.get_graph(self.thefunc4,x_min=1,x_max=1.5) 645 | func_graph4_r3=self.get_graph(self.thefunc4,x_min=2,x_max=2.5) 646 | func_graph4_r4=self.get_graph(self.thefunc4,x_min=-1,x_max=-0.5) 647 | func_graph4_r5=self.get_graph(self.thefunc4,x_min=-2,x_max=-1.5) 648 | 649 | region1=Rectangle(width=1,height=20,fill_color=BLUE,fill_opacity=0.2,stroke_color=BLUE,stroke_opacity=0.6) 650 | region1.shift(RIGHT*0.5+RIGHT*1) 651 | region2=Rectangle(width=1,height=20,fill_color=BLUE,fill_opacity=0.2,stroke_color=BLUE,stroke_opacity=0.6) 652 | region2.shift(RIGHT*0.5+RIGHT*3) 653 | region3=Rectangle(width=1,height=20,fill_color=BLUE,fill_opacity=0.2,stroke_color=BLUE,stroke_opacity=0.6) 654 | region3.shift(RIGHT*0.5+RIGHT*5) 655 | region4=Rectangle(width=1,height=20,fill_color=BLUE,fill_opacity=0.2,stroke_color=BLUE,stroke_opacity=0.6) 656 | region4.shift(RIGHT*0.5+LEFT*1) 657 | region5=Rectangle(width=1,height=20,fill_color=BLUE,fill_opacity=0.2,stroke_color=BLUE,stroke_opacity=0.6) 658 | region5.shift(RIGHT*0.5+LEFT*3) 659 | 660 | regions=VGroup(region1,region2,region3,region4,region5) 661 | 662 | piover2lab=TextMobject("$$\\frac{\pi}{2}$$") 663 | piover2lab.move_to(np.array([1,0,0])+0.4*DOWN) 664 | piover2lab.scale(0.35) 665 | 666 | primeregion=Rectangle(width=1,height=2,stroke_color=BLUE,stroke_opacity=0.6) 667 | primeregion.shift(RIGHT*0.5+UP) 668 | 669 | finreg=Rectangle(width=1,height=1,stroke_color=BLUE,stroke_opacity=0.6) 670 | finreg.shift(RIGHT*0.5+UP*0.5) 671 | 672 | 673 | self.wait() 674 | self.play(ShowCreation(labels)) 675 | self.wait() 676 | self.play(ShowCreation(bars)) 677 | self.play(ShowCreation(cross)) 678 | self.wait() 679 | self.play(ShowCreation(zerodots)) 680 | self.wait(2) 681 | self.play(ShowCreation(pidots)) 682 | self.wait(2) 683 | self.play( 684 | ShowCreation(func_graph_r1), 685 | ShowCreation(func_graph_r2), 686 | ShowCreation(func_graph_r3), 687 | ShowCreation(func_graph_r4), 688 | ShowCreation(func_graph_r5) 689 | ) 690 | self.wait(2) 691 | self.play( 692 | Transform(func_graph_r1,func_graph2_r1), 693 | Transform(func_graph_r2,func_graph2_r2), 694 | Transform(func_graph_r3,func_graph2_r3), 695 | Transform(func_graph_r4,func_graph2_r4), 696 | Transform(func_graph_r5,func_graph2_r5) 697 | ) 698 | self.wait(2) 699 | self.play( 700 | Transform(func_graph_r1,func_graph3_r1), 701 | Transform(func_graph_r2,func_graph3_r2), 702 | Transform(func_graph_r3,func_graph3_r3), 703 | Transform(func_graph_r4,func_graph3_r4), 704 | Transform(func_graph_r5,func_graph3_r5) 705 | ) 706 | 707 | 708 | self.wait(4) 709 | 710 | self.play(ShowCreation(middots)) 711 | self.wait(2) 712 | self.play( 713 | Transform(func_graph_r1,func_graph4_r1), 714 | Transform(func_graph_r2,func_graph4_r2), 715 | Transform(func_graph_r3,func_graph4_r3), 716 | Transform(func_graph_r4,func_graph4_r4), 717 | Transform(func_graph_r5,func_graph4_r5) 718 | ) 719 | self.wait(2) 720 | self.play(ShowCreation(regions)) 721 | self.wait(2) 722 | self.play(FadeOut(regions)) 723 | self.wait(2) 724 | self.play( 725 | 726 | self.camera_frame.scale,0.45, 727 | self.camera_frame.move_to,RIGHT+UP, 728 | 729 | ApplyMethod(middot1.scale,0.45), 730 | ApplyMethod(middot2.scale,0.45), 731 | ApplyMethod(middot3.scale,0.45), 732 | ApplyMethod(middot4.scale,0.45), 733 | ApplyMethod(middot5.scale,0.45), 734 | 735 | ApplyMethod(zerodot1.scale,0.45), 736 | ApplyMethod(zerodot2.scale,0.45), 737 | ApplyMethod(zerodot3.scale,0.45), 738 | ApplyMethod(zerodot4.scale,0.45), 739 | ApplyMethod(zerodot5.scale,0.45), 740 | 741 | 742 | ApplyMethod(pidot1.scale,0.45), 743 | ApplyMethod(pidot2.scale,0.45), 744 | ApplyMethod(pidot3.scale,0.45), 745 | ApplyMethod(pidot4.scale,0.45), 746 | ApplyMethod(pidot5.scale,0.45), 747 | 748 | ApplyMethod(pi.scale,0.45), 749 | ApplyMethod(npi.scale,0.45), 750 | ApplyMethod(ntpi.scale,0.45), 751 | ApplyMethod(tpi.scale,0.45), 752 | 753 | 754 | ApplyMethod(pi.scale,0.45), 755 | ApplyMethod(npi.scale,0.45), 756 | Write(piover2lab), 757 | 758 | FadeOut(cross), 759 | 760 | FadeOut(bars) 761 | 762 | ) 763 | 764 | self.play( 765 | ApplyMethod(pi.shift,LEFT*0.2+DOWN*0.1), 766 | ApplyMethod(npi.shift,LEFT*0.2+DOWN*0.1), 767 | run_time=0.5 768 | ) 769 | 770 | self.wait(2) 771 | 772 | 773 | #Area Stuff 774 | flat_graph=self.get_graph(self.flat,x_min=0,x_max=0.5) 775 | top_graph=self.get_graph(self.thefuncshifted,x_min=2,x_max=2.5) 776 | 777 | 778 | flat_graph_area=self.get_area(flat_graph,0,0.25) 779 | graph_area=self.get_area(func_graph4_r1,0.25,0.5) 780 | top_graph_area=self.get_area(top_graph,2,2.25) 781 | 782 | top_graph_area.shift(LEFT*4+UP) 783 | 784 | 785 | self.play(ShowCreation(primeregion)) 786 | self.wait(2) 787 | 788 | self.play( 789 | ShowCreation(flat_graph_area), 790 | ShowCreation(graph_area), 791 | ShowCreation(top_graph_area)) 792 | self.wait(2) 793 | 794 | self.play(ApplyMethod(func_graph4_r1.set_color,YELLOW)) 795 | 796 | self.wait() 797 | 798 | self.play(ApplyMethod(func_graph4_r1.set_color,BLUE)) 799 | 800 | self.wait() 801 | 802 | self.play( 803 | Rotating(top_graph_area,radians=-PI,about_point=primeregion.get_center()), 804 | rate_func=linear,run_time=1.5 805 | ) 806 | 807 | self.wait(2) 808 | 809 | self.play(Transform(primeregion,finreg)) 810 | 811 | area_width=VGroup(flat_graph_area,graph_area) 812 | 813 | width_brace=Brace(area_width,DOWN) 814 | width_lab=TextMobject("$$w$$") 815 | w_tot=VGroup(width_brace,width_lab) 816 | w_tot.set_color(BLUE) 817 | 818 | height_brace=Brace(top_graph_area,RIGHT) 819 | height_lab=TextMobject("$$h$$") 820 | h_tot=VGroup(height_brace,height_lab) 821 | h_tot.set_color(BLUE) 822 | 823 | self.wait() 824 | self.play(ShowCreation(width_brace)) 825 | self.wait() 826 | self.play(ShowCreation(height_brace)) 827 | 828 | self.wait(4) 829 | 830 | def thefunc(self,x): 831 | return 1/(np.tan(x*PI)+1) 832 | 833 | def thefunc2(self,x): 834 | return 1/(np.power(np.tan(x*PI),5)+1) 835 | 836 | def thefunc3(self,x): 837 | return 1/(np.tan(x*PI)*3+1) 838 | 839 | def thefunc4(self,x): 840 | return 1/(np.tan(x*PI)+1) 841 | 842 | def flat(self,x): 843 | return 0.5 844 | 845 | def thefuncshifted(self,x): 846 | return 1/(np.tan(x*PI)+1)-0.5 847 | 848 | 849 | #python -m manim MITintegral\tanint\tanint.py ZoomPractice -pl 850 | class ZoomPractice(MovingCameraScene): 851 | def construct(self): 852 | dot1=Dot() 853 | dot2=Dot() 854 | dot2.shift(RIGHT) 855 | 856 | self.play(ShowCreation(dot1),ShowCreation(dot2)) 857 | self.play( 858 | 859 | self.camera_frame.scale,0.5, 860 | self.camera_frame.move_to,dot2.get_center() 861 | ) 862 | self.wait(2) 863 | self.play(ApplyMethod(dot1.set_color,RED)) 864 | self.wait(4) 865 | 866 | #python -m manim MITintegral\tanint\tanint.py OddFunctions -pl 867 | class OddFunctions(GraphScene,MovingCameraScene): 868 | CONFIG = { 869 | "x_min" : -9, 870 | "x_max" : 9, 871 | "y_min" : -6, 872 | "y_max" : 6, 873 | "x_tick_frequency": 1, 874 | "y_tick_frequency": 2, 875 | "y_axis_height":8, 876 | "x_axis_width":12, 877 | "graph_origin" : ORIGIN, 878 | "function_color" : RED , 879 | "axes_color" : WHITE, 880 | #"x_labeled_nums" :range(-9,9,3), 881 | #"y_labeled_nums" :range(-6,6,2), 882 | "num_graph_anchor_points": 200, 883 | "always_update_mobjects": True, 884 | "always_continually_update": True, 885 | 886 | } 887 | 888 | def setup(self): 889 | GraphScene.setup(self) 890 | MovingCameraScene.setup(self) 891 | 892 | def construct(self): 893 | odd=TextMobject("Odd") 894 | functions=TextMobject("Functions") 895 | functions.next_to(odd,RIGHT) 896 | odd_functions=VGroup(odd,functions) 897 | odd_functions.move_to(ORIGIN) 898 | odd_functions.scale(2) 899 | nothing=TextMobject("") 900 | 901 | #Dots 902 | dotr=Dot() 903 | dotl=Dot() 904 | dotr.set_color(GREEN) 905 | dotl.set_color(GREEN) 906 | 907 | self.play(Write(odd_functions)) 908 | self.wait(2) 909 | self.play(ApplyMethod(odd.set_color,BLUE),run_time=0.3) 910 | self.wait(2) 911 | self.play(FadeOut(odd_functions),run_time=0.5) 912 | #self.play(Transform(odd_functions,nothing)) 913 | #self.play(ApplyMethod(odd_functions.scale,0.5)) 914 | #self.play(ApplyMethod(odd_functions.shift,RIGHT*3+UP*2)) 915 | 916 | self.setup_axes(animate=True) 917 | 918 | odd1_graph=self.get_graph(self.odd1,x_min=-9,x_max=9) 919 | odd2_graph=self.get_graph(self.odd2,x_min=-9,x_max=9) 920 | odd3_graph=self.get_graph(self.odd3,x_min=-9,x_max=9) 921 | odd4_graph=self.get_graph(self.odd4,x_min=-9,x_max=9) 922 | 923 | self.play(ShowCreation(odd1_graph),run_time=3) 924 | self.wait(1.5) 925 | self.play(Transform(odd1_graph,odd2_graph)) 926 | self.wait(1.5) 927 | self.play(Transform(odd1_graph,odd3_graph)) 928 | self.wait(1.5) 929 | self.play(Transform(odd1_graph,odd4_graph)) 930 | 931 | self.wait(4) 932 | 933 | #DASHED LINE STUFF 934 | 935 | #Origins of the dotted line (right and left respectively) 936 | Origin=self.coords_to_point(2,0) 937 | Origin2=self.coords_to_point(-2,0) 938 | 939 | #Create the dots 940 | Point1=Dot(color=RED) 941 | Point2=Dot(color=RED) 942 | 943 | #Create the dots at the ORIGIN and move them to the origins of the dotted lines 944 | self.play( 945 | ShowCreation(Point1), 946 | ShowCreation(Point2) 947 | ) 948 | 949 | self.play( 950 | ApplyMethod(Point1.move_to,self.coords_to_point(2,0)), 951 | ApplyMethod(Point2.move_to,self.coords_to_point(-2,0)) 952 | ) 953 | 954 | #Define lines that go from the origins of the lines to the dots 955 | line=DashedLine(Origin,Point1) 956 | line2=DashedLine(Origin2,Point2) 957 | 958 | #Define functions that re-define the line as new_line 959 | def update_line(line): 960 | new_line=DashedLine(Origin,Point1) 961 | line.become(new_line) 962 | 963 | def update_line2(line): 964 | new_line2=DashedLine(Origin2,Point2) 965 | line2.become(new_line2) 966 | 967 | #Add in the lines 968 | self.add(line,line2) 969 | 970 | #Move the dots the their first position 971 | self.play( 972 | 973 | #Use UpdateFromFunc to say "turn line into new line" 974 | UpdateFromFunc(line,update_line), 975 | 976 | #Move the point to the coordinates defined by the function 977 | ApplyMethod(Point1.move_to,self.coords_to_point(2,7*np.arctan((2)/3)*np.exp(-np.power((2)/3,2)))), 978 | 979 | UpdateFromFunc(line2,update_line2), 980 | ApplyMethod(Point2.move_to,self.coords_to_point(-2,7*np.arctan((-2)/3)*np.exp(-np.power((-2)/3,2)))), 981 | 982 | rate_func=smooth, 983 | run_time=2, 984 | ) 985 | self.wait(2) 986 | 987 | #Move the dots back to the number line 988 | self.play( 989 | 990 | #Use UpdateFromFunc to say "turn line into new line" 991 | UpdateFromFunc(line,update_line), 992 | 993 | #Move the point to the coordinates defined by the function 994 | ApplyMethod(Point1.move_to,self.coords_to_point(2,0)), 995 | 996 | UpdateFromFunc(line2,update_line2), 997 | ApplyMethod(Point2.move_to,self.coords_to_point(-2,0)), 998 | 999 | rate_func=smooth, 1000 | run_time=2, 1001 | ) 1002 | 1003 | #Remove the lines 1004 | self.remove(line,line2) 1005 | 1006 | #Move dots to their new starting position 1007 | self.play( 1008 | ApplyMethod(Point1.move_to,self.coords_to_point(4,0)), 1009 | ApplyMethod(Point2.move_to,self.coords_to_point(-4,0)), 1010 | run_time=0.7 1011 | ) 1012 | 1013 | #Re-define the starting position of the dotted lines 1014 | Origin=self.coords_to_point(4,0) 1015 | Origin2=self.coords_to_point(-4,0) 1016 | 1017 | #Add in the lines again 1018 | self.add(line,line2) 1019 | 1020 | #Move the dots the the graph in position 2 1021 | self.play( 1022 | 1023 | #Use UpdateFromFunc to say "turn line into new line" 1024 | UpdateFromFunc(line,update_line), 1025 | 1026 | #Move the point to the coordinates defined by the function 1027 | ApplyMethod(Point1.move_to,self.coords_to_point(4,7*np.arctan((4)/3)*np.exp(-np.power((4)/3,2)))), 1028 | 1029 | UpdateFromFunc(line2,update_line2), 1030 | ApplyMethod(Point2.move_to,self.coords_to_point(-4,7*np.arctan((-4)/3)*np.exp(-np.power((-4)/3,2)))), 1031 | 1032 | rate_func=smooth, 1033 | run_time=1, 1034 | ) 1035 | 1036 | self.wait(2) 1037 | 1038 | pospos=TextMobject("$$(+,+)$$") 1039 | negneg=TextMobject("$$(-,-)$$") 1040 | 1041 | pospos.move_to(self.coords_to_point(4,7*np.arctan((4)/3)*np.exp(-np.power((4)/3,2)))+RIGHT+UP*0.5) 1042 | negneg.move_to(self.coords_to_point(-4,7*np.arctan((-4)/3)*np.exp(-np.power((-4)/3,2)))+LEFT+DOWN*0.5) 1043 | 1044 | pospos.set_color(GREEN) 1045 | negneg.set_color(RED) 1046 | 1047 | self.play(Write(pospos)) 1048 | self.wait() 1049 | self.play(Write(negneg)) 1050 | 1051 | self.wait(2) 1052 | 1053 | left_f=TextMobject("$$f($$") 1054 | left_f_x=TextMobject("$$+x$$") 1055 | left_f_par=TextMobject("$$)=$$") 1056 | left_f_x_neg=TextMobject("$$-x$$") 1057 | left_f_x_neg.set_color(RED) 1058 | 1059 | right_f=TextMobject("$$f(x)$$") 1060 | right_f_pos=TextMobject("$$+$$") 1061 | right_f_neg=TextMobject("$$-$$") 1062 | right_f_neg.set_color(RED) 1063 | 1064 | left_f.move_to(LEFT*3+UP*2) 1065 | left_f_x.next_to(left_f,RIGHT,0.08) 1066 | left_f_x_neg.next_to(left_f,RIGHT,0.08) 1067 | left_f_par.next_to(left_f_x,RIGHT,0.08) 1068 | 1069 | right_f_neg.next_to(left_f_par,RIGHT,0.08) 1070 | right_f_pos.next_to(left_f_par,RIGHT,0.08) 1071 | right_f.next_to(right_f_neg,RIGHT,0.08) 1072 | 1073 | whole_eq=VGroup(left_f,left_f_x,left_f_par,left_f_x_neg,right_f,right_f_neg,right_f_pos) 1074 | 1075 | whole_eq.shift(LEFT*1.4) 1076 | 1077 | pos_group=VGroup(left_f,left_f_x,left_f_par,right_f,right_f_pos) 1078 | self.play(Write(pos_group)) 1079 | 1080 | self.wait(2) 1081 | 1082 | self.play(ApplyMethod(left_f_x.set_color,GREEN)) 1083 | self.wait() 1084 | self.play(ApplyMethod(right_f_pos.set_color,GREEN)) 1085 | self.wait(2) 1086 | self.play(Transform(left_f_x,left_f_x_neg)) 1087 | self.wait() 1088 | self.play(Transform(right_f_pos,right_f_neg)) 1089 | 1090 | self.wait(2) 1091 | 1092 | center=Dot() 1093 | center.set_color(YELLOW) 1094 | 1095 | self.play(ShowCreation(center)) 1096 | 1097 | self.wait(2) 1098 | 1099 | tanfunc_graph=self.get_graph(self.tanfunc,x_min=0,x_max=2) 1100 | 1101 | #self.play( 1102 | #self.camera_frame.scale,0.45, 1103 | #self.camera_frame.move_to,RIGHT+UP, 1104 | #FadeOut(center), 1105 | #FadeOut(odd1_graph) 1106 | #) 1107 | 1108 | self.play( 1109 | FadeOut(odd1_graph), 1110 | FadeOut(pospos), 1111 | FadeOut(negneg), 1112 | FadeOut(Point1), 1113 | FadeOut(Point2), 1114 | FadeOut(line), 1115 | FadeOut(line2) 1116 | ) 1117 | 1118 | #labels 1119 | pi=TextMobject("$$\\frac{\pi}{2}$$") 1120 | tpi=TextMobject("$$\pi$$") 1121 | thpi=TextMobject("$$\\frac{3\pi}{2}$$") 1122 | fpi=TextMobject("$$2\pi$$") 1123 | npi=TextMobject("$$-\\frac{\pi}{2}$$") 1124 | ntpi=TextMobject("$$-\pi$$") 1125 | nthpi=TextMobject("$$-\\frac{3\pi}{2}$$") 1126 | nfpi=TextMobject("$$-2\pi$$") 1127 | one=TextMobject("$$\\frac{1}{2}$$") 1128 | two=TextMobject("$$1$$") 1129 | none=TextMobject("$$-\\frac{1}{2}$$") 1130 | ntwo=TextMobject("$$-1$$") 1131 | 1132 | #Move Labelspi 1133 | pi.move_to(self.coords_to_point(2,0)+DOWN*0.5) 1134 | tpi.move_to(self.coords_to_point(4,0)+DOWN*0.5) 1135 | thpi.move_to(self.coords_to_point(6,0)+DOWN*0.5) 1136 | fpi.move_to(self.coords_to_point(8,0)+DOWN*0.5) 1137 | npi.move_to(self.coords_to_point(-2,0)+DOWN*0.5) 1138 | ntpi.move_to(self.coords_to_point(-4,0)+DOWN*0.5) 1139 | nthpi.move_to(self.coords_to_point(-6,0)+DOWN*0.5) 1140 | nfpi.move_to(self.coords_to_point(-8,0)+DOWN*0.5) 1141 | one.move_to(self.coords_to_point(0,2)+LEFT*0.25) 1142 | two.move_to(self.coords_to_point(0,4)+LEFT*0.25) 1143 | none.move_to(self.coords_to_point(0,-2)+LEFT*0.5) 1144 | ntwo.move_to(self.coords_to_point(0,-4)+LEFT*0.5) 1145 | 1146 | #Scale labels 1147 | pi.scale(0.7) 1148 | tpi.scale(0.7) 1149 | thpi.scale(0.7) 1150 | fpi.scale(0.7) 1151 | npi.scale(0.7) 1152 | ntpi.scale(0.7) 1153 | nthpi.scale(0.7) 1154 | nfpi.scale(0.7) 1155 | one.scale(0.7) 1156 | two.scale(0.7) 1157 | none.scale(0.7) 1158 | ntwo.scale(0.7) 1159 | 1160 | #gather labels 1161 | pilabels=VGroup(pi,tpi,thpi,npi,ntpi,nthpi,one,two,none,ntwo,fpi,nfpi) 1162 | 1163 | self.play(ShowCreation(pilabels)) 1164 | 1165 | self.wait() 1166 | 1167 | self.play(ApplyMethod(center.move_to,self.coords_to_point(1,2))) 1168 | 1169 | self.play(ShowCreation(tanfunc_graph)) 1170 | 1171 | self.wait(2) 1172 | 1173 | self.play(ApplyMethod(tanfunc_graph.move_to,self.coords_to_point(1,0)), 1174 | ApplyMethod(center.move_to,self.coords_to_point(1,0))) 1175 | 1176 | self.wait() 1177 | 1178 | self.play(ApplyMethod(tanfunc_graph.move_to,self.coords_to_point(0,0)), 1179 | ApplyMethod(center.move_to,self.coords_to_point(0,0))) 1180 | 1181 | self.wait(2) 1182 | 1183 | mainint=TextMobject("$$\\frac{1}{\\tan^{\sqrt{2020}}(x)+1}$$") 1184 | mainint.move_to(RIGHT*3.6+UP*2) 1185 | half=TextMobject("$$-\\frac{1}{2}$$") 1186 | half.next_to(mainint,RIGHT,0.1) 1187 | #half.set_color(BLUE) 1188 | mainint_shift=TextMobject("$$\\frac{1}{\\tan^{\sqrt{2020}}(x+\\frac{\pi}{4})+1}$$") 1189 | mainint_shift.next_to(half,LEFT,0.1) 1190 | 1191 | mainint.shift(DOWN*0.08) 1192 | mainint_shift.shift(DOWN*0.08) 1193 | 1194 | half.shift(UP*0.04) 1195 | 1196 | self.play(ShowCreation(mainint)) 1197 | self.wait() 1198 | self.play(ShowCreation(half)) 1199 | self.wait() 1200 | self.play(Transform(mainint,mainint_shift)) 1201 | self.wait(4) 1202 | 1203 | 1204 | 1205 | 1206 | def odd1(self,x): 1207 | return np.power((x)/3,3) 1208 | 1209 | def odd2(self,x): 1210 | return -np.power(x,3)+3*x 1211 | 1212 | def odd3(self,x): 1213 | return np.sin(x)*np.power(x,2) 1214 | 1215 | def odd4(self,x): 1216 | return 7*np.arctan((x)/3)*np.exp(-np.power((x)/3,2)) 1217 | 1218 | def tanfunc(self,x): 1219 | return 4/(np.power(np.tan((x/4)*PI),2)+1) 1220 | 1221 | #python -m manim MITintegral\tanint\tanint.py NegXAttempt -pl 1222 | class NegXAttempt(Scene): 1223 | def construct(self): 1224 | mainint=TextMobject("$$\\frac{1}{\\tan^{\sqrt{2020}}(x+\\frac{\pi}{4})+1}-\\frac{1}{2}$$") 1225 | #mainint_not=TextMobject("$$\\frac{1}{\Big(\\tan(x+\\frac{\pi}{4})\Big)^{n}+1}-\\frac{1}{2}$$") 1226 | fofx=TextMobject("$$f(x)=$$") 1227 | fofx.shift(UP*0.1) 1228 | fofx.scale(0.8) 1229 | mainint.scale(0.8) 1230 | #mainint_not.scale(0.8) 1231 | fofx.next_to(mainint,LEFT,0.1) 1232 | 1233 | total=VGroup(mainint,fofx) 1234 | #total2=VGroup(mainint_not,fofx) 1235 | #mainint.shift(RIGHT*0.4) 1236 | total.move_to(np.array([0,0,0])) 1237 | #total2.move_to(np.array([0,0,0])) 1238 | 1239 | #JUST ADDED 1240 | mainint.shift(DOWN*0.08) 1241 | 1242 | self.play(Write(fofx)) 1243 | self.play( 1244 | Write(mainint) 1245 | ) 1246 | self.wait() 1247 | #mainint_not.shift(RIGHT*0.5) 1248 | #self.play( 1249 | # Transform(mainint,mainint_not), 1250 | # ApplyMethod(fofx.shift,LEFT*0.4+UP*0.2) 1251 | # ) 1252 | 1253 | self.wait(4) 1254 | 1255 | fofx_wneg=TextMobject("$$f(-x)=$$") 1256 | fofx_wneg.scale(0.8) 1257 | fofx_wneg.move_to(fofx.get_center()+LEFT*0.15) 1258 | mainint_not_neg=TextMobject("$$\\frac{1}{\\tan^{\sqrt{2020}}(-x+\\frac{\pi}{4})+1}-\\frac{1}{2}$$") 1259 | mainint_not_neg.scale(0.8) 1260 | mainint_not_neg.move_to(mainint.get_center()+RIGHT*0.2) 1261 | 1262 | self.play(Transform(fofx,fofx_wneg),Transform(mainint,mainint_not_neg)) 1263 | 1264 | self.wait(2) 1265 | 1266 | everything=VGroup( 1267 | mainint, 1268 | #mainint_not, 1269 | #mainint_not_neg, 1270 | fofx, 1271 | #fofx_wneg 1272 | ) 1273 | 1274 | self.play(ApplyMethod(everything.shift,LEFT*2.6)) 1275 | 1276 | mainint_l=TextMobject("$$=-\Bigg(\\frac{1}{\\tan^{\sqrt{2020}}(x+\\frac{\pi}{4})+1}-\\frac{1}{2}\Bigg)$$") 1277 | mainint_l.scale(0.8) 1278 | mainint_l.next_to(mainint,RIGHT,0.15) 1279 | 1280 | #JUST ADDED 1281 | mainint_l.shift(UP*0.08) 1282 | 1283 | #mainint_l.shift(UP*0.2) 1284 | 1285 | question_mark=TextMobject("?") 1286 | question_mark.shift(RIGHT*0.8+UP*0.38) 1287 | 1288 | self.play(Write(mainint_l),Write(question_mark)) 1289 | 1290 | self.wait(2) 1291 | 1292 | everything_fr=VGroup( 1293 | mainint, 1294 | mainint_not_neg, 1295 | fofx, 1296 | fofx_wneg, 1297 | mainint_l 1298 | ) 1299 | 1300 | self.play(FadeOut(everything),FadeOut(mainint_l),FadeOut(question_mark)) 1301 | tangent_pos=TextMobject("$$\\tan(x+\\frac{\pi}{4})$$") 1302 | tangent_neg=TextMobject("$$\\tan(-x+\\frac{\pi}{4})$$") 1303 | 1304 | self.play(Write(tangent_pos)) 1305 | self.wait() 1306 | self.play(Transform(tangent_pos,tangent_neg)) 1307 | 1308 | self.wait(4) 1309 | 1310 | #python -m manim MITintegral\tanint\tanint.py UnitCircle2 -pl 1311 | class UnitCircle2(GraphScene): 1312 | CONFIG = { 1313 | "x_min" : -3, 1314 | "x_max" : 3, 1315 | "y_min" : -2, 1316 | "y_max" : 2, 1317 | "x_tick_frequency": 2, 1318 | "y_tick_frequency": 2, 1319 | "y_axis_height":8, 1320 | "x_axis_width":12, 1321 | "graph_origin" : ORIGIN, 1322 | "function_color" : RED , 1323 | "axes_color" : GREEN, 1324 | "x_labeled_nums" :range(-3,3,1), 1325 | "y_labeled_nums" :range(-1,2,1), 1326 | "num_graph_anchor_points": 200, 1327 | 1328 | } 1329 | def construct(self): 1330 | angle=math.radians(360) 1331 | arc=Arc(radius=2,angle=angle) 1332 | 1333 | x_value = ValueTracker(PI/3) 1334 | 1335 | #Positive arm 1336 | arm=Arrow(np.array([0,0,0]),np.array([1,2*np.sqrt(3)/2,0]),buff=0) 1337 | arm.set_color(GREEN) 1338 | 1339 | #Central arm 1340 | arm_c=Arrow(np.array([0,0,0]),np.array([1,2*np.sqrt(3)/2,0]),buff=0) 1341 | arm_c.set_color(BLUE) 1342 | 1343 | #Central arm negative 1344 | arm_c_n=Arrow(np.array([0,0,0]),np.array([1,-2*np.sqrt(3)/2,0]),buff=0) 1345 | arm_c_n.set_color(BLUE) 1346 | 1347 | #Negative arm 1348 | arm_n=Arrow(np.array([0,0,0]),np.array([1,-2*np.sqrt(3)/2,0]),buff=0) 1349 | arm_n.set_color(RED) 1350 | 1351 | #Reference Dot 1352 | #REFDOT DECIDES WHERE THE TRACKERS ARE 1353 | refd=Dot() 1354 | refd.move_to(RIGHT*5+UP*3) 1355 | refd2=Dot() 1356 | refd2.next_to(refd,DOWN*1.6) 1357 | 1358 | #Tan Definition 1359 | tan_func = lambda x: np.tan(x.get_value()) 1360 | tan_func_value = ValueTracker(tan_func(x_value)) 1361 | x_tex = DecimalNumber(x_value.get_value()).add_updater(lambda v: v.set_value(x_value.get_value())) 1362 | tan_func_tex = DecimalNumber(tan_func_value.get_value()).add_updater(lambda v: v.set_value(tan_func(x_value))) 1363 | 1364 | self.setup_axes(animate=True) 1365 | 1366 | self.play(ShowCreation(arc)) 1367 | 1368 | #Tan display 1369 | tan_func_tex.move_to(RIGHT*4.2+UP*2) 1370 | tanlab=TextMobject("$$\\tan(\\theta):$$") 1371 | tanlab.next_to(tan_func_tex,LEFT) 1372 | yoverx=TextMobject("$$\\frac{y}{x}:$$") 1373 | yoverx.next_to(tan_func_tex,LEFT) 1374 | 1375 | #Define Markers for angles 1376 | zerodot=Dot() 1377 | zerodot.move_to(np.array([2,0,0])) 1378 | pifourdot=Dot() 1379 | pifourdot.move_to(np.array([2*np.sqrt(2)/2,2*np.sqrt(2)/2,0])) 1380 | pitwodot=Dot() 1381 | pitwodot.move_to(np.array([0,2,0])) 1382 | pithreefourdot=Dot() 1383 | pithreefourdot.move_to(np.array([-2*np.sqrt(2)/2,2*np.sqrt(2)/2,0])) 1384 | pidot=Dot() 1385 | pidot.move_to(np.array([-2,0,0])) 1386 | 1387 | pifivefourdot=Dot() 1388 | pifivefourdot.move_to(np.array([-2*np.sqrt(2)/2,-2*np.sqrt(2)/2,0])) 1389 | pithreetwodot=Dot() 1390 | pithreetwodot.move_to(np.array([0,-2,0])) 1391 | pisevenfourdot=Dot() 1392 | pisevenfourdot.move_to(np.array([2*np.sqrt(2)/2,-2*np.sqrt(2)/2,0])) 1393 | 1394 | #Define Labels for angles 1395 | 1396 | buff=0.5 1397 | 1398 | zerolab=TextMobject("$$0$$") 1399 | zerolab.scale(0.65) 1400 | zerolab.next_to(zerodot,RIGHT*buff+UP*buff) 1401 | pifourlab=TextMobject("$$\\frac{\pi}{4}$$") 1402 | pifourlab.scale(0.65) 1403 | pifourlab.next_to(pifourdot,RIGHT*buff+UP*buff) 1404 | pitwolab=TextMobject("$$\\frac{\pi}{2}$$") 1405 | pitwolab.scale(0.65) 1406 | pitwolab.next_to(pitwodot,RIGHT*buff+UP*buff) 1407 | pithreefourlab=TextMobject("$$\\frac{3\pi}{4}$$") 1408 | pithreefourlab.scale(0.65) 1409 | pithreefourlab.next_to(pithreefourdot,LEFT*buff+UP*buff) 1410 | pilab=TextMobject("$$\pi$$") 1411 | pilab.scale(0.65) 1412 | pilab.next_to(pidot,LEFT*buff+UP*buff) 1413 | pifivefourlab=TextMobject("$$\\frac{5\pi}{4}$$") 1414 | pifivefourlab.scale(0.65) 1415 | pifivefourlab.next_to(pifivefourdot,LEFT*buff+DOWN*buff) 1416 | pithreetwolab=TextMobject("$$\\frac{3\pi}{2}$$") 1417 | pithreetwolab.scale(0.65) 1418 | pithreetwolab.next_to(pithreetwodot,RIGHT*buff+DOWN*buff) 1419 | pisevenfourlab=TextMobject("$$\\frac{7\pi}{4}$$") 1420 | pisevenfourlab.scale(0.65) 1421 | pisevenfourlab.next_to(pisevenfourdot,RIGHT*buff+DOWN*buff) 1422 | 1423 | 1424 | 1425 | allrads=VGroup(zerolab,pifourlab,pitwolab,pithreefourlab,pilab,pifivefourlab,pithreetwolab,pisevenfourlab) 1426 | 1427 | #self.play(ShowCreation(tip)) 1428 | #self.play(MoveAlongPath(tip,path1)) 1429 | 1430 | pos_theta=TextMobject("$$+\\theta$$") 1431 | neg_theta=TextMobject("$$-\\theta$$") 1432 | pos_theta.set_color(BLUE) 1433 | neg_theta.set_color(BLUE) 1434 | 1435 | pos_theta.move_to(RIGHT*3.5+UP*2.4) 1436 | neg_theta.next_to(pos_theta,DOWN,0.6) 1437 | 1438 | plus_pi_green=TextMobject("$$+\\frac{\pi}{4}$$") 1439 | plus_pi_green.set_color(GREEN) 1440 | plus_pi_green.next_to(pos_theta,RIGHT,0.1) 1441 | plus_pi_green.scale(0.8) 1442 | plus_pi_red=TextMobject("$$+\\frac{\pi}{4}$$") 1443 | plus_pi_red.set_color(RED) 1444 | plus_pi_red.next_to(neg_theta,RIGHT,0.1) 1445 | plus_pi_red.scale(0.8) 1446 | 1447 | 1448 | self.wait() 1449 | self.play(ShowCreation(arm),ShowCreation(arm_c), 1450 | ShowCreation(arm_n),ShowCreation(arm_c_n), 1451 | ShowCreation(pos_theta), 1452 | ShowCreation(neg_theta) 1453 | #ShowCreation(tan_func_tex) 1454 | ) 1455 | self.wait() 1456 | 1457 | self.play( 1458 | 1459 | Write(allrads) 1460 | 1461 | ) 1462 | 1463 | self.wait() 1464 | 1465 | self.play( 1466 | 1467 | ShowCreation(plus_pi_red), 1468 | 1469 | ShowCreation(plus_pi_green), 1470 | 1471 | Rotating(arm,radians=PI/4,about_point=np.array([0,0,0])), 1472 | 1473 | Rotating(arm_n,radians=PI/4,about_point=np.array([0,0,0])), 1474 | 1475 | run_time=1.4 1476 | 1477 | ) 1478 | 1479 | self.wait(2) 1480 | 1481 | tan_of_pos=TextMobject("$$\\tan(\\theta+\\frac{\pi}{4})=$$") 1482 | tan_of_neg=TextMobject("$$\\tan(-\\theta+\\frac{\pi}{4})=$$") 1483 | 1484 | tan_of_pos.scale(0.8) 1485 | tan_of_neg.scale(0.8) 1486 | 1487 | tan_of_pos.move_to(LEFT*5+UP*2.7) 1488 | tan_of_neg.next_to(tan_of_pos,DOWN,0.4) 1489 | 1490 | tan_of_pos.set_color(GREEN) 1491 | tan_of_neg.set_color(RED) 1492 | 1493 | frac_bar1=Line(np.array([-0.3,0,0]),np.array([0.3,0,0])) 1494 | frac_bar2=Line(np.array([-0.3,0,0]),np.array([0.3,0,0])) 1495 | 1496 | frac_bar1.next_to(tan_of_pos,RIGHT,0.1) 1497 | frac_bar2.next_to(tan_of_neg,RIGHT,0.1) 1498 | 1499 | self.play( 1500 | ShowCreation(tan_of_pos), 1501 | ShowCreation(tan_of_neg), 1502 | ShowCreation(frac_bar1), 1503 | ShowCreation(frac_bar2) 1504 | ) 1505 | 1506 | self.wait(2) 1507 | 1508 | ####################################################### 1509 | #FIRST POSITION 1510 | #Define braces for the green arrow at first position 1511 | x_g_1=Brace(arm,DOWN) 1512 | x_g_1_lab=TextMobject("$$\\mbox{-}x$$") 1513 | x_g_1_lab.next_to(x_g_1,DOWN,0.1) 1514 | y_g_1=Brace(arm,LEFT) 1515 | y_g_1_lab=TextMobject("$$y$$") 1516 | y_g_1_lab.next_to(y_g_1,LEFT,0.1) 1517 | 1518 | self.play( 1519 | ShowCreation(x_g_1), 1520 | ShowCreation(x_g_1_lab) 1521 | ) 1522 | 1523 | self.wait(2) 1524 | 1525 | self.play( 1526 | ShowCreation(y_g_1), 1527 | ShowCreation(y_g_1_lab) 1528 | ) 1529 | 1530 | self.wait(2) 1531 | 1532 | self.play( 1533 | ApplyMethod(x_g_1_lab.move_to,frac_bar1.get_center()+DOWN*0.3), 1534 | ApplyMethod(y_g_1_lab.move_to,frac_bar1.get_center()+UP*0.3) 1535 | ) 1536 | 1537 | self.wait(2) 1538 | 1539 | #Define braces for the red arrow at first position 1540 | x_r_1=Brace(arm_n,RIGHT) 1541 | x_r_1_lab=TextMobject("$$\\mbox{-}x$$") 1542 | x_r_1_lab.next_to(x_r_1,RIGHT,0.1) 1543 | y_r_1=Brace(arm_n,UP) 1544 | y_r_1_lab=TextMobject("$$y$$") 1545 | y_r_1_lab.next_to(y_r_1,UP,0.1) 1546 | 1547 | self.play(Transform(x_g_1,x_r_1),ShowCreation(x_r_1_lab)) 1548 | self.wait() 1549 | self.play(Transform(y_g_1,y_r_1),ShowCreation(y_r_1_lab)) 1550 | 1551 | self.wait(2) 1552 | 1553 | self.play( 1554 | ApplyMethod(x_r_1_lab.move_to,frac_bar2.get_center()+UP*0.3) 1555 | ) 1556 | 1557 | self.wait() 1558 | 1559 | self.play( 1560 | ApplyMethod(y_r_1_lab.move_to,frac_bar2.get_center()+DOWN*0.3) 1561 | ) 1562 | 1563 | self.wait(2) 1564 | 1565 | #Fadeout position one elements 1566 | self.play( 1567 | FadeOut(x_g_1), 1568 | FadeOut(y_g_1), 1569 | FadeOut(x_g_1_lab), 1570 | FadeOut(y_g_1_lab), 1571 | FadeOut(x_r_1_lab), 1572 | FadeOut(y_r_1_lab) 1573 | ) 1574 | 1575 | self.wait() 1576 | 1577 | theta_by=math.radians(30) 1578 | 1579 | self.play( 1580 | Rotating(arm,radians=-theta_by,about_point=np.array([0,0,0])), 1581 | 1582 | Rotating(arm_c,radians=-theta_by,about_point=np.array([0,0,0])), 1583 | 1584 | Rotating(arm_c_n,radians=theta_by,about_point=np.array([0,0,0])), 1585 | 1586 | Rotating(arm_n,radians=theta_by,about_point=np.array([0,0,0])), 1587 | 1588 | run_time=1.4 1589 | 1590 | ) 1591 | 1592 | self.wait(2) 1593 | ########################################################## 1594 | #Second position bracket and label elements 1595 | 1596 | #Define braces for the green arrow at second position 1597 | x_g_1=Brace(arm,DOWN) 1598 | x_g_1_lab=TextMobject("$$x$$") 1599 | x_g_1_lab.next_to(x_g_1,DOWN,0.1) 1600 | y_g_1=Brace(arm,LEFT) 1601 | y_g_1_lab=TextMobject("$$y$$") 1602 | y_g_1_lab.next_to(y_g_1,LEFT,0.1) 1603 | 1604 | #Add brackets pos two 1605 | self.play( 1606 | ShowCreation(x_g_1), 1607 | ShowCreation(x_g_1_lab) 1608 | ) 1609 | 1610 | self.wait(2) 1611 | 1612 | self.play( 1613 | ShowCreation(y_g_1), 1614 | ShowCreation(y_g_1_lab) 1615 | ) 1616 | 1617 | self.wait(2) 1618 | 1619 | #Add labels pos two 1620 | self.play( 1621 | ApplyMethod(x_g_1_lab.move_to,frac_bar1.get_center()+DOWN*0.3), 1622 | ApplyMethod(y_g_1_lab.move_to,frac_bar1.get_center()+UP*0.3) 1623 | ) 1624 | 1625 | self.wait(2) 1626 | 1627 | #Define elements and stuff for red arrow pos two 1628 | x_r_1=Brace(arm_n,RIGHT) 1629 | x_r_1_lab=TextMobject("$$x$$") 1630 | x_r_1_lab.next_to(x_r_1,RIGHT,0.1) 1631 | y_r_1=Brace(arm_n,DOWN) 1632 | y_r_1_lab=TextMobject("$$y$$") 1633 | y_r_1_lab.next_to(y_r_1,DOWN,0.1) 1634 | 1635 | self.play(Transform(x_g_1,x_r_1),ShowCreation(x_r_1_lab)) 1636 | self.wait() 1637 | self.play(Transform(y_g_1,y_r_1),ShowCreation(y_r_1_lab)) 1638 | 1639 | self.wait(2) 1640 | 1641 | self.play( 1642 | ApplyMethod(x_r_1_lab.move_to,frac_bar2.get_center()+UP*0.3) 1643 | ) 1644 | 1645 | self.wait() 1646 | 1647 | self.play( 1648 | ApplyMethod(y_r_1_lab.move_to,frac_bar2.get_center()+DOWN*0.3) 1649 | ) 1650 | 1651 | self.wait(2) 1652 | 1653 | 1654 | #Fadeout position two elements 1655 | self.play( 1656 | FadeOut(x_g_1), 1657 | FadeOut(y_g_1), 1658 | FadeOut(x_g_1_lab), 1659 | FadeOut(y_g_1_lab), 1660 | FadeOut(x_r_1_lab), 1661 | FadeOut(y_r_1_lab) 1662 | ) 1663 | 1664 | self.wait() 1665 | 1666 | theta_by=math.radians(-80) 1667 | 1668 | self.play( 1669 | Rotating(arm,radians=-theta_by,about_point=np.array([0,0,0])), 1670 | 1671 | Rotating(arm_c,radians=-theta_by,about_point=np.array([0,0,0])), 1672 | 1673 | Rotating(arm_c_n,radians=theta_by,about_point=np.array([0,0,0])), 1674 | 1675 | Rotating(arm_n,radians=theta_by,about_point=np.array([0,0,0])), 1676 | 1677 | run_time=2 1678 | 1679 | ) 1680 | 1681 | self.wait() 1682 | 1683 | ########################################################## 1684 | #THIRD position bracket and label elements 1685 | 1686 | #Define braces for the green arrow at third position 1687 | x_g_1=Brace(arm,DOWN) 1688 | x_g_1_lab=TextMobject("$$\\mbox{-}x$$") 1689 | x_g_1_lab.next_to(x_g_1,DOWN,0.1) 1690 | y_g_1=Brace(arm,LEFT) 1691 | y_g_1_lab=TextMobject("$$y$$") 1692 | y_g_1_lab.next_to(y_g_1,LEFT,0.1) 1693 | 1694 | #Add brackets pos 3 1695 | self.play( 1696 | ShowCreation(x_g_1), 1697 | ShowCreation(x_g_1_lab) 1698 | ) 1699 | 1700 | self.wait(2) 1701 | 1702 | self.play( 1703 | ShowCreation(y_g_1), 1704 | ShowCreation(y_g_1_lab) 1705 | ) 1706 | 1707 | self.wait(2) 1708 | 1709 | #Add labels pos 3 1710 | self.play( 1711 | ApplyMethod(x_g_1_lab.move_to,frac_bar1.get_center()+DOWN*0.3), 1712 | ApplyMethod(y_g_1_lab.move_to,frac_bar1.get_center()+UP*0.3) 1713 | ) 1714 | 1715 | self.wait(2) 1716 | 1717 | #Define elements and stuff for red arrow pos 3 1718 | x_r_1=Brace(arm_n,RIGHT) 1719 | x_r_1.shift(LEFT*0.15) 1720 | x_r_1_lab=TextMobject("$$\\mbox{-}x$$") 1721 | x_r_1_lab.next_to(x_r_1,RIGHT,0.1) 1722 | y_r_1=Brace(arm_n,UP) 1723 | y_r_1_lab=TextMobject("$$y$$") 1724 | y_r_1_lab.next_to(y_r_1,UP,0.1) 1725 | 1726 | self.play(Transform(x_g_1,x_r_1),ShowCreation(x_r_1_lab)) 1727 | self.wait() 1728 | self.play(Transform(y_g_1,y_r_1),ShowCreation(y_r_1_lab)) 1729 | 1730 | self.wait(2) 1731 | 1732 | self.play( 1733 | ApplyMethod(x_r_1_lab.move_to,frac_bar2.get_center()+UP*0.3) 1734 | ) 1735 | 1736 | self.wait() 1737 | 1738 | self.play( 1739 | ApplyMethod(y_r_1_lab.move_to,frac_bar2.get_center()+DOWN*0.3) 1740 | ) 1741 | 1742 | self.wait(4) 1743 | 1744 | #python -m manim MITintegral\tanint\tanint.py StatingProperty -pl 1745 | class StatingProperty(Scene): 1746 | def construct(self): 1747 | tan_prop=TextMobject("$$\\tan(-\\theta+\\frac{\pi}{4})=\\frac{1}{\\tan(\\theta+\\frac{\pi}{4})}$$") 1748 | 1749 | integrand=TextMobject("$$\\frac{1}{\\tan^{n}(x+\\frac{\pi}{4})+1}-\\frac{1}{2}$$") 1750 | 1751 | int_1_frac=TextMobject("$$\\frac{2}{2(\\tan^{n}(x+\\frac{\pi}{4})+1)}-\\frac{\\tan^{n}(x+\\frac{\pi}{4})+1}{2(\\tan^{n}(x+\\frac{\pi}{4})+1)}$$") 1752 | 1753 | int_1_frac_f=TextMobject("$$\\frac{1-\\tan^{n}(x+\\frac{\pi}{4})}{2(\\tan^{n}(x+\\frac{\pi}{4})+1)}$$") 1754 | 1755 | self.play(Write(tan_prop)) 1756 | 1757 | self.wait(2) 1758 | 1759 | self.play(FadeOut(tan_prop)) 1760 | 1761 | self.play(Write(integrand)) 1762 | 1763 | self.wait(2) 1764 | 1765 | self.play(Transform(integrand,int_1_frac)) 1766 | 1767 | self.wait(2) 1768 | 1769 | self.wait() 1770 | 1771 | self.play(Transform(integrand,int_1_frac_f)) 1772 | 1773 | self.wait(2) 1774 | 1775 | self.play(ApplyMethod(integrand.shift,LEFT*3.5+UP*2.3)) 1776 | 1777 | self.wait() 1778 | 1779 | neg_inp=TextMobject("$$\\frac{1-\\tan^{n}(-x+\\frac{\pi}{4})}{2(\\tan^{n}(-x+\\frac{\pi}{4})+1)}$$") 1780 | 1781 | self.play(Write(neg_inp)) 1782 | 1783 | self.wait(2) 1784 | 1785 | neg_inp_num=TextMobject("$$\\frac{1-\\frac{1}{\\tan^{n}(x+\\frac{\pi}{4})}} {2(\\tan^{n}(-x+\\frac{\pi}{4})+1)}$$") 1786 | 1787 | self.play(Transform(neg_inp,neg_inp_num)) 1788 | 1789 | self.wait(2) 1790 | 1791 | neg_inp_den=TextMobject("$$\\frac{1-\\frac{1}{\\tan^{n}(x+\\frac{\pi}{4})}} {2(\\frac{1}{\\tan^{n}(x+\\frac{\pi}{4})}+1)}$$") 1792 | 1793 | self.play(Transform(neg_inp,neg_inp_den)) 1794 | 1795 | self.wait(3) 1796 | 1797 | neg_inp_num_2=TextMobject("$$\\frac{\\frac{\\tan^{n}(x+\\frac{\pi}{4})}{\\tan^{n}(x+\\frac{\pi}{4})}-\\frac{1}{\\tan^{n}(x+\\frac{\pi}{4})}} {2(\\frac{1}{\\tan^{n}(x+\\frac{\pi}{4})}+1)}$$") 1798 | 1799 | self.play(Transform(neg_inp,neg_inp_num_2)) 1800 | 1801 | neg_inp_den_2=TextMobject("$$\\frac{\\frac{\\tan^{n}(x+\\frac{\pi}{4})}{\\tan^{n}(x+\\frac{\pi}{4})}-\\frac{1}{\\tan^{n}(x+\\frac{\pi}{4})}} {2(\\frac{1}{\\tan^{n}(x+\\frac{\pi}{4})}+\\frac{\\tan^{n}(x+\\frac{\pi}{4})}{\\tan^{n}(x+\\frac{\pi}{4})})}$$") 1802 | 1803 | self.wait(2) 1804 | 1805 | self.play(Transform(neg_inp,neg_inp_den_2)) 1806 | 1807 | self.wait(2) 1808 | 1809 | neg_inp_comb=TextMobject("$$\\frac{\\frac{\\tan^{n}(x+\\frac{\pi}{4})-1}{\\tan^{n}(x+\\frac{\pi}{4})}}{2(\\frac{1+\\tan^{n}(x+\\frac{\pi}{4})}{\\tan^{n}(x+\\frac{\pi}{4})})}$$") 1810 | 1811 | self.play(Transform(neg_inp,neg_inp_comb)) 1812 | 1813 | self.wait(2) 1814 | 1815 | recip=TextMobject("$$\\frac{\\tan^{n}(x+\\frac{\pi}{4})-1}{\\tan^{n}(x+\\frac{\pi}{4})}\cdot\\frac{\\tan^{n}(x+\\frac{\pi}{4})}{2(1+\\tan^{n}(x+\\frac{\pi}{4}))}$$") 1816 | 1817 | self.play(Transform(neg_inp,recip)) 1818 | 1819 | self.wait(2) 1820 | 1821 | cancel1=Line(np.array([-1.3,0,0]),np.array([1.3,0,0])) 1822 | cancel2=Line(np.array([-1.3,0,0]),np.array([1.3,0,0])) 1823 | cancel1.set_color(RED) 1824 | cancel2.set_color(RED) 1825 | 1826 | cancel1.move_to(RIGHT*1.95+UP*0.38) 1827 | cancel2.move_to(LEFT*2.32+DOWN*0.35) 1828 | 1829 | self.play(ShowCreation(cancel2),ShowCreation(cancel1)) 1830 | 1831 | final_frac=TextMobject("$$\\frac{\\tan^{n}(x+\\frac{\pi}{4})-1}{2(\\tan^{n}(x+\\frac{\pi}{4})+1)}$$") 1832 | 1833 | self.wait(2) 1834 | self.play(FadeOut(cancel1),FadeOut(cancel2),run_time=0.5) 1835 | self.play(Transform(neg_inp,final_frac)) 1836 | 1837 | self.wait(2) 1838 | 1839 | swap=TextMobject("$$\\frac{-(1-\\tan^{n}(x+\\frac{\pi}{4}))}{2(\\tan^{n}(x+\\frac{\pi}{4})+1)}$$") 1840 | 1841 | self.play(Transform(neg_inp,swap)) 1842 | 1843 | self.wait(2) 1844 | 1845 | times_neg=TextMobject("$$\\times -1=$$") 1846 | 1847 | self.play( 1848 | ApplyMethod(neg_inp.shift,RIGHT*3.3), 1849 | ApplyMethod(integrand.move_to,neg_inp.get_center()+LEFT*3.3), 1850 | ShowCreation(times_neg) 1851 | ) 1852 | 1853 | self.wait(4) 1854 | 1855 | 1856 | #python -m manim MITintegral\tanint\tanint.py Recap -pl 1857 | class Recap(GraphScene,MovingCameraScene): 1858 | CONFIG = { 1859 | "x_min" : -9, 1860 | "x_max" : 9, 1861 | "y_min" : -6, 1862 | "y_max" : 6, 1863 | "x_tick_frequency": 1, 1864 | "y_tick_frequency": 2, 1865 | "y_axis_height":8, 1866 | "x_axis_width":12, 1867 | "graph_origin" : ORIGIN, 1868 | "function_color" : RED , 1869 | "axes_color" : WHITE, 1870 | #"x_labeled_nums" :range(-9,9,3), 1871 | #"y_labeled_nums" :range(-6,6,2), 1872 | "num_graph_anchor_points": 200, 1873 | "always_update_mobjects": True, 1874 | "always_continually_update": True, 1875 | 1876 | } 1877 | 1878 | def setup(self): 1879 | GraphScene.setup(self) 1880 | MovingCameraScene.setup(self) 1881 | 1882 | def construct(self): 1883 | 1884 | self.setup_axes(animate=True) 1885 | 1886 | #labels 1887 | pi=TextMobject("$$\\frac{\pi}{2}$$") 1888 | tpi=TextMobject("$$\pi$$") 1889 | thpi=TextMobject("$$\\frac{3\pi}{2}$$") 1890 | fpi=TextMobject("$$2\pi$$") 1891 | npi=TextMobject("$$-\\frac{\pi}{2}$$") 1892 | ntpi=TextMobject("$$-\pi$$") 1893 | nthpi=TextMobject("$$-\\frac{3\pi}{2}$$") 1894 | nfpi=TextMobject("$$-2\pi$$") 1895 | one=TextMobject("$$\\frac{1}{2}$$") 1896 | two=TextMobject("$$1$$") 1897 | none=TextMobject("$$-\\frac{1}{2}$$") 1898 | ntwo=TextMobject("$$-1$$") 1899 | 1900 | #Move Labelspi 1901 | pi.move_to(self.coords_to_point(2,0)+DOWN*0.5) 1902 | tpi.move_to(self.coords_to_point(4,0)+DOWN*0.5) 1903 | thpi.move_to(self.coords_to_point(6,0)+DOWN*0.5) 1904 | fpi.move_to(self.coords_to_point(8,0)+DOWN*0.5) 1905 | npi.move_to(self.coords_to_point(-2,0)+DOWN*0.5) 1906 | ntpi.move_to(self.coords_to_point(-4,0)+DOWN*0.5) 1907 | nthpi.move_to(self.coords_to_point(-6,0)+DOWN*0.5) 1908 | nfpi.move_to(self.coords_to_point(-8,0)+DOWN*0.5) 1909 | one.move_to(self.coords_to_point(0,2)+LEFT*0.25) 1910 | two.move_to(self.coords_to_point(0,4)+LEFT*0.25) 1911 | none.move_to(self.coords_to_point(0,-2)+LEFT*0.5) 1912 | ntwo.move_to(self.coords_to_point(0,-4)+LEFT*0.5) 1913 | 1914 | #Scale labels 1915 | pi.scale(0.7) 1916 | tpi.scale(0.7) 1917 | thpi.scale(0.7) 1918 | fpi.scale(0.7) 1919 | npi.scale(0.7) 1920 | ntpi.scale(0.7) 1921 | nthpi.scale(0.7) 1922 | nfpi.scale(0.7) 1923 | one.scale(0.7) 1924 | two.scale(0.7) 1925 | none.scale(0.7) 1926 | ntwo.scale(0.7) 1927 | 1928 | #gather labels 1929 | pilabels=VGroup(pi,tpi,thpi,npi,ntpi,nthpi,one,two,none,ntwo,fpi,nfpi) 1930 | 1931 | self.play(ShowCreation(pilabels),run_time=1) 1932 | 1933 | tanfunc_graph=self.get_graph(self.tanfunc,x_min=0,x_max=2) 1934 | top_graph=self.get_graph(self.top,x_min=0,x_max=2) 1935 | block_graph=self.get_graph(self.block,x_min=0,x_max=2) 1936 | 1937 | tanfunc_graph.move_to(np.array([0,0,0])) 1938 | 1939 | integrand=TextMobject("$$\\frac{1}{\\tan^{n}(x+\\frac{\pi}{4})+1}-\\frac{1}{2}$$") 1940 | integrand_nsh=TextMobject("$$\\frac{1}{\\tan^{n}(x)+1}$$") 1941 | 1942 | integrand.move_to(LEFT*3.4+UP*2) 1943 | integrand.scale(0.8) 1944 | 1945 | integrand_nsh.move_to(integrand.get_center()) 1946 | integrand_nsh.scale(0.8) 1947 | 1948 | self.play(ShowCreation(tanfunc_graph),Write(integrand)) 1949 | 1950 | self.wait(3) 1951 | 1952 | self.play(ApplyMethod(tanfunc_graph.move_to,self.coords_to_point(1,0)),run_time=0.7) 1953 | self.play(ApplyMethod(tanfunc_graph.move_to,self.coords_to_point(1,2)), 1954 | Transform(integrand,integrand_nsh),run_time=0.7) 1955 | 1956 | self.wait() 1957 | 1958 | tan_area=self.get_area(tanfunc_graph,1,2) 1959 | top_area=self.get_area(top_graph,0,1) 1960 | top_area.shift(self.coords_to_point(0,2)) 1961 | block_area=self.get_area(block_graph,0,1) 1962 | 1963 | self.play( 1964 | ShowCreation(block_area), 1965 | ShowCreation(top_area), 1966 | ShowCreation(tan_area) 1967 | ) 1968 | 1969 | self.wait(2) 1970 | 1971 | self.play( 1972 | Rotating(top_area,radians=-PI,about_point=self.coords_to_point(1,2)), 1973 | rate_func=linear,run_time=1.5 1974 | ) 1975 | 1976 | self.wait(2) 1977 | 1978 | aarea=TextMobject("$$A=$$") 1979 | aarea.shift(RIGHT*3.1+UP*2.2) 1980 | self.play(Write(aarea)) 1981 | self.wait() 1982 | 1983 | 1984 | half=Brace(top_area,RIGHT) 1985 | area=VGroup(block_area,tan_area) 1986 | pitwo=Brace(area,DOWN) 1987 | 1988 | pitwolab=TextMobject("$$\\frac{\pi}{2}$$") 1989 | pitwolab.next_to(aarea,RIGHT,0.1) 1990 | 1991 | halflab=TextMobject("$$\cdot\\frac{1}{2}$$") 1992 | halflab.next_to(pitwolab,RIGHT,0.2) 1993 | halflab.shift(UP*0.02) 1994 | 1995 | pioverfour=TextMobject("$$\\frac{\pi}{4}$$") 1996 | pioverfour.next_to(aarea,RIGHT,0.25) 1997 | 1998 | self.play(ShowCreation(pitwo),Write(pitwolab)) 1999 | self.wait() 2000 | self.play(ShowCreation(half),Write(halflab)) 2001 | 2002 | prod=VGroup(halflab,pitwolab) 2003 | 2004 | self.wait() 2005 | self.play(Transform(prod,pioverfour)) 2006 | 2007 | self.wait(4) 2008 | 2009 | 2010 | def tanfunc(self,x): 2011 | return 4/(np.power(np.tan((x/4)*PI),2)+1) 2012 | 2013 | def top(self,x): 2014 | return 4/(np.power(np.tan((x/4)*PI),2)+1)-2 2015 | 2016 | def block(self,x): 2017 | return 2 2018 | 2019 | #python -m manim MITintegral\tanint\tanint.py Finale -pl 2020 | class Finale(Scene): 2021 | def construct(self): 2022 | mainint=TextMobject("$$\int_{0}^{\\frac{\pi}{2}}\\frac{1}{\\tan^{\sqrt{2020}}(x)+1} dx$$") 2023 | equals=TextMobject("$$=\\frac{\pi}{4}$$") 2024 | equals.next_to(mainint,RIGHT,0.2) 2025 | whole=VGroup(mainint,equals) 2026 | whole.move_to(np.array([0,0,0])) 2027 | 2028 | self.play(Write(whole)) 2029 | 2030 | self.wait(3) 2031 | 2032 | self.play(FadeOut(equals),ApplyMethod(mainint.move_to,ORIGIN)) 2033 | 2034 | mainint_t=TextMobject("$$\int_{0}^{\\frac{\pi}{2}}\\frac{1}{\\tan^{t}(x)+1} dx$$") 2035 | 2036 | self.wait() 2037 | 2038 | self.play(Transform(mainint,mainint_t)) 2039 | 2040 | self.wait(2) 2041 | 2042 | ddt=TextMobject("$$\\frac{\mathrm{d} }{\mathrm{d} t}$$") 2043 | ddt.next_to(mainint,LEFT,0.23) 2044 | 2045 | 2046 | 2047 | self.play(ShowCreation(ddt)) 2048 | 2049 | 2050 | mainint_part=TextMobject("$$\int_{0}^{\\frac{\pi}{2}}\\frac{\partial}{\partial t}\\frac{1}{\\tan^{t}(x)+1} dx$$") 2051 | 2052 | zero=TextMobject("$$=0$$") 2053 | zero.next_to(mainint,RIGHT,0.2) 2054 | 2055 | self.play(ShowCreation(zero)) 2056 | 2057 | self.wait(2) 2058 | 2059 | group=VGroup(mainint,ddt) 2060 | 2061 | self.play(Transform(group,mainint_part),ApplyMethod(zero.shift,RIGHT*0.4)) 2062 | 2063 | group2=VGroup(mainint,zero) 2064 | 2065 | self.wait(2) 2066 | 2067 | self.play(FadeOut(group2)) 2068 | 2069 | final_solve_1=TextMobject("$$\int_{0}^{\\frac{\pi}{2}}\\frac{1}{\\tan^{t}(x)+1} dx$$") 2070 | final_solve_2=TextMobject("$$\int_{0}^{\\frac{\pi}{2}}\\frac{1}{\\tan^{\pi}(x)+1} dx$$") 2071 | final_solve_3=TextMobject("$$\int_{0}^{\\frac{\pi}{2}}\\frac{1}{\\tan^{e}(x)+1} dx$$") 2072 | final_solve_4=TextMobject("$$\int_{0}^{\\frac{\pi}{2}}\\frac{1}{\\tan^{2}(x)+1} dx$$") 2073 | 2074 | final_solve_sec=TextMobject("$$\int_{0}^{\\frac{\pi}{2}}\\frac{1}{\\sec^{2}(x)} dx$$") 2075 | 2076 | final_solve_cos=TextMobject("$$\int_{0}^{\\frac{\pi}{2}} \\cos^{2}(x) dx$$") 2077 | 2078 | self.wait() 2079 | 2080 | self.play(Write(final_solve_1)) 2081 | self.wait() 2082 | self.play(Transform(final_solve_1,final_solve_2)) 2083 | self.wait() 2084 | self.play(Transform(final_solve_1,final_solve_3)) 2085 | 2086 | self.wait(2) 2087 | 2088 | self.play(Transform(final_solve_1,final_solve_4)) 2089 | 2090 | self.wait(2) 2091 | 2092 | self.play(Transform(final_solve_1,final_solve_sec)) 2093 | 2094 | self.wait(2) 2095 | 2096 | self.play(Transform(final_solve_1,final_solve_cos)) 2097 | 2098 | self.wait(4) 2099 | 2100 | class Test(Scene): 2101 | def construct(self): 2102 | p=TextMobject("-") 2103 | q=TextMobject("$$\\mbox{-}x$$") 2104 | p.next_to(q,LEFT,0.1) 2105 | 2106 | self.play(ShowCreation(p),ShowCreation(q)) 2107 | 2108 | self.wait(4) 2109 | 2110 | 2111 | #python -m manim MITintegral\tanint\tanint.py Thumbnail -ps 2112 | class Thumbnail(GraphScene,MovingCameraScene): 2113 | CONFIG = { 2114 | "x_min" : -9, 2115 | "x_max" : 9, 2116 | "y_min" : -6, 2117 | "y_max" : 6, 2118 | "x_tick_frequency": 1, 2119 | "y_tick_frequency": 2, 2120 | "y_axis_height":8, 2121 | "x_axis_width":12, 2122 | "graph_origin" : ORIGIN, 2123 | "function_color" : RED , 2124 | "axes_color" : WHITE, 2125 | #"x_labeled_nums" :range(-9,9,3), 2126 | #"y_labeled_nums" :range(-6,6,2), 2127 | "num_graph_anchor_points": 200, 2128 | "always_update_mobjects": True, 2129 | "always_continually_update": True, 2130 | 2131 | } 2132 | 2133 | def setup(self): 2134 | GraphScene.setup(self) 2135 | MovingCameraScene.setup(self) 2136 | 2137 | def construct(self): 2138 | 2139 | 2140 | self.setup_axes(animate=False) 2141 | 2142 | 2143 | odd4_graph=self.get_graph(self.odd4,x_min=-9,x_max=9,fill_opacity=0.3,stroke_opacity=0.5,stroke_color=WHITE) 2144 | 2145 | self.add(odd4_graph) 2146 | #DASHED LINE STUFF 2147 | 2148 | #Origins of the dotted line (right and left respectively) 2149 | Origin=self.coords_to_point(2,0) 2150 | Origin2=self.coords_to_point(-2,0) 2151 | 2152 | #Create the dots 2153 | Point1=Dot(color=RED) 2154 | Point2=Dot(color=RED) 2155 | 2156 | #Create the dots at the ORIGIN and move them to the origins of the dotted lines 2157 | 2158 | 2159 | Point1.move_to(self.coords_to_point(2,7*np.arctan((2)/3)*np.exp(-np.power((2)/3,2)))) 2160 | Point2.move_to(self.coords_to_point(-2,7*np.arctan((-2)/3)*np.exp(-np.power((-2)/3,2)))) 2161 | 2162 | #Define lines that go from the origins of the lines to the dots 2163 | line=DashedLine(Origin,Point1) 2164 | line2=DashedLine(Origin2,Point2) 2165 | 2166 | #Define functions that re-define the line as new_line 2167 | 2168 | 2169 | #Add in the lines 2170 | self.add(line,line2,Point1,Point2) 2171 | 2172 | rad_twtw=TextMobject("$$\sqrt{2020}$$",set_color=BLUE,fill_color=BLUE,fill_opacity=0.7,stroke_color=WHITE,stroke_width=6) 2173 | 2174 | 2175 | 2176 | rad_twtw.scale(9) 2177 | 2178 | rad_twtw.shift(LEFT*1) 2179 | 2180 | self.add(rad_twtw) 2181 | 2182 | def odd4(self,x): 2183 | return 12*np.arctan((x)/5)*np.exp(-np.power((x)/5,2)) --------------------------------------------------------------------------------