mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
putnam video published
This commit is contained in:
parent
a74743d384
commit
f7051c468d
1 changed files with 160 additions and 28 deletions
188
putnam.py
188
putnam.py
|
@ -152,7 +152,8 @@ class IntroducePutnam(Scene):
|
||||||
Write(median_words)
|
Write(median_words)
|
||||||
)
|
)
|
||||||
self.play(Write(median))
|
self.play(Write(median))
|
||||||
self.play(Write(difficulties, run_time = 3))
|
for difficulty in difficulties:
|
||||||
|
self.play(FadeIn(difficulty))
|
||||||
self.dither()
|
self.dither()
|
||||||
|
|
||||||
class NatureOf5sAnd6s(TeacherStudentsScene):
|
class NatureOf5sAnd6s(TeacherStudentsScene):
|
||||||
|
@ -848,6 +849,8 @@ class RevisitTwoDCase(TwoDCase):
|
||||||
"n_random_trials" : 200,
|
"n_random_trials" : 200,
|
||||||
}
|
}
|
||||||
def construct(self):
|
def construct(self):
|
||||||
|
self.force_skipping()
|
||||||
|
|
||||||
self.setup_circle()
|
self.setup_circle()
|
||||||
self.show_probability()
|
self.show_probability()
|
||||||
self.add_lines_and_comment_on_them()
|
self.add_lines_and_comment_on_them()
|
||||||
|
@ -1126,7 +1129,7 @@ class RevisitTwoDCase(TwoDCase):
|
||||||
|
|
||||||
def second_arc_update_func(arcs):
|
def second_arc_update_func(arcs):
|
||||||
VGroup(*arcs[:-1]).set_stroke(width = 0)
|
VGroup(*arcs[:-1]).set_stroke(width = 0)
|
||||||
arcs[-1].set_stroke(BLUE, 5)
|
arcs[-1].set_stroke(PINK, 6)
|
||||||
return arcs
|
return arcs
|
||||||
second_arc_update = UpdateFromFunc(arcs, second_arc_update_func)
|
second_arc_update = UpdateFromFunc(arcs, second_arc_update_func)
|
||||||
second_arc_update.update(1)
|
second_arc_update.update(1)
|
||||||
|
@ -1143,10 +1146,11 @@ class RevisitTwoDCase(TwoDCase):
|
||||||
self.play(
|
self.play(
|
||||||
MoveToTarget(point_mob),
|
MoveToTarget(point_mob),
|
||||||
*self.update_animations,
|
*self.update_animations,
|
||||||
run_time = 0.5
|
run_time = np.sqrt(2)/4 #Hacky reasons to be irrational
|
||||||
)
|
)
|
||||||
self.dither()
|
self.dither()
|
||||||
|
|
||||||
|
self.revert_to_original_skipping_status()
|
||||||
do_the_rounds()
|
do_the_rounds()
|
||||||
self.triangle_update.update(1)
|
self.triangle_update.update(1)
|
||||||
self.remove(arcs)
|
self.remove(arcs)
|
||||||
|
@ -1188,11 +1192,11 @@ class ContrastTwoRandomProcesses(TwoDCase):
|
||||||
VGroup(*pair) for pair in zip(point_mobs, labels)
|
VGroup(*pair) for pair in zip(point_mobs, labels)
|
||||||
])
|
])
|
||||||
|
|
||||||
left_circles = VGroup(*[
|
right_circles = VGroup(*[
|
||||||
VGroup(circle, *point_label_groups[:i+1]).copy()
|
VGroup(circle, *point_label_groups[:i+1]).copy()
|
||||||
for i in range(3)
|
for i in range(3)
|
||||||
])
|
])
|
||||||
right_circles = VGroup(
|
left_circles = VGroup(
|
||||||
VGroup(circle, center_lines).copy(),
|
VGroup(circle, center_lines).copy(),
|
||||||
VGroup(
|
VGroup(
|
||||||
circle, center_lines,
|
circle, center_lines,
|
||||||
|
@ -1320,6 +1324,36 @@ class Formality(TeacherStudentsScene):
|
||||||
)
|
)
|
||||||
self.dither(8)
|
self.dither(8)
|
||||||
|
|
||||||
|
class ProblemSolvingTakeaways(Scene):
|
||||||
|
def construct(self):
|
||||||
|
title = TextMobject("Problem solving takeaways")
|
||||||
|
underline = Line(LEFT, RIGHT)
|
||||||
|
underline.scale_to_fit_width(title.get_width()*1.1)
|
||||||
|
underline.next_to(title, DOWN)
|
||||||
|
group = VGroup(title, underline)
|
||||||
|
group.to_corner(UP+LEFT)
|
||||||
|
|
||||||
|
points = VGroup(*[
|
||||||
|
TextMobject(string, alignment = "")
|
||||||
|
for string in [
|
||||||
|
"Ask a simpler version \\\\ of the question",
|
||||||
|
"Try reframing the question \\\\ around new constructs",
|
||||||
|
]
|
||||||
|
])
|
||||||
|
points[0].highlight(BLUE)
|
||||||
|
points[1].highlight(YELLOW)
|
||||||
|
points.arrange_submobjects(
|
||||||
|
DOWN, buff = LARGE_BUFF,
|
||||||
|
aligned_edge = LEFT
|
||||||
|
)
|
||||||
|
points.next_to(group, DOWN, LARGE_BUFF)
|
||||||
|
|
||||||
|
self.play(Write(title), ShowCreation(underline))
|
||||||
|
self.dither()
|
||||||
|
for point in points:
|
||||||
|
self.play(Write(point))
|
||||||
|
self.dither(3)
|
||||||
|
|
||||||
class BrilliantPuzzle(PiCreatureScene):
|
class BrilliantPuzzle(PiCreatureScene):
|
||||||
CONFIG = {
|
CONFIG = {
|
||||||
"random_seed" : 2,
|
"random_seed" : 2,
|
||||||
|
@ -1332,24 +1366,31 @@ class BrilliantPuzzle(PiCreatureScene):
|
||||||
test.move_to(0.75*student.get_center())
|
test.move_to(0.75*student.get_center())
|
||||||
tests.add(test)
|
tests.add(test)
|
||||||
student.test = test
|
student.test = test
|
||||||
|
for i, student in enumerate(students):
|
||||||
|
student.right = students[(i+1)%len(students)]
|
||||||
|
student.left = students[(i-1)%len(students)]
|
||||||
arrows = VGroup()
|
arrows = VGroup()
|
||||||
for s1, s2 in adjacent_pairs(self.students):
|
for s1, s2 in adjacent_pairs(self.students):
|
||||||
arrow = Arrow(
|
arrow = Arrow(
|
||||||
s1.get_center(), s2.get_center(),
|
s1.get_center(), s2.get_center(),
|
||||||
buff = LARGE_BUFF
|
use_rectangular_stem = False,
|
||||||
|
path_arc = np.pi/2,
|
||||||
|
buff = 0.8
|
||||||
)
|
)
|
||||||
arrow.shift(-MED_SMALL_BUFF*arrow.get_vector())
|
arrow.tip.shift(SMALL_BUFF*arrow.get_vector())
|
||||||
|
arrow.tip.shift(-0.1*SMALL_BUFF*arrow.tip.get_center())
|
||||||
|
# arrow.shift(-MED_SMALL_BUFF*arrow.get_vector())
|
||||||
arrow.highlight(RED)
|
arrow.highlight(RED)
|
||||||
|
arrow.pointing_right = True
|
||||||
arrows.add(arrow)
|
arrows.add(arrow)
|
||||||
s1.right_arrow = arrow
|
s1.arrow = arrow
|
||||||
s2.left_arrow = arrow
|
arrow.student = s1
|
||||||
arrow.counterclockwise = True
|
|
||||||
|
|
||||||
title = TextMobject("Puzzle from Brilliant")
|
title = TextMobject("Puzzle from Brilliant")
|
||||||
title.scale(0.75)
|
title.scale(0.75)
|
||||||
title.to_corner(UP+LEFT)
|
title.to_corner(UP+LEFT)
|
||||||
|
|
||||||
question = TextMobject("Expecte number of \\\\ circled students?")
|
question = TextMobject("Expected number of \\\\ circled students?")
|
||||||
question.to_corner(UP+RIGHT)
|
question.to_corner(UP+RIGHT)
|
||||||
|
|
||||||
self.remove(students)
|
self.remove(students)
|
||||||
|
@ -1367,7 +1408,7 @@ class BrilliantPuzzle(PiCreatureScene):
|
||||||
ApplyMethod, students,
|
ApplyMethod, students,
|
||||||
lambda m : (m.change, "conniving")
|
lambda m : (m.change, "conniving")
|
||||||
))
|
))
|
||||||
self.play(LaggedStart(GrowArrow, arrows))
|
self.play(LaggedStart(ShowCreation, arrows))
|
||||||
for x in range(2):
|
for x in range(2):
|
||||||
self.swap_arrows_randomly(arrows)
|
self.swap_arrows_randomly(arrows)
|
||||||
self.dither()
|
self.dither()
|
||||||
|
@ -1401,12 +1442,18 @@ class BrilliantPuzzle(PiCreatureScene):
|
||||||
|
|
||||||
def get_arrow_swap_anim(self, arrow):
|
def get_arrow_swap_anim(self, arrow):
|
||||||
arrow.generate_target()
|
arrow.generate_target()
|
||||||
arrow.target.rotate_in_place(np.pi)
|
if arrow.pointing_right:
|
||||||
if arrow.counterclockwise:
|
target_color = GREEN
|
||||||
arrow.target.highlight(GREEN)
|
target_angle = np.pi - np.pi/4
|
||||||
else:
|
else:
|
||||||
arrow.target.highlight(RED)
|
target_color = RED
|
||||||
arrow.counterclockwise = not arrow.counterclockwise
|
target_angle = np.pi + np.pi/4
|
||||||
|
arrow.target.highlight(target_color)
|
||||||
|
arrow.target.rotate(
|
||||||
|
target_angle,
|
||||||
|
about_point = arrow.student.get_center()
|
||||||
|
)
|
||||||
|
arrow.pointing_right = not arrow.pointing_right
|
||||||
return MoveToTarget(arrow, path_arc = np.pi)
|
return MoveToTarget(arrow, path_arc = np.pi)
|
||||||
|
|
||||||
def swap_arrows_randomly(self, arrows, *added_anims):
|
def swap_arrows_randomly(self, arrows, *added_anims):
|
||||||
|
@ -1418,17 +1465,20 @@ class BrilliantPuzzle(PiCreatureScene):
|
||||||
|
|
||||||
def circle_students(self):
|
def circle_students(self):
|
||||||
circles = VGroup()
|
circles = VGroup()
|
||||||
|
circled_students = list(self.students)
|
||||||
for student in self.students:
|
for student in self.students:
|
||||||
ra, la = student.right_arrow, student.left_arrow
|
if student.arrow.pointing_right:
|
||||||
if ra.counterclockwise and not la.counterclockwise:
|
to_remove = student.right
|
||||||
circle = Circle(color = YELLOW)
|
else:
|
||||||
circle.scale_to_fit_height(1.2*student.get_height())
|
to_remove = student.left
|
||||||
circle.move_to(student)
|
if to_remove in circled_students:
|
||||||
circles.add(circle)
|
circled_students.remove(to_remove)
|
||||||
self.play(
|
for student in circled_students:
|
||||||
ShowCreation(circle),
|
circle = Circle(color = YELLOW)
|
||||||
Indicate(VGroup(ra, la))
|
circle.scale_to_fit_height(1.2*student.get_height())
|
||||||
)
|
circle.move_to(student)
|
||||||
|
circles.add(circle)
|
||||||
|
self.play(ShowCreation(circle))
|
||||||
return circles
|
return circles
|
||||||
|
|
||||||
class ScrollThroughBrilliantCourses(ExternallyAnimatedScene):
|
class ScrollThroughBrilliantCourses(ExternallyAnimatedScene):
|
||||||
|
@ -1474,7 +1524,89 @@ class Promotion(PiCreatureScene):
|
||||||
self.play(FadeOut(url_rect))
|
self.play(FadeOut(url_rect))
|
||||||
self.dither(3)
|
self.dither(3)
|
||||||
|
|
||||||
|
class AddedPromoWords(Scene):
|
||||||
|
def construct(self):
|
||||||
|
words = TextMobject(
|
||||||
|
"First", "$2^8$", "vistors get",
|
||||||
|
"$(e^\\pi - \\pi)\\%$", "off"
|
||||||
|
)
|
||||||
|
words.scale_to_fit_width(2*SPACE_WIDTH - 1)
|
||||||
|
words.to_edge(DOWN)
|
||||||
|
words.highlight_by_tex("2^8", YELLOW)
|
||||||
|
words.highlight_by_tex("pi", PINK)
|
||||||
|
|
||||||
|
self.play(Write(words))
|
||||||
|
self.dither()
|
||||||
|
|
||||||
|
class PatreonThanks(PatreonEndScreen):
|
||||||
|
CONFIG = {
|
||||||
|
"specific_patrons" : [
|
||||||
|
"Randall Hunt",
|
||||||
|
"Burt Humburg",
|
||||||
|
"CrypticSwarm",
|
||||||
|
"Juan Benet",
|
||||||
|
"David Kedmey",
|
||||||
|
"Marcus Schiebold",
|
||||||
|
"Ali Yahya",
|
||||||
|
"Mayank M. Mehrotra",
|
||||||
|
"Lukas Biewald",
|
||||||
|
"Yana Chernobilsky",
|
||||||
|
"Kaustuv DeBiswas",
|
||||||
|
"Kathryn Schmiedicke",
|
||||||
|
"Yu Jun",
|
||||||
|
"Dave Nicponski",
|
||||||
|
"Damion Kistler",
|
||||||
|
"Jordan Scales",
|
||||||
|
"Markus Persson",
|
||||||
|
"Egor Gumenuk",
|
||||||
|
"Yoni Nazarathy",
|
||||||
|
"Ryan Atallah",
|
||||||
|
"Joseph John Cox",
|
||||||
|
"Luc Ritchie",
|
||||||
|
"James Park",
|
||||||
|
"Samantha D. Suplee",
|
||||||
|
"Delton",
|
||||||
|
"Thomas Tarler",
|
||||||
|
"Jake Alzapiedi",
|
||||||
|
"Jonathan Eppele",
|
||||||
|
"Taro Yoshioka",
|
||||||
|
"1stViewMaths",
|
||||||
|
"Jacob Magnuson",
|
||||||
|
"Mark Govea",
|
||||||
|
"Dagan Harrington",
|
||||||
|
"Clark Gaebel",
|
||||||
|
"Eric Chow",
|
||||||
|
"Mathias Jansson",
|
||||||
|
"David Clark",
|
||||||
|
"Michael Gardner",
|
||||||
|
"Erik Sundell",
|
||||||
|
"Awoo",
|
||||||
|
"Dr. David G. Stork",
|
||||||
|
"Tianyu Ge",
|
||||||
|
"Ted Suzman",
|
||||||
|
"Linh Tran",
|
||||||
|
"Andrew Busey",
|
||||||
|
"John Haley",
|
||||||
|
"Ankalagon",
|
||||||
|
"Eric Lavault",
|
||||||
|
"Boris Veselinovich",
|
||||||
|
"Julian Pulgarin",
|
||||||
|
"Jeff Linse",
|
||||||
|
"Cooper Jones",
|
||||||
|
"Ryan Dahl",
|
||||||
|
"Robert Teed",
|
||||||
|
"Jason Hise",
|
||||||
|
"Meshal Alshammari",
|
||||||
|
"Bernd Sing",
|
||||||
|
"Mustafa Mahdi",
|
||||||
|
"Mathew Bramson",
|
||||||
|
"Jerry Ling",
|
||||||
|
"Shimin Kuang",
|
||||||
|
"Rish Kundalia",
|
||||||
|
"Achille Brighton",
|
||||||
|
"Ripta Pasay",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue