From 858051a8063215d42719961abff295f77cb5368f Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Thu, 9 Aug 2018 17:56:05 -0700 Subject: [PATCH] After running 2to3 --- active_projects/eola2/cramer.py | 22 +-- active_projects/eola2/determinant_puzzle.py | 7 +- active_projects/eop/bayes.py | 103 +++++----- active_projects/eop/bayes_footnote.py | 20 +- active_projects/eop/chapter1/all_sequences.py | 2 +- .../eop/chapter2/permutation_grid.py | 4 +- active_projects/eop/combinations.py | 115 +++++------ active_projects/eop/independence.py | 106 +++++----- active_projects/eop/pascal.py | 2 +- active_projects/eop/reusables/dice.py | 2 +- animation/animation.py | 4 +- animation/composition.py | 14 +- animation/creation.py | 2 +- animation/indication.py | 6 +- animation/movement.py | 2 +- animation/numbers.py | 2 +- animation/rotation.py | 2 +- animation/specialized.py | 2 +- animation/transform.py | 2 +- animation/update.py | 2 +- big_ol_pile_of_manim_imports.py | 2 +- cairo_test.py | 74 +++++++ camera/camera.py | 13 +- camera/mapping_camera.py | 2 +- camera/moving_camera.py | 2 +- camera/multi_camera.py | 2 +- camera/three_d_camera.py | 4 +- constants.py | 4 +- continual_animation/from_animation.py | 2 +- continual_animation/numbers.py | 2 +- continual_animation/update.py | 2 +- example.png | Bin 0 -> 35767 bytes example_scenes.py | 2 +- extract_scene.py | 8 +- for_3b1b_videos/common_scenes.py | 6 +- for_3b1b_videos/pi_creature_animations.py | 4 +- for_3b1b_videos/pi_creature_scene.py | 21 +- mayavi_test.py | 55 ++++++ mobject/coordinate_systems.py | 12 +- mobject/frame.py | 2 +- mobject/functions.py | 2 +- mobject/geometry.py | 6 +- mobject/matrix.py | 2 +- mobject/mobject.py | 20 +- mobject/number_line.py | 4 +- mobject/numbers.py | 2 +- mobject/probability.py | 2 +- mobject/shape_matchers.py | 2 +- mobject/svg/brace.py | 2 +- mobject/svg/drawings.py | 10 +- mobject/svg/svg_mobject.py | 8 +- mobject/svg/tex_mobject.py | 20 +- mobject/three_dimensions.py | 2 +- mobject/types/image_mobject.py | 2 +- mobject/types/point_cloud_mobject.py | 14 +- mobject/types/vectorized_mobject.py | 7 +- mobject/value_tracker.py | 2 +- old_projects/256.py | 2 +- old_projects/WindingNumber.py | 28 +-- old_projects/WindingNumber_G.py | 42 ++-- old_projects/alt_calc.py | 27 ++- old_projects/basel/basel.py | 22 +-- old_projects/basel/basel2.py | 47 +++-- old_projects/bell.py | 24 +-- old_projects/borsuk.py | 66 +++---- old_projects/brachistochrone/curves.py | 8 +- old_projects/brachistochrone/cycloid.py | 4 +- .../brachistochrone/drawing_images.py | 2 +- old_projects/brachistochrone/graveyard.py | 8 +- old_projects/brachistochrone/light.py | 16 +- old_projects/brachistochrone/misc.py | 16 +- old_projects/brachistochrone/multilayered.py | 2 +- old_projects/brachistochrone/wordplay.py | 8 +- .../complex_multiplication_article.py | 10 +- old_projects/counting_in_binary.py | 6 +- old_projects/crypto.py | 80 ++++---- old_projects/dandelin.py | 14 +- old_projects/div_curl.py | 37 ++-- old_projects/domino_play.py | 17 +- old_projects/efvgt.py | 103 +++++----- old_projects/eoc/chapter1.py | 55 +++--- old_projects/eoc/chapter10.py | 64 +++---- old_projects/eoc/chapter2.py | 42 ++-- old_projects/eoc/chapter3.py | 70 +++---- old_projects/eoc/chapter4.py | 82 ++++---- old_projects/eoc/chapter5.py | 60 +++--- old_projects/eoc/chapter6.py | 42 ++-- old_projects/eoc/chapter7.py | 77 ++++---- old_projects/eoc/chapter8.py | 70 +++---- old_projects/eoc/chapter9.py | 55 +++--- old_projects/eoc/footnote.py | 18 +- old_projects/eoc/old_chapter1.py | 48 ++--- old_projects/eola/chapter0.py | 14 +- old_projects/eola/chapter1.py | 37 ++-- old_projects/eola/chapter10.py | 88 ++++----- old_projects/eola/chapter11.py | 94 ++++----- old_projects/eola/chapter2.py | 4 +- old_projects/eola/chapter3.py | 16 +- old_projects/eola/chapter4.py | 30 +-- old_projects/eola/chapter5.py | 13 +- old_projects/eola/chapter6.py | 38 ++-- old_projects/eola/chapter7.py | 97 +++++----- old_projects/eola/chapter8.py | 70 +++---- old_projects/eola/chapter8p2.py | 24 +-- old_projects/eola/chapter9.py | 80 ++++---- old_projects/eola/footnote.py | 25 ++- old_projects/eola/footnote2.py | 6 +- old_projects/eulers_characteristic_formula.py | 35 +--- old_projects/fc1.py | 14 +- old_projects/fourier.py | 51 +++-- old_projects/fractal_dimension.py | 34 ++-- old_projects/hanoi.py | 66 +++---- old_projects/highD.py | 69 +++---- old_projects/hilbert/fractal_porn.py | 12 +- old_projects/hilbert/section1.py | 12 +- old_projects/hilbert/section2.py | 6 +- old_projects/inventing_math.py | 46 ++--- old_projects/inventing_math_images.py | 4 +- old_projects/leibniz.py | 181 +++++++++--------- old_projects/lost_lecture.py | 41 ++-- old_projects/moser_intro.py | 14 +- old_projects/moser_main.py | 51 +++-- old_projects/mug.py | 35 ++-- old_projects/music_and_measure.py | 26 +-- old_projects/mvcr.py | 6 +- old_projects/name_animation.py | 2 +- old_projects/nn/mnist_loader.py | 10 +- old_projects/nn/network.py | 22 +-- old_projects/nn/part1.py | 70 +++---- old_projects/nn/part2.py | 51 +++-- old_projects/nn/part3.py | 86 ++++----- old_projects/nn/playground.py | 4 +- old_projects/patreon.py | 12 +- old_projects/pi_day.py | 10 +- old_projects/playground_counting_in_binary.py | 7 +- old_projects/putnam.py | 32 ++-- old_projects/pythagorean_proof.py | 14 +- old_projects/qa_round_two.py | 2 +- old_projects/tattoo.py | 26 +-- old_projects/tau_poem.py | 6 +- old_projects/three_dimensions.py | 4 +- old_projects/triangle_of_power/end.py | 4 +- old_projects/triangle_of_power/intro.py | 8 +- old_projects/triangle_of_power/triangle.py | 13 +- old_projects/triples.py | 129 ++++++------- old_projects/uncertainty.py | 54 +++--- old_projects/wallis.py | 63 +++--- old_projects/waves.py | 56 +++--- old_projects/wcat.py | 52 ++--- old_projects/zeta.py | 82 ++++---- once_useful_constructs/arithmetic.py | 4 +- .../complex_transformation_scene.py | 2 +- once_useful_constructs/fractals.py | 4 +- once_useful_constructs/graph_theory.py | 8 +- once_useful_constructs/light.py | 6 +- requirements.txt | 14 +- scene/graph_scene.py | 16 +- scene/moving_camera_scene.py | 2 +- scene/reconfigurable_scene.py | 2 +- scene/sample_space_scene.py | 6 +- scene/scene.py | 22 +-- scene/scene_from_video.py | 8 +- scene/three_d_scene.py | 2 +- scene/vector_space_scene.py | 2 +- scene/zoomed_scene.py | 2 +- stage_scenes.py | 6 +- utils/color.py | 4 +- utils/config_ops.py | 6 +- utils/iterables.py | 25 +-- utils/simple_functions.py | 4 +- utils/strings.py | 14 +- utils/tex_file_writing.py | 2 +- 172 files changed, 2117 insertions(+), 2221 deletions(-) create mode 100644 cairo_test.py create mode 100644 example.png create mode 100644 mayavi_test.py diff --git a/active_projects/eola2/cramer.py b/active_projects/eola2/cramer.py index 269f0bfd..a296e777 100644 --- a/active_projects/eola2/cramer.py +++ b/active_projects/eola2/cramer.py @@ -321,7 +321,7 @@ class SetupSimpleSystemOfEquations(LinearTransformationScene): circle.save_state() circle.scale(5) circle.fade(1) - row_rects = VGroup(*map(SurroundingRectangle, system)) + row_rects = VGroup(*list(map(SurroundingRectangle, system))) row_rects.set_stroke(BLUE, 2) self.add(system) @@ -377,7 +377,7 @@ class SetupSimpleSystemOfEquations(LinearTransformationScene): system_in_lines_copy = system_in_lines.deepcopy() self.play( ReplacementTransform( - VGroup(*map(VGroup, system_in_lines_copy.matrix_elements)), + VGroup(*list(map(VGroup, system_in_lines_copy.matrix_elements))), matrix_system.matrix_mobject.elements, ), Write(matrix_system.matrix_mobject.brackets), @@ -386,7 +386,7 @@ class SetupSimpleSystemOfEquations(LinearTransformationScene): Write(matrix_system.equals) ) self.play(ReplacementTransform( - VGroup(*map(VGroup, system_in_lines_copy.output_vect_elements)), + VGroup(*list(map(VGroup, system_in_lines_copy.output_vect_elements))), matrix_system.output_vect_mob.elements, )) self.play(*[ @@ -406,7 +406,7 @@ class SetupSimpleSystemOfEquations(LinearTransformationScene): matrix_system.set_height, corner_rect.get_height() - MED_LARGE_BUFF, matrix_system.move_to, corner_rect, ) - self.play(*map(GrowArrow, self.basis_vectors)) + self.play(*list(map(GrowArrow, self.basis_vectors))) self.add_foreground_mobject(corner_rect) self.add_foreground_mobject(matrix_system) @@ -515,7 +515,7 @@ class SetupSimpleSystemOfEquations(LinearTransformationScene): colors = [ color for i, color in zip( - range(len(matrix)), + list(range(len(matrix))), it.cycle([X_COLOR, Y_COLOR, Z_COLOR, YELLOW, MAROON_B, TEAL]) ) ] @@ -1236,7 +1236,7 @@ class SolvingASystemWithOrthonormalMatrix(LinearTransformationScene): # Column arrays column_mobs = VGroup() - for i, vect in zip(range(2), [DR, DL]): + for i, vect in zip(list(range(2)), [DR, DL]): elements = system.matrix_mobject.deepcopy().mob_matrix[:, i] column_mob = MobjectMatrix(elements) column_mob.add_background_rectangle() @@ -1621,9 +1621,9 @@ class TransformingAreasYCoord(LinearTransformationScene): GrowFromCenter(matrix_brace), Write(matrix_label), ) self.add_foreground_mobjects(apply_group) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ area_words.rect, area_words, area_arrow, input_vect_label, - ])) + ]))) self.apply_matrix(matrix) self.wait(2) self.apply_inverse(matrix, run_time=0) @@ -1650,7 +1650,7 @@ class TransformingAreasYCoord(LinearTransformationScene): q_marks_group.move_to(ip) column_mobs = VGroup() - for i, vect in zip(range(2), [DOWN, LEFT]): + for i, vect in zip(list(range(2)), [DOWN, LEFT]): column = matrix_mobject.deepcopy().mob_matrix[:, i] column_mob = MobjectMatrix(column) column_mob.scale(self.array_scale_factor) @@ -1815,7 +1815,7 @@ class TransformingAreasYCoord(LinearTransformationScene): self.play( FadeOut(self.area_scale_words), ShowCreation(h_line), - *map(MoveToTarget, area_words[1:]), + *list(map(MoveToTarget, area_words[1:])), run_time=3 ) self.wait() @@ -1983,7 +1983,7 @@ class ParallelepipedForYCoordinate(ExternallyAnimatedScene): class ThreeDCoordinatesAsVolumes(Scene): def construct(self): colors = [X_COLOR, Y_COLOR, Z_COLOR] - x, y, z = coords = VGroup(*map(TexMobject, "xyz")) + x, y, z = coords = VGroup(*list(map(TexMobject, "xyz"))) coords.set_color_by_gradient(*colors) matrix = IntegerMatrix(np.identity(3)) matrix.set_color_columns(*colors) diff --git a/active_projects/eola2/determinant_puzzle.py b/active_projects/eola2/determinant_puzzle.py index 06065ce6..6f335463 100644 --- a/active_projects/eola2/determinant_puzzle.py +++ b/active_projects/eola2/determinant_puzzle.py @@ -95,10 +95,7 @@ class WorkOutNumerically(Scene): for matrix, det in zip([M1, M2], line1): numbers = VGroup(*[det[i] for i in indices]) numbers_iter = iter(numbers) - non_numbers = VGroup(*filter( - lambda m: m not in numbers, - det - )) + non_numbers = VGroup(*[m for m in det if m not in numbers]) matrix_numbers = VGroup(*[ matrix.mob_matrix[i][j].copy() for i, j in (0, 0), (1, 1), (0, 1), (1, 0) @@ -268,7 +265,7 @@ class SuccessiveLinearTransformations(LinearTransformationScene): self.reset_plane() self.play( MoveToTarget(matrices), - *map(GrowFromCenter, parens) + *list(map(GrowFromCenter, parens)) ) self.apply_matrix(self.matrix_product) self.wait() diff --git a/active_projects/eop/bayes.py b/active_projects/eop/bayes.py index d0d76b0a..1af6581c 100644 --- a/active_projects/eop/bayes.py +++ b/active_projects/eop/bayes.py @@ -32,9 +32,9 @@ class IntroducePokerHand(PiCreatureScene, SampleSpaceScene): def add_cards(self): you, her = self.you, self.her - community_cards = VGroup(*map( + community_cards = VGroup(*list(map( PlayingCard, self.community_card_values - )) + ))) community_cards.arrange_submobjects(RIGHT) community_cards.move_to(self.community_cards_center) deck = VGroup(*[ @@ -47,7 +47,7 @@ class IntroducePokerHand(PiCreatureScene, SampleSpaceScene): you.hand = self.get_hand(you, self.your_hand_values) her.hand = self.get_hand(her, None) - hand_cards = VGroup(*it.chain(*zip(you.hand, her.hand))) + hand_cards = VGroup(*it.chain(*list(zip(you.hand, her.hand)))) self.add(deck) for group in hand_cards, community_cards: @@ -70,10 +70,7 @@ class IntroducePokerHand(PiCreatureScene, SampleSpaceScene): for card in you.hand.target: card.set_height(community_cards.get_height()) - selected_community_cards = VGroup(*filter( - lambda card : card.numerical_value >= 10, - community_cards - )) + selected_community_cards = VGroup(*[card for card in community_cards if card.numerical_value >= 10]) card_cmp = lambda c1, c2 : cmp( c1.numerical_value, c2.numerical_value ) @@ -118,10 +115,7 @@ class IntroducePokerHand(PiCreatureScene, SampleSpaceScene): def show_flush_potential(self): you, her = self.you, self.her - heart_cards = VGroup(*filter( - lambda c : c.suit == "hearts", - self.community_cards - )) + heart_cards = VGroup(*[c for c in self.community_cards if c.suit == "hearts"]) heart_cards.save_state() her.hand.save_state() @@ -165,7 +159,7 @@ class IntroducePokerHand(PiCreatureScene, SampleSpaceScene): ("hearts", "hearts"), ] for new_suit_pair in new_suit_pairs: - new_symbols = VGroup(*map(SuitSymbol, new_suit_pair)) + new_symbols = VGroup(*list(map(SuitSymbol, new_suit_pair))) for new_symbol, heart in zip(new_symbols, hearts): new_symbol.replace(heart, dim_to_match = 1) self.play(Transform( @@ -229,11 +223,11 @@ class IntroducePokerHand(PiCreatureScene, SampleSpaceScene): ) self.wait(3) equation.remove(percentage) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ equation, num_hearts, num_hearts_arrow, num_cards, num_cards_arrow, - ])) + ]))) self.percentage = percentage @@ -259,9 +253,9 @@ class IntroducePokerHand(PiCreatureScene, SampleSpaceScene): FadeIn(sample_space), ReplacementTransform(percentage, top_label) ) - self.play(*map(GrowFromCenter, [ + self.play(*list(map(GrowFromCenter, [ brace for brace in braces - ])) + ]))) self.wait(2) self.play(Write(bottom_label)) self.wait(2) @@ -289,7 +283,7 @@ class IntroducePokerHand(PiCreatureScene, SampleSpaceScene): self.play(hand.restore) self.wait() self.wait() - self.play(*map(FadeOut, it.chain(*hand_lists))) + self.play(*list(map(FadeOut, it.chain(*hand_lists)))) def place_high_bet(self): you, her = self.you, self.her @@ -415,7 +409,7 @@ class IntroducePokerHand(PiCreatureScene, SampleSpaceScene): def get_hand(self, pi_creature, keys = None): if keys is not None: - hand = VGroup(*map(PlayingCard, keys)) + hand = VGroup(*list(map(PlayingCard, keys))) else: hand = VGroup(*[ PlayingCard(turned_over = True) @@ -585,7 +579,7 @@ class UpdatePokerPrior(SampleSpaceScene): self.wait() self.play(Write(VGroup(*label[-2:]))) self.wait(2) - self.play(*map(FadeOut, [her, her.glasses])) + self.play(*list(map(FadeOut, [her, her.glasses]))) self.sample_space.add(brace, label) self.bottom_explanation = explanation @@ -619,13 +613,13 @@ class UpdatePokerPrior(SampleSpaceScene): for num in numbers ]) - questions = VGroup(*map(TextMobject, [ + questions = VGroup(*list(map(TextMobject, [ "Does she bluff?", "How much does she have?", "Does she take risks?", "What's her model of me?", "\\vdots" - ])) + ]))) questions.arrange_submobjects(DOWN, aligned_edge = LEFT) questions[-1].next_to(questions[-2], DOWN) questions.scale(0.7) @@ -637,13 +631,13 @@ class UpdatePokerPrior(SampleSpaceScene): ShowCreation(bubble), Write(words, run_time = 2) ) - self.play(*map(ShowCreation, arrows)) + self.play(*list(map(ShowCreation, arrows))) self.play(numbers.set_color, YELLOW) self.play(Blink(randy)) self.play(randy.change_mode, "maybe") - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ bubble, words, arrows - ])) + ]))) for question in questions: self.play( FadeIn(question), @@ -679,7 +673,7 @@ class UpdatePokerPrior(SampleSpaceScene): (0.97, 0.3), ] - self.play(*map(ShowCreation, rects)) + self.play(*list(map(ShowCreation, rects))) self.play(FadeOut(rects)) for i, value in enumerate(it.chain(*new_conditionals)): self.play( @@ -718,12 +712,12 @@ class UpdatePokerPrior(SampleSpaceScene): self.play(MoveToTarget(low_bet_space)) self.play( Write(words), - *map(ShowCreation, arrows) + *list(map(ShowCreation, arrows)) ) self.wait() for rect in high_bet_space: self.play(Indicate(rect, scale_factor = 1)) - self.play(*map(FadeOut, [words, arrows])) + self.play(*list(map(FadeOut, [words, arrows]))) self.high_bet_space = high_bet_space @@ -758,11 +752,11 @@ class UpdatePokerPrior(SampleSpaceScene): self.play(MoveToTarget(rects[0])) self.wait() self.play(*it.chain( - map(Write, [frac_line, plus]), - map(MoveToTarget, rects[1:]) + list(map(Write, [frac_line, plus])), + list(map(MoveToTarget, rects[1:])) )) self.wait(3) - self.play(*map(FadeOut, [arrow, fraction] + rects)) + self.play(*list(map(FadeOut, [arrow, fraction] + rects))) self.posterior_tex = posterior_tex @@ -821,7 +815,7 @@ class UpdatePokerPrior(SampleSpaceScene): self.wait() self.play(post_words[1].fade, 0.8) self.wait(2) - self.play(*map(FadeOut, [post_words, post_arrow])) + self.play(*list(map(FadeOut, [post_words, post_arrow]))) def preview_tweaks(self): post_rects = self.post_rects @@ -830,7 +824,7 @@ class UpdatePokerPrior(SampleSpaceScene): (0.97, 0.3, 1./22), ] for new_values in new_value_lists: - for i, value in zip(range(2), new_values): + for i, value in zip(list(range(2)), new_values): self.play(*self.get_conditional_change_anims( i, value, post_rects )) @@ -863,7 +857,7 @@ class UpdatePokerPrior(SampleSpaceScene): arrows.next_to(prior_rects[1], RIGHT, SMALL_BUFF) self.wait(2) - self.play(*map(FadeIn, [her, her.glasses])) + self.play(*list(map(FadeIn, [her, her.glasses]))) self.play(LaggedStart(FadeIn, risk_averse_words)) self.play(her.change_mode, "sad", Animation(her.glasses)) self.wait() @@ -920,7 +914,7 @@ class UpdatePokerPrior(SampleSpaceScene): *self.get_prior_change_anims(1./22, post_rects), run_time = 2 ) - self.play(*map(FadeOut, [her, her.glasses])) + self.play(*list(map(FadeOut, [her, her.glasses]))) def compute_posterior(self): prior_rects = self.get_prior_rectangles() @@ -978,7 +972,7 @@ class UpdatePokerPrior(SampleSpaceScene): ]) self.play(Write(fraction.get_part_by_tex("over"))) for pair in zip(pre_top_rect_products, products[0]): - self.play(*map(Indicate, pair)) + self.play(*list(map(Indicate, pair))) self.wait() self.wait() self.play(Indicate(prior_rects[1], scale_factor = 1)) @@ -993,7 +987,7 @@ class UpdatePokerPrior(SampleSpaceScene): ]) self.wait() for pair in zip(pre_bottom_rect_products, products[1]): - self.play(*map(Indicate, pair)) + self.play(*list(map(Indicate, pair))) self.wait() self.play( Write(fraction.get_part_by_tex("+")), @@ -1213,10 +1207,7 @@ class BayesianNetworkPreview(Scene): node.ghost = node.fill.copy().fade() self.add(node.ghost) all_ghosts.add(node.ghost) - connected_nodes = filter( - lambda n : n not in covered_nodes, - it.chain(node.children, node.parents) - ) + connected_nodes = [n for n in it.chain(node.children, node.parents) if n not in covered_nodes] for next_node in connected_nodes: if next_node in covered_nodes: continue @@ -1454,7 +1445,7 @@ class GeneralizeBayesRule(SampleSpaceScene): self.play( self.bayes_rule_words.to_edge, UP, Write(name), - *map(ShowCreation, arrows+rects) + *list(map(ShowCreation, arrows+rects)) ) self.wait() @@ -1517,9 +1508,9 @@ class GeneralizeBayesRule(SampleSpaceScene): prior_rects.copy(), post_rects, run_time = 2 )) - self.play(*map(FadeIn, [ + self.play(*list(map(FadeIn, [ post_rects.braces, post_rects.labels - ])) + ]))) self.wait() self.play(*self.get_conditional_change_anims(1, 0.2, post_rects)) self.play(*self.get_conditional_change_anims(0, 0.6, post_rects)) @@ -1609,15 +1600,15 @@ class MusicExample(SampleSpaceScene, PiCreatureScene): labels.scale(0.7) braces, labels = sample_space.get_side_braces_and_labels(labels) VGroup(sample_space, braces, labels).to_edge(LEFT) - words = map(TextMobject, [ + words = list(map(TextMobject, [ "Blunt honesty", "Some confidence" - ]) + ])) for word, part in zip(words, sample_space.horizontal_parts): word.scale(0.6) word.move_to(part) self.play(LaggedStart(FadeIn, sample_space, run_time = 1)) - self.play(*map(GrowFromCenter, braces)) + self.play(*list(map(GrowFromCenter, braces))) for label in labels: self.play(Write(label, run_time = 2)) self.wait() @@ -1626,7 +1617,7 @@ class MusicExample(SampleSpaceScene, PiCreatureScene): self.change_pi_creature_with_guitar(mode) self.wait() self.wait() - self.play(*map(FadeOut, words)) + self.play(*list(map(FadeOut, words))) self.sample_space = sample_space @@ -1643,7 +1634,7 @@ class MusicExample(SampleSpaceScene, PiCreatureScene): for friend in friends: friend.look_at(randy.eyes) - headphones = VGroup(*map(Headphones, friends)) + headphones = VGroup(*list(map(Headphones, friends))) self.play(FadeIn(friends)) self.pi_creatures.add(*friends) @@ -1701,7 +1692,7 @@ class MusicExample(SampleSpaceScene, PiCreatureScene): ), ) self.wait(2) - self.play(*map(FadeOut, [bubble, content])) + self.play(*list(map(FadeOut, [bubble, content]))) def friends_dont_like(self): friends = self.friends @@ -1737,7 +1728,7 @@ class MusicExample(SampleSpaceScene, PiCreatureScene): ) self.change_pi_creature_with_guitar("happy") self.wait() - self.play(*map(FadeOut, [bubble, content])) + self.play(*list(map(FadeOut, [bubble, content]))) self.bubble = bubble @@ -1923,10 +1914,10 @@ class MusicExample(SampleSpaceScene, PiCreatureScene): run_time = 2, )) self.wait(time) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ prior_rect, post_rect, self.ratio_group, self.post_rhs - ])) + ]))) self.prior_num_rect = prior_rect @@ -1943,11 +1934,11 @@ class MusicExample(SampleSpaceScene, PiCreatureScene): self.wait(2) def fade_out_post_rect(self): - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ self.post_rects, self.post_rects.braces, self.post_rects.labels, - ])) + ]))) self.play(self.negative_space.restore) def get_negative_feedback(self): @@ -2010,7 +2001,7 @@ class MusicExample(SampleSpaceScene, PiCreatureScene): content.scale(0.6) bubble.add_content(content) - self.play(*map(MoveToTarget, friends)) + self.play(*list(map(MoveToTarget, friends))) self.play( ShowCreation(bubble), Write(bubble.content) @@ -2148,7 +2139,7 @@ class FinalWordsOnRule(SampleSpaceScene): (0.97, 0.3, 1./22), ] for new_values in new_value_lists: - for i, value in zip(range(2), new_values): + for i, value in zip(list(range(2)), new_values): self.play(*self.get_conditional_change_anims( i, value, post_rects )) diff --git a/active_projects/eop/bayes_footnote.py b/active_projects/eop/bayes_footnote.py index c6031e4d..98137182 100644 --- a/active_projects/eop/bayes_footnote.py +++ b/active_projects/eop/bayes_footnote.py @@ -74,7 +74,7 @@ class Introduction(TeacherStudentsScene): cross.set_stroke(RED, 6) group.add(cross) - self.play(*map(FadeIn, [bayes, intuition])) + self.play(*list(map(FadeIn, [bayes, intuition]))) self.play(Write(arrow)) self.play(ShowCreation(cross)) self.change_student_modes(*["confused"]*3) @@ -117,9 +117,9 @@ class Introduction(TeacherStudentsScene): music_example.next_to(poker_example, RIGHT) examples = VGroup(poker_example, music_example) brace = Brace(examples, UP) - bayes_to_intuition = VGroup(*map(TextMobject, [ + bayes_to_intuition = VGroup(*list(map(TextMobject, [ "Bayes", "$\\leftrightarrow$", "Intuition" - ])) + ]))) bayes_to_intuition.arrange_submobjects(RIGHT, buff = SMALL_BUFF) bayes_to_intuition.next_to(brace, UP, SMALL_BUFF) check = TexMobject("\\checkmark") @@ -179,7 +179,7 @@ class Introduction(TeacherStudentsScene): def get_poker_example(self): rect = self.get_example_rect() values = IntroducePokerHand.CONFIG["community_card_values"] - community_cards = VGroup(*map(PlayingCard, values)) + community_cards = VGroup(*list(map(PlayingCard, values))) community_cards.arrange_submobjects(RIGHT) deck = VGroup(*[ PlayingCard(turned_over = True) @@ -406,14 +406,14 @@ class AskAboutRephrasingQuestion(TeacherStudentsScene): class RephraseQuestion(Scene): def construct(self): - words = VGroup(*map(TextMobject, [ + words = VGroup(*list(map(TextMobject, [ r"1 in $1{,000}$ chance \\ of having disease", r"1 in $100$ \\ false positive rate.", r"""\underline{\phantom{1 in 10}} chance \\ of having disease \\ after testing positive. """, - ])) + ]))) words.arrange_submobjects(RIGHT, buff = LARGE_BUFF) words.set_width(2*(FRAME_X_RADIUS - MED_LARGE_BUFF)) @@ -688,7 +688,7 @@ class ShowRestrictedSpace(Scene): self.play(Transform( *arrows, run_time = 4, rate_func = there_and_back )) - self.play(*map(FadeOut, [words, arrows[0]])) + self.play(*list(map(FadeOut, [words, arrows[0]]))) self.brace = brace @@ -785,7 +785,7 @@ class DepressingForMedicalTestDesigners(TestScene): self.add(title) self.play(Write(checks)) self.wait(2) - self.play(*map(MoveToTarget, [title, checks])) + self.play(*list(map(MoveToTarget, [title, checks]))) def reject_test(self): randy = self.pi_creature @@ -1236,7 +1236,7 @@ class IntroduceTelepathyExample(StatisticsVsEmpathy): morty = self.morty bubble = morty.get_bubble("", direction = LEFT) numbers = [ - Integer(random.choice(range(100))) + Integer(random.choice(list(range(100)))) for x in range(30) ] numbers.append(Integer(67)) @@ -1376,7 +1376,7 @@ class CompareNumbersInBothExamples(Scene): self.play( LaggedStart(FadeIn, titles, lag_ratio = 0.7), - *map(ShowCreation, [h_line, v_line]) + *list(map(ShowCreation, [h_line, v_line])) ) self.wait() self.play(FadeIn(priors)) diff --git a/active_projects/eop/chapter1/all_sequences.py b/active_projects/eop/chapter1/all_sequences.py index 7c7d2c8e..5954c249 100644 --- a/active_projects/eop/chapter1/all_sequences.py +++ b/active_projects/eop/chapter1/all_sequences.py @@ -1,4 +1,4 @@ -from __future__ import print_function + from big_ol_pile_of_manim_imports import * from active_projects.eop.reusable_imports import * diff --git a/active_projects/eop/chapter2/permutation_grid.py b/active_projects/eop/chapter2/permutation_grid.py index f3cb0057..4772c893 100644 --- a/active_projects/eop/chapter2/permutation_grid.py +++ b/active_projects/eop/chapter2/permutation_grid.py @@ -15,8 +15,8 @@ def print_permutation(index_list): "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"] - free_indices = range(n) - free_indices_p1 = range(1,n + 1) + free_indices = list(range(n)) + free_indices_p1 = list(range(1,n + 1)) #print perm_list for i in range(n): findex = index_list[i] - 1 diff --git a/active_projects/eop/combinations.py b/active_projects/eop/combinations.py index d4fc5b81..868b4065 100644 --- a/active_projects/eop/combinations.py +++ b/active_projects/eop/combinations.py @@ -10,7 +10,7 @@ def get_stack( vertical_buff = MED_SMALL_BUFF, ): stack = VGroup() - for indices in it.combinations(range(n), k): + for indices in it.combinations(list(range(n)), k): term = VGroup(*[ obj1.copy() if i in indices else obj2.copy() for i in range(n) @@ -119,9 +119,9 @@ class ExperienceProblemSolver(PiCreatureScene): self.play(jenny.change, "happy") self.play(randy.change, "tired") self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ jenny.bubble, jenny_words, randy_words - ])) + ]))) def no_genius(self): randy, jenny = self.randy, self.jenny @@ -299,10 +299,7 @@ class InitialFiveChooseThreeExample(Scene): ) self.wait() for line in stack: - ones = VGroup(*filter( - lambda mob : "1" in mob.get_tex_string(), - line - )) + ones = VGroup(*[mob for mob in line if "1" in mob.get_tex_string()]) line.ones = ones self.play(LaggedStart( ApplyMethod, ones, @@ -340,7 +337,7 @@ class InitialFiveChooseThreeExample(Scene): self.play(ShowCreation(lines)) count = 1 - for indices in it.combinations(range(5), 3): + for indices in it.combinations(list(range(5)), 3): ones = VGroup(*[ self.get_obj1().next_to(lines[i], UP) for i in indices @@ -353,7 +350,7 @@ class InitialFiveChooseThreeExample(Scene): count += 1 self.add(num, ones) self.wait() - self.play(*map(FadeOut, [lines, num, ones])) + self.play(*list(map(FadeOut, [lines, num, ones]))) def walk_though_notation(self): equation = self.binomial_equations[3] @@ -428,10 +425,7 @@ class SixChooseThreeExample(InitialFiveChooseThreeExample): stack.set_height(self.stack_height) stack.to_edge(DOWN) for line in stack: - line.ones = VGroup(*filter( - lambda mob : "1" in mob.get_tex_string(), - line - )) + line.ones = VGroup(*[mob for mob in line if "1" in mob.get_tex_string()]) equation = TexMobject( "{%d \\choose %d}"%(self.n, self.k), @@ -483,7 +477,7 @@ class SixChooseThreeExample(InitialFiveChooseThreeExample): self.wait(2) self.play( line.restore, - *map(FadeOut, [brace, n_options, arrows, choose_k]) + *list(map(FadeOut, [brace, n_options, arrows, choose_k])) ) def count_stack(self): @@ -510,7 +504,7 @@ class SixChooseThreeExample(InitialFiveChooseThreeExample): coming_soon.next_to(lhs, UP) coming_soon.set_color(MAROON_B) - self.play(*map(FadeIn, [lhs, coming_soon])) + self.play(*list(map(FadeIn, [lhs, coming_soon]))) self.wait() self.play( ApplyMethod( @@ -519,7 +513,7 @@ class SixChooseThreeExample(InitialFiveChooseThreeExample): rate_func = running_start, remover = True, ), - *map(FadeOut, [brace, num, coming_soon]) + *list(map(FadeOut, [brace, num, coming_soon])) ) self.wait() @@ -569,7 +563,7 @@ class SixChooseThreeInOtherContext(Scene): last_rights = None last_ups = None last_line = None - for indices in it.combinations(range(6), 3): + for indices in it.combinations(list(range(6)), 3): bools = [i in indices for i in range(6)] arrows = VGroup(*[ right.deepcopy() if b else up.deepcopy() @@ -1000,10 +994,10 @@ class ProbabilityOfKWomenInGroupOfFive(Scene): last_lineup = get_lineup() self.play(LaggedStart(FadeIn, last_lineup, run_time = 1)) - for x in xrange(self.n_examples): + for x in range(self.n_examples): lineup = get_lineup() anims = [last_lineup.items.fade, 1] - anims += map(GrowFromCenter, lineup.items) + anims += list(map(GrowFromCenter, lineup.items)) if x >= 12 and x-12 < len(prob_words): anims.append(FadeIn(prob_words[x-12])) self.play(*anims, run_time = 0.75) @@ -1107,10 +1101,7 @@ class ProbabilityOfKWomenInGroupOfFive(Scene): lineups = self.lineups stacks = VGroup(*[VGroup() for x in range(6)]) for lineup in lineups: - lineup.women = VGroup(*filter( - lambda m : "female" in m.get_tex_string(), - lineup.items - )) + lineup.women = VGroup(*[m for m in lineup.items if "female" in m.get_tex_string()]) stacks[len(lineup.women)].add(lineup) stacks.generate_target() stacks.target.scale(0.75) @@ -1447,10 +1438,7 @@ class BuildFiveFromFour(ProbabilityOfKWomenInGroupOfFive): lineups = self.lineups stacks = VGroup(*[VGroup() for x in range(5)]) for lineup in lineups: - women = filter( - lambda m : "female" in m.get_tex_string(), - lineup.items - ) + women = [m for m in lineup.items if "female" in m.get_tex_string()] stacks[len(women)].add(lineup) stacks.generate_target() stacks.target.scale(0.75) @@ -1572,7 +1560,7 @@ class BuildFiveFromFour(ProbabilityOfKWomenInGroupOfFive): bottom_stacks.numbers.shift, dist*LEFT/2, ) self.wait() - self.play(*map(FadeOut, [add_man, add_woman, h_line])) + self.play(*list(map(FadeOut, [add_man, add_woman, h_line]))) self.set_variables_as_attrs(top_stacks, bottom_stacks) @@ -1612,7 +1600,7 @@ class BuildFiveFromFour(ProbabilityOfKWomenInGroupOfFive): self.play( Write(plus), - *map(MoveToTarget, movers) + *list(map(MoveToTarget, movers)) ) self.play( VGroup(top_stacks[-1], top_stacks.numbers[-1]).align_to, @@ -1656,7 +1644,7 @@ class BuildUpFromStart(Scene): for stack, num in zip(*group.target): num.next_to(stack, UP) group.target.next_to(ORIGIN, vect) - self.play(*map(MoveToTarget, [top_group, low_group])) + self.play(*list(map(MoveToTarget, [top_group, low_group]))) self.wait(wait_time) #Expand @@ -1687,10 +1675,10 @@ class BuildUpFromStart(Scene): for num, stack in zip(stacks.numbers.target, new_stacks): num.next_to(stack, UP) - self.play(*map(MoveToTarget, [ + self.play(*list(map(MoveToTarget, [ top_stacks, low_stacks, top_stacks.numbers, low_stacks.numbers, - ])) + ]))) self.wait(wait_time) #Shift @@ -1734,14 +1722,14 @@ class BuildUpFromStart(Scene): expressions.add(top_stacks.numbers[-1]) self.play(*it.chain( - map(MoveToTarget, all_movers), - map(Write, plusses), + list(map(MoveToTarget, all_movers)), + list(map(Write, plusses)), )) #Add new_numbers = self.get_numbers(stacks) self.play(ReplacementTransform( - expressions, VGroup(*map(VGroup, new_numbers)) + expressions, VGroup(*list(map(VGroup, new_numbers))) )) self.wait(wait_time) stacks.numbers = new_numbers @@ -1866,9 +1854,9 @@ class IntroducePascalsTriangle(Scene): color = PINK, ) ) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ morty, morty.bubble, morty.bubble.content - ])) + ]))) def issolate_9_choose_4_term(self): rows = self.rows @@ -1967,10 +1955,10 @@ class IntroducePascalsTriangle(Scene): self.play( self.nine_choose_four_term.scale_in_place, 1./1.2, self.nine_choose_four_term.set_color, WHITE, - *map(FadeOut, [ + *list(map(FadeOut, [ expr, nine_choose_four_term, over_512, eq_result, self.curr_line - ]) + ])) ) self.play(rows.shift, 3*DOWN) @@ -2068,10 +2056,10 @@ class StacksApproachBellCurve(Scene): # number.set_width(bar.get_width()) number.next_to(bar, UP, SMALL_BUFF) - self.play(*map(MoveToTarget, [ + self.play(*list(map(MoveToTarget, [ bars, bars_copy, numbers, numbers_copy - ])) + ]))) self.play( bars.shift, distance*LEFT/2, numbers.shift, distance*LEFT/2, @@ -2307,7 +2295,7 @@ class ChooseThreeFromFive(InitialFiveChooseThreeExample, PiCreatureScene): updownarrow.set_color(YELLOW) updownarrow.next_to(triplet, DOWN, SMALL_BUFF) permutations = VGroup() - for indices in it.permutations(range(len(triplet))): + for indices in it.permutations(list(range(len(triplet)))): perm = triplet.copy() resorter = VGroup(*[ perm[i] for i in indices @@ -2342,7 +2330,7 @@ class ChooseThreeFromFive(InitialFiveChooseThreeExample, PiCreatureScene): if i == 4: anims.append(Write(words, run_time = 1)) self.play(*anims) - self.play(*map(FadeOut, [triplet, curr_perm, updownarrow])) + self.play(*list(map(FadeOut, [triplet, curr_perm, updownarrow]))) self.order_doesnt_matter_words = words @@ -2385,7 +2373,7 @@ class ChooseThreeFromFive(InitialFiveChooseThreeExample, PiCreatureScene): self.play(FadeOut(q_marks)) line.sort_submobjects(lambda p : p[0]) - words = VGroup(*map(TextMobject, ["First", "Second", "Fifth"])) + words = VGroup(*list(map(TextMobject, ["First", "Second", "Fifth"]))) words.set_color(YELLOW) words.scale(0.75) word_arrow_groups = VGroup() @@ -2409,15 +2397,12 @@ class ChooseThreeFromFive(InitialFiveChooseThreeExample, PiCreatureScene): word_arrow_groups[j] for j in (1, 2, 0) ] - self.play(*map(FadeOut, [line, odm_words])) + self.play(*list(map(FadeOut, [line, odm_words]))) def pattern_is_unambiguous(self): all_ones = VGroup() for line in self.stack: - ones = VGroup(*filter( - lambda m : "1" in m.get_tex_string(), - line - )).copy() + ones = VGroup(*[m for m in line if "1" in m.get_tex_string()]).copy() ones.set_color(YELLOW) all_ones.add(ones) @@ -2435,7 +2420,7 @@ class ChooseThreeFromFive(InitialFiveChooseThreeExample, PiCreatureScene): ) self.wait() for trip in it.combinations(self.people, 3): - rects = VGroup(*map(SurroundingRectangle, trip)) + rects = VGroup(*list(map(SurroundingRectangle, trip))) self.add(rects) self.wait(0.3) self.remove(rects) @@ -2676,7 +2661,7 @@ class StudentsGetConfused(PiCreatureScene): return pis def get_shuffle_anim(self, line): - indices = range(len(line)) + indices = list(range(len(line))) random.shuffle(indices) line.generate_target() for i, m in zip(indices, line.target): @@ -2779,7 +2764,7 @@ class HowToComputeNChooseK(ChooseThreeFromFive): ]) choice_numbers.generate_target() dots = VGroup(*[TexMobject("\\cdot") for x in range(k-1)]) - product = VGroup(*it.chain(*zip(choice_numbers.target, dots))) + product = VGroup(*it.chain(*list(zip(choice_numbers.target, dots)))) product.add(choice_numbers.target[-1]) product.arrange_submobjects(RIGHT, buff = SMALL_BUFF) chosen_names_brace = Brace(chosen_names, UP) @@ -2804,7 +2789,7 @@ class HowToComputeNChooseK(ChooseThreeFromFive): lines = self.lines n_perms = self.n_permutaitons_to_show + 1 - for indices in list(it.permutations(range(3)))[1:n_perms]: + for indices in list(it.permutations(list(range(3))))[1:n_perms]: self.play(*[ ApplyMethod( name.next_to, lines[i], UP, SMALL_BUFF, @@ -2852,7 +2837,7 @@ class HowToComputeNChooseK(ChooseThreeFromFive): ]) choice_numbers.generate_target() dots = VGroup(*[TexMobject("\\cdot") for x in range(k-1)]) - product = VGroup(*it.chain(*zip(choice_numbers.target, dots))) + product = VGroup(*it.chain(*list(zip(choice_numbers.target, dots)))) product.add(choice_numbers.target[-1]) product.arrange_submobjects(RIGHT, buff = SMALL_BUFF) product.next_to(frac_line, DOWN, SMALL_BUFF) @@ -3001,7 +2986,7 @@ class HowToComputeNChooseK(ChooseThreeFromFive): place_words = VGroup(*[ TexMobject("%d^\\text{%s}"%(i+1, s)) for i, s in zip( - range(k), + list(range(k)), it.chain(["st", "nd", "rd"], it.repeat("th")) ) ]) @@ -3183,9 +3168,9 @@ class WeirdKindOfCancelation(TeacherStudentsScene): mob.set_color_by_gradient(GREEN, YELLOW) fraction.next_to(self.teacher, UP+LEFT) - names = VGroup(*map(TextMobject, [ + names = VGroup(*list(map(TextMobject, [ "Ali", "Ben", "Cam", "Denis", "Evan" - ])) + ]))) names.arrange_submobjects(RIGHT) names.to_edge(UP, buff = LARGE_BUFF) names.save_state() @@ -3227,12 +3212,12 @@ class WeirdKindOfCancelation(TeacherStudentsScene): self.wait(2) #Go through denominators - permutations = list(it.permutations(range(3)))[1:] + permutations = list(it.permutations(list(range(3))))[1:] self.shuffle(chosen_names, permutations[:2]) self.play(LaggedStart( ShowCreationThenDestruction, - VGroup(*map(SurroundingRectangle, bottom_numbers[::2])) + VGroup(*list(map(SurroundingRectangle, bottom_numbers[::2]))) )) self.shuffle(chosen_names, permutations[2:]) self.wait() @@ -3358,9 +3343,9 @@ class SumsToPowerOf2(Scene): plusses = VGroup(*[TexMobject("+") for n in numbers]) plusses.remove(plusses[-1]) plusses.add(TexMobject("=")) - sum_group = VGroup(*it.chain(*zip( + sum_group = VGroup(*it.chain(*list(zip( numbers.target, plusses - ))) + )))) sum_group.arrange_submobjects(RIGHT, SMALL_BUFF) sum_group.next_to(numbers, UP, LARGE_BUFF) sum_group.shift(MED_LARGE_BUFF*RIGHT) @@ -3405,9 +3390,9 @@ class SumsToPowerOf2(Scene): fractions = self.get_fractions(n) plusses.generate_target() - sum_group = VGroup(*it.chain(*zip( + sum_group = VGroup(*it.chain(*list(zip( fractions, plusses.target - ))) + )))) sum_group.arrange_submobjects(RIGHT, buff = 2*SMALL_BUFF) sum_group.next_to(rhs, LEFT) sum_group.shift(0.5*SMALL_BUFF*DOWN) @@ -3427,9 +3412,9 @@ class SumsToPowerOf2(Scene): plusses = VGroup(*[ TexMobject("+") for f in fractions[:-1] ] + [TexMobject("=")]) - sum_group = VGroup(*it.chain(*zip( + sum_group = VGroup(*it.chain(*list(zip( fractions, plusses - ))) + )))) sum_group.arrange_submobjects(RIGHT) sum_group.next_to( self.n_choose_k_terms, DOWN, diff --git a/active_projects/eop/independence.py b/active_projects/eop/independence.py index b23cd26f..5560347d 100644 --- a/active_projects/eop/independence.py +++ b/active_projects/eop/independence.py @@ -9,10 +9,10 @@ def get_binomial_distribution(n, p): return lambda k : choose(n, k)*(p**(k))*((1-p)**(n-k)) def get_quiz(*questions): - q_mobs = VGroup(*map(TextMobject, [ + q_mobs = VGroup(*list(map(TextMobject, [ "%d. %s"%(i+1, question) for i, question in enumerate(questions) - ])) + ]))) q_mobs.arrange_submobjects( DOWN, buff = MED_LARGE_BUFF, @@ -348,7 +348,7 @@ class IntroduceBinomial(Scene): dist = get_binomial_distribution(n, p) chart = BarChart( [dist(k) for k in range(n+1)], - bar_names = range(n+1), + bar_names = list(range(n+1)), ) chart.to_edge(LEFT) self.bar_chart = chart @@ -411,7 +411,7 @@ class IntroduceBinomial(Scene): chart = self.bar_chart chart_copy = chart.copy() dist = get_binomial_distribution(self.n, self.p) - values = np.array(map(dist, range(self.n+1))) + values = np.array(list(map(dist, list(range(self.n+1))))) values += 0.1 values /= sum(values) @@ -511,11 +511,11 @@ class IntroduceQuiz(PiCreatureScene): def show_distribution(self): dist = get_binomial_distribution(3, 0.7) - values = map(dist, range(4)) + values = list(map(dist, list(range(4)))) chart = BarChart( values, width = 7, - bar_names = range(4) + bar_names = list(range(4)) ) chart.to_edge(RIGHT) for short_p, bar in zip(self.abbreviated_probabilities, chart.bars): @@ -524,7 +524,7 @@ class IntroduceQuiz(PiCreatureScene): self.play( LaggedStart(Write, VGroup( - *filter(lambda m : m is not chart.bars, chart) + *[m for m in chart if m is not chart.bars] )), ) self.play(*[ @@ -654,10 +654,10 @@ class AssociatePatternsWithScores(BreakDownQuestionPatterns): self.think_about_binomial_patterns() def add_slot_groups(self): - self.slot_groups = VGroup(*map( + self.slot_groups = VGroup(*list(map( self.get_slot_group, it.product(*[[True, False]]*3) - )) + ))) self.add(self.slot_groups) self.remove(self.randy) @@ -1072,7 +1072,7 @@ class ThousandPossibleQuizzes(Scene): self.play(top_group.to_edge, UP, SMALL_BUFF) self.play( bottom_label.shift, LEFT, - *map(MoveToTarget, [left_split, right_split]) + *list(map(MoveToTarget, [left_split, right_split])) ) self.play(FadeIn(label)) self.wait() @@ -1136,7 +1136,7 @@ class ThousandPossibleQuizzes(Scene): ) self.play( Write(equation), - *map(Animation, [num1, num2]) + *list(map(Animation, [num1, num2])) ) self.remove(num1, num2) self.wait() @@ -1160,7 +1160,7 @@ class ThousandPossibleQuizzes(Scene): line.next_to(bottom_movers.target, LEFT, MED_LARGE_BUFF, UP) self.revert_to_original_skipping_status() - self.play(*map(MoveToTarget, both_movers)) + self.play(*list(map(MoveToTarget, both_movers))) self.play(ShowCreation(line)) self.play(FadeOut(line)) self.wait() @@ -1210,7 +1210,7 @@ class ThousandPossibleQuizzes(Scene): def get_thousand_quizzes(self): rows = VGroup() - for x in xrange(self.n_quiz_rows): + for x in range(self.n_quiz_rows): quiz = VGroup(*[ Rectangle( height = SMALL_BUFF, @@ -1604,7 +1604,7 @@ class ComputeProbabilityOfOneWrong(Scene): probabilities = VGroup() point_8s = VGroup() point_2s = VGroup() - for i in reversed(range(3)): + for i in reversed(list(range(3))): bool_list = [self.default_bool]*3 bool_list[i] = not self.default_bool probs = ["(%s)"%self.default_p]*3 @@ -1745,9 +1745,9 @@ class ShowFullDistribution(Scene): to_fade.add(VGroup(*score[3:-1])) value_mobs.add(score[-1]) dist = get_binomial_distribution(3, 0.8) - values = map(dist, range(4)) + values = list(map(dist, list(range(4)))) chart = BarChart( - values, bar_names = range(4), + values, bar_names = list(range(4)), ) chart.shift(DOWN) @@ -1784,14 +1784,14 @@ class ShowFullDistribution(Scene): def compare_to_binomial_pattern(self): dist = get_binomial_distribution(3, 0.5) - values = map(dist, range(4)) + values = list(map(dist, list(range(4)))) alt_chart = BarChart(values) alt_chart.move_to(self.bar_chart) bars = alt_chart.bars bars.set_fill(GREY, opacity = 0.5) vect = 4*UP bars.shift(vect) - nums = VGroup(*map(TexMobject, map(str, [1, 3, 3, 1]))) + nums = VGroup(*list(map(TexMobject, list(map(str, [1, 3, 3, 1]))))) for num, bar in zip(nums, bars): num.next_to(bar, UP) bars_copy = bars.copy() @@ -1831,7 +1831,7 @@ class ShowFullDistribution(Scene): alt_rhss.add(rhs) dist = get_binomial_distribution(3, p) - values = map(dist, range(4)) + values = list(map(dist, list(range(4)))) chart = self.bar_chart.copy() chart.change_bar_values(values) for label, bar in zip(chart.bar_top_labels, chart.bars): @@ -1855,7 +1855,7 @@ class ShowFullDistribution(Scene): last = mob for k in range(4): buff = MED_LARGE_BUFF - for indices in it.combinations(range(3), k): + for indices in it.combinations(list(range(3)), k): bool_list = np.array([False]*3) bool_list[list(indices)] = True prob = get_probability_of_slot_group(bool_list) @@ -1907,10 +1907,10 @@ class ShowTrueDistribution(PiCreatureScene): def show_distributions(self): dist = get_binomial_distribution(3, 0.65) - values = np.array(map(dist, range(4))) + values = np.array(list(map(dist, list(range(4))))) alt_values = values + [0.2, 0, 0, 0.2] alt_values /= sum(alt_values) - chart = BarChart(values, bar_names = range(4)) + chart = BarChart(values, bar_names = list(range(4))) bars = chart.bars old_bars = bars.copy() arrows = VGroup() @@ -1933,10 +1933,10 @@ class ShowTrueDistribution(PiCreatureScene): arrows.set_color_by_gradient(BLUE, YELLOW) self.add(chart) - self.play(*map(MoveToTarget, it.chain(bars, old_bars))) + self.play(*list(map(MoveToTarget, it.chain(bars, old_bars)))) self.play( chart.change_bar_values, alt_values, - *map(ShowCreation, arrows) + *list(map(ShowCreation, arrows)) ) self.wait(2) @@ -2100,7 +2100,7 @@ class CorrelationsWith35Percent(ThousandPossibleQuizzes): self.play( GrowFromCenter(brace), FadeIn(prop), - *map(MoveToTarget, parts) + *list(map(MoveToTarget, parts)) ) self.wait() self.play( @@ -2133,7 +2133,7 @@ class CorrelationsWith35Percent(ThousandPossibleQuizzes): self.play( GrowFromCenter(brace), FadeIn(prop), - *map(MoveToTarget, parts) + *list(map(MoveToTarget, parts)) ) self.wait() self.play( @@ -2166,7 +2166,7 @@ class CorrelationsWith35Percent(ThousandPossibleQuizzes): self.play( GrowFromCenter(brace), FadeIn(prop), - *map(MoveToTarget, parts) + *list(map(MoveToTarget, parts)) ) self.wait() self.play( @@ -2249,8 +2249,8 @@ class NameBinomial(Scene): charts = VGroup() for n in ns: dist = get_binomial_distribution(n, p) - values = map(dist, range(n+1)) - chart = BarChart(values, bar_names = range(n+1)) + values = list(map(dist, list(range(n+1)))) + chart = BarChart(values, bar_names = list(range(n+1))) chart.to_edge(LEFT) charts.add(chart) @@ -2321,10 +2321,7 @@ class NameBinomial(Scene): VGroup(*[group[i] for i in flip_indices]) for group in (arrows, crosses, checkmarks) ] - faded_checkmarks = VGroup(*filter( - lambda m : m not in full_checks, - checkmarks - )) + faded_checkmarks = VGroup(*[m for m in checkmarks if m not in full_checks]) self.play(*[ LaggedStart( @@ -2400,7 +2397,7 @@ class NameBinomial(Scene): new_p_mob.move_to(p_mob, LEFT) dist = get_binomial_distribution(10, 0.49) - values = map(dist, range(11)) + values = list(map(dist, list(range(11)))) self.play( Transform(checkmark, female), @@ -2527,7 +2524,7 @@ class CycleThroughPatterns(NameBinomial): question.to_edge(UP, buff = LARGE_BUFF) self.add(question) - all_combinations = list(it.combinations(range(n), k)) + all_combinations = list(it.combinations(list(range(n)), k)) shown_combinations = all_combinations[:self.n_patterns_shown] patterns = VGroup(*[ self.get_pattern(indicies) @@ -2588,8 +2585,8 @@ class Compute6of10GirlsProbability(CycleThroughPatterns): see_chapter_one.set_color(GREEN) computation = TexMobject( "=\\frac{%s}{%s}"%( - "\\cdot ".join(map(str, range(10, 4, -1))), - "\\cdot ".join(map(str, range(1, 7))), + "\\cdot ".join(map(str, list(range(10, 4, -1)))), + "\\cdot ".join(map(str, list(range(1, 7)))), ) ) computation.move_to(ten_choose_six, UP) @@ -2735,10 +2732,10 @@ class GeneralBinomialDistributionValues(Scene): def add_chart(self): dist = get_binomial_distribution(self.n, self.p) - values = map(dist, range(self.n+1)) + values = list(map(dist, list(range(self.n+1)))) chart = BarChart( values, - bar_names = range(self.n+1) + bar_names = list(range(self.n+1)) ) chart.to_edge(LEFT) @@ -2854,19 +2851,19 @@ class GeneralBinomialDistributionValues(Scene): self.wait(2) self.play( bars.restore, - *map(FadeOut, [ + *list(map(FadeOut, [ brace, words, self.pascals_triangle, self.ten_choose_ks - ]) + ])) ) def generalize(self): alt_n = self.alt_n dist = get_binomial_distribution(alt_n, self.p) - values = map(dist, range(alt_n + 1)) + values = list(map(dist, list(range(alt_n + 1)))) alt_chart = BarChart( - values, bar_names = range(alt_n + 1) + values, bar_names = list(range(alt_n + 1)) ) alt_chart.move_to(self.chart) @@ -2918,7 +2915,7 @@ class GeneralBinomialDistributionValues(Scene): for new_p in new_p_values: p = new_p dist = get_binomial_distribution(self.alt_n, p) - values = map(dist, range(self.alt_n + 1)) + values = list(map(dist, list(range(self.alt_n + 1)))) self.play( self.chart.change_bar_values, values, triangle.move_to, interval.number_to_point(p), DOWN @@ -3044,7 +3041,7 @@ class CorrectForDependence(NameBinomial): bar.set_color(average_color(RED_E, BLACK)) dist = get_binomial_distribution(10, 0.65) - values = np.array(map(dist, range(11))) + values = np.array(list(map(dist, list(range(11))))) alt_values = values + 0.1 alt_values[0] -= 0.06 alt_values[1] -= 0.03 @@ -3067,7 +3064,7 @@ class CorrectForDependence(NameBinomial): MoveToTarget(bars), ) self.wait() - self.play(*map(ShowCreation, arrows)) + self.play(*list(map(ShowCreation, arrows))) self.play(chart.change_bar_values, alt_values) ###### @@ -3170,13 +3167,10 @@ class AssumeOrderDoesntMatter(Scene): def show_equality(self): n = 3 prob_groups = VGroup(*[ - VGroup(*map( + VGroup(*list(map( get_probability_of_slot_group, - filter( - lambda t : sum(t) == k, - it.product(*[[True, False]]*n) - ) - )) + [t for t in it.product(*[[True, False]]*n) if sum(t) == k] + ))) for k in range(n+1) ]) for prob_group in prob_groups: @@ -3401,13 +3395,13 @@ class SkepticalOfDistributions(TeacherStudentsScene): #### def get_binomial(self): - k_range = range(11) + k_range = list(range(11)) dists = [ get_binomial_distribution(10, p) for p in (0.2, 0.8, 0.5) ] values_list = [ - map(dist, k_range) + list(map(dist, k_range)) for dist in dists ] chart = BarChart( @@ -3419,7 +3413,7 @@ class SkepticalOfDistributions(TeacherStudentsScene): return chart def get_poisson(self): - k_range = range(11) + k_range = list(range(11)) L = 2 values = [ np.exp(-L) * (L**k) / (scipy.special.gamma(k+1)) @@ -3533,7 +3527,7 @@ class Thumbnail(DangerInProbability): def construct(self): n, p = 15, 0.5 dist = get_binomial_distribution(n, p) - values = np.array(map(dist, range(n+1))) + values = np.array(list(map(dist, list(range(n+1))))) values *= 2 chart = BarChart( values = values, diff --git a/active_projects/eop/pascal.py b/active_projects/eop/pascal.py index e02e9839..8ae04ed2 100644 --- a/active_projects/eop/pascal.py +++ b/active_projects/eop/pascal.py @@ -1,4 +1,4 @@ -from __future__ import print_function + from big_ol_pile_of_manim_imports import * from once_useful_constructs.combinatorics import * diff --git a/active_projects/eop/reusables/dice.py b/active_projects/eop/reusables/dice.py index 7596e825..6073001c 100644 --- a/active_projects/eop/reusables/dice.py +++ b/active_projects/eop/reusables/dice.py @@ -13,7 +13,7 @@ class DieFace(SVGMobject): class RowOfDice(VGroup): CONFIG = { - "values" : range(1,7), + "values" : list(range(1,7)), "direction": RIGHT, } diff --git a/animation/animation.py b/animation/animation.py index 8d281219..410c6cc2 100644 --- a/animation/animation.py +++ b/animation/animation.py @@ -70,10 +70,10 @@ class Animation(object): return self.mobject, self.starting_mobject def get_all_families_zipped(self): - return zip(*map( + return list(zip(*list(map( Mobject.family_members_with_points, self.get_all_mobjects() - )) + )))) def get_sub_alpha(self, alpha, index, num_submobjects): if self.submobject_mode in ["lagged_start", "smoothed_lagged_start"]: diff --git a/animation/composition.py b/animation/composition.py index 6fb4c65e..51f4929e 100644 --- a/animation/composition.py +++ b/animation/composition.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + import itertools as it import numpy as np @@ -81,7 +81,7 @@ class Succession(Animation): for anim in animations: anim.update(0) - animations = filter(lambda x: not(x.empty), animations) + animations = [x for x in animations if not(x.empty)] self.run_times = [anim.run_time for anim in animations] if "run_time" in kwargs: @@ -100,8 +100,8 @@ class Succession(Animation): # critical_alphas[i] is the start alpha of self.animations[i] # critical_alphas[i + 1] is the end alpha of self.animations[i] critical_times = np.concatenate(([0], np.cumsum(self.run_times))) - self.critical_alphas = map(lambda x: np.true_divide( - x, run_time), critical_times) if self.num_anims > 0 else [0.0] + self.critical_alphas = [np.true_divide( + x, run_time) for x in critical_times] if self.num_anims > 0 else [0.0] # self.scene_mobjects_at_time[i] is the scene's mobjects at start of self.animations[i] # self.scene_mobjects_at_time[i + 1] is the scene mobjects at end of self.animations[i] @@ -149,7 +149,7 @@ class Succession(Animation): gt_alpha_iter = it.ifilter( lambda i: self.critical_alphas[i + 1] >= alpha, - range(self.num_anims) + list(range(self.num_anims)) ) i = next(gt_alpha_iter, None) if i is None: @@ -188,7 +188,7 @@ class AnimationGroup(Animation): } def __init__(self, *sub_anims, **kwargs): - sub_anims = filter(lambda x: not(x.empty), sub_anims) + sub_anims = [x for x in sub_anims if not(x.empty)] digest_config(self, locals()) self.update_config(**kwargs) # Handles propagation to self.sub_anims diff --git a/animation/creation.py b/animation/creation.py index 0827c37f..8b5fa69e 100644 --- a/animation/creation.py +++ b/animation/creation.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + import numpy as np diff --git a/animation/indication.py b/animation/indication.py index 26538b7a..c486b422 100644 --- a/animation/indication.py +++ b/animation/indication.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + import numpy as np @@ -221,10 +221,10 @@ class Vibrate(Animation): def update_mobject(self, alpha): time = alpha * self.run_time - families = map( + families = list(map( Mobject.submobject_family, [self.mobject, self.starting_mobject] - ) + )) for mob, start in zip(*families): mob.points = np.apply_along_axis( lambda x_y_z: (x_y_z[0], x_y_z[1] + self.wave_function(x_y_z[0], time), x_y_z[2]), diff --git a/animation/movement.py b/animation/movement.py index c478ab0f..9950aa9e 100644 --- a/animation/movement.py +++ b/animation/movement.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from constants import * diff --git a/animation/numbers.py b/animation/numbers.py index 569ed46b..03fa3928 100644 --- a/animation/numbers.py +++ b/animation/numbers.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from constants import * diff --git a/animation/rotation.py b/animation/rotation.py index 044cba64..21b2898e 100644 --- a/animation/rotation.py +++ b/animation/rotation.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + import numpy as np diff --git a/animation/specialized.py b/animation/specialized.py index 956ad880..5b43dbd3 100644 --- a/animation/specialized.py +++ b/animation/specialized.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + import numpy as np diff --git a/animation/transform.py b/animation/transform.py index 45e18cf3..b6635c51 100644 --- a/animation/transform.py +++ b/animation/transform.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + import inspect import numpy as np diff --git a/animation/update.py b/animation/update.py index fcef3e9b..ec5dfbd0 100644 --- a/animation/update.py +++ b/animation/update.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from constants import * diff --git a/big_ol_pile_of_manim_imports.py b/big_ol_pile_of_manim_imports.py index 0819d39f..7a86ce4c 100644 --- a/big_ol_pile_of_manim_imports.py +++ b/big_ol_pile_of_manim_imports.py @@ -12,7 +12,7 @@ addressible by changing this file. Note: One should NOT import from this file for main library code, it is meant only as a convenience for scripts creating scenes for videos. """ -from __future__ import absolute_import + from constants import * diff --git a/cairo_test.py b/cairo_test.py new file mode 100644 index 00000000..a9cb9f36 --- /dev/null +++ b/cairo_test.py @@ -0,0 +1,74 @@ +import math +import cairo +from PIL import Image +import subprocess as sp +import os +import numpy as np +import sys + +WIDTH, HEIGHT = 1024, 1024 + + +def argb32_to_rgba(array): + h, w = array.shape + result = np.ndarray(shape=(h, w, 4), dtype=np.uint8) + for i in range(0, 4): + result[:, :, (i + 1) % 4] = (array // (256**i)) % 256 + # result[:, :, 3] = array % 256 + return result + + +data = np.ndarray(shape=(HEIGHT, WIDTH, 4), dtype=np.uint8) + +surface = cairo.ImageSurface.create_for_data( + data, cairo.FORMAT_ARGB32, WIDTH, HEIGHT +) + +# surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, WIDTH, HEIGHT) + +# surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, WIDTH, HEIGHT) +ctx = cairo.Context(surface) + +ctx.scale(WIDTH, HEIGHT) # Normalizing the canvas + +pat = cairo.LinearGradient(0.0, 0.0, 0.0, 1.0) +pat.add_color_stop_rgba(1, 0.7, 0, 0, 0.5) # First stop, 50% opacity +pat.add_color_stop_rgba(0, 0.9, 0.7, 0.2, 1) # Last stop, 100% opacity + +ctx.rectangle(0, 0, 1, 1) # Rectangle(x0, y0, x1, y1) +ctx.set_source(pat) +ctx.fill() + +ctx.translate(0.1, 0.1) # Changing the current transformation matrix + +ctx.move_to(0, 0) +# Arc(cx, cy, radius, start_angle, stop_angle) +ctx.arc(0.2, 0.1, 0.1, -math.pi / 2, 0) +ctx.line_to(0.5, 0.1) # Line to (x,y) +# Curve(x1, y1, x2, y2, x3, y3) +ctx.curve_to(0.5, 0.2, 0.5, 0.4, 0.2, 0.8) +ctx.close_path() + +ctx.set_source_rgb(0.8, 0.2, 0.5) # Solid color +ctx.set_line_width(0.01) +ctx.stroke() + +# ctx.set_source(pat) +# ctx.fill() + +new_data = np.array(data) +new_data[:,:,:3] = data[:,:,2::-1] + +im = Image.fromarray(new_data, mode="RGBa") +im2 = im.convert("RGBA") +im2.show() +print(new_data[-1, -1]) + + +surface.write_to_png("example.png") # Output to PNG + +FNULL = open(os.devnull, 'w') +sp.call(["open", "example.png"], stdout=FNULL, stderr=sp.STDOUT) +FNULL.close() + +print(np.array(Image.open("example.png"))[-1, -1]) diff --git a/camera/camera.py b/camera/camera.py index 56800683..848bcc24 100644 --- a/camera/camera.py +++ b/camera/camera.py @@ -1,9 +1,9 @@ -from __future__ import print_function + import itertools as it import numpy as np import operator as op -import aggdraw +# import aggdraw import copy import time @@ -44,7 +44,7 @@ class Camera(object): # than this value will be rescaled. "max_allowable_norm": FRAME_WIDTH, "image_mode": "RGBA", - "n_rgb_coords": 4, + "n_channels": 4, "pixel_array_dtype": 'uint8', "use_z_coordinate_for_display_order": False, # z_buff_func is only used if the flag above is set to True. @@ -131,7 +131,7 @@ class Camera(object): self.background_color, self.background_opacity ) self.background = np.zeros( - (height, width, self.n_rgb_coords), + (height, width, self.n_channels), dtype=self.pixel_array_dtype ) self.background[:, :] = background_rgba @@ -372,8 +372,7 @@ class Camera(object): coord_strings[0] = "M" + coord_strings[0] # The C at the start of every 6th number communicates # that the following 6 define a cubic Bezier - coord_strings[2::6] = map( - lambda s: "C" + str(s), coord_strings[2::6]) + coord_strings[2::6] = ["C" + str(s) for s in coord_strings[2::6]] # Possibly finish with "Z" if vmobject.mark_paths_closed: coord_strings[-1] = coord_strings[-1] + " Z" @@ -549,7 +548,7 @@ class Camera(object): return 1 + (thickness - 1) / factor def get_thickening_nudges(self, thickness): - _range = range(-thickness / 2 + 1, thickness / 2 + 1) + _range = list(range(-thickness / 2 + 1, thickness / 2 + 1)) return np.array(list(it.product(_range, _range))) def thickened_coordinates(self, pixel_coords, thickness): diff --git a/camera/mapping_camera.py b/camera/mapping_camera.py index d85f51ca..8fec02ac 100644 --- a/camera/mapping_camera.py +++ b/camera/mapping_camera.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + import numpy as np diff --git a/camera/moving_camera.py b/camera/moving_camera.py index 99a38473..21b7f947 100644 --- a/camera/moving_camera.py +++ b/camera/moving_camera.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from constants import FRAME_HEIGHT from constants import FRAME_WIDTH diff --git a/camera/multi_camera.py b/camera/multi_camera.py index 42b428cd..e61496da 100644 --- a/camera/multi_camera.py +++ b/camera/multi_camera.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from camera.moving_camera import MovingCamera from utils.iterables import list_difference_update diff --git a/camera/three_d_camera.py b/camera/three_d_camera.py index d2777a33..52b7b56e 100644 --- a/camera/three_d_camera.py +++ b/camera/three_d_camera.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + import numpy as np @@ -98,7 +98,7 @@ class ThreeDCamera(MovingCamera): # -np.linalg.norm(vm.get_center()-camera_point) # for vm in vmobs # ]) - three_d_status = map(should_shade_in_3d, vmobs) + three_d_status = list(map(should_shade_in_3d, vmobs)) has_points = [vm.get_num_points() > 0 for vm in vmobs] if all(three_d_status) and all(has_points): cmp_vect = self.get_unit_normal_vect(vmobs[1]) diff --git a/constants.py b/constants.py index d7c77829..0ef138cd 100644 --- a/constants.py +++ b/constants.py @@ -200,7 +200,7 @@ COLOR_MAP = { "GREEN_SCREEN": "#00FF00", "ORANGE": "#FF862F", } -PALETTE = COLOR_MAP.values() +PALETTE = list(COLOR_MAP.values()) locals().update(COLOR_MAP) -for name in filter(lambda s: s.endswith("_C"), COLOR_MAP.keys()): +for name in [s for s in list(COLOR_MAP.keys()) if s.endswith("_C")]: locals()[name.replace("_C", "")] = locals()[name] diff --git a/continual_animation/from_animation.py b/continual_animation/from_animation.py index d0bc9e81..61314b85 100644 --- a/continual_animation/from_animation.py +++ b/continual_animation/from_animation.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from continual_animation.continual_animation import ContinualAnimation diff --git a/continual_animation/numbers.py b/continual_animation/numbers.py index 8c618ace..2cc81523 100644 --- a/continual_animation/numbers.py +++ b/continual_animation/numbers.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from continual_animation.from_animation import NormalAnimationAsContinualAnimation from animation.numbers import ChangingDecimal diff --git a/continual_animation/update.py b/continual_animation/update.py index 7e57331e..a72d471a 100644 --- a/continual_animation/update.py +++ b/continual_animation/update.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from continual_animation.continual_animation import ContinualAnimation from animation.update import MaintainPositionRelativeTo diff --git a/example.png b/example.png new file mode 100644 index 0000000000000000000000000000000000000000..f5887cd890d772364cd0ab01a48c0994466e0839 GIT binary patch literal 35767 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 self.max_patron_width: diff --git a/for_3b1b_videos/pi_creature_animations.py b/for_3b1b_videos/pi_creature_animations.py index 96721b7f..d0561236 100644 --- a/for_3b1b_videos/pi_creature_animations.py +++ b/for_3b1b_videos/pi_creature_animations.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from constants import * @@ -117,7 +117,7 @@ class FlashThroughClass(Animation): if not isinstance(mobject, PiCreatureClass): raise Exception("FlashThroughClass mobject must be a PiCreatureClass") digest_config(self, kwargs) - self.indices = range(mobject.height * mobject.width) + self.indices = list(range(mobject.height * mobject.width)) if mode == "random": np.random.shuffle(self.indices) diff --git a/for_3b1b_videos/pi_creature_scene.py b/for_3b1b_videos/pi_creature_scene.py index 86f23cbc..bcef0735 100644 --- a/for_3b1b_videos/pi_creature_scene.py +++ b/for_3b1b_videos/pi_creature_scene.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + import itertools as it import numpy as np @@ -67,10 +67,7 @@ class PiCreatureScene(Scene): def get_on_screen_pi_creatures(self): mobjects = self.get_mobjects() - return VGroup(*filter( - lambda pi: pi in mobjects, - self.get_pi_creatures() - )) + return VGroup(*[pi for pi in self.get_pi_creatures() if pi in mobjects]) def introduce_bubble(self, *args, **kwargs): if isinstance(args[0], PiCreature): @@ -99,7 +96,7 @@ class PiCreatureScene(Scene): pi.bubble is not None and \ pi.bubble in on_screen_mobjects - pi_creatures_with_bubbles = filter(has_bubble, self.get_pi_creatures()) + pi_creatures_with_bubbles = list(filter(has_bubble, self.get_pi_creatures())) if pi_creature in pi_creatures_with_bubbles: pi_creatures_with_bubbles.remove(pi_creature) old_bubble = pi_creature.bubble @@ -161,10 +158,7 @@ class PiCreatureScene(Scene): if not self.any_pi_creatures_on_screen(): return animations - non_pi_creature_anims = filter( - lambda anim: anim.mobject not in self.get_pi_creatures(), - animations - ) + non_pi_creature_anims = [anim for anim in animations if anim.mobject not in self.get_pi_creatures()] if len(non_pi_creature_anims) == 0: return animations first_anim = non_pi_creature_anims[0] @@ -178,10 +172,7 @@ class PiCreatureScene(Scene): continue if pi_creature in first_anim.mobject.submobject_family(): continue - anims_with_pi_creature = filter( - lambda anim: pi_creature in anim.mobject.submobject_family(), - animations - ) + anims_with_pi_creature = [anim for anim in animations if pi_creature in anim.mobject.submobject_family()] for anim in anims_with_pi_creature: if isinstance(anim, Transform): index = anim.mobject.submobject_family().index(pi_creature) @@ -336,7 +327,7 @@ class TeacherStudentsScene(PiCreatureScene): ) def get_student_changes(self, *modes, **kwargs): - pairs = zip(self.get_students(), modes) + pairs = list(zip(self.get_students(), modes)) pairs = [(s, m) for s, m in pairs if m is not None] start = VGroup(*[s for s, m in pairs]) target = VGroup(*[s.copy().change_mode(m) for s, m in pairs]) diff --git a/mayavi_test.py b/mayavi_test.py new file mode 100644 index 00000000..dfd297da --- /dev/null +++ b/mayavi_test.py @@ -0,0 +1,55 @@ +from numpy import arange, pi, cos, sin + +from traits.api import HasTraits, Range, Instance, \ + on_trait_change +from traitsui.api import View, Item, Group + +from mayavi.core.api import PipelineBase +from mayavi.core.ui.api import MayaviScene, SceneEditor, \ + MlabSceneModel + + +dphi = pi/1000. +phi = arange(0.0, 2*pi + 0.5*dphi, dphi, 'd') + +def curve(n_mer, n_long): + mu = phi*n_mer + x = cos(mu) * (1 + cos(n_long * mu/n_mer)*0.5) + y = sin(mu) * (1 + cos(n_long * mu/n_mer)*0.5) + z = 0.5 * sin(n_long*mu/n_mer) + t = sin(mu) + return x, y, z, t + + +class MyModel(HasTraits): + n_meridional = Range(0, 30, 6, )#mode='spinner') + n_longitudinal = Range(0, 30, 11, )#mode='spinner') + + scene = Instance(MlabSceneModel, ()) + + plot = Instance(PipelineBase) + + + # When the scene is activated, or when the parameters are changed, we + # update the plot. + @on_trait_change('n_meridional,n_longitudinal,scene.activated') + def update_plot(self): + x, y, z, t = curve(self.n_meridional, self.n_longitudinal) + if self.plot is None: + self.plot = self.scene.mlab.plot3d(x, y, z, t, + tube_radius=0.025, colormap='Spectral') + else: + self.plot.mlab_source.trait_set(x=x, y=y, z=z, scalars=t) + + + # The layout of the dialog created + view = View(Item('scene', editor=SceneEditor(scene_class=MayaviScene), + height=250, width=300, show_label=False), + Group( + '_', 'n_meridional', 'n_longitudinal', + ), + resizable=True, + ) + +my_model = MyModel() +my_model.configure_traits() \ No newline at end of file diff --git a/mobject/coordinate_systems.py b/mobject/coordinate_systems.py index f238e0e2..8bc823ba 100644 --- a/mobject/coordinate_systems.py +++ b/mobject/coordinate_systems.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + import numpy as np @@ -102,8 +102,8 @@ class Axes(VGroup): while abs(lh - rh) > 0.001: mh = np.mean([lh, rh]) hands = [lh, mh, rh] - points = map(graph.point_from_proportion, hands) - lx, mx, rx = map(self.x_axis.point_to_number, points) + points = list(map(graph.point_from_proportion, hands)) + lx, mx, rx = list(map(self.x_axis.point_to_number, points)) if lx <= x and rx >= x: if mx > x: rh = mh @@ -240,9 +240,9 @@ class NumberPlane(VMobject): def get_coordinate_labels(self, x_vals=None, y_vals=None): coordinate_labels = VGroup() if x_vals is None: - x_vals = range(-int(self.x_radius), int(self.x_radius) + 1) + x_vals = list(range(-int(self.x_radius), int(self.x_radius) + 1)) if y_vals is None: - y_vals = range(-int(self.y_radius), int(self.y_radius) + 1) + y_vals = list(range(-int(self.y_radius), int(self.y_radius) + 1)) for index, vals in enumerate([x_vals, y_vals]): num_pair = [0, 0] for val in vals: @@ -331,7 +331,7 @@ class ComplexPlane(NumberPlane): result = VGroup() if len(numbers) == 0: - numbers = range(-int(self.x_radius), int(self.x_radius) + 1) + numbers = list(range(-int(self.x_radius), int(self.x_radius) + 1)) numbers += [ complex(0, y) for y in range(-int(self.y_radius), int(self.y_radius) + 1) diff --git a/mobject/frame.py b/mobject/frame.py index a197d474..68bef518 100644 --- a/mobject/frame.py +++ b/mobject/frame.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from constants import * from mobject.geometry import Rectangle diff --git a/mobject/functions.py b/mobject/functions.py index e6560580..e6ab5772 100644 --- a/mobject/functions.py +++ b/mobject/functions.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from constants import * diff --git a/mobject/geometry.py b/mobject/geometry.py index 3cd4a00d..c3d4ac85 100644 --- a/mobject/geometry.py +++ b/mobject/geometry.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from constants import * @@ -334,7 +334,7 @@ class Line(VMobject): def set_start_and_end(self, start, end): start_to_end = self.pointify(end) - self.pointify(start) vect = np.zeros(len(start_to_end)) - longer_dim = np.argmax(map(abs, start_to_end)) + longer_dim = np.argmax(list(map(abs, start_to_end))) vect[longer_dim] = start_to_end[longer_dim] self.start, self.end = [ arg.get_edge_center(unit * vect) @@ -495,7 +495,7 @@ class Arrow(Line): } def __init__(self, *args, **kwargs): - points = map(self.pointify, args) + points = list(map(self.pointify, args)) if len(args) == 1: args = (points[0] + UP + LEFT, points[0]) Line.__init__(self, *args, **kwargs) diff --git a/mobject/matrix.py b/mobject/matrix.py index 7558cf77..5e445540 100644 --- a/mobject/matrix.py +++ b/mobject/matrix.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + import numpy as np diff --git a/mobject/mobject.py b/mobject/mobject.py index 2f6f39dc..397c1b81 100644 --- a/mobject/mobject.py +++ b/mobject/mobject.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + import copy import itertools as it @@ -40,7 +40,7 @@ class Mobject(Container): def __init__(self, *submobjects, **kwargs): Container.__init__(self, *submobjects, **kwargs) - if not all(map(lambda m: isinstance(m, Mobject), submobjects)): + if not all([isinstance(m, Mobject) for m in submobjects]): raise Exception("All submobjects must be of type Mobject") self.submobjects = list(submobjects) self.color = Color(self.color) @@ -89,10 +89,7 @@ class Mobject(Container): Ensures all attributes which are mobjects are included in the submobjects list. """ - mobject_attrs = filter( - lambda x: isinstance(x, Mobject), - self.__dict__.values() - ) + mobject_attrs = [x for x in list(self.__dict__.values()) if isinstance(x, Mobject)] self.submobjects = list_update(self.submobjects, mobject_attrs) return self @@ -127,7 +124,7 @@ class Mobject(Container): submob.copy() for submob in self.submobjects ] family = self.submobject_family() - for attr, value in self.__dict__.items(): + for attr, value in list(self.__dict__.items()): if isinstance(value, Mobject) and value in family and value is not self: setattr(copy_mobject, attr, value.copy()) return copy_mobject @@ -755,16 +752,13 @@ class Mobject(Container): return result + self.submobjects def submobject_family(self): - sub_families = map(Mobject.submobject_family, self.submobjects) + sub_families = list(map(Mobject.submobject_family, self.submobjects)) all_mobjects = [self] + list(it.chain(*sub_families)) #all_mobjects = list(it.chain(*sub_families)) + [self] return remove_list_redundancies(all_mobjects) def family_members_with_points(self): - return filter( - lambda m: m.get_num_points() > 0, - self.submobject_family() - ) + return [m for m in self.submobject_family() if m.get_num_points() > 0] def arrange_submobjects(self, direction=RIGHT, center=True, **kwargs): for m1, m2 in zip(self.submobjects, self.submobjects[1:]): diff --git a/mobject/number_line.py b/mobject/number_line.py index ebcfa36c..eae38b99 100644 --- a/mobject/number_line.py +++ b/mobject/number_line.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from constants import * @@ -116,7 +116,7 @@ class NumberLine(VMobject): if len(numbers) == 0: numbers = self.default_numbers_to_display() if "force_integers" in kwargs and kwargs["force_integers"]: - numbers = map(int, numbers) + numbers = list(map(int, numbers)) result = VGroup() for number in numbers: mob = TexMobject(str(number)) diff --git a/mobject/numbers.py b/mobject/numbers.py index fb7ae5f1..6be4e76e 100644 --- a/mobject/numbers.py +++ b/mobject/numbers.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from constants import * import operator as op diff --git a/mobject/probability.py b/mobject/probability.py index dbc95b2f..49c8f9bb 100644 --- a/mobject/probability.py +++ b/mobject/probability.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from constants import * diff --git a/mobject/shape_matchers.py b/mobject/shape_matchers.py index 4e341e0d..c0f8e394 100644 --- a/mobject/shape_matchers.py +++ b/mobject/shape_matchers.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from constants import * diff --git a/mobject/svg/brace.py b/mobject/svg/brace.py index 4ef048da..e5c42cb7 100644 --- a/mobject/svg/brace.py +++ b/mobject/svg/brace.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + import numpy as np diff --git a/mobject/svg/drawings.py b/mobject/svg/drawings.py index 5005a4d5..c82d3108 100644 --- a/mobject/svg/drawings.py +++ b/mobject/svg/drawings.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + import itertools as it from constants import * @@ -711,7 +711,7 @@ class Logo(VMobject): fill_opacity=1, stroke_width=0, ) - for vertex3 in half_base * LEFT, ORIGIN, + for vertex3 in (half_base * LEFT, ORIGIN,) ] left_half_triangle = right_half_triangle.copy() left_half_triangle.flip(UP, about_point=ORIGIN) @@ -782,7 +782,7 @@ class Logo(VMobject): class DeckOfCards(VGroup): def __init__(self, **kwargs): - possible_values = map(str, range(1, 11)) + ["J", "Q", "K"] + possible_values = list(map(str, list(range(1, 11)))) + ["J", "Q", "K"] possible_suits = ["hearts", "diamonds", "spades", "clubs"] VGroup.__init__(self, *[ PlayingCard(value=value, suit=suit, **kwargs) @@ -804,7 +804,7 @@ class PlayingCard(VGroup): "color": LIGHT_GREY, "turned_over": False, "possible_suits": ["hearts", "diamonds", "spades", "clubs"], - "possible_values": map(str, range(2, 11)) + ["J", "Q", "K", "A"], + "possible_values": list(map(str, list(range(2, 11)))) + ["J", "Q", "K", "A"], } def __init__(self, key=None, **kwargs): @@ -878,7 +878,7 @@ class PlayingCard(VGroup): def get_design(self, value, symbol): if value == "A": return self.get_ace_design(symbol) - if value in map(str, range(2, 11)): + if value in list(map(str, list(range(2, 11)))): return self.get_number_design(value, symbol) else: return self.get_face_card_design(value, symbol) diff --git a/mobject/svg/svg_mobject.py b/mobject/svg/svg_mobject.py index 2ad45c51..50fc3e51 100644 --- a/mobject/svg/svg_mobject.py +++ b/mobject/svg/svg_mobject.py @@ -103,7 +103,7 @@ class SVGMobject(VMobject): else: pass # TODO # warnings.warn("Unknown element type: " + element.tagName) - result = filter(lambda m: m is not None, result) + result = [m for m in result if m is not None] self.handle_transforms(element, VMobject(*result)) if len(result) > 1 and not self.unpack_groups: result = [VGroup(*result)] @@ -295,15 +295,15 @@ class VMobjectFromSVGPathstring(VMobject): "A", # elliptical Arc "Z", # closepath ] - result += map(lambda s: s.lower(), result) + result += [s.lower() for s in result] return result def generate_points(self): pattern = "[%s]" % ("".join(self.get_path_commands())) - pairs = zip( + pairs = list(zip( re.findall(pattern, self.path_string), re.split(pattern, self.path_string)[1:] - ) + )) # Which mobject should new points be added to self.growing_path = self for command, coord_string in pairs: diff --git a/mobject/svg/tex_mobject.py b/mobject/svg/tex_mobject.py index 22c86379..6db0726f 100644 --- a/mobject/svg/tex_mobject.py +++ b/mobject/svg/tex_mobject.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from constants import * from .svg_mobject import SVGMobject @@ -92,10 +92,7 @@ class SingleStringTexMobject(SVGMobject): # Handle imbalanced \left and \right num_lefts, num_rights = [ - len(filter( - lambda s: s[0] in "(){}[]|.\\", - tex.split(substr)[1:] - )) + len([s for s in tex.split(substr)[1:] if s[0] in "(){}[]|.\\"]) for substr in ("\\left", "\\right") ] if num_lefts != num_rights: @@ -164,13 +161,13 @@ class TexMobject(SingleStringTexMobject): def break_up_tex_strings(self, tex_strings): substrings_to_isolate = op.add( self.substrings_to_isolate, - self.tex_to_color_map.keys() + list(self.tex_to_color_map.keys()) ) split_list = split_string_list_to_isolate_substring( tex_strings, *substrings_to_isolate ) - split_list = map(str.strip, split_list) - split_list = filter(lambda s: s != '', split_list) + split_list = list(map(str.strip, split_list)) + split_list = [s for s in split_list if s != ''] return split_list def break_up_by_substrings(self): @@ -209,10 +206,7 @@ class TexMobject(SingleStringTexMobject): else: return tex1 == tex2 - return VGroup(*filter( - lambda m: test(tex, m.get_tex_string()), - self.submobjects - )) + return VGroup(*[m for m in self.submobjects if test(tex, m.get_tex_string())]) def get_part_by_tex(self, tex, **kwargs): all_parts = self.get_parts_by_tex(tex, **kwargs) @@ -225,7 +219,7 @@ class TexMobject(SingleStringTexMobject): return self def set_color_by_tex_to_color_map(self, texs_to_color_map, **kwargs): - for texs, color in texs_to_color_map.items(): + for texs, color in list(texs_to_color_map.items()): try: # If the given key behaves like tex_strings texs + '' diff --git a/mobject/three_dimensions.py b/mobject/three_dimensions.py index 0a183d30..a7a9bf4f 100644 --- a/mobject/three_dimensions.py +++ b/mobject/three_dimensions.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from constants import * diff --git a/mobject/types/image_mobject.py b/mobject/types/image_mobject.py index 9d6878b4..45560723 100644 --- a/mobject/types/image_mobject.py +++ b/mobject/types/image_mobject.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + import numpy as np diff --git a/mobject/types/point_cloud_mobject.py b/mobject/types/point_cloud_mobject.py index de628781..dbefff92 100644 --- a/mobject/types/point_cloud_mobject.py +++ b/mobject/types/point_cloud_mobject.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from constants import * @@ -54,13 +54,13 @@ class PMobject(Mobject): # def set_color_by_gradient(self, start_color, end_color): def set_color_by_gradient(self, *colors): - self.rgbas = np.array(map( + self.rgbas = np.array(list(map( color_to_rgba, color_gradient(colors, len(self.points)) - )) + ))) return self - start_rgba, end_rgba = map(color_to_rgba, [start_color, end_color]) + start_rgba, end_rgba = list(map(color_to_rgba, [start_color, end_color])) for mob in self.family_members_with_points(): num_points = mob.get_num_points() mob.rgbas = np.array([ @@ -70,7 +70,7 @@ class PMobject(Mobject): return self def set_colors_by_radial_gradient(self, center=None, radius=1, inner_color=WHITE, outer_color=BLACK): - start_rgba, end_rgba = map(color_to_rgba, [start_color, end_color]) + start_rgba, end_rgba = list(map(color_to_rgba, [start_color, end_color])) if center is None: center = self.get_center() for mob in self.family_members_with_points(): @@ -129,7 +129,7 @@ class PMobject(Mobject): def ingest_submobjects(self): attrs = self.get_array_attrs() - arrays = map(self.get_merged_array, attrs) + arrays = list(map(self.get_merged_array, attrs)) for attr, array in zip(attrs, arrays): setattr(self, attr, array) self.submobjects = [] @@ -184,7 +184,7 @@ class Mobject1D(PMobject): Mobject.__init__(self, **kwargs) def add_line(self, start, end, color=None): - start, end = map(np.array, [start, end]) + start, end = list(map(np.array, [start, end])) length = np.linalg.norm(end - start) if length == 0: points = [start] diff --git a/mobject/types/vectorized_mobject.py b/mobject/types/vectorized_mobject.py index 3253909d..9ec444c9 100644 --- a/mobject/types/vectorized_mobject.py +++ b/mobject/types/vectorized_mobject.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from colour import Color @@ -316,10 +316,7 @@ class VMobject(Mobject): return self def get_subpath_mobjects(self): - return filter( - lambda m: hasattr(m, 'is_subpath') and m.is_subpath, - self.submobjects - ) + return [m for m in self.submobjects if hasattr(m, 'is_subpath') and m.is_subpath] def apply_function(self, function): factor = self.pre_function_handle_to_anchor_scale_factor diff --git a/mobject/value_tracker.py b/mobject/value_tracker.py index 0af4d948..7c8ee584 100644 --- a/mobject/value_tracker.py +++ b/mobject/value_tracker.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + import numpy as np diff --git a/old_projects/256.py b/old_projects/256.py index f413d368..e62bf871 100644 --- a/old_projects/256.py +++ b/old_projects/256.py @@ -292,7 +292,7 @@ class MainBreakdown(Scene): Animation(hash_names) ) self.play(get_passing_flash(), Animation(hash_names)) - self.play(*map(FadeOut, [name, hash_names])) + self.play(*list(map(FadeOut, [name, hash_names]))) self.gpu = gpu self.rate_words = rate_words diff --git a/old_projects/WindingNumber.py b/old_projects/WindingNumber.py index e286f1ce..f65ba9ab 100644 --- a/old_projects/WindingNumber.py +++ b/old_projects/WindingNumber.py @@ -1,4 +1,4 @@ -from __future__ import print_function + from big_ol_pile_of_manim_imports import * import time @@ -483,12 +483,12 @@ def plane_func_by_wind_spec(*specs): return (p[0], p[1], 1) else: print("Error in plane_func_by_wind_spec embiggen!") - specs = map(embiggen, specs) + specs = list(map(embiggen, specs)) - pos_specs = filter(lambda x_y_z : x_y_z[2] > 0, specs) - neg_specs = filter(lambda x_y_z1 : x_y_z1[2] < 0, specs) + pos_specs = [x_y_z for x_y_z in specs if x_y_z[2] > 0] + neg_specs = [x_y_z1 for x_y_z1 in specs if x_y_z1[2] < 0] - neg_specs_made_pos = map (lambda x_y_z2 : (x_y_z2[0], x_y_z2[1], -x_y_z2[2]), neg_specs) + neg_specs_made_pos = [(x_y_z2[0], x_y_z2[1], -x_y_z2[2]) for x_y_z2 in neg_specs] def poly(c, root_specs): return np.prod([(c - complex(x, y))**z for (x, y, z) in root_specs]) @@ -949,7 +949,7 @@ class EquationSolver2dNode(object): if len(self.children) == 0: return 0 - return 1 + max(map(lambda n : n.depth(), self.children)) + return 1 + max([n.depth() for n in self.children]) def nodes_at_depth(self, n): if n == 0: @@ -957,7 +957,7 @@ class EquationSolver2dNode(object): # Not the efficient way to flatten lists, because Python + is linear in list size, # but we have at most two children, so no big deal here - return sum(map(lambda c : c.nodes_at_depth(n - 1), self.children), []) + return sum([c.nodes_at_depth(n - 1) for c in self.children], []) # This is definitely NOT the efficient way to do BFS, but I'm just trying to write something # quick without thinking that gets the job done on small instances for now @@ -966,17 +966,17 @@ class EquationSolver2dNode(object): # Not the efficient way to flatten lists, because Python + is linear in list size, # but this IS hacky_bfs... - return sum(map(lambda i : self.nodes_at_depth(i), range(depth + 1)), []) + return sum([self.nodes_at_depth(i) for i in range(depth + 1)], []) def display_in_series(self): - return Succession(self.first_anim, *map(lambda n : n.display_in_series(), self.children)) + return Succession(self.first_anim, *[n.display_in_series() for n in self.children]) def display_in_parallel(self): - return Succession(self.first_anim, AnimationGroup(*map(lambda n : n.display_in_parallel(), self.children))) + return Succession(self.first_anim, AnimationGroup(*[n.display_in_parallel() for n in self.children])) def display_in_bfs(self): bfs_nodes = self.hacky_bfs() - return Succession(*map(lambda n : n.first_anim, bfs_nodes)) + return Succession(*[n.first_anim for n in bfs_nodes]) def play_in_bfs(self, scene, border_anim): bfs_nodes = self.hacky_bfs() @@ -1228,7 +1228,7 @@ class EquationSolver2d(ColorMappedObjectsScene): rect.get_bottom_right(), rect.get_bottom_left(), ] - border = Polygon(*map(lambda x : num_plane.coords_to_point(*x) + IN, rect_points)) + border = Polygon(*[num_plane.coords_to_point(*x) + IN for x in rect_points]) match_style_with_bg(border, base_line) rect_time_without_linger = 4 * run_time_base @@ -1493,7 +1493,7 @@ class SignsExplanation(Scene): def construct(self): num_line = NumberLine() largest_num = 10 - num_line.add_numbers(*range(-largest_num, largest_num + 1)) + num_line.add_numbers(*list(range(-largest_num, largest_num + 1))) self.add(num_line) self.wait() @@ -1984,7 +1984,7 @@ class LoopSplitScene(ColorMappedObjectsScene): return UpdateFromAlphaFunc(mob, lambda m, a : m.set_fill(opacity = interpolate(start, end, a))) def bullet_list_fade(start, end, bullet_list): - return map(lambda b : bullet_fade(start, end, b), bullet_list) + return [bullet_fade(start, end, b) for b in bullet_list] def line_fade(start, end, mob): return UpdateFromAlphaFunc(mob, lambda m, a : m.set_stroke(width = interpolate(start, end, a) * stroke_width)) diff --git a/old_projects/WindingNumber_G.py b/old_projects/WindingNumber_G.py index 07fc2c58..a15d50fc 100644 --- a/old_projects/WindingNumber_G.py +++ b/old_projects/WindingNumber_G.py @@ -176,14 +176,14 @@ class Introduce1DFunctionCase(Scene): x_axis_config = { "unit_size" : 3, "tick_frequency" : 0.25, - "numbers_with_elongated_ticks" : range(-1, 4) + "numbers_with_elongated_ticks" : list(range(-1, 4)) }, y_min = -2, y_max = 4.5, ) axes.to_corner(DOWN+LEFT) - axes.x_axis.add_numbers(*range(-1, 4)) + axes.x_axis.add_numbers(*list(range(-1, 4))) axes.y_axis.label_direction = LEFT - axes.y_axis.add_numbers(-1, *range(1, 5)) + axes.y_axis.add_numbers(-1, *list(range(1, 5))) inputs = TextMobject("Inputs") inputs.next_to(axes.x_axis, UP, aligned_edge = RIGHT) @@ -279,7 +279,7 @@ class Introduce1DFunctionCase(Scene): self.wait() self.play( MoveToTarget(equation, replace_mobject_with_target_in_scene = True), - *map(FadeOut, [equation_arrow, v_line]) + *list(map(FadeOut, [equation_arrow, v_line])) ) self.set_variables_as_attrs( @@ -778,7 +778,7 @@ class InputOutputScene(Scene): label_colors = [GREEN, RED] for plane, vect, text, color in zip(planes, vects, label_texts, label_colors): plane.stretch_to_fit_width(self.plane_width) - plane.add_coordinates(x_vals = range(-2, 3), y_vals = range(-2, 3)) + plane.add_coordinates(x_vals = list(range(-2, 3)), y_vals = list(range(-2, 3))) plane.white_parts = VGroup(plane.axes, plane.coordinate_labels) plane.lines_to_fade = VGroup(plane.main_lines, plane.secondary_lines) plane.move_to(vect*FRAME_X_RADIUS/2 + self.y_shift*DOWN) @@ -906,11 +906,11 @@ class IntroduceInputOutputScene(InputOutputScene): FadeIn(output_label) ) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ input_label_arrow, input_label, output_label_arrow, output_label, curved_arrow, function_label, - ])) + ]))) #General movements and wiggles out_dot_continual_update = self.get_output_dot_continual_update(in_dot, out_dot) @@ -1042,9 +1042,9 @@ class IntroduceVectorField(IntroduceInputOutputScene): newer_in_vectors.add(in_vector.copy()) self.remove(*continual_updates) self.remove() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ out_dot, out_vector, in_vectors, in_dot, in_vector - ])) + ]))) self.wait() target_length = 0.4 for vector in newer_in_vectors: @@ -1557,8 +1557,8 @@ class OneDRegionBoundary(Scene): ) self.wait() self.play(*it.chain( - map(GrowArrow, arrows), - map(Write, signs) + list(map(GrowArrow, arrows)), + list(map(Write, signs)) )) self.wait() self.play( @@ -1737,7 +1737,7 @@ class HypothesisAboutFullyColoredBoundary(ColorMappedObjectsScene): hypothesis[0].next_to(hypothesis[1:], UP) hypothesis[0].set_color(YELLOW) s = hypothesis[1].get_tex_string() - s = filter(lambda c : c not in string.whitespace, s) + s = [c for c in s if c not in string.whitespace] n = s.index("colors") hypothesis[1][n:n+len("colors")].set_color_by_gradient( # RED, GOLD_E, YELLOW, GREEN, BLUE, PINK, @@ -2395,7 +2395,7 @@ class BreakDownLoopWithNonzeroWinding(TransitionFromPathsToBoundaries): ) self.play( FadeIn(both_cannot_be_zero), - *map(GrowArrow, arrows) + *list(map(GrowArrow, arrows)) ) self.wait() @@ -2438,7 +2438,7 @@ class MonomialTerm(PathContainingZero): if hasattr(plane, "numbers_to_show"): _range = plane.numbers_to_show else: - _range = range(-2, 3) + _range = list(range(-2, 3)) for x in _range: if x == 0: continue @@ -2534,7 +2534,7 @@ class MonomialTerm(PathContainingZero): def rescale_output_plane(self): output_stuff = VGroup(self.output_plane, self.output_coloring) - self.play(*map(FadeOut, [self.loop, self.out_loop])) + self.play(*list(map(FadeOut, [self.loop, self.out_loop]))) self.play( output_stuff.scale, 3.0/50, run_time = 2 ) @@ -2564,7 +2564,7 @@ class PolynomialTerms(MonomialTerm): def relabel_planes(self): self.output_plane.x_radius = 50 self.output_plane.y_radius = 50 - self.output_plane.numbers_to_show = range(-45, 50, 15) + self.output_plane.numbers_to_show = list(range(-45, 50, 15)) MonomialTerm.relabel_planes(self) def sweep_through_loop_interior(self): @@ -2758,7 +2758,7 @@ class ShowComplexFunction(Scene): FadeIn(rect), LaggedStart(FadeIn, title) ) - self.play(*map(FadeIn, [x_dot, x_label])) + self.play(*list(map(FadeIn, [x_dot, x_label]))) self.wait() self.play( ReplacementTransform(x_dot.copy(), fx_dot, path_arc = arrow.path_arc), @@ -2768,7 +2768,7 @@ class ShowComplexFunction(Scene): self.wait(2) self.play( MoveToTarget(fx_label), - *map(FadeOut, [title, x_dot, x_label, arrow, fx_dot]) + *list(map(FadeOut, [title, x_dot, x_label, arrow, fx_dot])) ) self.play(FadeOut(plane.coordinate_labels)) self.wait() @@ -2943,12 +2943,12 @@ class MentionQAndA(Scene): title.to_edge(UP) self.add(title) - questions = VGroup(*map(TextMobject, [ + questions = VGroup(*list(map(TextMobject, [ "If you think of the current videos as short stories, \\\\ what is the novel that you want to write?", "How did you get into mathematics?", "What motivated you to join 3b1b?", "$\\vdots$", - ])) + ]))) questions.arrange_submobjects(DOWN, buff = 0.75) questions.next_to(title, DOWN, LARGE_BUFF) @@ -3179,7 +3179,7 @@ class PatreonScroll(Scene): patreon_logo.shift(SMALL_BUFF*LEFT) self.add(patreon_logo) - patrons = VGroup(*map(TextMobject, self.specific_patrons)) + patrons = VGroup(*list(map(TextMobject, self.specific_patrons))) patrons.scale(0.75) random.shuffle(patrons.submobjects) patrons.arrange_submobjects(DOWN, aligned_edge = LEFT) diff --git a/old_projects/alt_calc.py b/old_projects/alt_calc.py index 2d69bc9e..57a14682 100644 --- a/old_projects/alt_calc.py +++ b/old_projects/alt_calc.py @@ -792,7 +792,7 @@ class StartingCalc101(PiCreatureScene): class GraphicalIntuitions(GraphScene): CONFIG = { "func": lambda x: 0.1 * (x - 2) * (x - 5) * (x - 7) + 4, - "x_labeled_nums": range(1, 10), + "x_labeled_nums": list(range(1, 10)), } def construct(self): @@ -1277,10 +1277,10 @@ class StandardDerivativeVisual(GraphScene): x = input_tracker.get_value() x_min = x - dx x_max = x + dx - y, y_min, y_max = map( + y, y_min, y_max = list(map( self.graph.underlying_function, [x, x_min, x_max] - ) + )) x_line = Line( self.coords_to_point(x_min, 0), self.coords_to_point(x_max, 0), @@ -1345,10 +1345,10 @@ class IntroduceTransformationView(NumberlineTransformationScene): def show_animation_preview(self): input_points = self.get_sample_input_points() - output_points = map( + output_points = list(map( self.number_func_to_point_func(self.func), input_points - ) + )) sample_dots = self.get_sample_dots() sample_dot_ghosts = sample_dots.copy().fade(0.5) arrows = VGroup(*[ @@ -1514,7 +1514,7 @@ class TalkThroughXSquaredExample(IntroduceTransformationView): self.get_output_point(self.func(x)), buff=MED_SMALL_BUFF ) - for x, num in zip(range(1, 6), self.input_line.numbers[1:]) + for x, num in zip(list(range(1, 6)), self.input_line.numbers[1:]) ]) point_func = self.number_func_to_point_func(self.func) @@ -2197,9 +2197,9 @@ class GraphOnePlusOneOverX(GraphScene): def setup_axes(self): GraphScene.setup_axes(self) step = 2 - self.x_axis.add_numbers(*range(-6, 0, step) + range(step, 7, step)) + self.x_axis.add_numbers(*list(range(-6, 0, step)) + list(range(step, 7, step))) self.y_axis.label_direction = RIGHT - self.y_axis.add_numbers(*range(-2, 0, step) + range(step, 4, step)) + self.y_axis.add_numbers(*list(range(-2, 0, step)) + list(range(step, 4, step))) def draw_graphs(self, animate=True): lower_func_graph, upper_func_graph = func_graph = VGroup(*[ @@ -2953,7 +2953,7 @@ class AnalyzeFunctionWithTransformations(NumberlineTransformationScene): x_max=10, ) sample_dots.set_stroke(BLACK, 0.5) - sample_points = map(Mobject.get_center, sample_dots) + sample_points = list(map(Mobject.get_center, sample_dots)) self.play(LaggedStart( FadeInAndShiftFromDirection, sample_dots, @@ -3241,10 +3241,7 @@ class StabilityAndInstability(AnalyzeFunctionWithTransformations): arrow_groups = VGroup() for point in phi_point, phi_bro_point: - arrows = VGroup(*filter( - lambda a: np.linalg.norm(a.get_start() - point) < 0.75, - self.all_arrows - )).copy() + arrows = VGroup(*[a for a in self.all_arrows if np.linalg.norm(a.get_start() - point) < 0.75]).copy() arrows.set_fill(PINK, 1) arrows.set_stroke(PINK, 3) arrows.second_anim = LaggedStart( @@ -3254,7 +3251,7 @@ class StabilityAndInstability(AnalyzeFunctionWithTransformations): lag_ratio=0.7, run_time=2, ) - arrows.anim = AnimationGroup(*map(GrowArrow, arrows)) + arrows.anim = AnimationGroup(*list(map(GrowArrow, arrows))) arrow_groups.add(arrows) phi_arrows, phi_bro_arrows = arrow_groups @@ -3318,7 +3315,7 @@ class StabilityAndInstability(AnalyzeFunctionWithTransformations): for deriv_label, dot_group in zip(deriv_labels, dot_groups): self.play(FadeInFromDown(deriv_label)) self.play(LaggedStart(GrowFromCenter, dot_group)) - self.play(*map(MoveToTarget, dot_group), run_time=2) + self.play(*list(map(MoveToTarget, dot_group)), run_time=2) self.wait() diff --git a/old_projects/basel/basel.py b/old_projects/basel/basel.py index be7ca457..280b72e9 100644 --- a/old_projects/basel/basel.py +++ b/old_projects/basel/basel.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -from __future__ import print_function + from big_ol_pile_of_manim_imports import * from once_useful_constructs.light import * @@ -368,7 +368,7 @@ class IntroScene(PiCreatureScene): slab_colors = [YELLOW, BLUE] * (max_n2 / 2) for t1, t2, color in zip(series_terms, series_terms[1:], slab_colors): - line = Line(*map(self.number_line.number_to_point, [t1, t2])) + line = Line(*list(map(self.number_line.number_to_point, [t1, t2]))) rect = Rectangle() rect.stroke_width = 0 rect.fill_opacity = 1 @@ -570,8 +570,8 @@ class FirstLighthouseScene(PiCreatureScene): color = WHITE, number_at_center = 1.6, stroke_width = 1, - numbers_with_elongated_ticks = range(1,5), - numbers_to_show = range(1,5), + numbers_with_elongated_ticks = list(range(1,5)), + numbers_to_show = list(range(1,5)), unit_size = 2, tick_frequency = 0.2, line_to_number_buff = LARGE_BUFF, @@ -618,7 +618,7 @@ class FirstLighthouseScene(PiCreatureScene): euler_sum_above = TexMobject("1", "+", "{1\over 4}", "+", "{1\over 9}", "+", "{1\over 16}", "+", "{1\over 25}", "+", "{1\over 36}") - for (i,term) in zip(range(len(euler_sum_above)),euler_sum_above): + for (i,term) in zip(list(range(len(euler_sum_above))),euler_sum_above): #horizontal alignment with tick marks term.next_to(self.number_line.number_to_point(0.5*i+1),UP,buff = 2) # vertical alignment with light indicator @@ -651,7 +651,7 @@ class FirstLighthouseScene(PiCreatureScene): # slowly switch on visible light cones and increment indicator - for (i,light_source) in zip(range(NUM_VISIBLE_CONES),light_sources[:NUM_VISIBLE_CONES]): + for (i,light_source) in zip(list(range(NUM_VISIBLE_CONES)),light_sources[:NUM_VISIBLE_CONES]): indicator_start_time = 1.0 * (i+1) * SWITCH_ON_RUN_TIME/light_source.radius * self.number_line.unit_size indicator_stop_time = indicator_start_time + INDICATOR_UPDATE_TIME indicator_rate_func = squish_rate_func( @@ -684,7 +684,7 @@ class FirstLighthouseScene(PiCreatureScene): self.wait() # quickly switch on off-screen light cones and increment indicator - for (i,light_source) in zip(range(NUM_VISIBLE_CONES,NUM_CONES),light_sources[NUM_VISIBLE_CONES:NUM_CONES]): + for (i,light_source) in zip(list(range(NUM_VISIBLE_CONES,NUM_CONES)),light_sources[NUM_VISIBLE_CONES:NUM_CONES]): indicator_start_time = 0.5 * (i+1) * FAST_SWITCH_ON_RUN_TIME/light_source.radius * self.number_line.unit_size indicator_stop_time = indicator_start_time + FAST_INDICATOR_UPDATE_TIME indicator_rate_func = squish_rate_func(#smooth, 0.8, 0.9) @@ -1659,8 +1659,8 @@ class BackToEulerSumScene(PiCreatureScene): color = WHITE, number_at_center = 1.6, stroke_width = 1, - numbers_with_elongated_ticks = range(1,5), - numbers_to_show = range(1,5), + numbers_with_elongated_ticks = list(range(1,5)), + numbers_to_show = list(range(1,5)), unit_size = 2, tick_frequency = 0.2, line_to_number_buff = LARGE_BUFF, @@ -3737,7 +3737,7 @@ class PondScene(ThreeDScene): stroke_width = LAKE_STROKE_WIDTH, stroke_color = LAKE_STROKE_COLOR, numbers_with_elongated_ticks = [], - numbers_to_show = range(-MAX_N,MAX_N + 1),#,2), + numbers_to_show = list(range(-MAX_N,MAX_N + 1)),#,2), unit_size = LAKE0_RADIUS * TAU/4 / 2 * scale, tick_frequency = 1, tick_size = LAKE_STROKE_WIDTH, @@ -3828,7 +3828,7 @@ class PondScene(ThreeDScene): two_sided_sum.scale(TEX_SCALE) - for (i,submob) in zip(range(nb_symbols),two_sided_sum.submobjects): + for (i,submob) in zip(list(range(nb_symbols)),two_sided_sum.submobjects): submob.next_to(self.number_line.number_to_point(i - 13),DOWN, buff = 2*scale) if (i == 0 or i % 2 == 1 or i == nb_symbols - 1): # non-fractions submob.shift(0.3 * scale * DOWN) diff --git a/old_projects/basel/basel2.py b/old_projects/basel/basel2.py index afa417e4..cd01d8d9 100644 --- a/old_projects/basel/basel2.py +++ b/old_projects/basel/basel2.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -from __future__ import print_function + from big_ol_pile_of_manim_imports import * from once_useful_constructs.light import * @@ -350,7 +350,7 @@ class IntroScene(PiCreatureScene): for i, t1, t2 in zip(it.count(1), [0]+series_terms, series_terms): color = next(slab_colors) - line = Line(*map(number_line.number_to_point, [t1, t2])) + line = Line(*list(map(number_line.number_to_point, [t1, t2]))) rect = Rectangle( stroke_width = 0, fill_opacity = 1, @@ -913,8 +913,8 @@ class FirstLighthouseScene(PiCreatureScene): color = WHITE, number_at_center = 1.6, stroke_width = 1, - numbers_with_elongated_ticks = range(1,6), - numbers_to_show = range(1,6), + numbers_with_elongated_ticks = list(range(1,6)), + numbers_to_show = list(range(1,6)), unit_size = 2, tick_frequency = 0.2, line_to_number_buff = LARGE_BUFF, @@ -1245,7 +1245,7 @@ class IntroduceScreen(Scene): FadeIn(screen) ) self.wait() - self.play(*map(FadeOut, [screen_label, screen_arrow])) + self.play(*list(map(FadeOut, [screen_label, screen_arrow]))) screen.save_state() self.play( FadeIn(morty), @@ -1774,7 +1774,7 @@ class InverseSquareLaw(ThreeDScene): copies.move_to(source_point, IN) copies.shift(distance*RIGHT*unit_distance) return copies - screen_copy_groups = map(get_screen_copy_group, range(1, 8)) + screen_copy_groups = list(map(get_screen_copy_group, list(range(1, 8)))) def get_screen_copy_group_anim(n): group = screen_copy_groups[n] prev_group = screen_copy_groups[n-1] @@ -2281,10 +2281,10 @@ class TwoLightSourcesScene(ManipulateLightsourceSetups): LaggedStart(GrowArrow, identical_lighthouses_arrows) ) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ identical_lighthouses_words, identical_lighthouses_arrows, - ])) + ]))) #Show labels of lengths self.play(ShowCreation(line_a), Write(label_a)) @@ -2306,7 +2306,7 @@ class TwoLightSourcesScene(ManipulateLightsourceSetups): b_part.move_to(lsB) h_part.move_to(lsC) - self.play(*map(FadeOut, [lsA, lsB, lsC, indicator])) + self.play(*list(map(FadeOut, [lsA, lsB, lsC, indicator]))) for ls, part in (lsA, a_part), (lsB, b_part), (lsC, h_part): self.add(ls) self.play( @@ -2352,10 +2352,7 @@ class SimpleIPTProof(Scene): C = ORIGIN #Dumb and inefficient alphas = np.linspace(0, 1, 500) - i = np.argmin(map( - lambda a : np.linalg.norm(interpolate(A, B, a)), - alphas - )) + i = np.argmin([np.linalg.norm(interpolate(A, B, a)) for a in alphas]) H = interpolate(A, B, alphas[i]) triangle = VGroup( Line(C, A, color = BLUE), @@ -2656,7 +2653,7 @@ class IPTScene(TwoLightSourcesScene, ZoomedScene): Animation(screen_arrow), ) self.add(spotlights_update_anim) - self.play(*map(FadeOut, [screen_word, screen_arrow])) + self.play(*list(map(FadeOut, [screen_word, screen_arrow]))) self.wait() # Reshape screen @@ -2715,9 +2712,9 @@ class IPTScene(TwoLightSourcesScene, ZoomedScene): self.remove(spotlights_update_anim) self.add(spotlight_b) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ spotlight_a, lsA.ambient_light, lsB.ambient_light - ])) + ]))) show_key_point(spotlight_b, A) self.play( FadeOut(spotlight_b), @@ -2861,7 +2858,7 @@ class InscribedeAngleThreorem(TeacherStudentsScene): self.teacher.change, "raise_right_hand", ShowCreation(shape, rate_func = None), ) - self.play(*map(FadeIn, [angle_mark, theta])) + self.play(*list(map(FadeIn, [angle_mark, theta]))) self.play( ShowCreation(half_angle_mark), Write(theta_halves), @@ -3608,7 +3605,7 @@ class PondScene(ThreeDScene): stroke_width = LAKE_STROKE_WIDTH, stroke_color = LAKE_STROKE_COLOR, #numbers_with_elongated_ticks = range(-MAX_N,MAX_N + 1), - numbers_to_show = range(-MAX_N,MAX_N + 1,2), + numbers_to_show = list(range(-MAX_N,MAX_N + 1,2)), unit_size = LAKE0_RADIUS * TAU/4 / 2 * scale, tick_frequency = 1, line_to_number_buff = LARGE_BUFF, @@ -3687,7 +3684,7 @@ class PondScene(ThreeDScene): two_sided_sum.scale(TEX_SCALE) - for (i,submob) in zip(range(nb_symbols),two_sided_sum.submobjects): + for (i,submob) in zip(list(range(nb_symbols)),two_sided_sum.submobjects): submob.next_to(self.number_line.number_to_point(i - 13),DOWN, buff = 2*scale) if (i == 0 or i % 2 == 1 or i == nb_symbols - 1): # non-fractions submob.shift(0.3 * scale * DOWN) @@ -3804,7 +3801,7 @@ class ThinkBackToHowAmazingThisIs(ThreeDScene): number_line = NumberLine( x_min = -self.x_radius, x_max = self.x_radius, - numbers_to_show = range(-self.max_shown_n, self.max_shown_n), + numbers_to_show = list(range(-self.max_shown_n, self.max_shown_n)), ) number_line.add_numbers() number_line.shift(2*DOWN) @@ -3816,7 +3813,7 @@ class ThinkBackToHowAmazingThisIs(ThreeDScene): ]) for u in (1, -1) ] - dot_pairs = it.starmap(VGroup, zip(positive_dots, negative_dots)) + dot_pairs = it.starmap(VGroup, list(zip(positive_dots, negative_dots))) # Decimal decimal = DecimalNumber(0, num_decimal_places = 6) @@ -3863,7 +3860,7 @@ class ThinkBackToHowAmazingThisIs(ThreeDScene): self.add(number_line, *dot_pairs) self.add(zoom_out, scale_decimal) - tuples = zip(term_mobjects, plusses, partial_sums) + tuples = list(zip(term_mobjects, plusses, partial_sums)) run_time = 1 for term_mobs, plus_pair, partial_sum in tuples: self.play( @@ -3878,10 +3875,10 @@ class ThinkBackToHowAmazingThisIs(ThreeDScene): zoom_out.begin_wind_down() self.wait() self.remove(zoom_out, scale_decimal) - self.play(*map(FadeOut, it.chain( + self.play(*list(map(FadeOut, it.chain( term_mobjects, plusses, number_line.numbers, [decimal] - ))) + )))) self.number_line = number_line @@ -4391,7 +4388,7 @@ class InfiniteCircleScene(PiCreatureScene): class Credits(Scene): def construct(self): credits = VGroup(*[ - VGroup(*map(TextMobject, pair)) + VGroup(*list(map(TextMobject, pair))) for pair in [ ("Primary writer and animator:", "Ben Hambrecht"), ("Editing, advising, narrating:", "Grant Sanderson"), diff --git a/old_projects/bell.py b/old_projects/bell.py index 9e710b16..69744e93 100644 --- a/old_projects/bell.py +++ b/old_projects/bell.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from big_ol_pile_of_manim_imports import * from tqdm import tqdm as ProgressDisplay @@ -227,7 +227,7 @@ class PhotonsThroughPerpendicularFilters(PhotonPassesCompletelyOrNotAtAll): class MoreFiltersMoreLight(FilterScene): CONFIG = { - "filter_x_coordinates" : range(-2, 3), + "filter_x_coordinates" : list(range(-2, 3)), "pol_filter_configs" : [ { "include_arrow_label" : False, @@ -399,7 +399,7 @@ class ShowALittleMath(TeacherStudentsScene): exp1.get_parts_by_tex(tex).copy(), exp2.get_parts_by_tex(tex).copy(), ) - for tex in color_map.keys() + for tex in list(color_map.keys()) ] + [Write(exp2, run_time = 2)]) self.change_student_modes( *["pondering"]*3, @@ -569,7 +569,7 @@ class AngleToProbabilityChart(Scene): ]) prob_mobs.set_color(YELLOW) - angle_prob_pairs = zip(angle_mobs, prob_mobs) + angle_prob_pairs = list(zip(angle_mobs, prob_mobs)) for angle_mob, prob_mob in angle_prob_pairs: prob_mob.next_to(angle_mob, RIGHT, buff = 3) for prob_mob in prob_mobs[1:]: @@ -890,7 +890,7 @@ class ShowVariousFilterPairsFrom0To45(ShowVariousFilterPairs): self.play(LaggedStart(ShowCreation, rects)) self.wait() - self.play(*map(Write, cosines), run_time = 2) + self.play(*list(map(Write, cosines)), run_time = 2) self.wait() class ForgetPreviousActions(ShowVariousFilterPairs): @@ -1338,10 +1338,10 @@ class RemoveBFromLabeledFilters(IntroduceLabeledFiltersNoRotation): self.wait() def fade_in_labels(self): - self.play(*map(FadeIn, [ + self.play(*list(map(FadeIn, [ self.blocked_at_B_label_group, self.blocked_at_C_label_group, - ])) + ]))) self.wait() class NumbersSuggestHiddenVariablesAreImpossible(TeacherStudentsScene): @@ -1772,7 +1772,7 @@ class VennDiagramProofByContradiction(Scene): terms[0].remove(less_than) plus = terms[2][0][0] terms[2][0].remove(plus) - rects = map(SurroundingRectangle, terms) + rects = list(map(SurroundingRectangle, terms)) terms[2][0].add_to_back(plus) last_rects = VGroup(*rects[1:]) @@ -1855,13 +1855,13 @@ class VennDiagramProofByContradiction(Scene): self.play( FadeIn(funny_business), - *map(Write, braces), + *list(map(Write, braces)), run_time = 1 ) self.wait() self.play( FadeIn(less_than), - *map(FadeOut, [funny_business, braces]) + *list(map(FadeOut, [funny_business, braces])) ) for term, group, region, num in zip(terms, photon_groups, regions, nums)[1:]: @@ -2005,7 +2005,7 @@ class VennDiagramProofByContradiction(Scene): R = np.sqrt(len(photons) / np.pi) pairs = [] rejected = [] - for x, y in it.product(*[range(-int(R)-1, int(R)+2)]*2): + for x, y in it.product(*[list(range(-int(R)-1, int(R)+2))]*2): if x**2 + y**2 < R**2: pairs.append((x, y)) else: @@ -2365,7 +2365,7 @@ class ReEmphasizeVennDiagram(VennDiagramProofByContradiction): def move_around(total_time): self.time - t_range = range(int(total_time/dt)) + t_range = list(range(int(total_time/dt))) for x in ProgressDisplay(t_range): self.time += dt new_B_to_A = rotate_vector(B_to_A, self.time*A_freq) diff --git a/old_projects/borsuk.py b/old_projects/borsuk.py index 729409d6..05ee2feb 100644 --- a/old_projects/borsuk.py +++ b/old_projects/borsuk.py @@ -333,7 +333,7 @@ class IntroduceStolenNecklaceProblem(ThreeDScene): self.play( FadeOut(necklace.chain), *it.chain(*[ - map(Animation, group) + list(map(Animation, group)) for group in strand_groups ]) ) @@ -401,12 +401,12 @@ class IntroduceStolenNecklaceProblem(ThreeDScene): def get_jewels_organized_by_type(self, jewels): return [ - VGroup(*filter(lambda m : m.get_color() == color, jewels)) + VGroup(*[m for m in jewels if m.get_color() == color]) for color in map(Color, self.jewel_colors) ] def shuffle_jewels(self, jewels, run_time = 2, path_arc = np.pi/2, **kwargs): - shuffled_indices = range(len(jewels)) + shuffled_indices = list(range(len(jewels))) random.shuffle(shuffled_indices) target_group = VGroup(*[ jewel.copy().move_to(jewels[shuffled_indices[i]]) @@ -426,15 +426,15 @@ class IntroduceStolenNecklaceProblem(ThreeDScene): if jewel in jewel_type: return i raise Exception("Not in any jewel_types") - type_numbers = map(jewel_to_type_number, jewels) + type_numbers = list(map(jewel_to_type_number, jewels)) n_types = len(jewel_types) - for slice_indices in it.combinations(range(1, len(jewels)), n_types): + for slice_indices in it.combinations(list(range(1, len(jewels))), n_types): slice_indices = [0] + list(slice_indices) + [len(jewels)] if self.forced_binary_choices is not None: all_binary_choices = [self.forced_binary_choices] else: - all_binary_choices = it.product(*[range(2)]*(n_types+1)) + all_binary_choices = it.product(*[list(range(2))]*(n_types+1)) for binary_choices in all_binary_choices: subsets = [ type_numbers[i1:i2] @@ -813,7 +813,7 @@ class WalkEquatorPostTransform(GraphScene): self.play(ShowCreation(v_line)) self.wait() self.play(FadeOut(v_line)) - self.play(*map(FadeOut, [tilted_eq, dots])) + self.play(*list(map(FadeOut, [tilted_eq, dots]))) def draw_transverse_curve(self): transverse_curve = self.get_transverse_curve(self.great_arc_images) @@ -1151,16 +1151,16 @@ class GeneralizeBorsukUlam(Scene): self.wait() def get_condition(self): - squares = map(TexMobject, [ + squares = list(map(TexMobject, [ "x_%d^2"%d for d in range(1, 1+self.n_dims) - ]) + ])) for square, color in zip(squares, self.colors): square[0].set_color(color) square[-1].set_color(color) plusses = [TexMobject("+") for x in range(self.n_dims-1)] plusses += [TexMobject("=1")] - condition = VGroup(*it.chain(*zip(squares, plusses))) + condition = VGroup(*it.chain(*list(zip(squares, plusses)))) condition.arrange_submobjects(RIGHT) return condition @@ -1354,7 +1354,7 @@ class MakeTwoJewelCaseContinuous(IntroduceStolenNecklaceProblem): jewels.submobjects.sort( lambda m1, m2 : cmp(m1.get_center()[0], m2.get_center()[0]) ) - remaining_indices = range(len(jewels)) + remaining_indices = list(range(len(jewels))) remaining_indices.remove(example_index) example_segment = self.color_necklace_by_indices(example_index) @@ -1365,10 +1365,7 @@ class MakeTwoJewelCaseContinuous(IntroduceStolenNecklaceProblem): lambda m1, m2 : cmp(m1.get_center()[0], m2.get_center()[0]) ) segment_types = VGroup(*[ - VGroup(*filter( - lambda m : m.get_color() == Color(color), - segments - )) + VGroup(*[m for m in segments if m.get_color() == Color(color)]) for color in self.jewel_colors ]) @@ -1437,7 +1434,7 @@ class MakeTwoJewelCaseContinuous(IntroduceStolenNecklaceProblem): for i in slice_indices[1:-1] ]) cut_points = [ - map(chain.point_from_proportion, pair) + list(map(chain.point_from_proportion, pair)) for pair in cut_proportions ] v_lines = VGroup(*[DashedLine(UP, DOWN) for x in range(2)]) @@ -1529,9 +1526,9 @@ class MakeTwoJewelCaseContinuous(IntroduceStolenNecklaceProblem): )) self.play(Blink(morty)) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ morty, morty.bubble, morty.bubble.content - ])) + ]))) def shift_divide_off_tick_marks(self): groups = self.groups @@ -1618,13 +1615,13 @@ class MakeTwoJewelCaseContinuous(IntroduceStolenNecklaceProblem): self.wait() self.play( emerald_segments.restore, - *map(FadeOut, [brace, label]) + *list(map(FadeOut, [brace, label])) ) self.wait() self.play(ShowCreation(arrow2)) self.wait() - self.play(*map(FadeOut, [words, arrow1, arrow2])) + self.play(*list(map(FadeOut, [words, arrow1, arrow2]))) for line in v_lines: self.play(line.shift, segment_width*LEFT/2) @@ -1704,7 +1701,7 @@ class ChoicesInNecklaceCutting(ReconfigurableScene): ] + [final_num_pair] point_pairs = [ - map(self.interval.number_to_point, num_pair) + list(map(self.interval.number_to_point, num_pair)) for num_pair in num_pairs ] @@ -1763,9 +1760,9 @@ class ChoicesInNecklaceCutting(ReconfigurableScene): self.wait() self.transition_to_alt_config(denoms = [3, 3, 3]) self.wait() - self.play(*map(FadeOut, list(braces) + [ + self.play(*list(map(FadeOut, list(braces) + [ brace.concrete_label for brace in braces - ])) + ]))) self.choice_one_words = words @@ -1781,7 +1778,7 @@ class ChoicesInNecklaceCutting(ReconfigurableScene): ) self.play(Write(words)) - self.play(*map(FadeIn, [boxes, labels])) + self.play(*list(map(FadeIn, [boxes, labels]))) for binary_choices in it.product(*[[0, 1]]*3): self.play(*[ ApplyMethod(group.move_to, group.target_points[choice]) @@ -2061,7 +2058,7 @@ class NecklaceDivisionSphereAssociation(ChoicesInNecklaceCutting): ) self.play(*it.chain( - map(GrowFromCenter, braces), + list(map(GrowFromCenter, braces)), [Write(brace.label) for brace in braces] )) self.wait() @@ -2070,14 +2067,14 @@ class NecklaceDivisionSphereAssociation(ChoicesInNecklaceCutting): def add_boxes_and_labels(self): boxes, labels = self.get_boxes_and_labels() - self.play(*map(FadeIn, [boxes, labels])) + self.play(*list(map(FadeIn, [boxes, labels]))) self.wait() def show_binary_choice_association(self): groups = self.get_groups() self.swapping_anims = [] final_choices = [1, 0, 1] - quads = zip(self.braces, self.denoms, groups, final_choices) + quads = list(zip(self.braces, self.denoms, groups, final_choices)) for brace, denom, group, final_choice in quads: char = brace.label.args[0][1] choices = [ @@ -2186,12 +2183,12 @@ class TotalLengthOfEachJewelEquals(NecklaceDivisionSphereAssociation, ThreeDScen def get_fair_division_indices(self, colors): colors = np.array(list(colors)) - color_types = map(Color, set([c.get_hex_l() for c in colors])) + color_types = list(map(Color, set([c.get_hex_l() for c in colors]))) type_to_count = dict([ (color, sum(colors == color)) for color in color_types ]) - for i1, i2 in it.combinations(range(1, len(colors)-1), 2): + for i1, i2 in it.combinations(list(range(1, len(colors)-1)), 2): bools = [ sum(colors[i1:i2] == color) == type_to_count[color]/2 for color in color_types @@ -2202,10 +2199,10 @@ class TotalLengthOfEachJewelEquals(NecklaceDivisionSphereAssociation, ThreeDScen def demonstrate_fair_division(self): segments, tick_marks = self.necklace - color_types = map(Color, set([ + color_types = list(map(Color, set([ segment.get_color().get_hex_l() for segment in segments - ])) + ]))) top_segments = VGroup(*it.chain( self.groups[0][0], self.groups[2][0], @@ -2213,10 +2210,7 @@ class TotalLengthOfEachJewelEquals(NecklaceDivisionSphereAssociation, ThreeDScen bottom_segments = self.groups[1][0] for color in color_types: monochrome_groups = [ - VGroup(*filter( - lambda segment: segment.get_color() == color, - segment_group - )) + VGroup(*[segment for segment in segment_group if segment.get_color() == color]) for segment_group in (top_segments, bottom_segments) ] labels = VGroup() @@ -2484,7 +2478,7 @@ class FourDBorsukUlam(GeneralizeBorsukUlam, PiCreatureScene): Write(brace_text) ) self.wait() - self.play(*map(FadeOut, [brace, brace_text])) + self.play(*list(map(FadeOut, [brace, brace_text]))) self.wait() self.play( FadeIn(lhs), diff --git a/old_projects/brachistochrone/curves.py b/old_projects/brachistochrone/curves.py index ba1449d7..19cd05d5 100644 --- a/old_projects/brachistochrone/curves.py +++ b/old_projects/brachistochrone/curves.py @@ -192,7 +192,7 @@ class PathSlidingScene(Scene): def write_time(self, time): if hasattr(self, "time_mob"): self.remove(self.time_mob) - digits = map(TexMobject, "%.2f"%time) + digits = list(map(TexMobject, "%.2f"%time)) digits[0].next_to(self.t_equals, buff = 0.1) for left, right in zip(digits, digits[1:]): right.next_to(left, buff = 0.1, aligned_edge = DOWN) @@ -401,7 +401,7 @@ class MinimalPotentialEnergy(Scene): side_words_start = TextMobject("Parameter describing") top_words, last_side_words = [ - map(TextMobject, pair) + list(map(TextMobject, pair)) for pair in [ ("Light's travel time", "Potential energy"), ("path", "mechanical state") @@ -483,7 +483,7 @@ class WhatGovernsSpeed(PathSlidingScene): slider = sliders.pop(1) vector = vectors.pop(1) faders = sliders+vectors+[words] - self.play(*map(FadeOut, faders)) + self.play(*list(map(FadeOut, faders))) self.remove(*faders) self.show_geometry(slider, vector) @@ -551,7 +551,7 @@ class WhatGovernsSpeed(PathSlidingScene): Point(loss_in_potential.get_left()), loss_in_potential ), - *map(GrowFromCenter, potential.split()) + *list(map(GrowFromCenter, potential.split())) ) self.wait(2) self.play( diff --git a/old_projects/brachistochrone/cycloid.py b/old_projects/brachistochrone/cycloid.py index 0e0a3cef..fd62497d 100644 --- a/old_projects/brachistochrone/cycloid.py +++ b/old_projects/brachistochrone/cycloid.py @@ -105,7 +105,7 @@ class IntroduceCycloid(CycloidScene): arrow.reverse_points() q_mark = TextMobject("?") - self.play(*map(ShimmerIn, equation.split())) + self.play(*list(map(ShimmerIn, equation.split()))) self.wait() self.play( ApplyMethod(equation.shift, 2.2*UP), @@ -545,7 +545,7 @@ class SlidingObject(CycloidScene, PathSlidingScene): self.roll_back() self.wait() if with_words: - self.play(*map(ShimmerIn, [words1, arrow, words2])) + self.play(*list(map(ShimmerIn, [words1, arrow, words2]))) self.wait() self.remove(self.circle) start_time = len(self.frames)*self.frame_duration diff --git a/old_projects/brachistochrone/drawing_images.py b/old_projects/brachistochrone/drawing_images.py index 26783942..663a5dfa 100644 --- a/old_projects/brachistochrone/drawing_images.py +++ b/old_projects/brachistochrone/drawing_images.py @@ -52,7 +52,7 @@ def sort_by_color(mob): def get_image_array(name): image_files = os.listdir(IMAGE_DIR) - possibilities = filter(lambda s : s.startswith(name), image_files) + possibilities = [s for s in image_files if s.startswith(name)] for possibility in possibilities: try: path = os.path.join(IMAGE_DIR, possibility) diff --git a/old_projects/brachistochrone/graveyard.py b/old_projects/brachistochrone/graveyard.py index 78f62310..d8135a4f 100644 --- a/old_projects/brachistochrone/graveyard.py +++ b/old_projects/brachistochrone/graveyard.py @@ -117,10 +117,10 @@ class MultilayeredGlass(PhotonScene, ZoomedScene): ) def show_layer_variables(self): - layer_top_pairs = zip( + layer_top_pairs = list(zip( self.layer_tops[:self.num_variables], self.layer_tops[1:] - ) + )) v_equations = [] start_ys = [] end_ys = [] @@ -170,7 +170,7 @@ class MultilayeredGlass(PhotonScene, ZoomedScene): self.add(start_y) self.play(GrowFromCenter(brace)) self.wait() - quads = zip(v_equations, start_ys, end_ys, braces) + quads = list(zip(v_equations, start_ys, end_ys, braces)) self.equations = [] for v_eq, start_y, end_y, brace in quads: self.remove(brace) @@ -223,7 +223,7 @@ class MultilayeredGlass(PhotonScene, ZoomedScene): bend_point - little_square.get_center(), run_time = 2 )) - self.play(*map(ShowCreation, figure_marks)) + self.play(*list(map(ShowCreation, figure_marks))) self.wait() equation_frame = little_square.copy() equation_frame.scale(0.5) diff --git a/old_projects/brachistochrone/light.py b/old_projects/brachistochrone/light.py index d0027f6a..9a2fe60c 100644 --- a/old_projects/brachistochrone/light.py +++ b/old_projects/brachistochrone/light.py @@ -240,9 +240,9 @@ class ShowMultiplePathsThroughLens(ShowMultiplePathsScene): def get_paths(self): alphas = [0.25, 0.4, 0.58, 0.75] - lower_right, upper_right, upper_left, lower_left = map( + lower_right, upper_right, upper_left, lower_left = list(map( self.lens.point_from_proportion, alphas - ) + )) return [ Mobject( Line(self.start_point, a), @@ -347,7 +347,7 @@ class StraightLinesFastestInConstantMedium(PhotonScene): right.next_to(arrow, RIGHT) squaggle, line = self.get_paths() - self.play(*map(ShimmerIn, [left, arrow, right])) + self.play(*list(map(ShimmerIn, [left, arrow, right]))) self.play(ShowCreation(squaggle)) self.play(self.photon_run_along_path( squaggle, run_time = 2, rate_func = None @@ -444,7 +444,7 @@ class GeometryOfGlassSituation(ShowMultiplePathsInWater): end_x = interpolate(left, right, 1.0) left_line = Line(self.start_point, left, color = RED_D) right_line = Line(self.end_point, right, color = RED_D) - h_1, h_2 = map(TexMobject, ["h_1", "h_2"]) + h_1, h_2 = list(map(TexMobject, ["h_1", "h_2"])) h_1.next_to(left_line, LEFT) h_2.next_to(right_line, RIGHT) point_a = Dot(self.start_point) @@ -711,7 +711,7 @@ class SpringSetup(ShowMultiplePathsInWater): def show_horizontal_component(self, ring): v_right = Vector(ring.get_top(), RIGHT) v_left = Vector(ring.get_bottom(), LEFT) - self.play(*map(ShowCreation, [v_right, v_left])) + self.play(*list(map(ShowCreation, [v_right, v_left]))) self.wait() self.remove(v_right, v_left) @@ -906,12 +906,12 @@ class StateSnellsLaw(PhotonScene): self.play(self.photon_run_along_path(path)) self.wait() self.play(ShowCreation(vert_line)) - self.play(*map(ShowCreation, arcs)) - self.play(*map(GrowFromCenter, thetas)) + self.play(*list(map(ShowCreation, arcs))) + self.play(*list(map(GrowFromCenter, thetas))) self.wait() self.play(ShimmerIn(exp1)) self.wait() - self.play(*map(ShimmerIn, [equals, exp2])) + self.play(*list(map(ShimmerIn, [equals, exp2]))) self.wait() diff --git a/old_projects/brachistochrone/misc.py b/old_projects/brachistochrone/misc.py index 06afcdac..812f8f96 100644 --- a/old_projects/brachistochrone/misc.py +++ b/old_projects/brachistochrone/misc.py @@ -66,7 +66,7 @@ class TimeLine(Scene): speical_dates = [2016] + [ obj["date"] for obj in dated_events ] - centuries = range(1600, 2100, 100) + centuries = list(range(1600, 2100, 100)) timeline = NumberLine( numerical_radius = 300, number_at_center = 1800, @@ -106,7 +106,7 @@ class TimeLine(Scene): ) self.play(FadeIn(picture)) self.wait(3) - self.play(*map(FadeOut, [event_mob, date_mob, line, picture])) + self.play(*list(map(FadeOut, [event_mob, date_mob, line, picture]))) class StayedUpAllNight(Scene): @@ -197,7 +197,7 @@ class StayedUpAllNight(Scene): self.play(ShimmerIn(not_newton)) phil_trans.add(solution, not_newton) self.wait() - self.play(*map(ShimmerIn, newton_complaint.split())) + self.play(*list(map(ShimmerIn, newton_complaint.split()))) self.wait() self.play( ShimmerIn(dunned_def), @@ -337,16 +337,16 @@ class VideoLayout(Scene): ), UP ) - left_brace.words = map(TextMobject, [ + left_brace.words = list(map(TextMobject, [ "Problem statement", "History", "Johann Bernoulli's cleverness" - ]) + ])) curr = left_brace - right_brace.words = map(TextMobject, [ + right_brace.words = list(map(TextMobject, [ "Challenge", "Mark Levi's cleverness", - ]) + ])) for brace in left_brace, right_brace: curr = brace direction = DOWN if brace is left_brace else UP @@ -392,7 +392,7 @@ class ShortestPathProblem(Scene): self.play( ShimmerIn(words), - *map(GrowFromCenter, dots) + *list(map(GrowFromCenter, dots)) ) self.play(ShowCreation(path)) self.play(Transform( diff --git a/old_projects/brachistochrone/multilayered.py b/old_projects/brachistochrone/multilayered.py index 0e78aa1a..273511aa 100644 --- a/old_projects/brachistochrone/multilayered.py +++ b/old_projects/brachistochrone/multilayered.py @@ -257,7 +257,7 @@ class ShowLayerVariables(MultilayeredScene, PhotonScene): ])) self.wait() - triplets = zip(v_equations, start_ys, end_ys) + triplets = list(zip(v_equations, start_ys, end_ys)) anims = [] for v_eq, start_y, end_y in triplets: anims += [ diff --git a/old_projects/brachistochrone/wordplay.py b/old_projects/brachistochrone/wordplay.py index e21bb69c..acc7e8b3 100644 --- a/old_projects/brachistochrone/wordplay.py +++ b/old_projects/brachistochrone/wordplay.py @@ -223,7 +223,7 @@ class OneSolutionTwoInsights(Scene): mark.next_to(johann, RIGHT) name = TextMobject("Mark Levi").to_edge(UP) - self.play(*map(ShimmerIn, one_solution.split())) + self.play(*list(map(ShimmerIn, one_solution.split()))) self.wait() for pair in zip(one_solution.split(), two_insights.split()): self.play(Transform(*pair, path_func = path_along_arc(np.pi))) @@ -243,9 +243,9 @@ class OneSolutionTwoInsights(Scene): class CircleOfIdeas(Scene): def construct(self): - words = map(TextMobject, [ + words = list(map(TextMobject, [ "optics", "calculus", "mechanics", "geometry", "history" - ]) + ])) words[0].set_color(YELLOW) words[1].set_color(BLUE_D) words[2].set_color(GREY) @@ -401,7 +401,7 @@ class BalanceCompetingFactors(Scene): (2, BLUE_D) ] ] - real_factor1, real_factor2 = map(TextMobject, words) + real_factor1, real_factor2 = list(map(TextMobject, words)) for word in factor1, factor2, real_factor1, real_factor2: word.shift(0.2*UP-word.get_bottom()) for f1 in factor1, real_factor1: diff --git a/old_projects/complex_multiplication_article.py b/old_projects/complex_multiplication_article.py index 04f9d89a..18c445e5 100644 --- a/old_projects/complex_multiplication_article.py +++ b/old_projects/complex_multiplication_article.py @@ -26,7 +26,7 @@ class SuccessiveComplexMultiplications(ComplexMultiplication): @staticmethod def string_to_args(arg_string): args_string.replac("i", "j") - return map(copmlex, arg_string.split()) + return list(map(copmlex, arg_string.split())) def construct(self, *multipliers): norm = abs(reduce(op.mul, multipliers, 1)) @@ -146,7 +146,7 @@ class DrawSolutionsToZToTheNEqualsW(Scene): radius*np.exp(complex(0, 1)*(2*np.pi*k + theta)/n) for k in range(n) ] - points = map(plane.number_to_point, solutions) + points = list(map(plane.number_to_point, solutions)) dots = [ Dot(point, color = BLUE_B, radius = 0.1) for point in points @@ -201,7 +201,7 @@ class DrawComplexAngleAndMagnitude(Scene): label.shift(point - edge + buff*dot_to_label_dir) label.set_color(YELLOW) - self.add_mobjects_among(locals().values()) + self.add_mobjects_among(list(locals().values())) def add_angle_label(self, number): @@ -210,7 +210,7 @@ class DrawComplexAngleAndMagnitude(Scene): radius = 0.2 ) - self.add_mobjects_among(locals().values()) + self.add_mobjects_among(list(locals().values())) def add_lines(self, tex_representation, number): point = self.plane.number_to_point(number) @@ -246,5 +246,5 @@ class DrawComplexAngleAndMagnitude(Scene): axis = OUT if point[1] > 0 else IN norm_label.next_to(brace, rotate_vector(point, np.pi/2, axis)) - self.add_mobjects_among(locals().values()) + self.add_mobjects_among(list(locals().values())) diff --git a/old_projects/counting_in_binary.py b/old_projects/counting_in_binary.py index c7f48421..7d54f5f7 100644 --- a/old_projects/counting_in_binary.py +++ b/old_projects/counting_in_binary.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -from __future__ import print_function + import numpy as np import itertools as it from copy import deepcopy @@ -255,7 +255,7 @@ class ShowReadingRule(Scene): self.wait() self.remove(question) self.add(answer[0]) - counts = map(finger_tip_power_of_2, range(5)) + counts = list(map(finger_tip_power_of_2, list(range(5)))) for count in counts: self.play(SpinInFromNothing(count, run_time = 0.3)) self.wait() @@ -269,7 +269,7 @@ class ShowReadingRule(Scene): hand = Hand(num, small = True) bool_arr = [c == '1' for c in five_char_binary(num)] counts = [4-count for count in range(5) if bool_arr[count]] - count_mobs = map(finger_tip_power_of_2, counts) + count_mobs = list(map(finger_tip_power_of_2, counts)) if num in [6, 27]: count_mobs[1].shift(0.2*DOWN + 0.2*LEFT) if num in [6, 17]: diff --git a/old_projects/crypto.py b/old_projects/crypto.py index e1ca76b4..809ad78b 100644 --- a/old_projects/crypto.py +++ b/old_projects/crypto.py @@ -281,13 +281,13 @@ class ListRecentCurrencies(Scene): logos.arrange_submobjects(DOWN, buff = MED_LARGE_BUFF) logos.shift(LEFT) logos.to_edge(UP) - names = map( + names = list(map( TextMobject, [ "Bitcoin", "Ethereum", "Ripple", "Litecoin", "Ethereum Classic" ], - ) + )) for logo, name in zip(logos, names): name.next_to(logo, RIGHT) anims = [] @@ -305,11 +305,11 @@ class ListRecentCurrencies(Scene): class Hype(TeacherStudentsScene): def construct(self): self.teacher.change_mode("guilty") - phrases = map(TextMobject, [ + phrases = list(map(TextMobject, [ "I want some!", "I'll get rich, right?", "Buy them all!" - ]) + ])) modes = ["hooray", "conniving", "surprised"] for student, phrase, mode in zip(self.students, phrases, modes): bubble = SpeechBubble() @@ -599,7 +599,7 @@ class LayOutPlan(LedgerScene): ("Alice", "You", 50), ] - self.play(*map(FadeIn, [network, ledger])) + self.play(*list(map(FadeIn, [network, ledger]))) for payment in payments: new_line = self.add_payment_line_to_ledger(*payment) from_name, to_name, amount = payment @@ -838,10 +838,10 @@ class InitialProtocol(Scene): self.add(title, h_line) def show_first_two_items(self): - items = VGroup(*map(self.get_new_item, [ + items = VGroup(*list(map(self.get_new_item, [ "Anyone can add lines to the Ledger", "Settle up with real money each month" - ])) + ]))) for item in items: self.wait() @@ -1025,7 +1025,7 @@ class DescribeDigitalSignatures(LedgerScene): def generate_key_pairs(self): title = TextMobject("Private", "key /", "Public", "key") title.to_edge(UP) - private, public = map(title.get_part_by_tex, ["Private", "Public"]) + private, public = list(map(title.get_part_by_tex, ["Private", "Public"])) private.set_color(self.private_color) public.set_color(self.public_color) secret = TextMobject("Secret") @@ -1084,7 +1084,7 @@ class DescribeDigitalSignatures(LedgerScene): def keep_secret_key_secret(self): keys = self.private_keys - rects = VGroup(*map(SurroundingRectangle, keys)) + rects = VGroup(*list(map(SurroundingRectangle, keys))) rects.set_color(self.private_color) lock = SVGMobject( file_name = "lock", @@ -1174,16 +1174,16 @@ class DescribeDigitalSignatures(LedgerScene): for sig in digital_signatures ]) - words = VGroup(*map( + words = VGroup(*list(map( TextMobject, ["Different messages", "Completely different signatures"] - )) + ))) words.arrange_submobjects(DOWN, aligned_edge = LEFT) words.scale(1.3) words.next_to(self.documents, RIGHT) self.play(FadeIn(rect)) - self.play(*map(ShowCreation, arrows)) + self.play(*list(map(ShowCreation, arrows))) self.play(Transform(self.signatures, digital_signatures)) self.play(*[ ApplyMethod(pi.change, "pondering", digital_signatures) @@ -1450,7 +1450,7 @@ class IncludeTransactionNumber(LedgerScene): ) self.play(ShowCreation(cross)) self.wait() - self.play(*map(FadeOut, [payment, cross, q_marks])) + self.play(*list(map(FadeOut, [payment, cross, q_marks]))) self.ledger.content.remove(payment) def copy_payment_many_times(self): @@ -1595,11 +1595,11 @@ class ThinkAboutSettlingUp(Scene): class DontAllowOverdrawing(InitialProtocol): def construct(self): self.add_title() - lines = map(self.get_new_item, [ + lines = list(map(self.get_new_item, [ "Anyone can add lines to the Ledger \\,", "Only signed transactions are valid \\,", "No overspending" - ]) + ])) lines[2].set_color(YELLOW) self.add(*lines[:2]) @@ -1717,7 +1717,7 @@ class LedgerWithInitialBuyIn(SignedLedgerScene): ]) self.play(Write(invalid)) self.wait(2) - self.play(*map(FadeOut, [rects, last_rect, invalid])) + self.play(*list(map(FadeOut, [rects, last_rect, invalid]))) def running_balance(self): charlie_lines = VGroup(*[ @@ -1737,9 +1737,9 @@ class LedgerWithInitialBuyIn(SignedLedgerScene): title.next_to(rect.get_top(), DOWN) balance = VGroup(rect, title) - lines = VGroup(*map(TextMobject, [ + lines = VGroup(*list(map(TextMobject, [ "\\$100", "\\$50", "\\$0", "Overdrawn" - ])) + ]))) lines.set_color(GREEN) lines[-1].set_color(RED) arrows = VGroup() @@ -2042,7 +2042,7 @@ class BigDifferenceBetweenLDAndCryptocurrencies(Scene): cryptos.next_to, decentralized, DOWN, LARGE_BUFF, ld.next_to, centralized, DOWN, LARGE_BUFF, ) - self.play(*map(Write, words)) + self.play(*list(map(Write, words))) self.wait(2) class DistributedLedgerScene(LedgerScene): @@ -2193,7 +2193,7 @@ class TransitionToDistributedLedger(DistributedLedgerScene): self.alice.change, "happy" ) self.wait() - pairs = zip(payment_copies, self.pi_creatures) + pairs = list(zip(payment_copies, self.pi_creatures)) Scene.play(self, *it.chain(*[ [ pi.look_at, pi.ledger[-1], @@ -2228,7 +2228,7 @@ class TransitionToDistributedLedger(DistributedLedgerScene): for ledger in ledgers ]) - self.play(*map(ShowCreation, arrows)) + self.play(*list(map(ShowCreation, arrows))) self.play(Write(question)) self.wait() @@ -2340,11 +2340,11 @@ class YouListeningToBroadcasts(LedgerScene): class AskWhatToAddToProtocol(InitialProtocol): def construct(self): self.add_title() - items = VGroup(*map(self.get_new_item, [ + items = VGroup(*list(map(self.get_new_item, [ "Broadcast transactions", "Only accept signed transactions", "No overspending", - ] + [""]*6)) + ] + [""]*6))) brace = Brace(VGroup(*items[3:]), LEFT) question = TextMobject("What to \\\\ add here?") question.set_color(RED) @@ -2746,10 +2746,7 @@ class IntroduceNonceOnTrasactions(LedgerScene): FadeOut(nonce_brace) ) ledger.content.add(nonce) - decomposed_ledger = VGroup(*filter( - lambda m : not m.is_subpath, - ledger.family_members_with_points() - )) + decomposed_ledger = VGroup(*[m for m in ledger.family_members_with_points() if not m.is_subpath]) self.play( ShowCreation(arrow), FadeIn(sha) @@ -2993,7 +2990,7 @@ class IntroduceBlockChain(Scene): rate_func = there_and_back, scale_factor = 1.1, )) - self.play(*map(FadeOut, [blocks_word, arrows])) + self.play(*list(map(FadeOut, [blocks_word, arrows]))) self.blocks = blocks @@ -3095,7 +3092,7 @@ class IntroduceBlockChain(Scene): ) arrow = new_arrows[0].copy().shift(-block_spacing) sha_arrows.add_to_back(arrow) - self.play(*map(FadeIn, [arrow, prev_hashes[0]])) + self.play(*list(map(FadeIn, [arrow, prev_hashes[0]]))) self.wait(2) self.prev_hashes = prev_hashes @@ -3594,11 +3591,11 @@ class IntroduceBlockCreator(DistributedBlockChainScene): big_rect.set_stroke(width = 0) big_rect.set_fill(BLACK, opacity = 1) - comments = VGroup(*map(TextMobject, [ + comments = VGroup(*list(map(TextMobject, [ "- ``Block reward''", "- No sender/signature", "- Adds to total money supply", - ])) + ]))) comments.arrange_submobjects(DOWN, aligned_edge = LEFT) comments.move_to(big_rect, UP+LEFT) @@ -3610,7 +3607,7 @@ class IntroduceBlockCreator(DistributedBlockChainScene): for comment in comments: self.play(FadeIn(comment)) self.wait(2) - self.play(*map(FadeOut, [big_rect, comments, reward_rect])) + self.play(*list(map(FadeOut, [big_rect, comments, reward_rect]))) self.pi_creatures = pi_creatures @@ -3639,10 +3636,10 @@ class IntroduceBlockCreator(DistributedBlockChainScene): arrow_creations = [] for old_chain, new_chain in zip(old_chains, new_chains): for attr in "blocks", "arrows": - pairs = zip( + pairs = list(zip( getattr(old_chain, attr), getattr(new_chain, attr), - ) + )) for m1, m2 in pairs: anims.append(Transform(m1, m2)) arrow_creations.append(ShowCreation(new_chain.arrows[-1])) @@ -3763,10 +3760,7 @@ class MiningIsALottery(IntroduceBlockCreator): winner_index = 1 winner = self.miners[winner_index] - losers = VGroup(*filter( - lambda m : m is not winner, - self.miners - )) + losers = VGroup(*[m for m in self.miners if m is not winner]) nonces[winner_index].set_color(GREEN) new_digest = sha256_tex_mob("Winner", 60) @@ -3909,7 +3903,7 @@ class TwoBlockChains(DistributedBlockChainScene): ) self.play( Write(conflicting), - *map(ShowCreation, arrows) + *list(map(ShowCreation, arrows)) ) self.wait() self.play(ShowCreation(longer_chain_rect)) @@ -4387,14 +4381,14 @@ class WhenToTrustANewBlock(DistributedBlockChainScene): chain.to_edge(LEFT) self.add(chain) - words = map(TextMobject, [ + words = list(map(TextMobject, [ "Don't trust yet", "Still don't trust", "...a little more...", "Maybe trust", "Probably safe", "Alright, you're good." - ]) + ])) colors = [RED, RED, YELLOW, YELLOW, GREEN, GREEN] self.add_new_block() arrow = Arrow(UP, DOWN, color = RED) @@ -4937,13 +4931,13 @@ class TopicsNotCovered(TeacherStudentsScene): title.shift(DOWN) title.set_fill(opacity = 0) - topics = VGroup(*map(TextMobject, [ + topics = VGroup(*list(map(TextMobject, [ "Merkle trees", "Alternatives to proof of work", "Scripting", "$\\vdots$", "(See links in description)", - ])) + ]))) topics.arrange_submobjects(DOWN, aligned_edge = LEFT) topics[-2].next_to(topics[-3], DOWN) topics.next_to(title, RIGHT) diff --git a/old_projects/dandelin.py b/old_projects/dandelin.py index 23242fe8..e037e1d4 100644 --- a/old_projects/dandelin.py +++ b/old_projects/dandelin.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from big_ol_pile_of_manim_imports import * from old_projects.lost_lecture import Orbiting @@ -99,7 +99,7 @@ class SumOfIntegersProof(Scene): equation.to_edge(UP) one, two, three, dots, n = numbers = VGroup(*[ equation.get_part_by_tex(tex, substring=False).copy() - for tex in "1", "2", "3", "\\cdots", "n", + for tex in ("1", "2", "3", "\\cdots", "n",) ]) for number in numbers: number.generate_target() @@ -230,11 +230,11 @@ class MultipleDefinitionsOfAnEllipse(Scene): )) self.wait() for definition in definitions: - others = filter(lambda d: d is not definition, definitions) + others = [d for d in definitions if d is not definition] self.play( definition.set_fill, WHITE, 1, definition.scale, 1.2, {"about_edge": LEFT}, - *map(Restore, others) + *list(map(Restore, others)) ) self.wait(2) @@ -324,9 +324,9 @@ class StretchACircle(Scene): class ShowArrayOfEccentricities(Scene): def construct(self): eccentricities = np.linspace(0, 0.99, 6) - eccentricity_labels = VGroup(*map( + eccentricity_labels = VGroup(*list(map( DecimalNumber, eccentricities - )) + ))) ellipses = self.get_ellipse_row(eccentricities) ellipses.set_color_by_gradient(BLUE, YELLOW) ellipses.move_to(DOWN) @@ -1473,7 +1473,7 @@ class LockhartQuote(Scene): I have no idea how it happens. I only know that when it happens to me, I feel very fortunate. """ % strings - quote_parts = filter(lambda s: s, quote_text.split(" ")) + quote_parts = [s for s in quote_text.split(" ") if s] quote = TextMobject( *quote_parts, tex_to_color_map={ diff --git a/old_projects/div_curl.py b/old_projects/div_curl.py index 0ea11cc6..ce2543fa 100644 --- a/old_projects/div_curl.py +++ b/old_projects/div_curl.py @@ -1,4 +1,4 @@ -from __future__ import print_function + from big_ol_pile_of_manim_imports import * DEFAULT_SCALAR_FIELD_COLORS = [BLUE_E, GREEN, YELLOW, RED] @@ -29,7 +29,7 @@ def get_flow_start_points(x_min=-8, x_max=8, noise_factor = delta_y / 2 return np.array([ x * RIGHT + y * UP + noise_factor * np.random.random(3) - for n in xrange(n_repeats) + for n in range(n_repeats) for x in np.arange(x_min, x_max + delta_x, delta_x) for y in np.arange(y_min, y_max + delta_y, delta_y) ]) @@ -122,7 +122,7 @@ def get_rgb_gradient_function(min_value=0, max_value=1, colors=[BLUE, RED], flip_alphas=True, # Why? ): - rgbs = np.array(map(color_to_rgb, colors)) + rgbs = np.array(list(map(color_to_rgb, colors))) def func(values): alphas = inverse_interpolate(min_value, max_value, values) @@ -494,7 +494,7 @@ class Introduction(MovingCameraScene): self.play( LaggedStart(ShowPassingFlash, stream_lines), FadeIn(div_title[0]), - *map(GrowFromCenter, div_title[1]) + *list(map(GrowFromCenter, div_title[1])) ) # Curl @@ -1220,14 +1220,14 @@ class ScopeMeiosis(PiCreatureScene): def construct(self): morty = self.pi_creature - section_titles = VGroup(*map(TextMobject, [ + section_titles = VGroup(*list(map(TextMobject, [ "Background on div/curl", "Conformal maps", "Conformal map $\\Rightarrow" + "\\text{div}\\textbf{F} = " + "\\text{curl}\\textbf{F} = 0$", "Complex derivatives", - ])) + ]))) sections = VGroup(*[ VGroup(title, self.get_lines(title, 3)) for title in section_titles @@ -1251,7 +1251,7 @@ class ScopeMeiosis(PiCreatureScene): "concerned_musician", ] - for n, mode in zip(range(6), modes): + for n, mode in zip(list(range(6)), modes): if n % 2 == 1: top_title = lines lines = self.get_lines(top_title, 4) @@ -1609,10 +1609,10 @@ class ChangingElectricField(Scene): return particles def get_vector_field(self): - func = get_force_field_func(*zip( - map(Mobject.get_center, self.particles), + func = get_force_field_func(*list(zip( + list(map(Mobject.get_center, self.particles)), [p.charge for p in self.particles] - )) + ))) self.vector_field = VectorField(func, **self.vector_field_config) return self.vector_field @@ -1925,7 +1925,7 @@ class DefineDivergenceSymbols(Scene): *fade_anims ) self.wait(2) - fade_anims = map(FadeOut, [brace, label]) + fade_anims = list(map(FadeOut, [brace, label])) self.wait() @@ -3205,7 +3205,7 @@ class PhaseSpaceOfPopulationModel(ShowTwoPopulations, PiCreatureScene, MovingCam ) axes.shift(self.origin) for axis in axes.x_axis, axes.y_axis: - axis.add_numbers(*range(10, 60, 10)) + axis.add_numbers(*list(range(10, 60, 10))) axes_labels = self.axes_labels = VGroup(*[ VGroup( @@ -3734,10 +3734,10 @@ class DivCurlDotCross(Scene): ]) rects.arrange_submobjects_in_grid(n_rows=2, buff=LARGE_BUFF) rects[2:].shift(MED_LARGE_BUFF * DOWN) - titles = VGroup(*map(TextMobject, [ + titles = VGroup(*list(map(TextMobject, [ "Divergence", "Curl", "Dot product", "Cross product" - ])) + ]))) for title, rect in zip(titles, rects): title.next_to(rect, UP) @@ -4290,10 +4290,7 @@ class ZToHalfFlowNearWall(ComplexTransformationScene, MovingCameraScene): secondary_line_ratio=0, ) plane.next_to(ORIGIN, UP, buff=0.001) - horizontal_lines = VGroup(*filter( - lambda l: np.abs(l.get_center()[0]) < 0.1, - list(plane.main_lines) + [plane.axes[0]] - )) + horizontal_lines = VGroup(*[l for l in list(plane.main_lines) + [plane.axes[0]] if np.abs(l.get_center()[0]) < 0.1]) plane.set_stroke(MAROON_B, width=2) horizontal_lines.set_stroke(BLUE, width=2) @@ -4567,7 +4564,7 @@ class ThoughtsOnAds(Scene): left_text.to_edge(LEFT) viewer, brand, creator = vcb = VGroup( - *map(TextMobject, ["viewer", "brand", "creator"]) + *list(map(TextMobject, ["viewer", "brand", "creator"])) ) brand.next_to(creator, LEFT, LARGE_BUFF) viewer.next_to(vcb[1:], UP, LARGE_BUFF) @@ -4626,7 +4623,7 @@ class ThoughtsOnAds(Scene): self.play( Write(misaligned), Write(aligned), - *map(GrowArrow, arrows), + *list(map(GrowArrow, arrows)), run_time=1 ) diff --git a/old_projects/domino_play.py b/old_projects/domino_play.py index 26f8e6a0..e9f85ec6 100644 --- a/old_projects/domino_play.py +++ b/old_projects/domino_play.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -from __future__ import print_function + from big_ol_pile_of_manim_imports import * @@ -25,7 +25,7 @@ class SimpleVelocityGraph(GraphScene): "y_tick_frequency" : 100, "y_min" : 0, "y_max" : 1000, - "y_labeled_nums" : range(0, 1000, 200), + "y_labeled_nums" : list(range(0, 1000, 200)), "x_axis_width" : 12, "graph_origin" : 2.5*DOWN + 5*LEFT, "trailing_average_length" : 20, @@ -48,7 +48,7 @@ class SimpleVelocityGraph(GraphScene): self.draw_lines(color) def save_all_images(self): - indices = range(1, 20) + indices = list(range(1, 20)) for i1, i2 in it.combinations(indices, 2): to_remove = VGroup() for index in i1, i2: @@ -82,10 +82,7 @@ class SimpleVelocityGraph(GraphScene): for line in file: line = line.replace(" ", ",") line = line.replace("\n", "") - entries = filter( - lambda s : s is not "", - line.split(",") - ) + entries = [s for s in line.split(",") if s is not ""] if len(entries) == 0: continue @@ -597,8 +594,8 @@ class ContrastTwoGraphs(SimpleVelocityGraph): sg_copy = sg.deepcopy() sg_copy.scale(0.5) sg_copy.shift(g.get_center()) - mover = VGroup(*it.chain(*zip(g.dots, g.lines))) - target = VGroup(*it.chain(*zip(sg_copy.dots, sg_copy.lines))) + mover = VGroup(*it.chain(*list(zip(g.dots, g.lines)))) + target = VGroup(*it.chain(*list(zip(sg_copy.dots, sg_copy.lines)))) for m, t in zip(mover, target): m.target = t self.play(LaggedStart( @@ -773,7 +770,7 @@ class ShowAllSteadyStateVelocities(SimpleVelocityGraph): "x_max" : 40, "x_axis_width" : 9, "x_tick_frequency" : 5, - "x_labeled_nums" : range(0, 50, 10), + "x_labeled_nums" : list(range(0, 50, 10)), "y_min" : 0, "y_max" : 400, "y_labeled_nums" : [], diff --git a/old_projects/efvgt.py b/old_projects/efvgt.py index aa28f10a..c73929c8 100644 --- a/old_projects/efvgt.py +++ b/old_projects/efvgt.py @@ -374,12 +374,12 @@ class SymmetriesOfSquare(ThreeDScene): self.wait() self.rotate_square(-np.pi) self.wait() - self.play(*map(FadeOut, [brace, q_marks])) + self.play(*list(map(FadeOut, [brace, q_marks]))) def talk_through_90_degree_rotation(self): arcs = self.get_rotation_arcs(self.square, np.pi/2) - self.play(*map(ShowCreation, arcs)) + self.play(*list(map(ShowCreation, arcs))) self.wait() self.rotate_square(np.pi/2, run_time = 2) self.wait() @@ -446,7 +446,7 @@ class SymmetriesOfSquare(ThreeDScene): for square, angle in zip(all_squares[1:4], [np.pi/2, np.pi, -np.pi/2]): arcs = self.get_rotation_arcs(square, angle, MED_SMALL_BUFF) - self.play(*map(FadeIn, [square, arcs])) + self.play(*list(map(FadeIn, [square, arcs]))) square.rotation_kwargs = {"angle" : angle} self.rotate_square(square = square, **square.rotation_kwargs) square.add(arcs) @@ -559,7 +559,7 @@ class SymmetriesOfSquare(ThreeDScene): ) arc.add_tip() if abs(angle) < 3*np.pi/4: - angle_multiple_range = range(1, 4) + angle_multiple_range = list(range(1, 4)) else: angle_multiple_range = [2] arcs = VGroup(arc, *[ @@ -747,7 +747,7 @@ class GroupOfCubeSymmetries(ThreeDScene): cube = self.get_cube() face_centers = [face.get_center() for face in cube[0:7:2]] - angle_axis_pairs = zip(3*[np.pi/2], face_centers) + angle_axis_pairs = list(zip(3*[np.pi/2], face_centers)) for i in range(3): ones = np.ones(3) ones[i] = -1 @@ -828,13 +828,13 @@ class AddSquareSymmetries(SymmetriesOfSquare): self.play(FadeIn(arcs)) self.rotate_square( square = square, angle = np.pi/2, - added_anims = map(FadeIn, equation[:2]) + added_anims = list(map(FadeIn, equation[:2])) ) self.wait() self.play(FadeOut(arcs)) self.flip_square( square = square, axis = UP, - added_anims = map(FadeIn, equation[2:4]) + added_anims = list(map(FadeIn, equation[2:4])) ) self.wait() alt_square.next_to(equals, RIGHT, buff = LARGE_BUFF) @@ -848,7 +848,7 @@ class AddSquareSymmetries(SymmetriesOfSquare): ) self.flip_square( square = alt_square, axis = UP+RIGHT, - added_anims = map(FadeIn, equation[4:]), + added_anims = list(map(FadeIn, equation[4:])), ) self.wait(2) @@ -1011,7 +1011,7 @@ class AddCubeSymmetries(GroupOfCubeSymmetries): ) arrows.move_to(cube) arrows.shift(-axis*cube.get_height()/2/np.linalg.norm(axis)) - anims += map(ShowCreation, arrows) + anims += list(map(ShowCreation, arrows)) anims.append( Rotate( cube, axis = axis, angle = angle, in_place = True, @@ -1022,7 +1022,7 @@ class AddCubeSymmetries(GroupOfCubeSymmetries): def get_composition_angle_and_axis(self): return get_composite_rotation_angle_and_axis( - *zip(*self.angle_axis_pairs) + *list(zip(*self.angle_axis_pairs)) ) class DihedralGroupStructure(SymmetriesOfSquare): @@ -1061,7 +1061,7 @@ class DihedralGroupStructure(SymmetriesOfSquare): def demonstrate_sum(self, angle_axis_pairs): angle_axis_pairs = list(angle_axis_pairs) + [ get_composite_rotation_angle_and_axis( - *zip(*angle_axis_pairs) + *list(zip(*angle_axis_pairs)) ) ] @@ -1103,7 +1103,7 @@ class DihedralGroupStructure(SymmetriesOfSquare): square.remove(square.action_illustration) self.play(FadeIn(s1)) - self.play(*map(ShowCreation, s1.action_illustration)) + self.play(*list(map(ShowCreation, s1.action_illustration))) self.rotate_square(**s1.rotation_kwargs) s1_copy = s1.copy() @@ -1115,14 +1115,14 @@ class DihedralGroupStructure(SymmetriesOfSquare): Transform(s2, s1_copy).update(1) self.remove(s1_copy) self.add(s2) - self.play(*map(ShowCreation, s2.action_illustration)) + self.play(*list(map(ShowCreation, s2.action_illustration))) self.rotate_square(**s2.rotation_kwargs) self.play( Write(equals), FadeIn(s3) ) - self.play(*map(ShowCreation, s3.action_illustration)) + self.play(*list(map(ShowCreation, s3.action_illustration))) self.rotate_square(**s3.rotation_kwargs) self.wait() final_expression.add(*expression) @@ -1155,12 +1155,12 @@ class ThisIsAVeryGeneralIdea(Scene): groups.to_edge(UP) groups.set_color(BLUE) - examples = VGroup(*map(TextMobject, [ + examples = VGroup(*list(map(TextMobject, [ "Square matrices \\\\ \\small (Where $\\det(M) \\ne 0$)", "Molecular \\\\ symmetry", "Cryptography", "Numbers", - ])) + ]))) numbers = examples[-1] examples.arrange_submobjects(buff = LARGE_BUFF) examples.set_width(FRAME_WIDTH-1) @@ -1190,10 +1190,10 @@ class ThisIsAVeryGeneralIdea(Scene): ) self.wait(2) - sub_categories = VGroup(*map(TextMobject, [ + sub_categories = VGroup(*list(map(TextMobject, [ "Numbers \\\\ (Additive)", "Numbers \\\\ (Multiplicative)", - ])) + ]))) sub_categories.arrange_submobjects(RIGHT, buff = MED_LARGE_BUFF) sub_categories.next_to(numbers, DOWN, 1.5*LARGE_BUFF) sub_categories.to_edge(RIGHT) @@ -1207,8 +1207,8 @@ class ThisIsAVeryGeneralIdea(Scene): sub_lines.set_color(numbers.get_color()) self.play(*it.chain( - map(ShowCreation, sub_lines), - map(Write, sub_categories) + list(map(ShowCreation, sub_lines)), + list(map(Write, sub_categories)) )) self.wait() @@ -1260,7 +1260,7 @@ class AdditiveGroupOfReals(Scene): shadow_line.move_to(number_line) - self.play(*map(Write, number_line), run_time = 1) + self.play(*list(map(Write, number_line)), run_time = 1) self.play(shadow_line.restore, Animation(number_line)) self.wait() @@ -1305,7 +1305,7 @@ class AdditiveGroupOfReals(Scene): Write(words), ) self.wait() - self.play(*map(FadeOut, [arrow, words])) + self.play(*list(map(FadeOut, [arrow, words]))) self.number_line.add(dot) @@ -1342,7 +1342,7 @@ class AdditiveGroupOfReals(Scene): Write(words) ) self.wait(2) - self.play(*map(FadeOut, [line, words])) + self.play(*list(map(FadeOut, [line, words]))) def get_write_name_of_group_anim(self): new_title = TextMobject("Additive group of real numbers") @@ -1403,7 +1403,7 @@ class AdditiveGroupOfReals(Scene): self.wait() self.play( self.number_line.restore, - *map(FadeOut, [arrows, sum_mob]) + *list(map(FadeOut, [arrows, sum_mob])) ) def get_adder_mobs(self, num): @@ -1540,7 +1540,7 @@ class AdditiveGroupOfComplexNumbers(ComplexTransformationScene): self.foreground_mobjects.remove(real_arrow) self.foreground_mobjects.remove(imag_arrow) - self.play(*map(FadeOut, [real_arrow, imag_arrow, self.plane])) + self.play(*list(map(FadeOut, [real_arrow, imag_arrow, self.plane]))) self.plane.restore() self.plane.set_stroke(width = 0) self.play(self.plane.restore) @@ -1634,7 +1634,7 @@ class AdditiveGroupOfComplexNumbers(ComplexTransformationScene): rate_func = squish_rate_func(smooth, 0.75, 1), ), Write(plus), - *map(MoveToTarget, [rp1, rp2]) + *list(map(MoveToTarget, [rp1, rp2])) ) self.wait() self.play( @@ -1643,7 +1643,7 @@ class AdditiveGroupOfComplexNumbers(ComplexTransformationScene): imag_background_rect, rate_func = squish_rate_func(smooth, 0.75, 1), ), - *map(MoveToTarget, [ip1, ip2]) + *list(map(MoveToTarget, [ip1, ip2])) ) self.wait(2) to_remove = [ @@ -1656,7 +1656,7 @@ class AdditiveGroupOfComplexNumbers(ComplexTransformationScene): for mob in to_remove: if mob in self.foreground_mobjects: self.foreground_mobjects.remove(mob) - self.play(*map(FadeOut, to_remove)) + self.play(*list(map(FadeOut, to_remove))) self.play(self.plane.restore, run_time = 2) self.wait() @@ -1794,10 +1794,7 @@ class MultiplicativeGroupOfReals(AdditiveGroupOfReals): def add_number_line(self): AdditiveGroupOfReals.add_number_line(self) self.zero_point = self.number_line.number_to_point(0) - self.one = filter( - lambda m : m.get_tex_string() is "1", - self.number_line.numbers - )[0] + self.one = [m for m in self.number_line.numbers if m.get_tex_string() is "1"][0] self.one.add_background_rectangle() self.one.background_rectangle.scale_in_place(1.3) self.number_line.save_state() @@ -1845,10 +1842,7 @@ class MultiplicativeGroupOfReals(AdditiveGroupOfReals): ) for num in (3, 0.5) ] - three_mob = filter( - lambda m : m.get_tex_string() == "3", - self.shadow_line.numbers - )[0] + three_mob = [m for m in self.shadow_line.numbers if m.get_tex_string() == "3"][0] half_point = self.shadow_line.number_to_point(0.5) half_arrow = Arrow( half_point+UP+LEFT, half_point, buff = SMALL_BUFF, @@ -1868,7 +1862,7 @@ class MultiplicativeGroupOfReals(AdditiveGroupOfReals): self.number_line.numbers.add(dot) self.number_line.save_state() self.wait() - self.play(*map(FadeOut, [arrow, words])) + self.play(*list(map(FadeOut, [arrow, words]))) self.stretch(3) self.play( @@ -1883,7 +1877,7 @@ class MultiplicativeGroupOfReals(AdditiveGroupOfReals): self.wait() self.play( self.number_line.restore, - *map(FadeOut, [three_line, dot_copy]) + *list(map(FadeOut, [three_line, dot_copy])) ) self.wait() self.stretch(0.5) @@ -1902,10 +1896,10 @@ class MultiplicativeGroupOfReals(AdditiveGroupOfReals): self.wait() self.play( self.number_line.restore, - *map(FadeOut, [ + *list(map(FadeOut, [ half_label, half_arrow, half_line, dot_copy - ]) + ])) ) self.wait() @@ -2105,10 +2099,10 @@ class MultiplicativeGroupOfComplexNumbers(AdditiveGroupOfComplexNumbers): Indicate(self.plane.one_dot, color = RED), ) self.wait(2) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ zero_words, zero_arrow, one_words, one_arrow, - ])) + ]))) def show_example_actions(self): z_list = [ @@ -2157,10 +2151,7 @@ class MultiplicativeGroupOfComplexNumbers(AdditiveGroupOfComplexNumbers): self.turn_arrow = arc def show_action_at_i_again(self): - neg_one_label = filter( - lambda m : m.get_tex_string() == "-1", - self.real_labels - )[0] + neg_one_label = [m for m in self.real_labels if m.get_tex_string() == "-1"][0] half_turn_arc = Arc( start_angle = np.pi/12, angle = 10*np.pi/12, @@ -2263,7 +2254,7 @@ class MultiplicativeGroupOfComplexNumbers(AdditiveGroupOfComplexNumbers): ] for mob in to_remove: self.foreground_mobjects.remove(mob) - self.reset_plane(*map(FadeOut, to_remove)) + self.reset_plane(*list(map(FadeOut, to_remove))) self.wait() def show_break_down(self): @@ -2657,7 +2648,7 @@ class ExponentsAsHomomorphism(Scene): randy = self.randy terms = list(self.adders) + list(self.multipliers) inputs = [-1, 2] - target_texs = map(str, inputs) + target_texs = list(map(str, inputs)) target_texs += ["2^{%d}"%x for x in inputs] for mob, target_tex in zip(terms, target_texs): target = TexMobject(target_tex) @@ -2676,7 +2667,7 @@ class ExponentsAsHomomorphism(Scene): self.play(randy.look_at, self.top_line) self.show_composition( *inputs, - parallel_anims = map(MoveToTarget, self.adders) + parallel_anims = list(map(MoveToTarget, self.adders)) ) self.play( FocusOn(self.bottom_line_center), @@ -2684,7 +2675,7 @@ class ExponentsAsHomomorphism(Scene): ) self.show_composition( *inputs, - parallel_anims = map(MoveToTarget, self.multipliers) + parallel_anims = list(map(MoveToTarget, self.multipliers)) ) self.wait() @@ -2884,7 +2875,7 @@ class ComplexExponentiationAbstract(): line.add(Line(ORIGIN, FRAME_X_RADIUS*LEFT)) line.set_color(RED) - self.play(*map(ShowCreation, line), run_time = 3) + self.play(*list(map(ShowCreation, line)), run_time = 3) self.add_foreground_mobjects(line) self.real_line = line @@ -2954,7 +2945,7 @@ class ComplexExponentiationAdderHalf( self.play( FadeOut(self.real_line), - *map(ShowCreation, line) + *list(map(ShowCreation, line)) ) self.foreground_mobjects.remove(self.real_line) self.play( @@ -3009,7 +3000,7 @@ class ComplexExponentiationAdderHalf( to_remove = arrow, brace, brace_text for mob in to_remove: self.foreground_mobjects.remove(mob) - self.play(*map(FadeOut, to_remove)) + self.play(*list(map(FadeOut, to_remove))) self.apply_action(complex(0, -1)) def take_steps_for_e(self): @@ -3018,12 +3009,12 @@ class ComplexExponentiationAdderHalf( Brace(Line(ORIGIN, x*UP), RIGHT, buff = SMALL_BUFF) for x in np.cumsum(slide_values) ] - labels = map(TextMobject, [ + labels = list(map(TextMobject, [ "1 unit", "2 units", "3 units", "$\\pi$ units", - ]) + ])) for label, brace in zip(labels, braces): label.add_background_rectangle() label.next_to(brace, RIGHT, buff = SMALL_BUFF) @@ -3110,7 +3101,7 @@ class ComplexExponentiationMultiplierHalf( self.wait(2) self.foreground_mobjects.remove(arc) - self.play(*map(FadeOut, [arc, brace, radians_label])) + self.play(*list(map(FadeOut, [arc, brace, radians_label]))) self.apply_action(complex(0, -1)) def get_arc_braces_and_label(self, angle): diff --git a/old_projects/eoc/chapter1.py b/old_projects/eoc/chapter1.py index 4dbf62e9..ac1a60b6 100644 --- a/old_projects/eoc/chapter1.py +++ b/old_projects/eoc/chapter1.py @@ -810,7 +810,7 @@ class ApproximateOneRing(CircleScene, ReconfigurableScene): self.pi_creature.change_mode, "happy" ) self.wait() - self.play(*map(FadeOut, [trapezoid, strike])) + self.play(*list(map(FadeOut, [trapezoid, strike]))) self.unwrapped_ring = ring @@ -943,12 +943,12 @@ class GraphRectangles(CircleScene, GraphScene): "x_min" : 0, "x_max" : 4, "x_axis_width" : 7, - "x_labeled_nums" : range(5), + "x_labeled_nums" : list(range(5)), "x_axis_label" : "$r$", "y_min" : 0, "y_max" : 20, "y_tick_frequency" : 2.5, - "y_labeled_nums" : range(5, 25, 5), + "y_labeled_nums" : list(range(5, 25, 5)), "y_axis_label" : "", "exclude_zero_label" : False, "num_rings_in_ring_sum_start" : 3, @@ -1078,7 +1078,7 @@ class GraphRectangles(CircleScene, GraphScene): self.wait() self.play(FadeIn(dr_group)) self.wait() - self.play(*map(FadeOut, [moving_arrow, values_of_r])) + self.play(*list(map(FadeOut, [moving_arrow, values_of_r]))) self.x_axis.add(r_ticks) self.r_ticks = r_ticks @@ -1132,7 +1132,7 @@ class GraphRectangles(CircleScene, GraphScene): ring.target = target ring.original_ring = ring.copy() - foreground_animations = map(Animation, [self.x_axis, self.area_label]) + foreground_animations = list(map(Animation, [self.x_axis, self.area_label])) example_ring = transformed_rings[2] self.play( @@ -1240,7 +1240,7 @@ class GraphRectangles(CircleScene, GraphScene): self.rects, self.flat_rects, np.linspace(0, 0.5, len(self.rects)) ) - ] + map(Animation, [self.x_axis, self.graph]) + ] + list(map(Animation, [self.x_axis, self.graph])) ) self.wait(2) @@ -1279,7 +1279,7 @@ class GraphRectangles(CircleScene, GraphScene): for n in range(1, 5) ] - self.play(*map(FadeOut, [self.r_ticks, self.dr_group])) + self.play(*list(map(FadeOut, [self.r_ticks, self.dr_group]))) self.x_axis.remove(self.r_ticks, *self.r_ticks) for new_rects in thinner_rects_list: self.play( @@ -1339,11 +1339,11 @@ class GraphRectangles(CircleScene, GraphScene): self.play(Write(formula.bottom_line)) self.wait(2) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ self.ghost_rings, self.ring_sum.tex_mobs - ])) - self.play(*map(FadeIn, [fresh_rings, self.radius_group])) + ]))) + self.play(*list(map(FadeIn, [fresh_rings, self.radius_group]))) self.wait() self.play( Transform(formula, formula_with_R), @@ -1534,10 +1534,7 @@ class RecapCircleSolution(GraphRectangles, ReconfigurableScene): self.integral_condition = integral_condition def show_sum(self): - visible_rings = filter( - lambda ring : ring.get_fill_opacity() > 0, - self.rings - ) + visible_rings = [ring for ring in self.rings if ring.get_fill_opacity() > 0] radii = self.dR*np.arange(len(visible_rings)) radii[-1] = 3-self.dR @@ -1656,13 +1653,13 @@ class RecapCircleSolution(GraphRectangles, ReconfigurableScene): self.play( Write(self.y_axis, run_time = 2), - *map(FadeOut, [ + *list(map(FadeOut, [ self.approximations, self.area_label, self.area_arrows, self.dr_brace_group, self.r_ticks, - ]) + ])) ) self.play( ReplacementTransform( @@ -1952,11 +1949,11 @@ class MathematicianPonderingAreaUnderDifferentCurves(PiCreatureScene): class AreaUnderParabola(GraphScene): CONFIG = { "x_max" : 4, - "x_labeled_nums" : range(-1, 5), + "x_labeled_nums" : list(range(-1, 5)), "y_min" : 0, "y_max" : 15, "y_tick_frequency" : 2.5, - "y_labeled_nums" : range(5, 20, 5), + "y_labeled_nums" : list(range(5, 20, 5)), "n_rect_iterations" : 6, "default_right_x" : 3, "func" : lambda x : x**2, @@ -2009,7 +2006,7 @@ class AreaUnderParabola(GraphScene): rate_func = smooth, submobject_mode = "lagged_start", ), - *map(Animation, foreground_mobjects) + *list(map(Animation, foreground_mobjects)) ) self.wait() for new_rects in rect_lists[1:]: @@ -2018,7 +2015,7 @@ class AreaUnderParabola(GraphScene): rects, new_rects, submobject_mode = "lagged_start", ), - *map(Animation, foreground_mobjects) + *list(map(Animation, foreground_mobjects)) ) self.wait() @@ -2147,7 +2144,7 @@ class AreaUnderParabola(GraphScene): group, update_group, **kwargs ), - *map(Animation, self.foreground_mobjects) + *list(map(Animation, self.foreground_mobjects)) ) class WhoCaresAboutArea(TeacherStudentsScene): @@ -2226,7 +2223,7 @@ class PlayingTowardsDADX(AreaUnderParabola, ReconfigurableScene): self.move_right_point_to(curr_x + self.deriv_dx) self.play( FadeIn(shadow_rects), - *map(Animation, self.foreground_mobjects) + *list(map(Animation, self.foreground_mobjects)) ) self.shadow_rects = shadow_rects @@ -2279,7 +2276,7 @@ class PlayingTowardsDADX(AreaUnderParabola, ReconfigurableScene): self.play( ReplacementTransform(dA_label[0].copy(), difference_in_area[0]), ReplacementTransform(dA_label[1].copy(), difference_in_area[2]), - *map(FadeIn, [difference_in_area[1], difference_in_area[3]]) + *list(map(FadeIn, [difference_in_area[1], difference_in_area[3]])) ) self.wait(2) self.play(FadeIn(dA_rect), Animation(dA_arrow)) @@ -2334,10 +2331,10 @@ class PlayingTowardsDADX(AreaUnderParabola, ReconfigurableScene): self.play(Write(equation.get_part_by_tex("approx"))) self.wait() for tex, mob in (f_tex, x_squared), ("dx", dx): - self.play(*map(Indicate, [ + self.play(*list(map(Indicate, [ equation.get_part_by_tex(tex), mob - ])) + ]))) self.wait(2) self.play(*[ ReplacementTransform( @@ -2387,17 +2384,17 @@ class PlayingTowardsDADX(AreaUnderParabola, ReconfigurableScene): ) self.play(Blink(randy)) self.wait() - self.play(*map(FadeOut, [randy, q_marks, dA_circle])) + self.play(*list(map(FadeOut, [randy, q_marks, dA_circle]))) def write_example_inputs(self): d = self.default_right_x three = TexMobject("x =", "%d"%d) three_plus_dx = TexMobject("x = ", "%d.001"%d) - labels_lines_vects = zip( + labels_lines_vects = list(zip( [three, three_plus_dx], self.right_v_lines, [LEFT, RIGHT] - ) + )) for label, line, vect in labels_lines_vects: point = line.get_bottom() @@ -2568,7 +2565,7 @@ class AlternateAreaUnderCurve(PlayingTowardsDADX): ) dx_to_zero = self.dx_to_zero_words[1] - self.play(*map(FadeIn, [box, brace])) + self.play(*list(map(FadeIn, [box, brace]))) self.wait() self.play( FadeOut(faders), diff --git a/old_projects/eoc/chapter10.py b/old_projects/eoc/chapter10.py index e4610e6a..68394721 100644 --- a/old_projects/eoc/chapter10.py +++ b/old_projects/eoc/chapter10.py @@ -505,7 +505,7 @@ class ExampleApproximationWithCos(ExampleApproximationWithSine): for dx in (0.01, 0.7) ] - self.play(*map(ShowCreation, v_lines), run_time = 2) + self.play(*list(map(ShowCreation, v_lines)), run_time = 2) self.play(Transform( v_lines, alt_v_lines, run_time = 2, @@ -623,7 +623,7 @@ class ConstructQuadraticApproximation(ExampleApproximationWithCos): )) self.play( FadeIn(free_to_change), - *map(ShowCreation, arrows) + *list(map(ShowCreation, arrows)) ) self.play(*[ ApplyMethod( @@ -711,7 +711,7 @@ class ConstructQuadraticApproximation(ExampleApproximationWithCos): submobject_mode = "lagged_start" )) self.wait(2) - self.play(*map(FadeOut, [poly_at_zero, equals_c0])) + self.play(*list(map(FadeOut, [poly_at_zero, equals_c0]))) self.free_to_change_group.remove( self.free_to_change_group.arrows[0] @@ -824,7 +824,7 @@ class ConstructQuadraticApproximation(ExampleApproximationWithCos): )) self.wait(2) - self.play(*map(FadeOut, poly_group[:-1])) + self.play(*list(map(FadeOut, poly_group[:-1]))) self.free_to_change_group.remove( self.free_to_change_group.arrows[1] ) @@ -855,9 +855,9 @@ class ConstructQuadraticApproximation(ExampleApproximationWithCos): run_time = run_time )) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ partial_cosine_graph, self.tangent_line - ])) + ]))) def compute_cosine_second_derivative(self): second_deriv, rhs = self.get_cosine_second_derivative() @@ -899,9 +899,9 @@ class ConstructQuadraticApproximation(ExampleApproximationWithCos): for line, graph in zip(tangent_lines, graphs) ] - self.play(*map(ShowCreation, tangent_lines)) + self.play(*list(map(ShowCreation, tangent_lines))) self.play(*tangent_change_anims) - self.play(*map(FadeOut, tangent_lines)) + self.play(*list(map(FadeOut, tangent_lines))) def compute_polynomial_second_derivative(self): c2s = ["c_2", "\\text{\\tiny $\\left(-\\frac{1}{2}\\right)$}"] @@ -1136,9 +1136,9 @@ class ReflectOnQuadraticApproximation(TeacherStudentsScene): self.wait(2) self.change_student_modes( *["plain"]*3, - added_anims = map(FadeOut, [ + added_anims = list(map(FadeOut, [ approx_at_point, approx_rhs, real_result - ]), + ])), look_at_arg = approx_at_x ) @@ -1297,7 +1297,7 @@ class SimilarityOfChangeBehavior(ConstructQuadraticApproximation): FadeOut(dots) ) self.play(*tangent_line_movements + dot_anims, run_time = 6) - self.play(*map(FadeOut, [tangent_lines, dots])) + self.play(*list(map(FadeOut, [tangent_lines, dots]))) self.wait() class MoreTerms(TeacherStudentsScene): @@ -1476,11 +1476,11 @@ class CubicAndQuarticApproximations(ConstructQuadraticApproximation): plus_quartic_term.next_to(polynomial, RIGHT) plus_quartic_term.set_color_by_tex("c_4", self.colors[4]) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ self.plus_cubic_term, self.polynomial_third_derivative, self.polynomial_third_derivative_brace, - ])) + ]))) self.play(Write(plus_quartic_term)) self.wait() @@ -2084,9 +2084,9 @@ class TranslationOfInformation(CubicAndQuarticApproximations): run_time = 2 )) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ deriv_info, arrow, output_info, outer_v_lines - ])) + ]))) self.quadratic_graph = quadratic_graph self.v_line = center_v_line @@ -2112,10 +2112,10 @@ class TranslationOfInformation(CubicAndQuarticApproximations): ) for d in derivs_at_x ]) - group = VGroup(*it.chain(*zip( + group = VGroup(*it.chain(*list(zip( derivs_at_x, arrows - ))) + )))) group.add(TexMobject("\\vdots")) group.arrange_submobjects(DOWN, buff = SMALL_BUFF) group.set_height(FRAME_HEIGHT - MED_LARGE_BUFF) @@ -2153,7 +2153,7 @@ class TranslationOfInformation(CubicAndQuarticApproximations): derivs_at_x, derivs_at_zero )) self.wait() - self.play(*map(Write, rhs_group)) + self.play(*list(map(Write, rhs_group))) self.wait() for rhs in rhs_group: self.play(Indicate(rhs[1]), color = WHITE) @@ -2245,13 +2245,13 @@ class TranslationOfInformation(CubicAndQuarticApproximations): func, color = self.colors[0] ) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ self.cosine_derivative_group, self.cosine_graph, self.quadratic_graph, self.v_line, self.dot - ])) + ]))) self.play(ShowCreation(graph)) self.graph = graph @@ -2525,10 +2525,10 @@ class ExpPolynomial(TranslationOfInformation, ExampleApproximationWithExp): ) for d in derivs_at_x ]) - group = VGroup(*it.chain(*zip( + group = VGroup(*it.chain(*list(zip( derivs_at_x, arrows - ))) + )))) group.add(TexMobject("\\vdots")) group.arrange_submobjects(DOWN, buff = 2*SMALL_BUFF) group.set_height(FRAME_HEIGHT - MED_LARGE_BUFF) @@ -2569,7 +2569,7 @@ class ExpPolynomial(TranslationOfInformation, ExampleApproximationWithExp): derivs_at_x, derivs_at_zero )) self.wait() - self.play(*map(Write, rhs_group)) + self.play(*list(map(Write, rhs_group))) self.derivative_values = derivative_values @@ -2742,7 +2742,7 @@ class SecondTermIntuition(AreaIsDerivative): self.change_area_bounds(new_t_max = new_x) self.play( FadeIn(dark_area), - *map(Animation, self.foreground_mobjects) + *list(map(Animation, self.foreground_mobjects)) ) self.play( FadeOut(self.T_label_group), @@ -3453,8 +3453,8 @@ class RadiusOfConvergenceForLnX(ExpGraphConvergence): brace = self.braces[0].copy() self.play(*it.chain( - map(FadeIn, [approx_graph, brace]), - map(Animation, self.foreground_mobjects) + list(map(FadeIn, [approx_graph, brace])), + list(map(Animation, self.foreground_mobjects)) )) self.wait() new_graphs = approx_graphs[1:self.initial_n_iterations] @@ -3462,15 +3462,15 @@ class RadiusOfConvergenceForLnX(ExpGraphConvergence): self.play( Transform(approx_graph, new_graph), Transform(brace, new_brace), - *map(Animation, self.foreground_mobjects) + *list(map(Animation, self.foreground_mobjects)) ) self.wait() approx_graph.remove(approx_dot) self.play( approx_dot.move_to, self.coords_to_point(self.divergent_example, 0), *it.chain( - map(FadeOut, [approx_graph, brace]), - map(Animation, self.foreground_mobjects) + list(map(FadeOut, [approx_graph, brace])), + list(map(Animation, self.foreground_mobjects)) ) ) self.wait() @@ -3493,7 +3493,7 @@ class RadiusOfConvergenceForLnX(ExpGraphConvergence): ), FadeIn(approx_graph[0]), FadeIn(brace), - *map(Animation, self.foreground_mobjects) + *list(map(Animation, self.foreground_mobjects)) ) new_graphs = self.approx_graphs[1:self.initial_n_iterations] @@ -3501,7 +3501,7 @@ class RadiusOfConvergenceForLnX(ExpGraphConvergence): self.play( Transform(approx_graph, new_graph), Transform(brace, new_brace), - *map(Animation, self.foreground_mobjects) + *list(map(Animation, self.foreground_mobjects)) ) self.wait() @@ -3528,7 +3528,7 @@ class RadiusOfConvergenceForLnX(ExpGraphConvergence): for new_graph in new_graphs: self.play( Transform(self.approx_graph, new_graph), - *map(Animation, self.foreground_mobjects) + *list(map(Animation, self.foreground_mobjects)) ) self.wait() diff --git a/old_projects/eoc/chapter2.py b/old_projects/eoc/chapter2.py index 3e6f69b1..49cfe575 100644 --- a/old_projects/eoc/chapter2.py +++ b/old_projects/eoc/chapter2.py @@ -297,12 +297,12 @@ class GraphCarTrajectory(GraphScene): CONFIG = { "x_min" : 0, "x_max" : 10, - "x_labeled_nums" : range(1, 11), + "x_labeled_nums" : list(range(1, 11)), "x_axis_label" : "Time (seconds)", "y_min" : 0, "y_max" : 110, "y_tick_frequency" : 10, - "y_labeled_nums" : range(10, 110, 10), + "y_labeled_nums" : list(range(10, 110, 10)), "y_axis_label" : "Distance traveled \\\\ (meters)", "graph_origin" : 2.5*DOWN + 5*LEFT, "default_graph_colors" : [DISTANCE_COLOR, VELOCITY_COLOR], @@ -363,7 +363,7 @@ class GraphCarTrajectory(GraphScene): run_time = self.time_of_journey, ) self.wait() - self.play(*map(FadeOut, [h_line, v_line, car])) + self.play(*list(map(FadeOut, [h_line, v_line, car]))) #Show example vertical distance h_update(h_line, 0.6) @@ -383,7 +383,7 @@ class GraphCarTrajectory(GraphScene): Write(brace_text) ) self.wait(2) - self.play(*map(FadeOut, [t_dot, dashed_h, brace, brace_text])) + self.play(*list(map(FadeOut, [t_dot, dashed_h, brace, brace_text]))) #Name graph s_of_t = TexMobject("s(t)") @@ -436,7 +436,7 @@ class GraphCarTrajectory(GraphScene): self.play(FadeOut(text)) else: self.wait() - self.play(*map(FadeOut, [rect, change_lines])) + self.play(*list(map(FadeOut, [rect, change_lines]))) self.rect = rect def get_change_lines(self, curr_time, delta_t = 1): @@ -761,7 +761,7 @@ class CompareTwoTimes(Scene): def get_car_state(self, distance, time): line = Line(3*LEFT, 3*RIGHT) - dots = map(Dot, line.get_start_and_end()) + dots = list(map(Dot, line.get_start_and_end())) line.add(*dots) car = Car() car.move_to(line.get_start()) @@ -1012,7 +1012,7 @@ class DsOverDtGraphically(GraphCarTrajectory, ZoomedScene): #Initially zoom in self.play(ShowCreation(input_point_line)) self.activate_zooming() - self.play(*map(FadeIn, [self.big_rectangle, self.little_rectangle])) + self.play(*list(map(FadeIn, [self.big_rectangle, self.little_rectangle]))) self.play( ApplyFunction( align_little_rectangle_on_ds_dt_group, @@ -1140,7 +1140,7 @@ class DsOverDtGraphically(GraphCarTrajectory, ZoomedScene): self.wait() self.play(ShowCreation(v_line_at_t_plus_dt)) self.wait() - self.play(*map(FadeOut, [v_line_at_t, v_line_at_t_plus_dt])) + self.play(*list(map(FadeOut, [v_line_at_t, v_line_at_t_plus_dt]))) self.play( Write(frac_line), Write(lower_dt) @@ -1287,7 +1287,7 @@ class SecantLineToTangentLine(GraphCarTrajectory, DefineTrueDerivative): self.input_to_graph_point(time, self.graph) for time in (self.curr_time, self.curr_time+dt) ] - dots = map(Dot, points) + dots = list(map(Dot, points)) for dot in dots: dot.scale_in_place(0.5) secant_line = Line(*points) @@ -1531,10 +1531,10 @@ class TCubedExample(SecantLineToTangentLine): "y_min" : 0, "y_max" : 16, "y_tick_frequency" : 1, - "y_labeled_nums" : range(0, 17, 2), + "y_labeled_nums" : list(range(0, 17, 2)), "x_min" : 0, "x_max" : 4, - "x_labeled_nums" : range(1, 5), + "x_labeled_nums" : list(range(1, 5)), "graph_origin" : 2.5*DOWN + 6*LEFT, "start_time" : 2, "end_time" : 0.5, @@ -1598,10 +1598,10 @@ class TCubedExample(SecantLineToTangentLine): )) self.play(Blink(morty)) self.wait() - self.play(*map( + self.play(*list(map( FadeOut, [morty, morty.bubble, morty.bubble.content] - )) + ))) def add_ds_dt_group(self): self.curr_time = self.start_time @@ -1655,7 +1655,7 @@ class TCubedExample(SecantLineToTangentLine): Write(nonzero_size), ) self.wait(2) - self.play(*map(FadeOut, [arrow, nonzero_size])) + self.play(*list(map(FadeOut, [arrow, nonzero_size]))) self.play(Write(numerator)) self.play(ShowCreation(v_lines[1])) self.wait() @@ -1667,7 +1667,7 @@ class TCubedExample(SecantLineToTangentLine): self.play(Write(non_numerator)) self.wait(2) self.play( - *map(MoveToTarget, s_pair), + *list(map(MoveToTarget, s_pair)), **{ "path_arc" : -np.pi/2 } @@ -1773,7 +1773,7 @@ class TCubedExample(SecantLineToTangentLine): [DOWN+RIGHT, DOWN+LEFT] ) ])) - self.play(*map(FadeOut, two_cubed_terms)) + self.play(*list(map(FadeOut, two_cubed_terms))) numerator = VGroup(*terms[1:4]) self.play( numerator.scale, 1.4, numerator.get_bottom(), @@ -1900,7 +1900,7 @@ class TCubedExample(SecantLineToTangentLine): for two in twos: two.target = TexMobject("t") two.target.replace(two, dim_to_match = 1) - self.play(*map(MoveToTarget, twos)) + self.play(*list(map(MoveToTarget, twos))) def update_as_tangent_line(group, alpha): self.curr_time = interpolate(self.start_time, self.end_time, alpha) new_group = self.get_ds_dt_group(self.end_dt) @@ -1927,7 +1927,7 @@ class TCubedExample(SecantLineToTangentLine): self.play(Blink(morty)) self.play( morty.change_mode, 'happy', - *map(FadeOut, [morty.bubble, morty.bubble.content]) + *list(map(FadeOut, [morty.bubble, morty.bubble.content])) ) numerator = VGroup(*self.rhs[:12]) @@ -2055,7 +2055,7 @@ class TimeForAnActualParadox(TeacherStudentsScene): teacher.look_at, words, Write(words) ) - self.play(*map(Write, [arrow, paradoxes])) + self.play(*list(map(Write, [arrow, paradoxes]))) self.play(*it.chain(*[ [pi.change_mode, mode, pi.look_at, words] for pi, mode in zip( @@ -2119,7 +2119,7 @@ class ParadoxAtTEquals0(TCubedExample): UpdateFromFunc(v_line, v_line_update), run_time = 5 ) - self.play(*map(FadeOut, [h_line, v_line])) + self.play(*list(map(FadeOut, [h_line, v_line]))) self.label_graph( graph, @@ -2171,7 +2171,7 @@ class ParadoxAtTEquals0(TCubedExample): self.play(Write(derivative[0])) self.wait() self.play(FadeIn(derivative[1])) - self.play(*map(FadeIn, derivative[2:])) + self.play(*list(map(FadeIn, derivative[2:]))) self.wait(2) self.derivative = derivative diff --git a/old_projects/eoc/chapter3.py b/old_projects/eoc/chapter3.py index 2301b7ea..28861280 100644 --- a/old_projects/eoc/chapter3.py +++ b/old_projects/eoc/chapter3.py @@ -50,12 +50,12 @@ class ContrastAbstractAndConcrete(Scene): h_line = Line(LEFT, RIGHT).scale(FRAME_X_RADIUS) h_line.shift((r_title.get_bottom()[1]-MED_SMALL_BUFF)*UP) - functions = VGroup(*map(TexMobject, [ + functions = VGroup(*list(map(TexMobject, [ "f(x) = 2x^2 - x^3", "f(x) = \\sin(x)", "f(x) = e^x", "\\v_dots" - ])) + ]))) functions.arrange_submobjects( DOWN, aligned_edge = LEFT, @@ -65,7 +65,7 @@ class ContrastAbstractAndConcrete(Scene): functions[-1].shift(MED_LARGE_BUFF*RIGHT) self.add(l_title, r_title) - self.play(*map(ShowCreation, [h_line, v_line])) + self.play(*list(map(ShowCreation, [h_line, v_line]))) self.play(Write(functions)) self.wait() anims = [ @@ -150,7 +150,7 @@ class ContrastAbstractAndConcrete(Scene): anims.append(FadeIn(pi)) continue mom_index, dad_index = random.choice( - list(it.combinations(range(index), 2)) + list(it.combinations(list(range(index)), 2)) ) pi.parents = VGroup(pis[mom_index], pis[dad_index]).copy() pi.parents.set_fill(opacity = 0) @@ -183,13 +183,13 @@ class ListOfRules(PiCreatureScene): "use_morty" : False, } def construct(self): - rules = VGroup(*map(TexMobject, [ + rules = VGroup(*list(map(TexMobject, [ "\\frac{d}{dx} x^n = nx^{n-1}", "\\frac{d}{dx} \\sin(x) = \\cos(x)", "\\frac{d}{dx} \\cos(x) = -\\sin(x)", "\\frac{d}{dx} a^x = \\ln(a) a^x", "\\vdots" - ])) + ]))) rules.arrange_submobjects( DOWN, buff = MED_LARGE_BUFF, aligned_edge = LEFT, @@ -212,8 +212,8 @@ class DerivativeOfXSquaredAsGraph(GraphScene, ZoomedScene, PiCreatureScene): "big_x" : 3, "dx" : 0.1, "x_min" : -9, - "x_labeled_nums" : range(-8, 0, 2) + range(2, 10, 2), - "y_labeled_nums" : range(2, 12, 2), + "x_labeled_nums" : list(range(-8, 0, 2)) + list(range(2, 10, 2)), + "y_labeled_nums" : list(range(2, 12, 2)), "little_rect_nudge" : 0.5*(1.5*UP+RIGHT), "graph_origin" : 2.5*DOWN + LEFT, "zoomed_canvas_corner" : UP+LEFT, @@ -310,9 +310,9 @@ class DerivativeOfXSquaredAsGraph(GraphScene, ZoomedScene, PiCreatureScene): self.wait() self.play(Write(df_dx)) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ v_line, nudged_v_line, - ])) + ]))) self.ss_group = ss_group def position_little_rectangle(self, rect, ss_group): @@ -415,7 +415,7 @@ class NudgeSideLengthOfSquare(PiCreatureScene): DrawBorderThenFill(square), self.pi_creature.change_mode, "plain" ) - self.play(*map(GrowFromCenter, braces)) + self.play(*list(map(GrowFromCenter, braces))) self.play(Write(x_squared)) self.change_mode("pondering") self.wait() @@ -478,7 +478,7 @@ class NudgeSideLengthOfSquare(PiCreatureScene): ) self.remove(corner_point, bottom_line, right_line) self.add(corner_square, bottom_rect, right_rect) - self.play(*map(GrowFromCenter, little_braces)) + self.play(*list(map(GrowFromCenter, little_braces))) self.wait() self.play(*it.chain(*[ [mob.shift, vect*SMALL_BUFF] @@ -752,7 +752,7 @@ class NudgeSideLengthOfSquare(PiCreatureScene): ) x_mob.save_state() x_mob.target = number - self.play(*map(MoveToTarget, xs)) + self.play(*list(map(MoveToTarget, xs))) self.wait(2) #Recursively transform to what would have happened @@ -779,7 +779,7 @@ class ChangeInAreaOverChangeInX(Scene): def construct(self): fractions = [] for pair in ("Change in area", "Change in $x$"), ("$d(x^2)$", "$dx$"): - top, bottom = map(TextMobject, pair) + top, bottom = list(map(TextMobject, pair)) top.set_color(YELLOW) bottom.set_color(BLUE_B) frac_line = TexMobject("-") @@ -792,7 +792,7 @@ class ChangeInAreaOverChangeInX(Scene): words, symbols = fractions self.play(Write(words[0], run_time = 1)) - self.play(*map(Write, words[1:]), run_time = 1) + self.play(*list(map(Write, words[1:])), run_time = 1) self.wait() self.play(Transform(words, symbols)) self.wait() @@ -922,7 +922,7 @@ class NudgeSideLengthOfCube(Scene): x_squared_dx = TexMobject("x^2", "\\, dx") - self.play(*map(Write, [df, equals])) + self.play(*list(map(Write, [df, equals]))) self.grab_pieces(self.faces, faces) self.wait() self.shrink_dx("Faces are introduced") @@ -1044,7 +1044,7 @@ class NudgeSideLengthOfCube(Scene): np.pi/12, piece.get_center()-self.cube.get_center() ) piece.target.set_color(RED) - self.play(*map(MoveToTarget, start_pieces), rate_func = wiggle) + self.play(*list(map(MoveToTarget, start_pieces)), rate_func = wiggle) self.wait() added_anims = [] if to_write is not None: @@ -1200,12 +1200,12 @@ class GraphOfXCubed(GraphScene): "x_min" : -6, "x_max" : 6, "x_axis_width" : FRAME_WIDTH, - "x_labeled_nums" : range(-6, 7), + "x_labeled_nums" : list(range(-6, 7)), "y_min" : -35, "y_max" : 35, "y_axis_height" : FRAME_HEIGHT, "y_tick_frequency" : 5, - "y_labeled_nums" : range(-30, 40, 10), + "y_labeled_nums" : list(range(-30, 40, 10)), "graph_origin" : ORIGIN, "dx" : 0.2, "deriv_x_min" : -3, @@ -1287,7 +1287,7 @@ class PatternForPowerRule(PiCreatureScene): self.show_hopping() def introduce_pattern(self): - exp_range = range(1, 1+self.num_exponents) + exp_range = list(range(1, 1+self.num_exponents)) colors = color_gradient([BLUE_D, YELLOW], self.num_exponents) derivatives = VGroup() for exponent, color in zip(exp_range, colors): @@ -1367,7 +1367,7 @@ class PatternForPowerRule(PiCreatureScene): self.wait() def show_hopping(self): - exp_range = range(2, 2+self.num_exponents-1) + exp_range = list(range(2, 2+self.num_exponents-1)) self.change_mode("tired") for exp, color in zip(exp_range, self.colors[1:]): form = TexMobject( @@ -1407,7 +1407,7 @@ class PatternForPowerRule(PiCreatureScene): self.pi_creature.change_mode, "hesitant", self.pi_creature.look_at, lhs_copy ) - self.play(*map(FadeOut, [form, lhs_copy])) + self.play(*list(map(FadeOut, [form, lhs_copy]))) class PowerRuleAlgebra(Scene): CONFIG = { @@ -1463,7 +1463,7 @@ class PowerRuleAlgebra(Scene): self.workout_product(equals2, full_product) def workout_product(self, equals, full_product): - product_part_tex_pairs = zip(full_product, full_product.expression_parts) + product_part_tex_pairs = list(zip(full_product, full_product.expression_parts)) xs, dxs = [ VGroup(*[ submob @@ -1613,7 +1613,7 @@ class OneOverX(PiCreatureScene, GraphScene): "y_min" : 0, "x_tick_frequency" : 0.5, "y_tick_frequency" : 0.5, - "x_labeled_nums" : range(0, 4), + "x_labeled_nums" : list(range(0, 4)), "y_labeled_nums" : [1], "y_axis_height" : 10, "morty_scale_val" : 0.8, @@ -1801,7 +1801,7 @@ class OneOverX(PiCreatureScene, GraphScene): stroke_width = 0 ) area_change_rect.replace( - VGroup(*map(VectorizedPoint, point_pair)), + VGroup(*list(map(VectorizedPoint, point_pair))), stretch = True ) area_changes.add(area_change_rect) @@ -1847,12 +1847,12 @@ class OneOverX(PiCreatureScene, GraphScene): ) self.play( GrowFromCenter(dx_brace), - *map(ShowCreation, v_lines) + *list(map(ShowCreation, v_lines)) ) self.wait() self.play( GrowFromCenter(df_brace), - *map(ShowCreation, h_lines) + *list(map(ShowCreation, h_lines)) ) self.change_mode("confused") self.wait() @@ -2057,7 +2057,7 @@ class SquareRootOfX(Scene): DrawBorderThenFill(square), Write(area_label) ) - self.play(*map(FadeIn, braces)) + self.play(*list(map(FadeIn, braces))) self.wait() self.square = square @@ -2117,8 +2117,8 @@ class SquareRootOfX(Scene): ) self.play(Write(area_increase)) self.play(*it.chain( - map(ShowCreation, lines), - map(FadeIn, little_braces) + list(map(ShowCreation, lines)), + list(map(FadeIn, little_braces)) )) self.play(Write(question)) self.wait() @@ -2258,7 +2258,7 @@ class IntroduceUnitCircleWithSine(GraphScene): buff = SMALL_BUFF ) theta_copy.target.shift(SMALL_BUFF*UP) - self.play(*map(MoveToTarget, [arc_copy, theta_copy])) + self.play(*list(map(MoveToTarget, [arc_copy, theta_copy]))) self.wait() self.angle_label = VGroup(arc_copy, theta_copy) @@ -2282,7 +2282,7 @@ class IntroduceUnitCircleWithSine(GraphScene): faders = [brace, brace_text, self.example_theta_equation] if self.remove_angle_label: faders += self.angle_label - self.play(*map(FadeOut, faders)) + self.play(*list(map(FadeOut, faders))) self.v_line = v_line @@ -2498,9 +2498,9 @@ class DerivativeFromZoomingInOnSine(IntroduceUnitCircleWithSine, ZoomedScene): def zoom_in(self): self.activate_zooming() self.little_rectangle.next_to(self.radial_line.get_end(), UP, LARGE_BUFF) - self.play(*map(FadeIn, [ + self.play(*list(map(FadeIn, [ self.little_rectangle, self.big_rectangle - ])) + ]))) self.play( self.little_rectangle.move_to, self.radial_line.get_end(), DOWN+RIGHT, @@ -2592,7 +2592,7 @@ class DerivativeFromZoomingInOnSine(IntroduceUnitCircleWithSine, ZoomedScene): new_angle_label[1].rotate_in_place(np.pi/2) little_triangle_lines = VGroup(*[ - Line(*map(little_triangle.get_corner, pair)) + Line(*list(map(little_triangle.get_corner, pair))) for pair in [ (DOWN+RIGHT, UP+LEFT), (UP+LEFT, DOWN+LEFT) diff --git a/old_projects/eoc/chapter4.py b/old_projects/eoc/chapter4.py index befc5609..55421f41 100644 --- a/old_projects/eoc/chapter4.py +++ b/old_projects/eoc/chapter4.py @@ -17,11 +17,11 @@ class Chapter4OpeningQuote(OpeningQuote): class TransitionFromLastVideo(TeacherStudentsScene): def construct(self): - simple_rules = VGroup(*map(TexMobject, [ + simple_rules = VGroup(*list(map(TexMobject, [ "\\frac{d(x^3)}{dx} = 3x^2", "\\frac{d(\\sin(x))}{dx} = \\cos(x)", "\\frac{d(1/x)}{dx} = -\\frac{1}{x^2}", - ])) + ]))) combination_rules = VGroup(*[ TexMobject("\\frac{d}{dx}\\left(%s\\right)"%tex) @@ -174,11 +174,11 @@ class TransitionFromLastVideo(TeacherStudentsScene): ) self.wait() self.change_student_modes(*["happy"]*3) - words = map(TextMobject, [ + words = list(map(TextMobject, [ "composition", "product", "composition", "sum", "composition" - ]) + ])) for word, part in zip(words, reversed(parts)): word.set_color(YELLOW) @@ -189,7 +189,7 @@ class TransitionFromLastVideo(TeacherStudentsScene): part.set_color, YELLOW ) self.wait() - self.play(*map(FadeOut, [word, part])) + self.play(*list(map(FadeOut, [word, part]))) self.play(FadeOut(parts[0])) #Bring back combinations @@ -425,9 +425,9 @@ class SumRule(GraphScene): about_point = mob.get_bottom() ) mob.shift_onto_screen() - self.play(*map(MoveToTarget, [ + self.play(*list(map(MoveToTarget, [ graph_parts, self.graph_labels - ])) + ]))) self.wait() def show_example_stacking(self): @@ -443,10 +443,7 @@ class SumRule(GraphScene): VGroup(example_v_lines[i], nudged_v_lines[i]) for i in (0, 1) ] - faders = VGroup(*filter( - lambda line : line not in example_v_lines, - it.chain(*v_line_sets) - )) + faders = VGroup(*[line for line in it.chain(*v_line_sets) if line not in example_v_lines]) label_groups = [] for line, tex, vect in zip(sine_lines, ["", "+dx"], [LEFT, RIGHT]): dot = Dot(line.get_bottom(), radius = 0.03, color = YELLOW) @@ -753,10 +750,7 @@ class NotGraphsForProducts(GraphScene): ) self.wait() - everything = VGroup(*filter( - lambda m : not m.is_subpath, - self.get_mobjects() - )) + everything = VGroup(*[m for m in self.get_mobjects() if not m.is_subpath]) words = TextMobject("Not the best visualization") words.scale(1.5) words.shift(FRAME_Y_RADIUS*UP/2) @@ -877,7 +871,7 @@ class IntroduceProductAsArea(ReconfigurableScene): ) self.wait() self.play(*it.chain( - map(FadeOut, [y_axis, graph, label, v_line]), + list(map(FadeOut, [y_axis, graph, label, v_line])), [Animation(x_axis)] )) self.wait() @@ -918,7 +912,7 @@ class IntroduceProductAsArea(ReconfigurableScene): right_box, corner_box, right_box = df_boxes self.play(FocusOn(nudge_label_group)) - self.play(*map(GrowFromCenter, nudge_label_group)) + self.play(*list(map(GrowFromCenter, nudge_label_group))) self.animate_x_change( self.default_x+self.dx, rate_func = there_and_back, @@ -1085,10 +1079,7 @@ class IntroduceProductAsArea(ReconfigurableScene): top_label = self.box_label_group[1][0] right_label = self.df_box_labels[1] - faders = VGroup(*filter( - lambda m : m not in [bottom_box, top_label, right_label], - self.full_box_parts - )) + faders = VGroup(*[m for m in self.full_box_parts if m not in [bottom_box, top_label, right_label]]) faders.save_state() self.play(faders.fade, 0.8) @@ -1109,10 +1100,7 @@ class IntroduceProductAsArea(ReconfigurableScene): top_label = self.df_box_labels[0] right_label = self.box_label_group[1][1] - faders = VGroup(*filter( - lambda m : m not in [right_box, top_label, right_label], - self.full_box_parts - )) + faders = VGroup(*[m for m in self.full_box_parts if m not in [right_box, top_label, right_label]]) faders.save_state() self.play(faders.fade, 0.8) @@ -1144,7 +1132,7 @@ class IntroduceProductAsArea(ReconfigurableScene): self.wait() self.play(Write(words), ShowCreation(arrow)) self.wait() - self.play(*map(FadeOut, [words, arrow, corner_copy])) + self.play(*list(map(FadeOut, [words, arrow, corner_copy]))) self.wait() corner_copy.set_color(BLACK) @@ -1198,7 +1186,7 @@ class IntroduceProductAsArea(ReconfigurableScene): self.deriv.submobjects.insert( index+1, self.deriv[index].copy() ) - non_deriv_indices = range(len(expanded_deriv)) + non_deriv_indices = list(range(len(expanded_deriv))) for indices in [(3, 4), (7, 8)]: top_part = VGroup() bottom_part = VGroup() @@ -1316,7 +1304,7 @@ class IntroduceProductAsArea(ReconfigurableScene): x_slider.x_val = target_x def get_x_slider(self, x): - numbers = range(int(self.slider_x_max) + 1) + numbers = list(range(int(self.slider_x_max) + 1)) line = NumberLine( x_min = 0, x_max = self.slider_x_max, @@ -1411,9 +1399,9 @@ class MneumonicExample(TeacherStudentsScene): left_words.copy(), left_terms )) self.wait() - self.play(*map(Indicate, [left, left_words[0], left_terms[0]])) + self.play(*list(map(Indicate, [left, left_words[0], left_terms[0]]))) self.wait() - self.play(*map(Indicate, [right, left_words[1], left_terms[1]])) + self.play(*list(map(Indicate, [right, left_words[1], left_terms[1]]))) self.wait() right_words = VGroup(*words[2:]) @@ -1426,9 +1414,9 @@ class MneumonicExample(TeacherStudentsScene): right_words.copy(), right_terms )) self.wait() - self.play(*map(Indicate, [right, right_words[1], right_terms[1]])) + self.play(*list(map(Indicate, [right, right_words[1], right_terms[1]]))) self.wait() - self.play(*map(Indicate, [left, right_words[2], right_terms[2]])) + self.play(*list(map(Indicate, [left, right_words[2], right_terms[2]]))) self.wait(3) self.play(self.get_teacher().change_mode, "shruggie") @@ -1533,8 +1521,8 @@ class ThreeLinesChainRule(ReconfigurableScene): "center_y" : 3, "x_min" : 0, "x_max" : 3, - "numbers_to_show" : range(4), - "numbers_with_elongated_ticks" : range(4), + "numbers_to_show" : list(range(4)), + "numbers_with_elongated_ticks" : list(range(4)), "tick_frequency" : 0.25, }, { @@ -1544,8 +1532,8 @@ class ThreeLinesChainRule(ReconfigurableScene): "center_y" : 0.5, "x_min" : 0, "x_max" : 10, - "numbers_to_show" : range(0, 11), - "numbers_with_elongated_ticks" : range(0, 11, 1), + "numbers_to_show" : list(range(0, 11)), + "numbers_with_elongated_ticks" : list(range(0, 11, 1)), "tick_frequency" : 0.25, }, { @@ -1555,8 +1543,8 @@ class ThreeLinesChainRule(ReconfigurableScene): "center_y" : -2, "x_min" : -2, "x_max" : 2, - "numbers_to_show" : range(-2, 3), - "numbers_with_elongated_ticks" : range(-2, 3), + "numbers_to_show" : list(range(-2, 3)), + "numbers_with_elongated_ticks" : list(range(-2, 3)), "tick_frequency" : 0.25, }, ], @@ -1639,7 +1627,7 @@ class ThreeLinesChainRule(ReconfigurableScene): ShowCreation(sine_arrow) ) self.wait(2) - self.play(*map(FadeOut, [sine_text, sine_arrow])) + self.play(*list(map(FadeOut, [sine_text, sine_arrow]))) self.animate_x_change(self.example_x, run_time = 3) def nudge_x(self): @@ -1710,7 +1698,7 @@ class ThreeLinesChainRule(ReconfigurableScene): run_time = 1, added_anims = it.chain( [GrowFromCenter(dx_brace)], - map(ShowCreation, nudge_lines) + list(map(ShowCreation, nudge_lines)) ) ) self.animate_x_change(self.example_x) @@ -1797,7 +1785,7 @@ class ThreeLinesChainRule(ReconfigurableScene): group.to_edge(RIGHT) arrow = Arrow(group.get_bottom(), self.final_derivative[0].get_top()) - self.play(*map(FadeOut, [self.arrows, self.arrow_labels])) + self.play(*list(map(FadeOut, [self.arrows, self.arrow_labels]))) self.play(FadeIn(group)) self.play(ShowCreation(arrow)) self.wait() @@ -1965,7 +1953,7 @@ class GeneralizeChainRule(Scene): self.wait() #Generalize - self.play(*map(FadeIn, general[:5])) + self.play(*list(map(FadeIn, general[:5]))) self.wait() self.play( Transform(example_outer_brace, general_outer_brace), @@ -2026,9 +2014,9 @@ class GeneralizeChainRule(Scene): self.play(morty.change_mode, "pondering") self.play(Blink(morty)) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ d_general_outer_copy, inner, circle - ])) + ]))) #Show cancelation braces = [ @@ -2038,15 +2026,15 @@ class GeneralizeChainRule(Scene): example_outer_brace, ] texts = [brace.text for brace in braces] - self.play(*map(FadeOut, braces+texts)) + self.play(*list(map(FadeOut, braces+texts))) to_collapse = VGroup(VGroup(*general[7:10]), general[12]) dg_dh = VGroup(*general[5:7]) dh_dx = VGroup(*general[10:12]) to_collapse.generate_target() - points = VGroup(*map(VectorizedPoint, + points = VGroup(*list(map(VectorizedPoint, [m.get_left() for m in to_collapse] - )) + ))) self.play( Transform(to_collapse, points), dh_dx.next_to, dg_dh, diff --git a/old_projects/eoc/chapter5.py b/old_projects/eoc/chapter5.py index faec8028..c3d035c5 100644 --- a/old_projects/eoc/chapter5.py +++ b/old_projects/eoc/chapter5.py @@ -22,10 +22,10 @@ class LastVideo(TeacherStudentsScene): last_video.save_state() this_video = series[3] - known_formulas = VGroup(*map(TexMobject, [ + known_formulas = VGroup(*list(map(TexMobject, [ "\\frac{d(x^n)}{dx} = nx^{n-1}", "\\frac{d(\\sin(x))}{dx} = \\cos(x)", - ])) + ]))) known_formulas.arrange_submobjects( DOWN, buff = MED_LARGE_BUFF, ) @@ -196,11 +196,11 @@ class DoublingPopulation(PiCreatureScene): for x in range(2): new_day_to_day, new_frac = self.get_from_day_to_day_label() - self.play(*map(FadeOut, [rect, frac])) + self.play(*list(map(FadeOut, [rect, frac]))) frac = new_frac self.play(Transform(day_to_day, new_day_to_day)) rect = self.let_day_pass_and_highlight_new_creatures(frac) - self.play(*map(FadeOut, [rect, frac, day_to_day])) + self.play(*list(map(FadeOut, [rect, frac, day_to_day]))) def let_day_pass_and_highlight_new_creatures(self, frac): num_new_creatures = 2**self.get_curr_day() @@ -273,9 +273,9 @@ class DoublingPopulation(PiCreatureScene): fading_creatures = VGroup(*self.get_on_screen_pi_creatures()[8:]) - self.play(*map(FadeIn, [ + self.play(*list(map(FadeIn, [ false_deriv, false_deriv.brace, false_deriv.brace_text - ])) + ]))) self.wait() self.play( Transform(time, new_time), @@ -303,9 +303,9 @@ class DoublingPopulation(PiCreatureScene): rect.replace(real_deriv) rect.stretch_to_fit_width(rect.get_width()+MED_SMALL_BUFF) rect.stretch_to_fit_height(rect.get_height()+MED_SMALL_BUFF) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ false_deriv.brace, false_deriv.brace_text - ])) + ]))) self.play(ShowCreation(rect)) self.play(*[ ApplyFunction( @@ -348,8 +348,8 @@ class DoublingPopulation(PiCreatureScene): new_time.next_to(self.t_expression[-2], RIGHT) first_creature = self.get_pi_creatures()[0] - self.play(*map(FadeOut, faders)) - self.play(*map(FadeIn, [first_creature, new_time])) + self.play(*list(map(FadeOut, faders))) + self.play(*list(map(FadeIn, [first_creature, new_time]))) self.t_expression.submobjects[-1] = new_time def let_one_day_pass(self, run_time = 2): @@ -445,8 +445,8 @@ class GraphOfTwoToT(GraphScene): CONFIG = { "x_axis_label" : "$t$", "y_axis_label" : "$M$", - "x_labeled_nums" : range(1, 7), - "y_labeled_nums" : range(8, 40, 8), + "x_labeled_nums" : list(range(1, 7)), + "y_labeled_nums" : list(range(8, 40, 8)), "x_max" : 6, "y_min" : 0, "y_max" : 32, @@ -800,10 +800,10 @@ class AnalyzeExponentRatio(PiCreatureScene): Transform(*arrows), ) self.wait(2) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ words[0], arrows[0], add_exp_rect, mult_rect, two_to_t_plus_dt, exp_prop_brace, - ])) + ]))) #Factor out 2^t self.play(*[ @@ -886,7 +886,7 @@ class AnalyzeExponentRatio(PiCreatureScene): self.play(ReplacementTransform(rects[0].copy(), rects[1])) self.change_mode("happy") self.wait() - self.play(*map(FadeOut, rects)) + self.play(*list(map(FadeOut, rects))) #Plug in specific values static_constant = self.try_specific_dt_values() @@ -1145,7 +1145,7 @@ class GraphOfExp(GraphScene): "x_max" : 3, "x_tick_frequency" : 1, "x_axis_label" : "t", - "x_labeled_nums" : range(-3, 4), + "x_labeled_nums" : list(range(-3, 4)), "x_axis_width" : 11, "graph_origin" : 2*DOWN + LEFT, "example_inputs" : [1, 2], @@ -1196,7 +1196,7 @@ class GraphOfExp(GraphScene): ) ) self.wait() - self.play(*map(ShowCreation, ss_group)) + self.play(*list(map(ShowCreation, ss_group))) self.play(Write(slope_labels[0])) self.play(ShowCreation(v_lines[0])) self.play(Write(height_labels[0])) @@ -1291,8 +1291,8 @@ class ChainRuleIntuition(ThreeLinesChainRule): "center_y" : 3, "x_min" : 0, "x_max" : 3, - "numbers_to_show" : range(4), - "numbers_with_elongated_ticks" : range(4), + "numbers_to_show" : list(range(4)), + "numbers_with_elongated_ticks" : list(range(4)), "tick_frequency" : 1, }, { @@ -1302,8 +1302,8 @@ class ChainRuleIntuition(ThreeLinesChainRule): "center_y" : 0.5, "x_min" : 0, "x_max" : 3, - "numbers_to_show" : range(0, 4), - "numbers_with_elongated_ticks" : range(4), + "numbers_to_show" : list(range(0, 4)), + "numbers_with_elongated_ticks" : list(range(4)), "tick_frequency" : 1, }, { @@ -1313,8 +1313,8 @@ class ChainRuleIntuition(ThreeLinesChainRule): "center_y" : -2, "x_min" : 0, "x_max" : 10, - "numbers_to_show" : range(0, 11, 3), - "numbers_with_elongated_ticks" : range(11), + "numbers_to_show" : list(range(0, 11, 3)), + "numbers_with_elongated_ticks" : list(range(11)), "tick_frequency" : 1, }, ], @@ -1364,7 +1364,7 @@ class ChainRuleIntuition(ThreeLinesChainRule): line.remove(*line.numbers) dt_brace, d3t_brace, dexp3t_brace = braces - self.play(*map(FadeIn, [nudge_lines, braces])) + self.play(*list(map(FadeIn, [nudge_lines, braces]))) self.wait() for count in range(3): for dx in self.dx, 0: @@ -1526,7 +1526,7 @@ class CompareWaysToWriteExponentials(GraphScene): } def construct(self): self.setup_axes() - bases = range(2, 7) + bases = list(range(2, 7)) graphs = [ self.get_graph(lambda t : base**t, color = GREEN) for base in bases @@ -1783,7 +1783,7 @@ class InvestedMoney(Scene): class NaturalLog(Scene): def construct(self): - expressions = VGroup(*map(self.get_expression, [2, 3, 7])) + expressions = VGroup(*list(map(self.get_expression, [2, 3, 7]))) expressions.arrange_submobjects(DOWN, buff = MED_SMALL_BUFF) expressions.to_edge(LEFT) @@ -1807,7 +1807,7 @@ class NaturalLog(Scene): log_constant, exp_constant = constant.copy(), constant.copy() log_base, exp_base = base.copy(), base.copy() - log_equals, exp_equals = map(TexMobject, "==") + log_equals, exp_equals = list(map(TexMobject, "==")) ln = TexMobject("\\ln(2)") log_base.move_to(ln[-2]) @@ -1858,7 +1858,7 @@ class NaturalLog(Scene): ln_a.set_color, BLUE ) self.wait() - self.play(*map(FadeOut, [log_expression, exp_expression])) + self.play(*list(map(FadeOut, [log_expression, exp_expression]))) self.wait() def get_expression(self, base): @@ -1895,9 +1895,9 @@ class NextVideo(TeacherStudentsScene): this_tex[3][1].set_color(YELLOW) this_tex.next_to(brace, DOWN) - next_tex = VGroup(*map(TextMobject, [ + next_tex = VGroup(*list(map(TextMobject, [ "Chain rule", "Product rule", "$\\vdots$" - ])) + ]))) next_tex.arrange_submobjects(DOWN) next_tex.next_to(brace, DOWN) next_tex.shift( diff --git a/old_projects/eoc/chapter6.py b/old_projects/eoc/chapter6.py index 0062f2a3..bdb0337c 100644 --- a/old_projects/eoc/chapter6.py +++ b/old_projects/eoc/chapter6.py @@ -150,17 +150,17 @@ class SlopeOfCircleExample(ZoomedScene): #Move labels to equation movers = labels.copy() - pairs = zip( + pairs = list(zip( [movers[1], movers[2], movers[0]], self.circle_equation[1][0:-1:3] - ) + )) self.play(*[ ApplyMethod(m1.replace, m2) for m1, m2 in pairs ]) self.wait() - self.play(*map(FadeOut, [lines, labels, movers])) + self.play(*list(map(FadeOut, [lines, labels, movers]))) self.remove(full_group) self.add(dot) self.wait() @@ -224,8 +224,8 @@ class SlopeOfCircleExample(ZoomedScene): self.play(Blink(morty)) self.wait() - self.play(*map(FadeOut, to_fade)) - self.play(*map(FadeOut, [radial_line, perp_mark])) + self.play(*list(map(FadeOut, to_fade))) + self.play(*list(map(FadeOut, [radial_line, perp_mark]))) self.wait() def show_dx_and_dy(self): @@ -341,7 +341,7 @@ class SlopeOfCircleExample(ZoomedScene): ) self.play(new_circle.set_stroke, None, 0) self.wait() - self.play(*map(FadeOut, [brace, brace_text])) + self.play(*list(map(FadeOut, [brace, brace_text]))) self.wait() def perform_implicit_derivative(self): @@ -663,7 +663,7 @@ class RelatedRatesExample(ThreeDScene): self.wait() self.play(ShowCreation(x_line), Write(x_label)) self.wait(2) - self.play(*map(FadeOut, [x_label, y_label])) + self.play(*list(map(FadeOut, [x_label, y_label]))) self.ladder_brace = ladder_brace self.x_and_y_lines = x_and_y_lines @@ -733,9 +733,9 @@ class RelatedRatesExample(ThreeDScene): randy, "Give names" )) self.play(Blink(randy)) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ randy, randy.bubble, randy.bubble.content - ])) + ]))) def write_equation(self): self.x_and_y_labels = self.get_x_and_y_labels() @@ -827,9 +827,9 @@ class RelatedRatesExample(ThreeDScene): run_time = 8, rate_func = there_and_back ) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ randy, find_dx_dt, alt_equation - ])) + ]))) self.wait() def discuss_lhs_as_function(self): @@ -872,9 +872,9 @@ class RelatedRatesExample(ThreeDScene): rate_func = lambda t : 0.5*there_and_back(t) ) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ brace, constant_words, function_of_time - ])) + ]))) self.play( ReplacementTransform(lhs.copy(), derivative_interior), Write(derivative_scaffold), @@ -906,10 +906,10 @@ class RelatedRatesExample(ThreeDScene): GrowFromCenter(dt_brace), Write(dt_brace_text, run_time = 2) ) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ self.dy_arrow, self.dy_label, self.dx_arrow, self.dx_label, - ])) + ]))) self.add(shadow_ladder) self.let_ladder_fall( self.ladder, *self.get_added_anims_for_ladder_fall(), @@ -2034,7 +2034,7 @@ class AlternateExample(ZoomedScene): ShowCreation(arrows) ) self.wait() - self.play(*map(FadeOut, [word, arrows])) + self.play(*list(map(FadeOut, [word, arrows]))) def differentiate_lhs(self): formula = self.formula @@ -2124,7 +2124,7 @@ class AlternateExample(ZoomedScene): self.play(ShowCreation(arrow)) self.play(Write(equals_dx)) self.wait() - self.play(*map(FadeOut, [circle, arrow])) + self.play(*list(map(FadeOut, [circle, arrow]))) self.equals_dx = equals_dx @@ -2301,7 +2301,7 @@ class DerivativeOfNaturalLog(ZoomedScene): update_dot(dot, 0) update_label(label) - self.play(*map(FadeIn, [dot, label])) + self.play(*list(map(FadeIn, [dot, label]))) self.play( UpdateFromAlphaFunc(dot, update_dot), UpdateFromFunc(label, update_label), @@ -2322,7 +2322,7 @@ class DerivativeOfNaturalLog(ZoomedScene): run_time = 3, rate_func = lambda t : 1-0.6*smooth(t), ) - self.play(*map(FadeOut, [xy_start, label])) + self.play(*list(map(FadeOut, [xy_start, label]))) self.dot = dot @@ -2654,9 +2654,9 @@ class Chapter6PatreonThanks(PatreonThanks): class Thumbnail(AlternateExample): def construct(self): - title = VGroup(*map(TextMobject, [ + title = VGroup(*list(map(TextMobject, [ "Implicit", "Differentiation" - ])) + ]))) title.arrange_submobjects(DOWN) title.scale(3) title.next_to(ORIGIN, UP) diff --git a/old_projects/eoc/chapter7.py b/old_projects/eoc/chapter7.py index 937a1873..78aee000 100644 --- a/old_projects/eoc/chapter7.py +++ b/old_projects/eoc/chapter7.py @@ -31,7 +31,7 @@ class ThisVideo(TeacherStudentsScene): integral_videos = VGroup(*series[7:9]) video_groups = [deriv_videos, this_video, integral_videos] - braces = map(Brace, video_groups) + braces = list(map(Brace, video_groups)) deriv_brace, this_brace, integral_brace = braces tex_mobs = [ @@ -278,11 +278,8 @@ class RefreshOnDerivativeDefinition(GraphScene): ) for s in ["f", "over", "dx", "(", str(self.start_x), ")"] ]) - covered_new_deriv_parts = list(it.chain(*deriv_to_new_deriv.values())) - uncovered_new_deriv_parts = filter( - lambda part : part not in covered_new_deriv_parts, - new_deriv - ) + covered_new_deriv_parts = list(it.chain(*list(deriv_to_new_deriv.values()))) + uncovered_new_deriv_parts = [part for part in new_deriv if part not in covered_new_deriv_parts] new_deriv.move_to(derivative) new_brace = Brace(new_deriv, DOWN) @@ -295,7 +292,7 @@ class RefreshOnDerivativeDefinition(GraphScene): self.wait() self.play(*[ ReplacementTransform(*pair, run_time = 2) - for pair in deriv_to_new_deriv.items() + for pair in list(deriv_to_new_deriv.items()) ]+[ Transform(deriv_brace, new_brace), dx_to_0.next_to, new_brace, DOWN @@ -632,7 +629,7 @@ class OtherViewsOfDx(TeacherStudentsScene): "h" : GREEN, "2" : RED } - for tex, color in tex_to_color.items(): + for tex, color in list(tex_to_color.items()): definition.set_color_by_tex(tex, color) definition.scale(0.8) definition.to_corner(UP+LEFT) @@ -767,11 +764,11 @@ class GraphLimitExpression(GraphScene): "x_min" : -8, "x_max" : 5, "x_axis_label" : "$h$", - "x_labeled_nums" : range(-8, 6, 2), + "x_labeled_nums" : list(range(-8, 6, 2)), "y_min" : 0, "y_max" : 20, "y_tick_frequency" : 1, - "y_labeled_nums" : range(5, 25, 5), + "y_labeled_nums" : list(range(5, 25, 5)), "y_axis_label" : "", "big_delta" : 0.7, "small_delta" : 0.01, @@ -803,7 +800,7 @@ class GraphLimitExpression(GraphScene): "2" : self.two_color } for tex_mob in expression, limit, derivative: - for tex, color in tex_to_color.items(): + for tex, color in list(tex_to_color.items()): tex_mob.set_color_by_tex(tex, color) tex_mob.next_to(ORIGIN, RIGHT, LARGE_BUFF) tex_mob.to_edge(UP) @@ -847,7 +844,7 @@ class GraphLimitExpression(GraphScene): self.wait(2) self.play( expression.restore, - *map(FadeOut, [derivative, brace, limit]) + *list(map(FadeOut, [derivative, brace, limit])) ) self.wait() @@ -893,7 +890,7 @@ class GraphLimitExpression(GraphScene): undefined.to_edge(RIGHT) self.play(Write(h_equals_0, run_time = 2)) - self.play(*map(ShowCreation, [arrow, dot])) + self.play(*list(map(ShowCreation, [arrow, dot]))) self.wait() self.play(ReplacementTransform( expression.copy(), new_expression @@ -989,7 +986,7 @@ class GraphLimitExpression(GraphScene): self.remove(self.limit_point_hole) #Show approaching - self.play(*map(FadeOut, [brace, brace_text])) + self.play(*list(map(FadeOut, [brace, brace_text]))) for v_line, h_line in (right_v_line, top_h_line), (left_v_line, bottom_h_line): self.play( ShowCreation(v_line), @@ -1082,7 +1079,7 @@ class GraphLimitExpression(GraphScene): ) ) self.wait() - self.play(*map(GrowFromCenter, self.ed_group.epsilon_lines)) + self.play(*list(map(GrowFromCenter, self.ed_group.epsilon_lines))) self.play(*[ ApplyMethod( line.copy().set_stroke(GREY, 2).move_to, @@ -1207,11 +1204,11 @@ class LimitCounterExample(GraphLimitExpression): CONFIG = { "x_min" : -8, "x_max" : 8, - "x_labeled_nums" : range(-8, 10, 2), + "x_labeled_nums" : list(range(-8, 10, 2)), "x_axis_width" : FRAME_WIDTH - LARGE_BUFF, "y_min" : -4, "y_max" : 4, - "y_labeled_nums" : range(-2, 4, 1), + "y_labeled_nums" : list(range(-2, 4, 1)), "y_axis_height" : FRAME_HEIGHT+2*LARGE_BUFF, "graph_origin" : DOWN, "graph_color" : BLUE, @@ -1288,7 +1285,7 @@ class LimitCounterExample(GraphLimitExpression): return lines for lines in right_lines, left_lines: - self.play(*map(ShowCreation, lines)) + self.play(*list(map(ShowCreation, lines))) self.play(UpdateFromAlphaFunc( lines, update_lines, run_time = 3 @@ -1462,10 +1459,10 @@ class EpsilonDeltaExample(GraphLimitExpression, ZoomedScene): self.revert_to_original_skipping_status() def introduce_epsilon(self): - epsilon_group, small_epsilon_group = map( + epsilon_group, small_epsilon_group = list(map( self.get_epsilon_group, self.epsilon_list[:2] - ) + )) twelve_line = epsilon_group.limit_line twelve = self.rhs[-1] @@ -1490,15 +1487,15 @@ class EpsilonDeltaExample(GraphLimitExpression, ZoomedScene): ReplacementTransform(twelve_line.copy(), line) for line in epsilon_group.epsilon_lines ], - map(GrowFromCenter, epsilon_group.braces), + list(map(GrowFromCenter, epsilon_group.braces)), )) - self.play(*map(Write, epsilon_group.labels)) + self.play(*list(map(Write, epsilon_group.labels))) self.play( Write(distance), ShowCreation(arrows) ) self.wait() - self.play(*map(FadeOut, [distance, arrows])) + self.play(*list(map(FadeOut, [distance, arrows]))) self.play(Transform( epsilon_group, small_epsilon_group, run_time = 2 @@ -1537,8 +1534,8 @@ class EpsilonDeltaExample(GraphLimitExpression, ZoomedScene): def introduce_delta(self): delta_group = self.get_delta_group(self.delta_list[1]) - self.play(*map(GrowFromCenter, delta_group.braces)) - self.play(*map(Write, delta_group.labels)) + self.play(*list(map(GrowFromCenter, delta_group.braces))) + self.play(*list(map(Write, delta_group.labels))) self.wait() self.play( ReplacementTransform( @@ -1667,9 +1664,9 @@ class EpsilonDeltaCounterExample(LimitCounterExample, EpsilonDeltaExample): ) for line in epsilon_group.epsilon_lines ], - map(GrowFromCenter, epsilon_group.braces) + list(map(GrowFromCenter, epsilon_group.braces)) )) - self.play(*map(Write, epsilon_group.labels)) + self.play(*list(map(Write, epsilon_group.labels))) self.play(Write(rhs)) self.wait() @@ -1678,7 +1675,7 @@ class EpsilonDeltaCounterExample(LimitCounterExample, EpsilonDeltaExample): def introduce_epsilon_delta_group(self): ed_group = self.get_epsilon_delta_group(self.big_delta) - self.play(*map(ShowCreation, ed_group.delta_lines)) + self.play(*list(map(ShowCreation, ed_group.delta_lines))) self.play(ShowCreation(ed_group.input_range)) self.play(ReplacementTransform( ed_group.input_range.copy(), @@ -1686,7 +1683,7 @@ class EpsilonDeltaCounterExample(LimitCounterExample, EpsilonDeltaExample): run_time = 2 )) self.remove(self.graph_holes) - self.play(*map(GrowFromCenter, ed_group.epsilon_lines)) + self.play(*list(map(GrowFromCenter, ed_group.epsilon_lines))) self.wait(2) self.animate_epsilon_delta_group_change( ed_group, target_delta = self.small_delta, @@ -1810,13 +1807,13 @@ class LHopitalExample(LimitCounterExample, PiCreatureScene, ZoomedScene, Reconfi "x_axis_width" : FRAME_WIDTH, "x_min" : -5, "x_max" : 5, - "x_labeled_nums" : range(-6, 8, 2), + "x_labeled_nums" : list(range(-6, 8, 2)), "x_axis_label" : "$x$", "y_axis_height" : FRAME_HEIGHT, "y_min" : -3.1, "y_max" : 3.1, "y_bottom_tick" : -4, - "y_labeled_nums" : range(-2, 4, 2), + "y_labeled_nums" : list(range(-2, 4, 2)), "y_axis_label" : "", "x_color" : RED, "hole_radius" : 0.07, @@ -1960,9 +1957,9 @@ class LHopitalExample(LimitCounterExample, PiCreatureScene, ZoomedScene, Reconfi ed_group.input_range.copy(), ed_group.output_range ), - *map(ShowCreation, ed_group.delta_lines) + *list(map(ShowCreation, ed_group.delta_lines)) ) - self.play(*map(GrowFromCenter, ed_group.epsilon_lines)) + self.play(*list(map(GrowFromCenter, ed_group.epsilon_lines))) self.play(morty.change_mode, "thinking") self.animate_epsilon_delta_group_change( ed_group, target_delta = self.small_delta, @@ -1979,7 +1976,7 @@ class LHopitalExample(LimitCounterExample, PiCreatureScene, ZoomedScene, Reconfi self.wait(2) self.play( func_1_group.to_corner, UP+LEFT, - *map(FadeOut, [morty, ed_group]) + *list(map(FadeOut, [morty, ed_group])) ) self.wait() @@ -2250,7 +2247,7 @@ class LHopitalExample(LimitCounterExample, PiCreatureScene, ZoomedScene, Reconfi self.play(FadeOut(cos)) neg = neg_one.get_part_by_tex("-").copy() self.play(neg.next_to, cos_dx[-2], LEFT, SMALL_BUFF/self.zoom_factor) - self.play(*map(FadeOut, [neg_one, brace])) + self.play(*list(map(FadeOut, [neg_one, brace]))) neg_pi_dx = VGroup(neg, *cos_dx[-2:]) self.play( neg_pi_dx.next_to, d_sine_arrow, @@ -2322,7 +2319,7 @@ class LHopitalExample(LimitCounterExample, PiCreatureScene, ZoomedScene, Reconfi self.wait() self.play(Transform(x, dot_one)) self.wait() - self.play(*map(FadeOut, [eq_x, equals])) + self.play(*list(map(FadeOut, [eq_x, equals]))) self.wait() def show_final_ratio(self): @@ -2358,7 +2355,7 @@ class LHopitalExample(LimitCounterExample, PiCreatureScene, ZoomedScene, Reconfi self.wait() #Cancel dx's - self.play(*map(ShowCreation, circles), run_time = 2) + self.play(*list(map(ShowCreation, circles)), run_time = 2) self.wait() self.play(dxs.fade, 0.75, FadeOut(circles)) self.wait() @@ -2381,10 +2378,10 @@ class LHopitalExample(LimitCounterExample, PiCreatureScene, ZoomedScene, Reconfi height.add_background_rectangle() self.disactivate_zooming() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ self.sine_graph, self.sine_label, self.parabola, self.parabola_label, - ]) + [ + ])) + [ Animation(self.final_ratio) ]) self.play(GrowFromCenter(brace)) @@ -2501,7 +2498,7 @@ class GeneralLHoptial(LHopitalExample): ShowCreation(a_dot), ) self.wait() - self.play(*map(FadeOut, [a_label, a_arrow])) + self.play(*list(map(FadeOut, [a_label, a_arrow]))) self.a_dot = a_dot self.f_graph = f_graph diff --git a/old_projects/eoc/chapter8.py b/old_projects/eoc/chapter8.py index 4f2e3530..fb2ba5cd 100644 --- a/old_projects/eoc/chapter8.py +++ b/old_projects/eoc/chapter8.py @@ -147,7 +147,7 @@ class InCarRestrictedView(ShowSpeedometer): time_label = TextMobject("Time (in seconds):", "0") time_label.shift(2*UP) - dots = VGroup(*map(Dot, [self.point_A, self.point_B])) + dots = VGroup(*list(map(Dot, [self.point_A, self.point_B]))) line = Line(*dots, buff = 0) line.set_color(DISTANCE_COLOR) brace = Brace(line, DOWN) @@ -186,7 +186,7 @@ class InCarRestrictedView(ShowSpeedometer): self.wait() #Ask about distance - self.play(*map(ShowCreation, dots)) + self.play(*list(map(ShowCreation, dots))) self.play(ShowCreation(line)) self.play( GrowFromCenter(brace), @@ -200,14 +200,14 @@ class GraphDistanceVsTime(GraphCarTrajectory): "y_max" : 100, "y_axis_height" : 6, "y_tick_frequency" : 10, - "y_labeled_nums" : range(10, 100, 10), + "y_labeled_nums" : list(range(10, 100, 10)), "y_axis_label" : "Distance (in meters)", "x_min" : -1, "x_max" : 9, "x_axis_width" : 9, "x_tick_frequency" : 1, "x_leftmost_tick" : None, #Change if different from x_min - "x_labeled_nums" : range(1, 9), + "x_labeled_nums" : list(range(1, 9)), "x_axis_label" : "$t$", "time_of_journey" : 8, "care_movement_rate_func" : s_rate_func, @@ -233,13 +233,13 @@ class PlotVelocity(GraphScene): "x_max" : 9, "x_axis_width" : 9, "x_tick_frequency" : 1, - "x_labeled_nums" : range(1, 9), + "x_labeled_nums" : list(range(1, 9)), "x_axis_label" : "$t$", "y_min" : 0, "y_max" : 25, "y_axis_height" : 6, "y_tick_frequency" : 5, - "y_labeled_nums" : range(5, 30, 5), + "y_labeled_nums" : list(range(5, 30, 5)), "y_axis_label" : "Velocity in $\\frac{\\text{meters}}{\\text{second}}$", "num_graph_anchor_points" : 50, } @@ -263,7 +263,7 @@ class PlotVelocity(GraphScene): self.speedometer = speedometer def plot_points(self): - times = range(0, 9) + times = list(range(0, 9)) points = [ self.coords_to_point(t, v_func(t)) for t in times @@ -442,7 +442,7 @@ class Antiderivative(PiCreatureScene): self.pi_creature.change_mode, "raise_right_hand" ) self.wait(2) - for pair in reversed(zip(functions, alt_functions)): + for pair in reversed(list(zip(functions, alt_functions))): self.play( Transform(*pair), self.pi_creature.change_mode, "pondering" @@ -629,7 +629,7 @@ class ConstantVelocityPlot(PlotVelocity): self.play(randy.change_mode, "pondering") self.play( self.area_rect.set_color, YELLOW, - *map(Animation, self.get_mobjects()), + *list(map(Animation, self.get_mobjects())), rate_func = there_and_back ) self.play(Blink(randy)) @@ -807,7 +807,7 @@ class PiecewiseConstantPlot(PlotVelocity): mob.generate_target() mob.target.fade(0.7) - self.play(*map(MoveToTarget, faders)) + self.play(*list(map(MoveToTarget, faders))) self.play(ShowCreation(pw_constant_graph, run_time = 2)) self.wait() self.play(ShowCreation(line)) @@ -864,7 +864,7 @@ class PiecewiseConstantPlot(PlotVelocity): ), Animation(right_brace) ) - self.play(*map(FadeOut, [top_brace, right_brace])) + self.play(*list(map(FadeOut, [top_brace, right_brace]))) self.wait() self.rects = rects @@ -1020,10 +1020,10 @@ class PiecewiseConstantPlot(PlotVelocity): rate_func = there_and_back ) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ group[1] for group in (v_lines, h_lines, height_labels) - ])) + ]))) self.play( v_lines[0].set_color, RED, rate_func = there_and_back, @@ -1050,11 +1050,11 @@ class PiecewiseConstantPlot(PlotVelocity): ShowCreation(arrow) ) self.wait(2) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ area, arrow, v_lines[0], h_lines[0], height_labels[0], rect, t_labels - ])) + ]))) def show_v_dt_for_all_rectangles(self): dt_brace_group = VGroup(self.dt_brace, self.dt_label) @@ -1096,7 +1096,7 @@ class PiecewiseConstantPlot(PlotVelocity): ) integral.to_corner(UP+RIGHT) int_copy = integral.get_part_by_tex("int").copy() - bounds = map(integral.get_part_by_tex, ["0", "8"]) + bounds = list(map(integral.get_part_by_tex, ["0", "8"])) sum_word = TextMobject("``Sum''") sum_word.next_to(integral, DOWN, MED_LARGE_BUFF, LEFT) @@ -1187,9 +1187,9 @@ class PiecewiseConstantPlot(PlotVelocity): self.play( morty.change_mode, "pondering", rects.set_fill, None, 0.75, - *map(FadeOut, [ + *list(map(FadeOut, [ dt_copy, self.v_t, self.v_t_brace - ]) + ])) ) rects.align_submobjects(next_rects) for every_other_rect in rects[::2]: @@ -1262,10 +1262,10 @@ class PiecewiseConstantPlot(PlotVelocity): self.wait() self.play( RemovePiCreatureBubble(morty, target_mode = "plain"), - *map(FadeOut, [ + *list(map(FadeOut, [ cross, self.sum_word, self.ticks, self.dt_brace, self.dt_label, - ]) + ])) ) self.play(FadeIn(brace), FadeIn(dt_to_0)) for new_rects in self.rect_list[4:]: @@ -1616,7 +1616,7 @@ class AreaIsDerivative(PlotVelocity, ReconfigurableScene): self.change_area_bounds(new_t_max = new_T) self.play( FadeIn(dark_area), - *map(Animation, self.foreground_mobjects) + *list(map(Animation, self.foreground_mobjects)) ) self.play( FadeOut(self.T_label_group), @@ -1750,7 +1750,7 @@ class AreaIsDerivative(PlotVelocity, ReconfigurableScene): self.play( UpdateFromAlphaFunc(group, update_group), - *map(Animation, self.foreground_mobjects), + *list(map(Animation, self.foreground_mobjects)), **kwargs ) @@ -1814,7 +1814,7 @@ class FindAntiderivative(Antiderivative): derivative, antiderivative = words = self.get_arc_labels(arcs) self.add(functions) - self.play(*map(ShowCreation, arcs)) + self.play(*list(map(ShowCreation, arcs))) for word in words: self.play(FadeIn(word, submobject_mode = "lagged_start")) self.wait() @@ -2122,7 +2122,7 @@ class LowerBound(AreaIsDerivative): big_brace = Brace(VGroup(at_T, at_zero)) cancel_text = big_brace.get_text("Cancels when $T=0$") - self.play(*map(Write, [equals, at_T])) + self.play(*list(map(Write, [equals, at_T]))) self.play( GrowFromCenter(at_T.brace), Write(antideriv_text, run_time = 2) @@ -2157,10 +2157,10 @@ class LowerBound(AreaIsDerivative): Write(value_at_eight) ) self.wait(2) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ at_eight.brace, value_at_eight, at_zero.brace, happens_to_be_zero, - ])) + ]))) self.antideriv_diff = antideriv_diff @@ -2183,7 +2183,7 @@ class LowerBound(AreaIsDerivative): self.change_area_bounds(1, 7, run_time = 2) self.play( self.T_label_group[0].set_fill, None, 0, - *map(FadeIn, numbers) + *list(map(FadeIn, numbers)) ) self.play( Transform(self.integral, new_integral), @@ -2340,8 +2340,8 @@ class FundamentalTheorem(GraphScene): for rect in rects ]) self.play(*it.chain( - map(GrowFromCenter, [f_brace, dx_brace]), - map(Write, [f_brace.label, dx_brace.label]), + list(map(GrowFromCenter, [f_brace, dx_brace])), + list(map(Write, [f_brace.label, dx_brace.label])), )) self.wait() for i in range(start_rect_index+1, last_rect_index): @@ -2358,10 +2358,10 @@ class FundamentalTheorem(GraphScene): ) self.wait() self.play(*it.chain( - map(FadeOut, [ + list(map(FadeOut, [ f_brace, dx_brace, f_brace.label, dx_brace.label - ]), + ])), [rects.set_fill, None, kwargs["fill_opacity"]] )) @@ -2451,7 +2451,7 @@ class FundamentalTheorem(GraphScene): self.deriv.set_fill, None, 1, self.rhs.set_fill, None, 1, ) - for label, line in reversed(zip(self.bound_labels, self.v_lines)): + for label, line in reversed(list(zip(self.bound_labels, self.v_lines))): new_line = line.copy().set_color(YELLOW) label.save_state() self.play(label.set_color, YELLOW) @@ -2538,7 +2538,7 @@ class NegativeArea(GraphScene): ShowCreation(arrow) ) self.wait(2) - self.play(*map(FadeOut, [self.area, arrow])) + self.play(*list(map(FadeOut, [self.area, arrow]))) self.negative_area_words = words @@ -2649,9 +2649,9 @@ class NegativeArea(GraphScene): self.wait(2) self.play(*it.chain( [FadeIn(r) for r in rects if r is not rect], - map(FadeOut, [ + list(map(FadeOut, [ dt_brace, v_brace, dt_label, v_label - ]) + ])) )) self.wait() for new_rects in rect_list[1:]: diff --git a/old_projects/eoc/chapter9.py b/old_projects/eoc/chapter9.py index 352941a1..4349123b 100644 --- a/old_projects/eoc/chapter9.py +++ b/old_projects/eoc/chapter9.py @@ -186,13 +186,13 @@ class LengthOfDayGraph(GraphScene): "x_max" : 365, "x_axis_width" : 12, "x_tick_frequency" : 25, - "x_labeled_nums" : range(50, 365, 50), + "x_labeled_nums" : list(range(50, 365, 50)), "x_axis_label" : "Days since March 21", "y_min" : 0, "y_max" : 16, "y_axis_height" : 6, "y_tick_frequency" : 1, - "y_labeled_nums" : range(2, 15, 2), + "y_labeled_nums" : list(range(2, 15, 2)), "y_axis_label" : "Hours of daylight", "graph_origin" : 6*LEFT + 3*DOWN, "camera_class" : ThreeDCamera, @@ -286,7 +286,7 @@ class LengthOfDayGraph(GraphScene): for panel, a in zip(panels, np.linspace(0, 0.2, len(panels))) ]) self.play(Blink(randy)) - self.play(*map(FadeOut, [randy, panels])) + self.play(*list(map(FadeOut, [randy, panels]))) def set_color_summer_months(self): summer_rect = Rectangle() @@ -387,7 +387,7 @@ class AverageOfFiniteSet(Scene): labels.generate_target() symbols.generate_target() symbols.target.set_fill(opacity = 1) - sum_eq = VGroup(*it.chain(*zip(labels.target, symbols.target))) + sum_eq = VGroup(*it.chain(*list(zip(labels.target, symbols.target)))) sum_eq.arrange_submobjects(RIGHT) sum_eq.next_to(brace, UP) @@ -425,15 +425,15 @@ class AverageOfFiniteSet(Scene): self.wait() self.play( GrowFromCenter(brace), - *map(MoveToTarget, [lines, labels, symbols]), + *list(map(MoveToTarget, [lines, labels, symbols])), run_time = 2 ) self.play(Write(sum_mob)) self.wait() self.play(ShowCreation(dividing_lines, run_time = 2)) self.play(*it.chain( - map(Write, averages), - map(GrowFromCenter, lower_braces) + list(map(Write, averages)), + list(map(GrowFromCenter, lower_braces)) )) self.play(ShowCreation(circle)) self.wait(2) @@ -473,7 +473,7 @@ class TryToAddInfinitelyManyPoints(AverageOfSineStart): end_lines = VGroup(*v_lines.target[15:]) plusses = VGroup(*[TexMobject("+") for x in start_lines]) - sum_eq = VGroup(*it.chain(*zip(start_lines, plusses))) + sum_eq = VGroup(*it.chain(*list(zip(start_lines, plusses)))) sum_eq.add(*end_lines) sum_eq.arrange_submobjects(RIGHT) sum_eq.next_to(v_lines[0], UP, aligned_edge = LEFT) @@ -570,7 +570,7 @@ class FiniteSample(TryToAddInfinitelyManyPoints): TexMobject("+").scale(0.75) for l in v_lines ]) - numerator = VGroup(*it.chain(*zip(summed_v_lines, plusses))) + numerator = VGroup(*it.chain(*list(zip(summed_v_lines, plusses)))) for group in numerator, plusses: group.remove(plusses[-1]) numerator.arrange_submobjects( @@ -731,8 +731,8 @@ class IntegralOfSine(FiniteSample): ) for rect in rects ], - map(GrowFromCenter, [side_brace, bottom_brace]), - map(Write, [sin_x, dx]), + list(map(GrowFromCenter, [side_brace, bottom_brace])), + list(map(Write, [sin_x, dx])), )) self.wait() for i in range(start_index+1, end_index): @@ -748,7 +748,7 @@ class IntegralOfSine(FiniteSample): self.wait() self.play( rects.restore, - *map(FadeOut, [sin_x, dx, side_brace, bottom_brace]) + *list(map(FadeOut, [sin_x, dx, side_brace, bottom_brace])) ) self.rects = rects @@ -920,7 +920,7 @@ class IntegralOfSine(FiniteSample): MoveToTarget(integral, run_time = 2) ) self.wait(2) - self.play(*map(FadeOut, [self.dx_label, self.dx_brace])) + self.play(*list(map(FadeOut, [self.dx_label, self.dx_brace]))) self.integral_over_pi = VGroup(integral, over_pi) self.average = average @@ -929,7 +929,7 @@ class IntegralOfSine(FiniteSample): def write_area_over_width(self): self.play( self.integral_over_pi.shift, 2*LEFT, - *map(FadeOut, [self.average, self.average_arrow]) + *list(map(FadeOut, [self.average, self.average_arrow])) ) average_height = TextMobject("Average height = ") @@ -942,7 +942,7 @@ class IntegralOfSine(FiniteSample): area_over_width.next_to(self.integral_over_pi[1][0], LEFT) average_height.next_to(area_over_width, LEFT) - self.play(*map(FadeIn, [average_height, area_over_width])) + self.play(*list(map(FadeIn, [average_height, area_over_width]))) self.wait() def show_moving_v_line(self): @@ -1109,7 +1109,7 @@ class Antiderivative(AverageOfSineStart): for m in faders ]) self.wait() - self.play(*map(ShowCreation, ss_group), run_time = 2) + self.play(*list(map(ShowCreation, ss_group)), run_time = 2) kwargs = { "run_time" : 20, "rate_func" : quad_smooth, @@ -1128,7 +1128,7 @@ class Antiderivative(AverageOfSineStart): **kwargs ) self.play( - *map(FadeOut, [ss_group, v_line, sin_copy]) + *list(map(FadeOut, [ss_group, v_line, sin_copy])) ) self.wait() @@ -1170,10 +1170,7 @@ class Antiderivative(AverageOfSineStart): self.wait() self.play(FadeIn( - VGroup(*filter( - lambda part : part not in [end_pi, end_zero], - rhs - )), + VGroup(*[part for part in rhs if part not in [end_pi, end_zero]]), submobject_mode = "lagged_start", run_time = 2, )) @@ -1294,7 +1291,7 @@ class Antiderivative(AverageOfSineStart): self.play( equals.next_to, frac_lines[0].copy(), RIGHT, rhs_without_eq.next_to, frac_lines[1].copy(), UP, - *map(Write, frac_lines) + *list(map(Write, frac_lines)) ) self.play(*[ ReplacementTransform( @@ -1411,7 +1408,7 @@ class Antiderivative(AverageOfSineStart): secant_line_length = 4, ) - self.play(*map(ShowCreation, ss_group), run_time = 2) + self.play(*list(map(ShowCreation, ss_group)), run_time = 2) for count in range(2): for x in reversed(self.bounds): self.animate_secant_slope_group_change( @@ -1448,7 +1445,7 @@ class GeneralAverage(AverageOfContinuousVariable): ]) for line, color in zip(v_lines, self.bound_colors): line.set_color(color) - labels = map(TexMobject, "ab") + labels = list(map(TexMobject, "ab")) for line, label in zip(v_lines, labels): vect = line.get_start()-line.get_end() label.next_to(line, vect/np.linalg.norm(vect)) @@ -1629,7 +1626,7 @@ class GeneralAverage(AverageOfContinuousVariable): self.play(ShowCreation(v_lines, run_time = 2)) - self.play(*map(Write, [brace, dx])) + self.play(*list(map(Write, [brace, dx]))) self.wait() self.play(Write(VGroup(num_samples, approx, *rhs[:-1]))) self.play(ReplacementTransform( @@ -1686,9 +1683,9 @@ class GeneralAverage(AverageOfContinuousVariable): VGroup(add_up_f_over, rhs_copy).shift, 0.4*DOWN ) self.play(Write(double_arrow)) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ dx, brace, num_samples, approx, rhs - ])) + ]))) self.wait() self.v_lines = v_lines @@ -1922,7 +1919,7 @@ class GeneralAntiderivative(GeneralAverage): secant_line_length = 2, ) - self.play(*map(ShowCreation, ss_group)) + self.play(*list(map(ShowCreation, ss_group))) for x in range(2): for bound in reversed(self.bounds): self.animate_secant_slope_group_change( @@ -1999,7 +1996,7 @@ class ASecondIntegralSensation(TeacherStudentsScene): ShowCreation(line), run_time = 2 ) - self.play(*map(FadeOut, [arrow])) + self.play(*list(map(FadeOut, [arrow]))) self.wait(2) self.change_student_modes( *["pondering"]*3, diff --git a/old_projects/eoc/footnote.py b/old_projects/eoc/footnote.py index 9f1b0b83..b4c2c454 100644 --- a/old_projects/eoc/footnote.py +++ b/old_projects/eoc/footnote.py @@ -113,7 +113,7 @@ class SecondDerivativeGraphically(GraphScene): self.play( Write(deriv), - *map(ShowCreation, ss_group) + *list(map(ShowCreation, ss_group)) ) self.animate_secant_slope_group_change( ss_group, target_x = self.x3, @@ -208,7 +208,7 @@ class SecondDerivativeGraphically(GraphScene): added_anims = [Animation(positive_curve)] ) - self.play(*map(FadeOut, [self.ss_group, positive_curve])) + self.play(*list(map(FadeOut, [self.ss_group, positive_curve]))) self.animate_secant_slope_group_change( self.ss_group, target_x = self.x1, run_time = 0 @@ -225,10 +225,10 @@ class SecondDerivativeGraphically(GraphScene): added_anims = [Animation(negative_curve)] ) self.wait(2) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ self.graph, self.ss_group, negative_curve, self.second_deriv_words - ])) + ]))) def contrast_big_and_small_concavity(self): colors = color_gradient([GREEN, WHITE], 3) @@ -315,9 +315,9 @@ class IntroduceNotation(TeacherStudentsScene): rp = clunky_deriv.get_part_by_tex("(") lp = clunky_deriv.get_part_by_tex(")") - dfs, overs, dxs = map(clunky_deriv.get_parts_by_tex, [ + dfs, overs, dxs = list(map(clunky_deriv.get_parts_by_tex, [ "df", "over", "dx" - ]) + ])) df_over_dx = VGroup(dfs[0], overs[0], dxs[0]) d = clunky_deriv.get_part_by_tex("d") d_over_dx = VGroup(d, overs[1], dxs[1]) @@ -566,7 +566,7 @@ class HowToReadNotation(GraphScene, ReconfigurableScene): ddf.set_color(MAROON_B) self.play( - *map(MoveToTarget, [df_dx_groups, df_labels]), + *list(map(MoveToTarget, [df_dx_groups, df_labels])), run_time = 2 ) self.play(ShowCreation(h_lines, run_time = 2)) @@ -797,7 +797,7 @@ class SecondDerivativeAsAcceleration(Scene): s_graph.scale, 0.3, s_graph.next_to, s_words, LEFT ) - self.play(*map(FadeIn, [v_graph, v_words]) ) + self.play(*list(map(FadeIn, [v_graph, v_words])) ) self.wait(2) self.play( v_graph.scale, 0.3, @@ -827,7 +827,7 @@ class SecondDerivativeAsAcceleration(Scene): self.play( a_graph.scale, 0.3, a_graph.next_to, self.a_words, LEFT, - *map(FadeOut, [positive_rect, negative_rect]) + *list(map(FadeOut, [positive_rect, negative_rect])) ) self.play( FadeOut(self.car), diff --git a/old_projects/eoc/old_chapter1.py b/old_projects/eoc/old_chapter1.py index efd8c134..2c593564 100644 --- a/old_projects/eoc/old_chapter1.py +++ b/old_projects/eoc/old_chapter1.py @@ -364,9 +364,9 @@ class IntroduceCircle(Scene): radius.set_color(MAROON_B) R = TexMobject("R").next_to(radius, UP) - area, circumference = words = VGroup(*map(TextMobject, [ + area, circumference = words = VGroup(*list(map(TextMobject, [ "Area =", "Circumference =" - ])) + ]))) area.set_color(BLUE) circumference.set_color(YELLOW) @@ -696,7 +696,7 @@ class IntroduceTinyChangeInArea(CircleScene): expanded.shift(LEFT/2.) faders = [area_brace, area_word, new_area_brace, new_area_word] - self.play(*map(FadeOut, faders)) + self.play(*list(map(FadeOut, faders))) trips = [ ([0, 2, 8], pi_R_squared, plus), ([8, 0, 2, 1, 4, 5, 6, 7], two_pi_R_dR, plus2), @@ -824,13 +824,13 @@ class BuildToDADR(CircleScene): ) self.wait() self.play(*it.chain( - map(Write, [equals, two_pi_R, dR]), - map(FadeIn, [circum_text, circum_brace]) + list(map(Write, [equals, two_pi_R, dR])), + list(map(FadeIn, [circum_text, circum_brace])) )) self.wait() self.play(*it.chain( - map(Write, [plus, pi, dR2, squared]), - map(FadeIn, [error_brace, error_text]) + list(map(Write, [plus, pi, dR2, squared])), + list(map(FadeIn, [error_brace, error_text])) )) self.wait(2) self.change = change @@ -860,7 +860,7 @@ class BuildToDADR(CircleScene): self.play(*it.chain( [Write(term.frac_line) for term in terms], - map(MoveToTarget, [self.equals, self.plus]) + list(map(MoveToTarget, [self.equals, self.plus])) )) self.play(*[term.denom.restore for term in terms]) self.wait(2) @@ -945,9 +945,9 @@ class BuildToDADR(CircleScene): error_brace.target = Brace(self.error_term.target) error_text.target = error_brace.target.get_text("Truly tiny") error_text.target.set_color(error_text.get_color()) - self.play(*map(MoveToTarget, [ + self.play(*list(map(MoveToTarget, [ error_brace, error_text, self.plus, self.error_term - ])) + ]))) self.wait() difference_text = TextMobject( @@ -985,7 +985,7 @@ class BuildToDADR(CircleScene): MoveToTarget(difference_arrow), ) self.wait(2) - self.play(*map(FadeOut, [difference_text, difference_arrow])) + self.play(*list(map(FadeOut, [difference_text, difference_arrow]))) def elaborate_on_d(self): arc = Arc(-np.pi, start_angle = -np.pi/2) @@ -1022,7 +1022,7 @@ class BuildToDADR(CircleScene): Write(d), self.pi_creature.change_mode, "speaking" ) - self.play(*map(Write, [arrow, ignore_error])) + self.play(*list(map(Write, [arrow, ignore_error]))) self.play(error_group.fade, 0.8) self.wait(2) equality_brace = Brace(VGroup(self.change.denom, self.circum_term)) @@ -1033,7 +1033,7 @@ class BuildToDADR(CircleScene): Write(equal_word, run_time = 1) ) self.wait(2) - self.play(*map(FadeOut, [equality_brace, equal_word])) + self.play(*list(map(FadeOut, [equality_brace, equal_word]))) less_wrong_philosophy = TextMobject("``Less wrong'' philosophy") less_wrong_philosophy.move_to(ignore_error, LEFT) @@ -1106,7 +1106,7 @@ class BuildToDADR(CircleScene): self.wait() self.play(*it.chain( [mob.restore for mob in to_infs], - map(FadeOut, [bubble, bubble.content]), + list(map(FadeOut, [bubble, bubble.content])), [randy.change_mode, "erm"], [self.pi_creature.change_mode, "happy"], )) @@ -1465,10 +1465,10 @@ class DerivativeAsTangentLine(ZoomedScene): dot.scale(0.1) dot.move_to(graph_point) - self.play(*map(FadeIn, [ + self.play(*list(map(FadeIn, [ self.little_rectangle, self.big_rectangle - ])) + ]))) self.play( self.little_rectangle.move_to, graph_point+self.little_rect_nudge @@ -1556,7 +1556,7 @@ class DerivativeAsTangentLine(ZoomedScene): self.note_R_value_of_point() alphas = np.arange(0, 1, 0.01) - graph_points = map(self.graph.point_from_proportion, alphas) + graph_points = list(map(self.graph.point_from_proportion, alphas)) curr_graph_point = self.graph_point(R) self.last_alpha = alphas[np.argmin([ np.linalg.norm(point - curr_graph_point) @@ -1600,7 +1600,7 @@ class DerivativeAsTangentLine(ZoomedScene): self.play(ShowCreation(arrow)) self.play(dot.scale_in_place, 2, rate_func = there_and_back) self.wait() - self.play(*map(FadeOut, [dashed_line, dot, arrow])) + self.play(*list(map(FadeOut, [dashed_line, dot, arrow]))) def state_commonality(self): morty = Mortimer() @@ -1731,10 +1731,10 @@ class IntroduceConcentricRings(CircleScene): moving_rings.generate_target() moving_rings.target.set_stroke(width = 0) plusses = VGroup(*[TexMobject("+") for ring in moving_rings]) - area_sum = VGroup(*it.chain(*zip( + area_sum = VGroup(*it.chain(*list(zip( [ring for ring in moving_rings.target], plusses - ))) + )))) dots_equals_area = TexMobject("\\dots", "=", "\\pi R^2") area_sum.add(*dots_equals_area) area_sum.arrange_submobjects() @@ -2028,13 +2028,13 @@ class GraphIntegral(GraphScene): "x_max" : 4, "x_tick_frequency" : 0.25, "x_leftmost_tick" : -0.25, - "x_labeled_nums" : range(1, 5), + "x_labeled_nums" : list(range(1, 5)), "x_axis_label" : "r", "y_min" : -2, "y_max" : 25, "y_tick_frequency" : 2.5, "y_bottom_tick" : 0, - "y_labeled_nums" : range(5, 30, 5), + "y_labeled_nums" : list(range(5, 30, 5)), "y_axis_label" : "", "dr" : 0.125, "R" : 3.5, @@ -2122,7 +2122,7 @@ class GraphIntegral(GraphScene): rectangles.save_state() rectangles.stretch_to_fit_height(0) rectangles.move_to(self.graph_origin, DOWN+LEFT) - self.play(*map(FadeOut, [arrows, values_words])) + self.play(*list(map(FadeOut, [arrows, values_words]))) self.play( rectangles.restore, Animation(ticks), @@ -2158,7 +2158,7 @@ class GraphIntegral(GraphScene): ShowCreation(graph) ) self.wait(3) - self.play(*map(FadeOut, [ticks, dr_brace, dr_text])) + self.play(*list(map(FadeOut, [ticks, dr_brace, dr_text]))) self.rectangles = rectangles def thinner_rectangles(self): diff --git a/old_projects/eola/chapter0.py b/old_projects/eola/chapter0.py index 0c2b1767..354e159d 100644 --- a/old_projects/eola/chapter0.py +++ b/old_projects/eola/chapter0.py @@ -92,14 +92,14 @@ class AboutLinearAlgebra(Scene): def show_dependencies(self): linalg = TextMobject("Linear Algebra") - subjects = map(TextMobject, [ + subjects = list(map(TextMobject, [ "Computer science", "Physics", "Electrical engineering", "Mechanical engineering", "Statistics", "\\vdots" - ]) + ])) prev = subjects[0] for subject in subjects[1:]: subject.next_to(prev, DOWN, aligned_edge = LEFT) @@ -132,7 +132,7 @@ class AboutLinearAlgebra(Scene): new_linalg = bubble.position_mobject_inside(linalg.copy()) q_marks = TextMobject("???").next_to(randy, UP) - self.play(*map(FadeOut, all_else)) + self.play(*list(map(FadeOut, all_else))) self.remove(*all_else) self.play( Transform(linalg, new_linalg), @@ -813,7 +813,7 @@ class TableOfContents(Scene): h_line = Line(FRAME_X_RADIUS*LEFT, FRAME_X_RADIUS*RIGHT) h_line.next_to(title, DOWN) h_line.to_edge(LEFT, buff = 0) - chapters = VMobject(*map(TextMobject, [ + chapters = VMobject(*list(map(TextMobject, [ "Chapter 1: Vectors, what even are they?", "Chapter 2: Linear combinations, span and bases", "Chapter 3: Matrices as linear transformations", @@ -824,7 +824,7 @@ class TableOfContents(Scene): "Chapter 8: Change of basis", "Chapter 9: Eigenvectors and eigenvalues", "Chapter 10: Abstract vector spaces", - ])) + ]))) chapters.arrange_submobjects(DOWN) chapters.scale(0.7) chapters.next_to(h_line, DOWN) @@ -930,11 +930,11 @@ class AboutPacing(Scene): class DifferingBackgrounds(Scene): def construct(self): - words = map(TextMobject, [ + words = list(map(TextMobject, [ "Just brushing up", "Has yet to take the course", "Supplementing course concurrently", - ]) + ])) students = VMobject(*[ Randolph(color = c) for c in (BLUE_D, BLUE_C, BLUE_E) diff --git a/old_projects/eola/chapter1.py b/old_projects/eola/chapter1.py index 56409887..128e47ec 100644 --- a/old_projects/eola/chapter1.py +++ b/old_projects/eola/chapter1.py @@ -183,11 +183,11 @@ class DifferentConceptions(Scene): title = TextMobject("Vectors $\\Leftrightarrow$ lists of numbers") title.to_edge(UP) - vectors = VMobject(*map(matrix_to_mobject, [ + vectors = VMobject(*list(map(matrix_to_mobject, [ [2, 1], [5, 0, 0, -3], [2.3, -7.1, 0.1], - ])) + ]))) vectors.arrange_submobjects(RIGHT, buff = 1) vectors.to_edge(LEFT) @@ -445,9 +445,9 @@ class HowIWantYouToThinkAboutVectors(Scene): vector = Vector([-2, 3]) plane = NumberPlane() axis_labels = plane.get_axis_labels() - other_vectors = VMobject(*map(Vector, [ + other_vectors = VMobject(*list(map(Vector, [ [1, 2], [2, -1], [4, 0] - ])) + ]))) colors = [GREEN_B, MAROON_B, PINK] for v, color in zip(other_vectors.split(), colors): v.set_color(color) @@ -512,9 +512,9 @@ class HowIWantYouToThinkAboutVectors(Scene): class ListsOfNumbersAddOn(Scene): def construct(self): - arrays = VMobject(*map(matrix_to_mobject, [ + arrays = VMobject(*list(map(matrix_to_mobject, [ [-2, 3], [1, 2], [2, -1], [4, 0] - ])) + ]))) arrays.arrange_submobjects(buff = 0.4) arrays.scale(2) self.play(Write(arrays)) @@ -537,10 +537,7 @@ class CoordinateSystemWalkthrough(VectorScene): y_tick_marks = x_tick_marks.copy().rotate(np.pi/2) tick_marks = VMobject(x_tick_marks, y_tick_marks) tick_marks.set_color(WHITE) - plane_lines = filter( - lambda m : isinstance(m, Line), - plane.submobject_family() - ) + plane_lines = [m for m in plane.submobject_family() if isinstance(m, Line)] origin_words = TextMobject("Origin") origin_words.shift(2*UP+2*LEFT) dot = Dot(radius = 0.1).set_color(RED) @@ -576,7 +573,7 @@ class CoordinateSystemWalkthrough(VectorScene): self.wait(2) self.remove(unit_brace, one) self.play( - *map(GrowFromCenter, plane_lines) + [ + *list(map(GrowFromCenter, plane_lines)) + [ Animation(x_axis), Animation(y_axis) ]) self.wait() @@ -748,7 +745,7 @@ class AddingNumbersOnNumberLine(Scene): seven_vect.shift(0.5*DOWN) vects = [two_vect, five_vect, seven_vect] - two, five, seven = map(TexMobject, ["2", "5", "7"]) + two, five, seven = list(map(TexMobject, ["2", "5", "7"])) two.next_to(two_vect, UP) five.next_to(five_vect, UP) seven.next_to(seven_vect, DOWN) @@ -864,9 +861,9 @@ class VectorAdditionNumerically(VectorScene): self.wait(2) starters = [x1, y1, x2, y2, sum_x_start, sum_y_start] - variables = map(TexMobject, [ + variables = list(map(TexMobject, [ "x_1", "y_1", "x_2", "y_2", "x_1+y_1", "x_2+y_2" - ]) + ])) for i, (var, starter) in enumerate(zip(variables, starters)): if i%2 == 0: var.set_color(X_COLOR) @@ -896,7 +893,7 @@ class MultiplicationByANumberIntro(Scene): def construct(self): v = TexMobject("\\vec{\\textbf{v}}") v.set_color(YELLOW) - nums = map(TexMobject, ["2", "\\dfrac{1}{3}", "-1.8"]) + nums = list(map(TexMobject, ["2", "\\dfrac{1}{3}", "-1.8"])) for mob in [v] + nums: mob.scale(1.5) @@ -975,9 +972,9 @@ class ShowScalarMultiplication(VectorScene): original_v = v.copy() scaling_word = TextMobject("``Scaling''").to_corner(UP+LEFT) scaling_word.shift(2*RIGHT) - scalars = VMobject(*map(TexMobject, [ + scalars = VMobject(*list(map(TexMobject, [ "2,", "\\dfrac{1}{3},", "-1.8,", "\\dots" - ])) + ]))) scalars.arrange_submobjects(RIGHT, buff = 0.4) scalars.next_to(scaling_word, DOWN, aligned_edge = LEFT) scalars_word = TextMobject("``Scalars''") @@ -1024,8 +1021,8 @@ class ScalingNumerically(VectorScene): x, y = v_coords.get_mob_matrix().flatten() two_v_elems = two_v_coords.get_mob_matrix().flatten() - x_sym, y_sym = map(TexMobject, ["x", "y"]) - two_x_sym, two_y_sym = map(TexMobject, ["2x", "2y"]) + x_sym, y_sym = list(map(TexMobject, ["x", "y"])) + two_x_sym, two_y_sym = list(map(TexMobject, ["2x", "2y"])) VMobject(x_sym, two_x_sym).set_color(X_COLOR) VMobject(y_sym, two_y_sym).set_color(Y_COLOR) syms = [x_sym, y_sym, two_x_sym, two_y_sym] @@ -1171,7 +1168,7 @@ class DataAnalyst(Scene): string_vects = string_vects_matrix.get_mob_matrix().flatten() string_vects = VMobject(*string_vects) - vects = VMobject(*map(Vector, ellipse_points)) + vects = VMobject(*list(map(Vector, ellipse_points))) self.play(Write(string_vects)) self.wait(2) diff --git a/old_projects/eola/chapter10.py b/old_projects/eola/chapter10.py index a7c4a0ea..e7cb25bd 100644 --- a/old_projects/eola/chapter10.py +++ b/old_projects/eola/chapter10.py @@ -132,7 +132,7 @@ class ManyPrerequisites(Scene): self.play(Write(rects[0])) self.wait() - self.play(*map(FadeIn, rects[1:])) + self.play(*list(map(FadeIn, rects[1:]))) self.wait() class ExampleTranformationScene(LinearTransformationScene): @@ -308,7 +308,7 @@ class AllXAxisVectorsAreEigenvectors(ExampleTranformationScene): def construct(self): vectors = VGroup(*[ self.add_vector(u*x*RIGHT, animate = False) - for x in reversed(range(1, int(FRAME_X_RADIUS)+1)) + for x in reversed(list(range(1, int(FRAME_X_RADIUS)+1))) for u in -1, 1 ]) vectors.set_color_by_gradient(YELLOW, X_COLOR) @@ -465,8 +465,8 @@ class NameEigenvectorsAndEigenvalues(ExampleTranformationScene): path_arc = 0, ) self.wait(2) - self.play(*map(FadeOut, [non_eigen, non_eigen_span])) - self.play(*map(MoveToTarget, [x_words, sneak_words])) + self.play(*list(map(FadeOut, [non_eigen, non_eigen_span]))) + self.play(*list(map(MoveToTarget, [x_words, sneak_words]))) self.wait() for words in x_words, sneak_words: self.play(Write(words.eigen_val_words), run_time = 2) @@ -591,23 +591,23 @@ class ContrastMatrixUnderstandingWithEigenvalue(TeacherStudentsScene): everyone = self.get_pi_creatures() self.play( Write(axis_and_rotation), - *it.chain(*zip( + *it.chain(*list(zip( [pi.change_mode for pi in everyone], ["hooray"]*4, [pi.look_at for pi in everyone], [axis_and_rotation]*4, - )), + ))), run_time = 2 ) self.random_blink(2) self.play( Transform(axis_and_rotation, matrix), - *it.chain(*zip( + *it.chain(*list(zip( [pi.change_mode for pi in everyone], ["confused"]*4, [pi.look_at for pi in everyone], [matrix]*4, - )) + ))) ) self.random_blink(3) @@ -704,11 +704,11 @@ class SymbolicEigenvectors(Scene): Write(lamb_text) ) self.wait(2) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ A_brace, A_text, lamb_brace, lamb_text, v_text, v_arrows - ])) + ]))) def contrast_multiplication_types(self): A, v1, equals, lamb, v2 = self.expression @@ -756,11 +756,11 @@ class SymbolicEigenvectors(Scene): ) self.play(Blink(morty)) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ left_group.brace, left_group.text, right_group.brace, right_group.text, morty, bubble, solve_text - ])) + ]))) def rewrite_righthand_side(self): A, v1, equals, lamb, v2 = self.expression @@ -848,12 +848,12 @@ class SymbolicEigenvectors(Scene): ).arrange_submobjects().next_to(equals).shift(SMALL_BUFF*UP) self.play( Write(parens), - *map(MoveToTarget, [lamb, id_text, v2]) + *list(map(MoveToTarget, [lamb, id_text, v2])) ) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ corner_group, id_brace, id_text_copy, new_lamb - ])) + ]))) self.expression = VGroup( A, v1, equals, VGroup(l_paren, lamb, id_text, r_paren), @@ -878,7 +878,7 @@ class SymbolicEigenvectors(Scene): self.play( Write(zero), Write(minus), - *map(MoveToTarget, movers), + *list(map(MoveToTarget, movers)), path_arc = np.pi/3 ) self.wait() @@ -1299,12 +1299,12 @@ class RevisitExampleTransformation(ExampleTranformationScene): rect.target = BackgroundRectangle( VGroup(l_bracket.target, r_bracket.target) ) - result = map(MoveToTarget, movers) - result += map(Write, [minus1, minus2]) - result += map(Animation, [ + result = list(map(MoveToTarget, movers)) + result += list(map(Write, [minus1, minus2])) + result += list(map(Animation, [ self.matrix.get_mob_matrix()[i, 1-i] for i in range(2) - ]) + ])) self.diag_entries = [ VGroup(three, minus1, lamb), VGroup(two, minus2, lamb_copy), @@ -1385,8 +1385,8 @@ class RevisitExampleTransformation(ExampleTranformationScene): ) self.wait() self.play(*it.chain( - map(MoveToTarget, [brace, brace_text]), - map(FadeOut, [one, zero, minus, cdot, new_rect]) + list(map(MoveToTarget, [brace, brace_text])), + list(map(FadeOut, [one, zero, minus, cdot, new_rect])) )) self.wait() self.play(Write(equals_0)) @@ -1404,7 +1404,7 @@ class RevisitExampleTransformation(ExampleTranformationScene): if to_fade is not None: faders.append(to_fade) self.play(*it.chain( - map(FadeOut, faders), + list(map(FadeOut, faders)), [ lambda_equals_two.scale_in_place, 1.3, lambda_equals_two.next_to, self.matrix, DOWN @@ -1423,7 +1423,7 @@ class RevisitExampleTransformation(ExampleTranformationScene): self.play(Transform(lamb, two)) self.play(*it.chain( [mob.restore for mob in (self.plane, self.i_hat, self.j_hat)], - map(Animation, self.foreground_mobjects), + list(map(Animation, self.foreground_mobjects)), )) xy_array = Matrix(["x", "y"]) @@ -1436,7 +1436,7 @@ class RevisitExampleTransformation(ExampleTranformationScene): equals = TexMobject("=").next_to(xy_array) equals.add_background_rectangle() zero_array.next_to(equals) - self.play(*map(Write, [xy_array, equals, zero_array])) + self.play(*list(map(Write, [xy_array, equals, zero_array]))) self.wait() vectors = VGroup(*[ @@ -1452,7 +1452,7 @@ class RevisitExampleTransformation(ExampleTranformationScene): submobject_mode = "lagged_start", run_time = 2 ), - *map(Animation, self.foreground_mobjects) + *list(map(Animation, self.foreground_mobjects)) ) self.wait() self.apply_transposed_matrix( @@ -1461,8 +1461,8 @@ class RevisitExampleTransformation(ExampleTranformationScene): self.wait() self.play(*it.chain( [mob.restore for mob in (self.plane, self.i_hat, self.j_hat, vectors)], - map(FadeOut, [xy_array, equals, zero_array]), - map(Animation, self.foreground_mobjects) + list(map(FadeOut, [xy_array, equals, zero_array])), + list(map(Animation, self.foreground_mobjects)) )) def show_unaltered_transform(self): @@ -1480,8 +1480,8 @@ class RevisitExampleTransformation(ExampleTranformationScene): self.lambda_equals_two.target = brace_text movers.append(self.lambda_equals_two) self.play(*it.chain( - map(MoveToTarget, movers), - map(FadeOut, faders), + list(map(MoveToTarget, movers)), + list(map(FadeOut, faders)), [GrowFromCenter(brace)] )) VGroup(*faders).set_fill(opacity = 0) @@ -1550,7 +1550,7 @@ class SolveRotationEigenvalues(Rotate90Degrees): det_text = get_det_text(self.matrix) equals = TexMobject("=").next_to(det_text) - self.play(*map(Write, [det_text, equals])) + self.play(*list(map(Write, [det_text, equals]))) self.wait() minus = TexMobject("-") for entries, sym in (diag_entries, equals), (off_diag_entries, minus): @@ -1721,9 +1721,9 @@ class ShearExample(RevisitExampleTransformation): Write(brace_text) ) self.wait() - self.play(* map(FadeOut, [ + self.play(* list(map(FadeOut, [ one, zero, minus, cdot, new_rect, brace, brace_text - ])) + ]))) self.wait() self.play(Write(equals_0)) self.wait() @@ -1782,11 +1782,11 @@ class ScalingExample(LinearTransformationScene): class IntroduceEigenbasis(TeacherStudentsScene): def construct(self): - words1, words2 = map(TextMobject, [ + words1, words2 = list(map(TextMobject, [ "Finish with ``eigenbasis.''", """Make sure you've watched the last video""" - ]) + ])) words1.set_color(YELLOW) self.teacher_says(words1) self.change_student_modes( @@ -1845,7 +1845,7 @@ class BasisVectorsAreEigenvectors(LinearTransformationScene): for array in matrix, i_coords, j_coords: array.rect = BackgroundRectangle(array) array.add_to_back(array.rect) - self.play(*map(Write, [i_coords, j_coords])) + self.play(*list(map(Write, [i_coords, j_coords]))) self.wait() self.play( Transform(i_coords.rect, matrix.rect), @@ -1945,11 +1945,11 @@ class RepeatedMultiplicationInAction(Scene): ]), LEFT) self.add(vector) - self.play(*map(FadeIn, [matrix]+scalars)) + self.play(*list(map(FadeIn, [matrix]+scalars))) self.wait() self.play( FadeOut(matrix), - *map(MoveToTarget, scalars + [l_bracket]) + *list(map(MoveToTarget, scalars + [l_bracket])) ) self.wait() #nth multiplications @@ -1977,11 +1977,11 @@ class RepeatedMultiplicationInAction(Scene): ]), LEFT) movers.append(l_bracket) - self.play(*map(FadeIn, [matrix]+new_scalars)) + self.play(*list(map(FadeIn, [matrix]+new_scalars))) self.wait() self.play( FadeOut(matrix), - *map(MoveToTarget, movers) + *list(map(MoveToTarget, movers)) ) self.remove(*to_remove) self.wait() @@ -2048,8 +2048,8 @@ class RepeatedMultilpicationOfMatrices(Scene): ).next_to(vector, LEFT) self.play(*it.chain( - map(FadeOut, [brace, brace_text[1]] + list(matrices[:-1])), - map(MoveToTarget, [hundred, hundred_copy, last_matrix]) + list(map(FadeOut, [brace, brace_text[1]] + list(matrices[:-1]))), + list(map(MoveToTarget, [hundred, hundred_copy, last_matrix])) ), run_time = 2) self.wait() else: @@ -2216,7 +2216,7 @@ class ChangeToEigenBasis(ExampleTranformationScene): ) self.wait() self.add_foreground_mobject(cob_matrix, inv_cob, neg_1) - self.play(*map(FadeOut, self.to_fade)) + self.play(*list(map(FadeOut, self.to_fade))) self.wait() self.play(FadeOut(self.plane)) cob_transform = self.get_matrix_transformation([[1, 0], [-1, 1]]) @@ -2225,7 +2225,7 @@ class ChangeToEigenBasis(ExampleTranformationScene): self.plane.axes.set_color(WHITE) self.play( FadeIn(self.plane), - *map(Animation, self.foreground_mobjects+self.moving_vectors) + *list(map(Animation, self.foreground_mobjects+self.moving_vectors)) ) self.add(self.plane.copy().set_color(GREY).set_stroke(width = 2)) self.apply_transposed_matrix(self.t_matrix) diff --git a/old_projects/eola/chapter11.py b/old_projects/eola/chapter11.py index 85d16dff..0e2f6633 100644 --- a/old_projects/eola/chapter11.py +++ b/old_projects/eola/chapter11.py @@ -122,7 +122,7 @@ class WhatIsA2DVector(LinearTransformationScene): student.bubble = get_small_bubble( student, height = 4, width = 4, ) - self.play(*map(FadeIn, students)) + self.play(*list(map(FadeIn, students))) self.play(Blink(physics_student)) self.wait() for student, vect in zip(students, [RIGHT, LEFT]): @@ -171,16 +171,16 @@ class WhatIsA2DVector(LinearTransformationScene): self.play(Blink(student)) self.wait() self.play(*it.chain( - map(FadeOut, everything + [ + list(map(FadeOut, everything + [ physics_student.bubble, physics_student.v, physics_student.coords, physics_student.arrow, physics_student.q_marks, cs_student.q_marks, - ]), + ])), [ApplyMethod(s.change_mode, "plain") for s in students], - map(Animation, [cs_student.bubble, cs_student.arrow]), + list(map(Animation, [cs_student.bubble, cs_student.arrow])), [mob.restore for mob in (cs_student.v, cs_student.coords)], )) bubble = cs_student.get_bubble(SpeechBubble, width = 4, height = 3) @@ -197,18 +197,18 @@ class WhatIsA2DVector(LinearTransformationScene): class HigherDimensionalVectorsNumerically(Scene): def construct(self): - words = VGroup(*map(TextMobject, [ + words = VGroup(*list(map(TextMobject, [ "4D vector", "5D vector", "100D vector", - ])) + ]))) words.arrange_submobjects(RIGHT, buff = LARGE_BUFF*2) words.to_edge(UP) - vectors = VGroup(*map(Matrix, [ + vectors = VGroup(*list(map(Matrix, [ [3, 1, 4, 1], [5, 9, 2, 6, 5], [3, 5, 8, "\\vdots", 0, 8, 6] - ])) + ]))) colors = [YELLOW, MAROON_B, GREEN] for word, vector, color in zip(words, vectors, colors): vector.shift(word.get_center()[0]*RIGHT) @@ -255,7 +255,7 @@ class HyperCube(VMobject): "dims" : 4, } def generate_points(self): - corners = np.array(map(np.array, it.product(*[(-1, 1)]*self.dims))) + corners = np.array(list(map(np.array, it.product(*[(-1, 1)]*self.dims)))) def project(four_d_array): result = four_d_array[:3] w = four_d_array[self.dims-1] @@ -345,15 +345,15 @@ class ManyCoordinateSystems(LinearTransformationScene): for t_matrix in t_matrices: self.animate_coordinates() self.play(*it.chain( - map(FadeOut, movers), - map(Animation, self.foreground_mobjects) + list(map(FadeOut, movers)), + list(map(Animation, self.foreground_mobjects)) )) for mover in movers: mover.restore() self.apply_transposed_matrix(t_matrix, run_time = 0) self.play(*it.chain( - map(FadeIn, movers), - map(Animation, self.foreground_mobjects) + list(map(FadeIn, movers)), + list(map(Animation, self.foreground_mobjects)) )) self.animate_coordinates() @@ -367,7 +367,7 @@ class ManyCoordinateSystems(LinearTransformationScene): ]).T inv_cob = np.linalg.inv(cob_matrix) coords = np.dot(inv_cob, self.v_coords) - array = Matrix(map(DecimalNumber, coords)) + array = Matrix(list(map(DecimalNumber, coords))) array.get_entries()[0].set_color(X_COLOR) array.get_entries()[1].set_color(Y_COLOR) array.add_to_back(BackgroundRectangle(array)) @@ -386,14 +386,14 @@ class ManyCoordinateSystems(LinearTransformationScene): self.play(Write(array, run_time = 1)) self.wait() - self.play(*map(MoveToTarget, [self.i_hat, coord1])) - self.play(*map(MoveToTarget, [self.j_hat, coord2])) + self.play(*list(map(MoveToTarget, [self.i_hat, coord1]))) + self.play(*list(map(MoveToTarget, [self.j_hat, coord2]))) self.play(VGroup(self.j_hat, coord2).shift, self.i_hat.get_end()) self.wait(2) self.play( self.i_hat.restore, self.j_hat.restore, - *map(FadeOut, [array, coord1, coord2]) + *list(map(FadeOut, [array, coord1, coord2])) ) class DeterminantAndEigenvectorDontCare(LinearTransformationScene): @@ -479,13 +479,13 @@ class DeterminantAndEigenvectorDontCare(LinearTransformationScene): if cob_matrix is not None: self.play( FadeOut(self.plane), - *map(Animation, non_plane_mobs) + *list(map(Animation, non_plane_mobs)) ) transform = self.get_matrix_transformation(cob_matrix) self.plane.apply_function(transform) self.play( FadeIn(self.plane), - *map(Animation, non_plane_mobs) + *list(map(Animation, non_plane_mobs)) ) self.wait() self.apply_transposed_matrix( @@ -675,7 +675,7 @@ class AddTwoFunctions(FunctionGraphScene): self.wait() for lines in f_lines, g_lines: self.add_lines(lines) - self.play(*map(FadeOut, [f_graph, g_graph])) + self.play(*list(map(FadeOut, [f_graph, g_graph]))) self.wait() self.play(FadeOut(brace)) fg_group = VGroup(*list(f_label)+list(g_label)) @@ -860,7 +860,7 @@ class ShowSlopes(Animation): def update_mobject(self, alpha): f = self.graph.point_from_proportion - low, high = map(f, np.clip([alpha-self.dx, alpha+self.dx], 0, 1)) + low, high = list(map(f, np.clip([alpha-self.dx, alpha+self.dx], 0, 1))) slope = (high[1]-low[1])/(high[0]-low[0]) self.mobject.restore() self.mobject.rotate(np.arctan(slope)) @@ -974,7 +974,7 @@ class FromVectorsToFunctions(VectorScene): self.play( MoveToTarget(func_tex), - *map(Write, [L, lp, rp, equals, new_func]) + *list(map(Write, [L, lp, rp, equals, new_func])) ) self.remove(func_tex) self.add(func_tex.target) @@ -1188,19 +1188,19 @@ class FormalDefinitionOfLinear(LinearTransformationScene): rhs.next_to(vw_label, RIGHT) rect = BackgroundRectangle(rhs) self.play(*it.chain( - map(Write, [rect, equals, plus]), - map(MoveToTarget, [v_label_copy, w_label_copy]), + list(map(Write, [rect, equals, plus])), + list(map(MoveToTarget, [v_label_copy, w_label_copy])), )) to_fade = [self.plane, v, v_label, w_group, vw_label, vw_sum] to_fade += self.get_mobjects_from_last_animation() self.wait() self.play(*it.chain( - map(FadeOut, to_fade), - map(Animation, self.foreground_mobjects) + list(map(FadeOut, to_fade)), + list(map(Animation, self.foreground_mobjects)) )) self.plane.restore() - self.play(FadeIn(self.plane), *map(Animation, self.foreground_mobjects)) + self.play(FadeIn(self.plane), *list(map(Animation, self.foreground_mobjects))) self.transformable_mobjects = [] self.moving_vectors = [] self.transformable_labels = [] @@ -1257,7 +1257,7 @@ class FormalDefinitionOfLinear(LinearTransformationScene): scaled_v_label, scaled_v, v_copy, v, rhs ] + self.transformable_labels + self.moving_vectors - self.play(*map(FadeOut, faders)) + self.play(*list(map(FadeOut, faders))) def add_words(self): randy = Randolph().shift(LEFT).to_edge(DOWN) @@ -1416,12 +1416,12 @@ class ProposeDerivativeAsMatrix(TeacherStudentsScene): class PolynomialsHaveArbitrarilyLargeDegree(Scene): def construct(self): - polys = VGroup(*map(TexMobject, [ + polys = VGroup(*list(map(TexMobject, [ "x^{300} + 9x^2", "4x^{4{,}000{,}000{,}000} + 1", "3x^{\\left(10^{100}\\right)}", "\\vdots" - ])) + ]))) polys.set_color_by_gradient(BLUE_B, BLUE_D) polys.arrange_submobjects(DOWN, buff = MED_LARGE_BUFF) polys.scale(1.3) @@ -1569,7 +1569,7 @@ class IntroducePolynomialSpace(Scene): Write(brace.text), *[ ApplyMethod(self.poly1[index].set_color, color) - for index, color in index_to_color.items() + for index, color in list(index_to_color.items()) ] ) self.wait() @@ -1674,7 +1674,7 @@ class IntroducePolynomialSpace(Scene): )) self.wait() - self.play(*map(FadeOut, [self.poly1]+more_terms)) + self.play(*list(map(FadeOut, [self.poly1]+more_terms))) self.poly2.next_to(equals, LEFT) self.poly2.shift(MED_SMALL_BUFF*UP) self.poly2.set_color(WHITE) @@ -1699,7 +1699,7 @@ class IntroducePolynomialSpace(Scene): self.remove(*self.get_mobjects_from_last_animation()) self.add(self.poly2) self.wait() - self.play(*map(FadeOut, [self.poly2, coords, equals])) + self.play(*list(map(FadeOut, [self.poly2, coords, equals]))) def derivative_as_matrix(self): matrix = Matrix([ @@ -1754,7 +1754,7 @@ class IntroducePolynomialSpace(Scene): deriv.target.shift(0.25*RIGHT) self.play( FadeOut(equals), - *map(MoveToTarget, [matrix, deriv]) + *list(map(MoveToTarget, [matrix, deriv])) ) poly = TexMobject( @@ -1795,7 +1795,7 @@ class IntroducePolynomialSpace(Scene): poly_result.next_to(eq1) brace = Brace(poly_result, buff = 0) - self.play(*map(Write, [eq1, eq2, brace])) + self.play(*list(map(Write, [eq1, eq2, brace]))) result_coefs = VGroup(*np.array(poly_result)[[6, 3, 0]]) VGroup(*poly_result[0:2]).set_color(MAROON_B) @@ -1836,14 +1836,14 @@ class IntroducePolynomialSpace(Scene): vert_rect.replace(array.get_entries(), stretch = True) vert_rect.stretch_in_place(1.1, 1) vert_rect.stretch_in_place(1.5, 0) - tuples = zip( + tuples = list(zip( relevant_entries, diag_entries, result_entries, rects, result_terms, coefs[1:] - ) + )) self.play(Write(result_array.get_brackets())) for entry, diag_entry, result_entry, rect, result_term, coef in tuples: self.play(FadeIn(rect), FadeIn(vert_rect)) @@ -1864,7 +1864,7 @@ class IntroducePolynomialSpace(Scene): self.play(Transform(coef.copy(), VGroup(result_term))) self.wait() self.play(FadeOut(rect), FadeOut(vert_rect)) - self.play(*map(Write, result_array.get_entries()[3:])) + self.play(*list(map(Write, result_array.get_entries()[3:]))) self.wait() class MatrixVectorMultiplicationAndDerivative(TeacherStudentsScene): @@ -1925,19 +1925,19 @@ class CompareTermsInLinearAlgebraToFunction(Scene): VGroup(h_line, v_line).set_color(BLUE) self.add(l_title, r_title) - self.play(*map(ShowCreation, [h_line, v_line])) + self.play(*list(map(ShowCreation, [h_line, v_line]))) self.wait() - lin_alg_concepts = VGroup(*map(TextMobject, [ + lin_alg_concepts = VGroup(*list(map(TextMobject, [ "Linear transformations", "Dot products", "Eigenvectors", - ])) - function_concepts = VGroup(*map(TextMobject, [ + ]))) + function_concepts = VGroup(*list(map(TextMobject, [ "Linear operators", "Inner products", "Eigenfunctions", - ])) + ]))) for concepts, vect in (lin_alg_concepts, LEFT), (function_concepts, RIGHT): concepts.arrange_submobjects(DOWN, buff = MED_LARGE_BUFF, aligned_edge = LEFT) concepts.next_to(h_line, DOWN, buff = LARGE_BUFF) @@ -2100,13 +2100,13 @@ class ShowVectorSpaces(Scene): class ToolsOfLinearAlgebra(Scene): def construct(self): - words = VGroup(*map(TextMobject, [ + words = VGroup(*list(map(TextMobject, [ "Linear transformations", "Null space", "Eigenvectors", "Dot products", "$\\vdots$" - ])) + ]))) words.arrange_submobjects(DOWN, aligned_edge = LEFT, buff = MED_SMALL_BUFF) words[-1].next_to(words[-2], DOWN) self.play(FadeIn( @@ -2373,8 +2373,8 @@ class VectorSpaceOfPiCreatures(Scene): self.play(FadeOut(creatures)) self.play(*it.chain( - map(MoveToTarget, [pi1, pi2, pi3]), - map(Write, [plus, equals, two, equals2]), + list(map(MoveToTarget, [pi1, pi2, pi3])), + list(map(Write, [plus, equals, two, equals2])), )) self.play( Transform(pi1.copy(), sum_pi), diff --git a/old_projects/eola/chapter2.py b/old_projects/eola/chapter2.py index 086cbd96..a8069ac5 100644 --- a/old_projects/eola/chapter2.py +++ b/old_projects/eola/chapter2.py @@ -655,13 +655,13 @@ class VectorsToDotsScene(VectorScene): return Dot(vector.get_end(), fill_color = vector.get_stroke_color()) self.wait() vectors.remove(prototype_vector) - self.play(*map(FadeOut, vectors)+[Animation(prototype_vector)]) + self.play(*list(map(FadeOut, vectors))+[Animation(prototype_vector)]) self.remove(vector_group) self.add(prototype_vector) self.wait() self.play(Transform(prototype_vector, v_to_dot(prototype_vector))) self.wait() - self.play(*map(FadeIn, vectors) + [Animation(prototype_vector)]) + self.play(*list(map(FadeIn, vectors)) + [Animation(prototype_vector)]) rate_functions = [ squish_rate_func(smooth, float(x)/(len(vectors)+2), 1) for x in range(len(vectors)) diff --git a/old_projects/eola/chapter3.py b/old_projects/eola/chapter3.py index 6f9aa949..786d39a5 100644 --- a/old_projects/eola/chapter3.py +++ b/old_projects/eola/chapter3.py @@ -98,7 +98,7 @@ class DescribeTransformation(Scene): f_of_x = TexMobject("f(x)") L_of_v = TexMobject("L(\\vec{\\textbf{v}})") nums = [5, 2, -3] - num_inputs = VMobject(*map(TexMobject, map(str, nums))) + num_inputs = VMobject(*list(map(TexMobject, list(map(str, nums))))) num_outputs = VMobject(*[ TexMobject(str(num**2)) for num in nums @@ -594,7 +594,7 @@ class FollowIHatJHat(LinearTransformationScene): ) self.wait() - self.play(*map(FadeOut, [i_label, j_label])) + self.play(*list(map(FadeOut, [i_label, j_label]))) self.apply_transposed_matrix([[-1, 1], [-2, -1]]) self.wait() @@ -951,9 +951,9 @@ class MatrixVectorMultiplication(LinearTransformationScene): ShowCreation(j_arrow) ) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ i_message, i_circle, i_arrow, j_message, j_circle, j_arrow - ])) + ]))) def multiply_by_vector(self, matrix): @@ -1009,8 +1009,8 @@ class MatrixVectorMultiplication(LinearTransformationScene): else: row1 = ["3", "(5)", "+", "2", "(7)"] row2 = ["-2", "(5)", "+", "1", "(7)"] - row1 = VMobject(*map(TexMobject, row1)) - row2 = VMobject(*map(TexMobject, row2)) + row1 = VMobject(*list(map(TexMobject, row1))) + row2 = VMobject(*list(map(TexMobject, row2))) for row in row1, row2: row.arrange_submobjects(RIGHT, buff = 0.1) final_sum = Matrix([row1, row2]) @@ -1417,8 +1417,8 @@ class UsedToThinkinfOfFunctionsAsGraphs(VectorScene): self.wait() def show_inputs_and_output(self): - numbers = range(-3, 4) - inputs = VMobject(*map(TexMobject, map(str, numbers))) + numbers = list(range(-3, 4)) + inputs = VMobject(*list(map(TexMobject, list(map(str, numbers))))) inputs.arrange_submobjects(DOWN, buff = 0.5, aligned_edge = RIGHT) arrows = VMobject(*[ Arrow(LEFT, RIGHT).next_to(mob) diff --git a/old_projects/eola/chapter4.py b/old_projects/eola/chapter4.py index 4391265d..c0d727c2 100644 --- a/old_projects/eola/chapter4.py +++ b/old_projects/eola/chapter4.py @@ -167,9 +167,9 @@ class FollowLinearCombination(LinearTransformationScene): for mob in (scaled_j, scaled_j_label) ]) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ scaled_i, scaled_j, scaled_i_label, scaled_j_label, - ])) + ]))) def record_basis_coordinates(self, vect_array, vect): i_label = vector_coordinate_label(self.i_hat) @@ -341,7 +341,7 @@ class IntroduceIdeaOfComposition(RotationThenShear): everything = list_difference_update( everything, matrix.submobject_family() ) - self.play(*map(FadeOut, everything) + [Animation(matrix)]) + self.play(*list(map(FadeOut, everything)) + [Animation(matrix)]) new_matrix = matrix.copy() new_matrix.center().to_edge(UP) self.play(Transform(matrix, new_matrix)) @@ -350,7 +350,7 @@ class IntroduceIdeaOfComposition(RotationThenShear): self.setup() everything = self.get_mobjects() - self.play(*map(FadeIn, everything) + [Animation(matrix)]) + self.play(*list(map(FadeIn, everything)) + [Animation(matrix)]) func = self.get_matrix_transformation([[1, 1], [-1, 0]]) bases = VMobject(self.i_hat, self.j_hat) new_bases = VMobject(*[ @@ -382,7 +382,7 @@ class ExplainWhyItsMatrixMultiplication(Scene): rot_matrix.set_color(TEAL) shear_matrix = Matrix([[1, 1], [0, 1]]) shear_matrix.set_color(PINK) - l_paren, r_paren = map(TexMobject, ["\\Big(", "\\Big)"]) + l_paren, r_paren = list(map(TexMobject, ["\\Big(", "\\Big)"])) for p in l_paren, r_paren: p.set_height(1.4*vect.get_height()) long_way = VMobject( @@ -420,9 +420,9 @@ class ExplainWhyItsMatrixMultiplication(Scene): [equals, comp_matrix, vect_copy], ] for group in groups: - self.play(*map(Write, group)) + self.play(*list(map(Write, group))) self.wait() - self.play(*map(FadeOut, [l_paren, r_paren, vect, vect_copy])) + self.play(*list(map(FadeOut, [l_paren, r_paren, vect, vect_copy]))) comp_matrix.add(equals) matrices = VMobject(shear_matrix, rot_matrix, comp_matrix) self.play(ApplyMethod( @@ -486,12 +486,12 @@ class MoreComplicatedExampleVisually(LinearTransformationScene): self.play(Write(comp_matrix)) self.add_foreground_mobject(comp_matrix) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ self.background_plane, self.plane, self.i_hat, self.j_hat, - ]) + [ + ])) + [ Animation(m) for m in self.foreground_mobjects ]) self.remove(self.i_hat, self.j_hat) @@ -615,7 +615,7 @@ class MoreComplicatedExampleNumerically(MoreComplicatedExampleVisually): Transform(question, second), ) self.wait() - self.play(*map(FadeOut, [question, first_arrow])) + self.play(*list(map(FadeOut, [question, first_arrow]))) self.play(Write(intermediate)) self.wait() self.play(Write(product)) @@ -639,9 +639,9 @@ class MoreComplicatedExampleNumerically(MoreComplicatedExampleVisually): class GeneralMultiplication(MoreComplicatedExampleNumerically): def get_result(self): - entries = map(TexMobject, [ + entries = list(map(TexMobject, [ "ae+bg", "af+bh", "ce+dg", "cf+dh" - ]) + ])) for mob in entries: mob.split()[0].set_color(PINK) mob.split()[3].set_color(PINK) @@ -749,7 +749,7 @@ class AskAboutCommutativity(Scene): neq = TexMobject("\\neq") neq.move_to(eq) - self.play(*map(Write, [l_m1, l_m2, eq])) + self.play(*list(map(Write, [l_m1, l_m2, eq]))) self.play( Transform(l_m1.copy(), r_m1), Transform(l_m2.copy(), r_m2), @@ -902,10 +902,10 @@ class AskAssociativityQuestion(Scene): everything.remove(title) everything = VMobject(*everything) - matrices = map(matrix_to_mobject, [ + matrices = list(map(matrix_to_mobject, [ np.array(list(m)).reshape((2, 2)) for m in ("abcd", "efgh", "ijkl") - ]) + ])) VMobject(*matrices).arrange_submobjects() self.play(everything.to_edge, UP) diff --git a/old_projects/eola/chapter5.py b/old_projects/eola/chapter5.py index 9906c2fa..a79c481e 100644 --- a/old_projects/eola/chapter5.py +++ b/old_projects/eola/chapter5.py @@ -21,13 +21,10 @@ class Blob(Circle): def probably_contains(self, point): border_points = np.array(self.get_anchors_and_handles()[0]) - distances = map(lambda p : np.linalg.norm(p-point), border_points) + distances = [np.linalg.norm(p-point) for p in border_points] min3 = border_points[np.argsort(distances)[:3]] center_direction = self.get_center() - point - in_center_direction = map( - lambda p : np.dot(p-point, center_direction) > 0, - min3 - ) + in_center_direction = [np.dot(p-point, center_direction) > 0 for p in min3] return sum(in_center_direction) <= 2 class RightHand(VMobject): @@ -184,7 +181,7 @@ class DiagonalExample(LinearTransformationScene): width_target, height_target = width.copy(), height.copy() det = np.linalg.det(self.transposed_matrix) - times, eq_det = map(TexMobject, ["\\times", "=%d"%det]) + times, eq_det = list(map(TexMobject, ["\\times", "=%d"%det])) words = TextMobject("New area $=$") equation = VMobject( words, width_target, times, height_target, eq_det @@ -198,7 +195,7 @@ class DiagonalExample(LinearTransformationScene): ShowCreation(background_rect), Transform(width.copy(), width_target), Transform(height.copy(), height_target), - *map(Write, [words, times, eq_det]) + *list(map(Write, [words, times, eq_det])) ) self.wait() @@ -918,7 +915,7 @@ class TwoDDeterminantFormulaIntuition(LinearTransformationScene): ] ) self.wait() - self.play(*map(FadeOut, [i_brace, side_brace, width, height])) + self.play(*list(map(FadeOut, [i_brace, side_brace, width, height]))) matrix1 = np.dot( [[a, b], [c, d]], np.linalg.inv([[a, b], [0, d]]) diff --git a/old_projects/eola/chapter6.py b/old_projects/eola/chapter6.py index 7516ac13..58cfb3f8 100644 --- a/old_projects/eola/chapter6.py +++ b/old_projects/eola/chapter6.py @@ -25,12 +25,12 @@ class ListTerms(Scene): title.set_color(YELLOW) title.to_edge(UP) randy = Randolph().to_corner() - words = VMobject(*map(TextMobject, [ + words = VMobject(*list(map(TextMobject, [ "Inverse matrices", "Column space", "Rank", "Null space", - ])) + ]))) words.arrange_submobjects(DOWN, aligned_edge = LEFT) words.next_to(title, DOWN, aligned_edge = LEFT) words.shift(RIGHT) @@ -243,17 +243,17 @@ class SystemOfEquations(Scene): [1, 3, 0] ]) mob_matrix = matrix.get_mob_matrix() - rhs = map(TexMobject, map(str, [-3, 0, 2])) - variables = map(TexMobject, list("xyz")) + rhs = list(map(TexMobject, list(map(str, [-3, 0, 2])))) + variables = list(map(TexMobject, list("xyz"))) for v, color in zip(variables, [X_COLOR, Y_COLOR, Z_COLOR]): v.set_color(color) equations = VMobject() for row in mob_matrix: - equation = VMobject(*it.chain(*zip( + equation = VMobject(*it.chain(*list(zip( row, [v.copy() for v in variables], - map(TexMobject, list("++=")) - ))) + list(map(TexMobject, list("++="))) + )))) equation.arrange_submobjects( RIGHT, buff = 0.1, aligned_edge = DOWN @@ -342,7 +342,7 @@ class SystemOfEquations(Scene): for mob in sine, product: self.play(Transform(squared, mob)) draw_circle_slash(mob) - self.play(*map(FadeOut, [words, arrow, squared])) + self.play(*list(map(FadeOut, [words, arrow, squared]))) self.wait() @@ -393,13 +393,13 @@ class SystemOfEquations(Scene): FadeIn(mob.words) ) self.wait() - self.play(*map(FadeOut, [mob.square, mob.words])) + self.play(*list(map(FadeOut, [mob.square, mob.words]))) self.play( ShowCreation(zero_circles), Write(zero_circles.words, run_time = 1) ) self.wait() - self.play(*map(FadeOut, [zero_circles, zero_circles.words])) + self.play(*list(map(FadeOut, [zero_circles, zero_circles.words]))) self.wait() title = TextMobject("``Linear system of equations''") title.scale(1.5) @@ -491,7 +491,7 @@ class SystemOfEquations(Scene): FadeIn(mob.words) ) self.wait() - self.play(*map(FadeOut, [mob.brace, mob.words])) + self.play(*list(map(FadeOut, [mob.brace, mob.words]))) self.wait() for mob in parts: self.play( @@ -678,7 +678,7 @@ class ShowBijectivity(LinearTransformationScene): "submobject_mode" : "lagged_start", "run_time" : 2 } - anims = map(Animation, self.foreground_mobjects) + anims = list(map(Animation, self.foreground_mobjects)) self.play(ShowCreation(vectors, **kwargs), *anims) self.play(Transform(vectors, dots, **kwargs), *anims) self.wait() @@ -1092,7 +1092,7 @@ class InvertNonInvertable(LinearTransformationScene): self.add_foreground_mobject(no_func) self.play( grid.restore, - *map(Animation, self.foreground_mobjects), + *list(map(Animation, self.foreground_mobjects)), run_time = 3 ) self.wait() @@ -1122,7 +1122,7 @@ class OneInputMultipleOutputs(InvertNonInvertable): *[ Transform(output_vector.copy(), input_vector) for input_vector in input_vectors.split() - ] + map(Animation, self.foreground_mobjects), + ] + list(map(Animation, self.foreground_mobjects)), run_time = 3 ) multiple_outputs = TextMobject( @@ -1204,7 +1204,7 @@ class DefineRank(Scene): self.play(Write(rank)) self.play( ShowCreation(arrow), - *map(Write, dims) + *list(map(Write, dims)) ) self.wait() @@ -1364,7 +1364,7 @@ class NameColumnSpace(Scene): matrix.set_color_columns(X_COLOR, Y_COLOR, Z_COLOR) matrix.to_corner(UP+LEFT) cols = list(matrix.copy().get_mob_matrix().T) - col_arrays = map(Matrix, cols) + col_arrays = list(map(Matrix, cols)) span_text = TexMobject( "\\text{Span}", @@ -1406,7 +1406,7 @@ class NameColumnSpace(Scene): ]) self.play( Write(span_text), - *map(Animation, self.get_mobjects_from_last_animation()) + *list(map(Animation, self.get_mobjects_from_last_animation())) ) self.play( ShowCreation(arrow), @@ -1496,7 +1496,7 @@ class NameColumnSpace(Scene): def replace_number_matrix(self, matrix, new_numbers): starters = matrix.flatten() - targets = map(TexMobject, map(str, np.array(new_numbers).flatten())) + targets = list(map(TexMobject, list(map(str, np.array(new_numbers).flatten())))) for start, target in zip(starters, targets): target.move_to(start) target.set_color(start.get_color()) @@ -1674,7 +1674,7 @@ class NameNullSpace(LinearTransformationScene): self.play( vectors.restore, self.plane.restore, - *map(Animation, self.foreground_mobjects), + *list(map(Animation, self.foreground_mobjects)), run_time = 2 ) self.play(Transform( diff --git a/old_projects/eola/chapter7.py b/old_projects/eola/chapter7.py index 7bea8dca..ef415e17 100644 --- a/old_projects/eola/chapter7.py +++ b/old_projects/eola/chapter7.py @@ -57,13 +57,13 @@ class TraditionalOrdering(RandolphScene): title.set_color(YELLOW) title.scale(1.2) title.to_corner(UP+LEFT) - topics = VMobject(*map(TextMobject, [ + topics = VMobject(*list(map(TextMobject, [ "Topic 1: Vectors", "Topic 2: Dot products", "\\vdots", "(everything else)", "\\vdots", - ])) + ]))) topics.arrange_submobjects(DOWN, aligned_edge = LEFT, buff = SMALL_BUFF) # topics.next_to(title, DOWN+RIGHT) @@ -162,7 +162,7 @@ class ShowNumericalDotProduct(Scene): dot_product = VGroup(v1, inter_array_dot, v2) dot_product.arrange_submobjects(RIGHT, buff = MED_SMALL_BUFF/2) dot_product.to_edge(LEFT) - pairs = zip(v1.get_entries(), v2.get_entries()) + pairs = list(zip(v1.get_entries(), v2.get_entries())) for pair, color in zip(pairs, [X_COLOR, Y_COLOR, Z_COLOR, PINK]): VGroup(*pair).set_color(color) @@ -180,10 +180,10 @@ class ShowNumericalDotProduct(Scene): products.target = products.copy() plusses = ["+"]*(len(self.v1)-1) - symbols = VGroup(*map(TexMobject, ["="] + plusses)) - final_sum = VGroup(*it.chain(*zip( + symbols = VGroup(*list(map(TexMobject, ["="] + plusses))) + final_sum = VGroup(*it.chain(*list(zip( symbols, products.target - ))) + )))) final_sum.arrange_submobjects(RIGHT, buff = SMALL_BUFF) final_sum.next_to(dot_product, RIGHT) @@ -432,11 +432,11 @@ class ShowQualitativeDotProductValues(VectorScene): less_than = TexMobject("<").set_color(RED).move_to(comp) v_sym.set_color(V_COLOR) w_sym.set_color(W_COLOR) - words = map(TextMobject, [ + words = list(map(TextMobject, [ "Similar directions", "Perpendicular", "Opposing directions" - ]) + ])) for word, sym in zip(words, [comp, equals, less_than]): word.add_background_rectangle() word.next_to(sym, DOWN, aligned_edge = LEFT, buff = MED_SMALL_BUFF) @@ -555,7 +555,7 @@ class SymmetricVAndW(VectorScene): ) self.wait(0.5) self.remove(line_of_symmetry_words) - self.play(*map(Uncreate, line_of_symmetry_words)) + self.play(*list(map(Uncreate, line_of_symmetry_words))) for vect in w, v: self.play(ShowCreation(vect.proj_line)) vect_copy = vect.copy() @@ -563,9 +563,9 @@ class SymmetricVAndW(VectorScene): self.remove(vect_copy) self.add(vect.proj) self.wait() - self.play(*map(FadeOut,[ + self.play(*list(map(FadeOut,[ v.proj, v.proj_line, w.proj, w.proj_line - ])) + ]))) self.show_doubling(v, w) def show_doubling(self, v, w): @@ -639,9 +639,9 @@ class SymmetricVAndW(VectorScene): run_time = 2 ) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ projector.proj, projector.proj_line - ])) + ]))) class LurkingQuestion(TeacherStudentsScene): def construct(self): @@ -702,7 +702,7 @@ class Introduce2Dto1DLinearTransformations(TwoDToOneDScene): ShowCreation(number_line), *[Animation(v) for v in (self.i_hat, self.j_hat)] ) - self.play(*map(Write, [numbers, number_line_words])) + self.play(*list(map(Write, [numbers, number_line_words]))) self.wait() class Symbolic2To1DTransform(Scene): @@ -856,7 +856,7 @@ class FormalVsVisual(Scene): mob.next_to(text, DOWN, buff = MED_SMALL_BUFF) self.add(title) - self.play(*map(ShowCreation, [line, v_line])) + self.play(*list(map(ShowCreation, [line, v_line]))) for mob in formal, visual, additivity, scaling, visual_statement: self.play(Write(mob, run_time = 2)) self.wait() @@ -1108,7 +1108,7 @@ class FollowVectorViaCoordinates(TwoDToOneDScene): basis_labels, array, [DOWN, RIGHT] ) - self.play(*map(Write, basis_labels)) + self.play(*list(map(Write, basis_labels))) self.play( ShowCreation(v), Write(array), @@ -1129,7 +1129,7 @@ class FollowVectorViaCoordinates(TwoDToOneDScene): ]) self.wait() self.play( - *map(FadeOut, to_fade) + [ + *list(map(FadeOut, to_fade)) + [ vect.restore for vect in (self.i_hat, self.j_hat) ] @@ -1161,7 +1161,7 @@ class FollowVectorViaCoordinates(TwoDToOneDScene): for label, vect, direction in zip(new_labels, list(bases) + [v], [UP, DOWN, UP]): label.next_to(vect, direction) - self.play(*map(Write, new_labels)) + self.play(*list(map(Write, new_labels))) self.wait() scaling_anim_tuples = self.get_scaling_anim_tuples( new_labels, array, [UP, DOWN] @@ -1183,10 +1183,10 @@ class FollowVectorViaCoordinates(TwoDToOneDScene): def get_scaling_anim_tuples(self, labels, array, directions): scaling_anim_tuples = [] bases = self.i_hat, self.j_hat - quints = zip( + quints = list(zip( bases, self.v_coords, labels, array.get_entries(), directions - ) + )) for basis, scalar, label, entry, direction in quints: basis.save_state() basis.scaled = basis.copy().scale(scalar) @@ -1242,7 +1242,7 @@ class TwoDOneDMatrixMultiplication(Scene): self.show_product(matrix, vector) def show_product(self, matrix, vector): - starter_pairs = zip(vector.get_entries(), matrix.get_entries()) + starter_pairs = list(zip(vector.get_entries(), matrix.get_entries())) pairs = [ VMobject( e1.copy(), TexMobject("\\cdot"), e2.copy() @@ -1251,8 +1251,8 @@ class TwoDOneDMatrixMultiplication(Scene): ) for e1, e2 in starter_pairs ] - symbols = map(TexMobject, ["=", "+"]) - equation = VMobject(*it.chain(*zip(symbols, pairs))) + symbols = list(map(TexMobject, ["=", "+"])) + equation = VMobject(*it.chain(*list(zip(symbols, pairs)))) equation.arrange_submobjects(align_using_submobjects = True) equation.next_to(vector, RIGHT) @@ -1288,8 +1288,8 @@ class AssociationBetweenMatricesAndVectors(Scene): matrices_words, arrow, vectors_words ).arrange_submobjects(buff = MED_SMALL_BUFF) - matrices = VGroup(*map(Matrix, self.matrices)) - vectors = VGroup(*map(Matrix, [m[0] for m in self.matrices])) + matrices = VGroup(*list(map(Matrix, self.matrices))) + vectors = VGroup(*list(map(Matrix, [m[0] for m in self.matrices]))) for m in list(matrices) + list(vectors): x, y = m.get_entries() x.set_color(X_COLOR) @@ -1300,7 +1300,7 @@ class AssociationBetweenMatricesAndVectors(Scene): for m, direction in zip(group, [UP, DOWN]): m.next_to(group.words, direction, buff = MED_SMALL_BUFF) - self.play(*map(Write, [matrices_words, vectors_words])) + self.play(*list(map(Write, [matrices_words, vectors_words]))) self.play(ShowCreation(arrow)) self.wait() self.play(FadeIn(vectors)) @@ -1360,7 +1360,7 @@ class SomeKindOfConnection(Scene): number_line.to_edge(RIGHT) squish_plane.move_to(number_line) - numbers = number_line.get_numbers(*range(-6, 8, 2)) + numbers = number_line.get_numbers(*list(range(-6, 8, 2))) v_line = Line(UP, DOWN).scale(FRAME_Y_RADIUS) v_line.set_color(GREY) v_line.set_stroke(width = 10) @@ -1376,9 +1376,9 @@ class SomeKindOfConnection(Scene): array.add_to_back(BackgroundRectangle(array)) - self.play(*map(ShowCreation, [ + self.play(*list(map(ShowCreation, [ plane, number_line, v_line - ])+[ + ]))+[ Write(numbers, run_time = 2) ]) self.play(Write(matrix, run_time = 1)) @@ -1667,19 +1667,19 @@ class ProjectBasisVectors(ProjectOntoUnitVectorNumberline): i_label = TexMobject(i_tex[1:-1]) j_label = TexMobject(j_tex[1:-1]) u_label = TexMobject("\\hat{\\textbf{u}}") - trips = zip( + trips = list(zip( (i_label, j_label, u_label), (i_hat, j_hat, self.u_hat), (DOWN+RIGHT, UP+LEFT, UP), - ) + )) for label, vect, direction in trips: label.set_color(vect.get_color()) label.scale(1.2) label.next_to(vect.get_end(), direction, buff = MED_SMALL_BUFF/2) self.play(Write(u_label, run_time = 1)) - self.play(*map(ShowCreation, basis_vectors)) - self.play(*map(Write, [i_label, j_label]), run_time = 1) + self.play(*list(map(ShowCreation, basis_vectors))) + self.play(*list(map(Write, [i_label, j_label])), run_time = 1) self.play(ShowCreation(proj_lines)) self.play( Write(question), @@ -1688,12 +1688,12 @@ class ProjectBasisVectors(ProjectOntoUnitVectorNumberline): run_time = 2, ) to_remove = [proj_lines] - quads = zip(basis_vectors, proj_basis, proj_lines, proj_dots) + quads = list(zip(basis_vectors, proj_basis, proj_lines, proj_dots)) for vect, proj_vect, proj_line, proj_dot in quads: self.play(Transform(vect.copy(), proj_vect)) to_remove += self.get_mobjects_from_last_animation() self.wait() - self.play(*map(FadeOut, to_remove)) + self.play(*list(map(FadeOut, to_remove))) # self.show_u_coords(u_label) u_x, u_y = [ @@ -1771,7 +1771,7 @@ class ProjectBasisVectors(ProjectOntoUnitVectorNumberline): for mob in self.get_mobjects() if mob not in starting_mobjects + [final_coord] ] - self.play(*map(FadeOut, added_mobjects)) + self.play(*list(map(FadeOut, added_mobjects))) class ShowSingleProjection(ProjectBasisVectors): CONFIG = { @@ -1813,10 +1813,7 @@ class GeneralTwoDOneDMatrixMultiplication(TwoDOneDMatrixMultiplication): def construct(self): TwoDOneDMatrixMultiplication.construct(self) everything = VGroup(*self.get_mobjects()) - to_fade = filter( - lambda m : isinstance(m, Brace) or isinstance(m, TextMobject), - everything - ) + to_fade = [m for m in everything if isinstance(m, Brace) or isinstance(m, TextMobject)] u = Matrix(self.matrix[0]) v = Matrix(self.vector) @@ -1838,7 +1835,7 @@ class GeneralTwoDOneDMatrixMultiplication(TwoDOneDMatrixMultiplication): self.play( everything.to_corner, UP+RIGHT, - *map(FadeOut, to_fade) + *list(map(FadeOut, to_fade)) ) self.remove(everything) self.add(*everything) @@ -1955,7 +1952,7 @@ class ScaleUpUHat(ProjectOntoUnitVectorNumberline) : v.label.add_background_rectangle() v.label.next_to(v.get_end(), direction) - self.play(*map(ShowCreation, bases)) + self.play(*list(map(ShowCreation, bases))) for b in bases: mover = b.copy() self.play(ShowCreation(b.proj_line)) @@ -1967,11 +1964,11 @@ class ScaleUpUHat(ProjectOntoUnitVectorNumberline) : Transform(b.proj.label, b.scaled_proj.label) ) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ mob for mob in self.get_mobjects() if mob not in start_state - ])) + ]))) def transform_some_vector(self): words = TextMobject( @@ -2048,7 +2045,7 @@ class TwoDOneDTransformationSeparateSpace(Scene): number_line.to_edge(RIGHT) squish_plane.move_to(number_line) - numbers = number_line.get_numbers(*range(-6, 8, 2)) + numbers = number_line.get_numbers(*list(range(-6, 8, 2))) v_line = Line(UP, DOWN).scale(FRAME_Y_RADIUS) v_line.set_color(GREY) v_line.set_stroke(width = 10) @@ -2077,9 +2074,9 @@ class TwoDOneDTransformationSeparateSpace(Scene): start_words.next_to(ORIGIN, RIGHT, buff = MED_SMALL_BUFF).to_edge(UP) end_words.next_to(ORIGIN, DOWN+LEFT, buff = MED_SMALL_BUFF/2) - self.play(*map(ShowCreation, [ + self.play(*list(map(ShowCreation, [ plane, number_line, v_line - ])+[ + ]))+[ Write(numbers, run_time = 2) ]) self.play(Write(start_words, run_time = 2)) @@ -2236,7 +2233,7 @@ class WhatTheVectorWantsToBe(Scene): number_line.to_edge(RIGHT) squish_plane.move_to(number_line) - numbers = number_line.get_numbers(*range(-6, 8, 2)) + numbers = number_line.get_numbers(*list(range(-6, 8, 2))) v_line = Line(UP, DOWN).scale(FRAME_Y_RADIUS) v_line.set_color(GREY) v_line.set_stroke(width = 10) @@ -2269,13 +2266,13 @@ class WhatTheVectorWantsToBe(Scene): ) self.play( Transform(plane.copy(), squish_plane, run_time = 3), - *map(Animation, [ + *list(map(Animation, [ words, matrix, plane, vect, v_coords - ]) + ])) ) self.wait() diff --git a/old_projects/eola/chapter8.py b/old_projects/eola/chapter8.py index 01b861ec..462e437d 100644 --- a/old_projects/eola/chapter8.py +++ b/old_projects/eola/chapter8.py @@ -137,7 +137,7 @@ class SimpleDefine2dCrossProduct(LinearTransformationScene): self.square.apply_function(transform) self.play( ShowCreation(self.square), - *map(Animation, [self.v, self.w]) + *list(map(Animation, [self.v, self.w])) ) self.wait() self.play(FadeOut(self.square)) @@ -148,10 +148,10 @@ class SimpleDefine2dCrossProduct(LinearTransformationScene): self.wait() self.play( FadeIn(self.square), - *map(Animation, [self.v, self.w, v_copy, w_copy]) + *list(map(Animation, [self.v, self.w, v_copy, w_copy])) ) self.wait() - self.play(*map(FadeOut, [v_copy, w_copy])) + self.play(*list(map(FadeOut, [v_copy, w_copy]))) def write_area_words(self): times = TexMobject("\\times") @@ -240,7 +240,7 @@ class SimpleDefine2dCrossProduct(LinearTransformationScene): self.area_words.target = self.area_words.copy() self.area_words.target.next_to(minus_sign, RIGHT) - self.play(*map(MoveToTarget, [square, self.v, self.w])) + self.play(*list(map(MoveToTarget, [square, self.v, self.w]))) arc = self.get_arc(self.v, self.w, radius = 1.5) arc.set_color(GREEN) self.play(ShowCreation(arc)) @@ -262,7 +262,7 @@ class SimpleDefine2dCrossProduct(LinearTransformationScene): MoveToTarget(self.area_words) ) self.wait() - self.play(*map(FadeOut, [negative, negative.arrow, arc])) + self.play(*list(map(FadeOut, [negative, negative.arrow, arc]))) def swap_v_and_w(self): new_cross = self.cross.copy() @@ -445,17 +445,17 @@ class ContrastDotAndCross(Scene): [random.randint(0, 9) for in_count in range(dim)] for out_count in range(2) ] - m1, m2 = map(Matrix, arrays) + m1, m2 = list(map(Matrix, arrays)) for matrix in m1, m2: for entry, color in zip(matrix.get_entries(), colors): entry.set_color(color) entry.target = entry.copy() - syms = VGroup(*map(TexMobject, ["="] + ["+"]*(dim-1))) + syms = VGroup(*list(map(TexMobject, ["="] + ["+"]*(dim-1)))) def get_dot(): dot = TexMobject("\\cdot") syms.add(dot) return dot - result = VGroup(*it.chain(*zip( + result = VGroup(*it.chain(*list(zip( syms, [ VGroup( @@ -463,7 +463,7 @@ class ContrastDotAndCross(Scene): ).arrange_submobjects() for e1, e2 in zip(m1.get_entries(), m2.get_entries()) ] - ))) + )))) result.arrange_submobjects(RIGHT) dot_prod = VGroup( m1, TexMobject("\\cdot"), m2, result @@ -500,7 +500,7 @@ class ContrastDotAndCross(Scene): [random.randint(0, 9) for in_count in range(3)] for out_count in range(2) ] - matrices = map(Matrix, arrays) + matrices = list(map(Matrix, arrays)) for matrix in matrices: for entry, color in zip(matrix.get_entries(), colors): entry.set_color(color) @@ -511,7 +511,7 @@ class ContrastDotAndCross(Scene): index_to_cross_enty = {} syms = VGroup() movement_sets = [] - for a, b, c in it.permutations(range(3)): + for a, b, c in it.permutations(list(range(3))): e1, e2 = m1.get_entries()[b], m2.get_entries()[c] for e in e1, e2: e.target = e.copy() @@ -576,7 +576,7 @@ class ContrastDotAndCross(Scene): h_line.next_to(self.only_3d_text, DOWN, buff = MED_SMALL_BUFF/2) h_line.to_edge(RIGHT, buff = 0) arrays = np.random.randint(0, 9, (2, 2)) - m1, m2 = matrices = map(Matrix, arrays) + m1, m2 = matrices = list(map(Matrix, arrays)) for m in matrices: for e, color in zip(m.get_entries(), [X_COLOR, Y_COLOR]): e.set_color(color) @@ -586,9 +586,9 @@ class ContrastDotAndCross(Scene): entries = [x1, x2, x3, x4] for entry in entries: entry.target = entry.copy() - eq, dot1, minus, dot2 = syms = map(TexMobject, + eq, dot1, minus, dot2 = syms = list(map(TexMobject, ["=", "\\cdot", "-", "\\cdot"] - ) + )) result = VGroup( eq, x1.target, dot1, x4.target, minus, x3.target, dot2, x2.target, @@ -748,7 +748,7 @@ class Define2dCrossProduct(LinearTransformationScene): everything.remove(self.plane) everything.remove(self.background_plane) self.play( - *map(FadeOut, everything) + [ + *list(map(FadeOut, everything)) + [ Animation(self.background_plane), self.plane.restore, Animation(matrix), @@ -799,22 +799,22 @@ class Define2dCrossProduct(LinearTransformationScene): col2.set_color, Y_COLOR ) self.wait() - self.play(*map(FadeOut, [i_words, i_words.arrow, basis_labels])) + self.play(*list(map(FadeOut, [i_words, i_words.arrow, basis_labels]))) self.add_vector(i_hat, animate = False) self.add_vector(j_hat, animate = False) - self.play(*map(FadeOut, [side_brace, transform_words])) + self.play(*list(map(FadeOut, [side_brace, transform_words]))) self.add_foreground_mobject(matrix) self.apply_transposed_matrix([self.v_coords, self.w_coords]) self.wait() self.play( FadeOut(self.plane), - *map(Animation, [ + *list(map(Animation, [ self.background_plane, matrix, i_hat, j_hat, - ]) + ])) ) self.play( ShowCreation(self.v), @@ -842,7 +842,7 @@ class Define2dCrossProduct(LinearTransformationScene): for mob in to_restore: mob.fade(1) - self.play(*map(FadeOut, vect_stuffs)) + self.play(*list(map(FadeOut, vect_stuffs))) self.play( *[m.restore for m in to_restore] + [ Animation(self.matrix) @@ -858,7 +858,7 @@ class Define2dCrossProduct(LinearTransformationScene): self.play( FadeOut(self.plane), Animation(self.matrix), - *map(FadeIn, vect_stuffs) + *list(map(FadeIn, vect_stuffs)) ) self.play(Write(self.cross_product)) @@ -877,7 +877,7 @@ class Define2dCrossProduct(LinearTransformationScene): ) self.wait() - pm = VGroup(*map(TexMobject, ["+", "-"])) + pm = VGroup(*list(map(TexMobject, ["+", "-"]))) pm.set_color_by_gradient(GREEN, RED) pm.arrange_submobjects(DOWN, buff = SMALL_BUFF) pm.add_to_back(BackgroundRectangle(pm)) @@ -887,9 +887,9 @@ class Define2dCrossProduct(LinearTransformationScene): path_arc = -np.pi/2 ) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ area_arrow, self.v.coord_array, self.w.coord_array - ])) + ]))) def show_orientation_rule(self): self.remove(self.i_hat, self.j_hat) @@ -1045,7 +1045,7 @@ class TwoDCrossProductExample(Define2dCrossProduct): Transform(v.coords.get_brackets(), matrix.get_brackets()), Transform(w.coords.get_brackets(), matrix.get_brackets()), ) - self.play(*map(Write, [det_text, cross_product])) + self.play(*list(map(Write, [det_text, cross_product]))) v1, v2 = v.coords.get_entries() @@ -1054,10 +1054,10 @@ class TwoDCrossProductExample(Define2dCrossProduct): for entry in entries: entry.target = entry.copy() det = np.linalg.det([self.v_coords, self.w_coords]) - equals, dot1, minus, dot2, equals_result = syms = VGroup(*map( + equals, dot1, minus, dot2, equals_result = syms = VGroup(*list(map( TexMobject, ["=", "\\cdot", "-", "\\cdot", "=%d"%det] - )) + ))) equation_end = VGroup( equals, v1.target, dot1, w2.target, @@ -1101,7 +1101,7 @@ class TwoDCrossProductExample(Define2dCrossProduct): def show_transformation(self, v, w): i_hat, j_hat = self.get_basis_vectors() - self.play(*map(ShowCreation, [i_hat, j_hat])) + self.play(*list(map(ShowCreation, [i_hat, j_hat]))) self.add_unit_square(animate = True, opacity = 0.2) self.apply_transposed_matrix( [v.get_end()[:2], w.get_end()[:2]], @@ -1172,7 +1172,7 @@ class BiggerWhenPerpendicular(LinearTransformationScene): self.play( FadeIn(group), ShowCreation(start_square), - *map(Animation, [v, w]) + *list(map(Animation, [v, w])) ) self.play(GrowFromCenter(bigger)) self.wait() @@ -1239,7 +1239,7 @@ class ScalingRule(LinearTransformationScene): self.play(ShowCreation(w)) self.play( ShowCreation(square), - *map(Animation, [v, w]) + *list(map(Animation, [v, w])) ) self.wait() self.play( @@ -1249,7 +1249,7 @@ class ScalingRule(LinearTransformationScene): self.wait() self.play( Transform(square, new_squares), - *map(Animation, [v, w]), + *list(map(Animation, [v, w])), path_arc = -np.pi/6 ) self.wait() @@ -1384,7 +1384,7 @@ class ShowCrossProductFormula(Scene): ["%s_%d"%(s, i) for i in range(1, 4)] for s in ("v", "w") ] - matrices = map(Matrix, arrays) + matrices = list(map(Matrix, arrays)) for matrix in matrices: for entry, color in zip(matrix.get_entries(), colors): entry.set_color(color) @@ -1395,7 +1395,7 @@ class ShowCrossProductFormula(Scene): entry_dicts = [{} for x in range(3)] movement_sets = [] - for a, b, c in it.permutations(range(3)): + for a, b, c in it.permutations(list(range(3))): sign = get_perm_sign(a, b, c) e1, e2 = m1.get_entries()[b], m2.get_entries()[c] for e in e1, e2: @@ -1515,7 +1515,7 @@ class DeterminantTrick(Scene): for entry in col1: self.play(Write(entry)) self.wait() - self.play(*map(Write, [equals, det_text])) + self.play(*list(map(Write, [equals, det_text]))) self.wait() disclaimer = TextMobject("$^*$ See ``Note on conventions'' in description") @@ -1563,7 +1563,7 @@ class DeterminantTrick(Scene): mob.save_state() basis = quint[0] basis.t.scale(1/0.8) - lp, minus, rp = syms = VGroup(*map(TexMobject, "(-)")) + lp, minus, rp = syms = VGroup(*list(map(TexMobject, "(-)"))) term = VGroup( basis.t, lp, quint[1].t, quint[2].t, minus, diff --git a/old_projects/eola/chapter8p2.py b/old_projects/eola/chapter8p2.py index 64a94edb..fc2d9a87 100644 --- a/old_projects/eola/chapter8p2.py +++ b/old_projects/eola/chapter8p2.py @@ -42,7 +42,7 @@ class CrossProductSymbols(Scene): vector_text = brace.get_text("Vector") vector_text.set_color(RED) self.add(equation) - self.play(*map(Write, [brace, vector_text])) + self.play(*list(map(Write, [brace, vector_text]))) self.wait() class DeterminantTrickCopy(DeterminantTrick): @@ -200,7 +200,7 @@ class DotProductToTransformSymbol(Scene): _input = Matrix(["x", "y"]) _input.get_entries().set_color_by_gradient(X_COLOR, Y_COLOR) left_input, right_input = [_input.copy() for x in range(2)] - dot, equals = map(TexMobject, ["\\cdot", "="]) + dot, equals = list(map(TexMobject, ["\\cdot", "="])) equation = VGroup( vector, dot, left_input, equals, matrix, right_input @@ -338,7 +338,7 @@ class ThreeStepPlan(Scene): VGroup(linear, transformation), linear_transformation ), - *map(FadeOut, steps) + *list(map(FadeOut, steps)) ) self.wait() self.play(Write(left_right_arrow)) @@ -382,7 +382,7 @@ class DefineDualTransform(Scene): def show_triple_cross_product(self): colors = [WHITE, ORANGE, W_COLOR] - tex_mobs = map(TexMobject, get_vect_tex(*"uvw")) + tex_mobs = list(map(TexMobject, get_vect_tex(*"uvw"))) u_tex, v_tex, w_tex = tex_mobs arrays = [ Matrix(["%s_%d"%(s, d) for d in range(1, 4)]) @@ -482,7 +482,7 @@ class DefineDualTransform(Scene): ) self.wait() - x, y, z = variables = map(TexMobject, "xyz") + x, y, z = variables = list(map(TexMobject, "xyz")) for var, entry in zip(variables, self.u_entries): var.scale(0.8) var.move_to(entry) @@ -540,7 +540,7 @@ class DefineDualTransform(Scene): def introduce_dual_vector(self): everything = VGroup(*self.get_mobjects()) colors = [X_COLOR, Y_COLOR, Z_COLOR] - q_marks = VGroup(*map(TextMobject, "???")) + q_marks = VGroup(*list(map(TextMobject, "???"))) q_marks.scale(2) q_marks.set_color_by_gradient(*colors) @@ -596,16 +596,16 @@ class DefineDualTransform(Scene): ShowCreation(matrix_arrow) ) self.wait(2) - self.play(*map(FadeOut, [matrix_words, matrix_arrow])) + self.play(*list(map(FadeOut, [matrix_words, matrix_arrow]))) self.play( Transform(func, dual_vector), Write(dual_dot[1]) ) self.wait() - p_coords = VGroup(*map(TexMobject, [ + p_coords = VGroup(*list(map(TexMobject, [ "p_%d"%d for d in range(1, 4) - ])) + ]))) p_coords.set_color(RED) p_array = Matrix(list(p_coords)) p_array.set_height(dual_vector.get_height()) @@ -690,13 +690,13 @@ class DefineDualTransform(Scene): sym_strings = ["(", "\\cdot", "-", "\\cdot", ")"] if i < 2: sym_strings[-1] += "+" - syms = map(TexMobject, sym_strings) + syms = list(map(TexMobject, sym_strings)) for mob, sym in zip(quint, syms): mob.target = mob.copy() mob.target.scale(1.5) mob.sym = sym quint_targets = [mob.target for mob in quint] - component = VGroup(*it.chain(*zip(quint_targets, syms))) + component = VGroup(*it.chain(*list(zip(quint_targets, syms)))) component.arrange_submobjects() cross_components.add(component) to_fade.add(syms[0], syms[-1], quint[0]) @@ -723,7 +723,7 @@ class DefineDualTransform(Scene): ).next_to(cross_components, LEFT), new_ps ), - *map(FadeOut, to_fade) + *list(map(FadeOut, to_fade)) ) self.play(*[ Write(TexMobject("=").next_to(p, buff = 2*SMALL_BUFF)) diff --git a/old_projects/eola/chapter9.py b/old_projects/eola/chapter9.py index 3a29a7a1..0f0e3ea0 100644 --- a/old_projects/eola/chapter9.py +++ b/old_projects/eola/chapter9.py @@ -92,7 +92,7 @@ class LinearCombinationScene(LinearTransformationScene): basis.save_state() basis.label.save_state() if coord_mobs is None: - coord_mobs = map(TexMobject, map(str, numerical_coords)) + coord_mobs = list(map(TexMobject, list(map(str, numerical_coords)))) VGroup(*coord_mobs).set_fill(opacity = 0) for coord, basis in zip(coord_mobs, basis_vectors): coord.next_to(basis.label, LEFT) @@ -111,9 +111,9 @@ class LinearCombinationScene(LinearTransformationScene): ) coord.target.next_to(basis.label.target, LEFT) coord.target.set_fill(basis.get_color(), opacity = 1) - self.play(*map(MoveToTarget, [ + self.play(*list(map(MoveToTarget, [ coord, basis, basis.label - ])) + ]))) self.wait() self.play(*[ ApplyMethod(m.shift, basis_vectors[0].get_end()) @@ -164,7 +164,7 @@ class RemindOfCoordinates(LinearCombinationScene): ) self.wait() self.wait() - self.play(*map(FadeOut, [x_coord, y_coord, x_line, y_line])) + self.play(*list(map(FadeOut, [x_coord, y_coord, x_line, y_line]))) def show_abstract_scalar_idea(self, x_coord, y_coord): @@ -191,7 +191,7 @@ class RemindOfCoordinates(LinearCombinationScene): y_coord.move_to, y_shift + 3*UP, Write(words) ) - self.play(*map(FadeIn, [self.i_hat, self.j_hat])) + self.play(*list(map(FadeIn, [self.i_hat, self.j_hat]))) self.wait() self.play(Transform(self.i_hat, scaled_i)) self.play(Transform(self.j_hat, scaled_j)) @@ -204,7 +204,7 @@ class RemindOfCoordinates(LinearCombinationScene): self.wait() def scale_basis_vectors(self, x_coord, y_coord): - self.play(*map(Write, [self.i_hat.label, self.j_hat.label])) + self.play(*list(map(Write, [self.i_hat.label, self.j_hat.label]))) self.show_linear_combination( self.vector_coords, basis_vectors = [self.i_hat, self.j_hat], @@ -423,13 +423,13 @@ class IntroduceJennifer(JenniferScene): self.play(ShowCreation(v)) self.wait() self.play(*it.chain( - map(FadeIn, [ + list(map(FadeIn, [ self.plane, self.i_hat, self.j_hat, self.i_hat.label, self.j_hat.label, you - ]), - map(Animation, [jenny, v]), - map(FadeOut, self.basis_vectors), + ])), + list(map(Animation, [jenny, v])), + list(map(FadeOut, self.basis_vectors)), )) self.play( ShowCreation(you.bubble), @@ -442,13 +442,13 @@ class IntroduceJennifer(JenniferScene): coord_mobs = you.coords.get_entries().copy(), ) self.play(*it.chain( - map(FadeOut, [ + list(map(FadeOut, [ self.plane, self.i_hat, self.j_hat, self.i_hat.label, self.j_hat.label, you.bubble, you.coords - ]), - map(FadeIn, [self.jenny_plane, self.basis_vectors]), - map(Animation, [v, you, jenny]), + ])), + list(map(FadeIn, [self.jenny_plane, self.basis_vectors])), + list(map(Animation, [v, you, jenny])), )) self.play( ShowCreation(jenny.bubble), @@ -500,9 +500,9 @@ class IntroduceJennifer(JenniferScene): ) coord.target.next_to(basis.label.target, LEFT) coord.target.set_fill(basis.get_color(), opacity = 1) - self.play(*map(MoveToTarget, [ + self.play(*list(map(MoveToTarget, [ coord, basis, basis.label - ])) + ]))) self.wait() self.play(*[ ApplyMethod(m.shift, basis_vectors[0].get_end()) @@ -544,19 +544,19 @@ class IntroduceJennifer(JenniferScene): Transform(self.jenny.bubble, self.you.bubble), self.you.change_mode, "speaking", self.jenny.change_mode, "erm", - *map(MoveToTarget, [ + *list(map(MoveToTarget, [ self.jenny.coords, b1, b2, new_label1, new_label2, sum_vect - ]) + ])) ) self.play(Blink(self.you)) self.wait() self.play(*it.chain( - map(FadeOut, [ + list(map(FadeOut, [ self.jenny.bubble, self.jenny.coords, coord_mobs, sum_vect - ]), + ])), [ ApplyMethod(pi.change_mode, "plain") for pi in (self.jenny, self.you) @@ -608,11 +608,11 @@ class IntroduceJennifer(JenniferScene): FadeOut(b1_coords), self.jenny.change_mode, "speaking", self.you.change_mode, "confused", - *map(Animation, [ + *list(map(Animation, [ self.basis_vectors, b1_coords.mover, b2_coords.mover, - ]) + ])) ) self.play(MoveToTarget(b1_coords.mover)) self.play(MoveToTarget(b2_coords.mover)) @@ -692,7 +692,7 @@ class SpaceHasNoGrid(LinearTransformationScene): self.play( Write(words), FadeOut(self.plane), - *map(Animation, [self.i_hat, self.j_hat]) + *list(map(Animation, [self.i_hat, self.j_hat])) ) self.wait() @@ -768,7 +768,7 @@ class ShowOriginOfGrid(JenniferScene): self.wait() self.play( Transform(self.jenny_plane, self.plane), - *map(Animation, [origin_word, origin_dot, arrow]) + *list(map(Animation, [origin_word, origin_dot, arrow])) ) self.wait() self.play(Write(coords)) @@ -779,7 +779,7 @@ class ShowOriginOfGrid(JenniferScene): self.wait() self.play( self.jenny_plane.restore, - *map(Animation, [origin_word, origin_dot, arrow, coords]) + *list(map(Animation, [origin_word, origin_dot, arrow, coords])) ) for vect in self.b1, self.b2: self.play( @@ -847,7 +847,7 @@ class TranslateFromJenny(JenniferScene): everything.remove(submob) self.play( Transform(self.jenny_plane, self.plane), - *map(Animation, everything) + *list(map(Animation, everything)) ) self.play( self.you.change_mode, "confused", @@ -872,7 +872,7 @@ class TranslateFromJenny(JenniferScene): def perform_arithmetic(self): jenny_x, jenny_y = self.jenny.coords.get_entries().copy() - equals, plus, equals2 = syms = map(TexMobject, list("=+=")) + equals, plus, equals2 = syms = list(map(TexMobject, list("=+="))) result = Matrix([-4, 1]) result.set_height(self.you.coords.get_height()) for mob in syms + [self.you.coords, self.jenny.coords, result]: @@ -898,7 +898,7 @@ class TranslateFromJenny(JenniferScene): [self.you.coords, equals], ] for mover_set in mover_sets: - self.play(*map(MoveToTarget, mover_set)) + self.play(*list(map(MoveToTarget, mover_set))) self.wait() self.play( MoveToTarget(equals2), @@ -1102,14 +1102,14 @@ class ChangeOfBasisExample(JenniferScene): basis_vectors = [self.i_hat, self.j_hat], coord_mobs = v_coords.get_entries().copy(), ) - self.play(*map(FadeOut, [self.i_hat.label, self.j_hat.label])) + self.play(*list(map(FadeOut, [self.i_hat.label, self.j_hat.label]))) self.apply_transposed_matrix(self.cob_matrix().T) VGroup(self.i_hat, self.j_hat).fade() self.add(self.b1, self.b2) self.play( Transform(start_words, end_words), Transform(self.you, self.jenny), - *map(Write, [self.b1.label, self.b2.label]) + *list(map(Write, [self.b1.label, self.b2.label])) ) self.play(Blink(self.you)) self.show_linear_combination( @@ -1161,7 +1161,7 @@ class FeelsBackwards(Scene): inverse_word.next_to(matrix, LEFT, buff = MED_SMALL_BUFF) inverse_exponent = TexMobject("-1") inverse_exponent.next_to(matrix.get_corner(UP+RIGHT), RIGHT) - self.play(*map(Write, [inverse_word, inverse_exponent])) + self.play(*list(map(Write, [inverse_word, inverse_exponent]))) self.play( Swap(jenny_grid, our_grid), top_arrow.scale_in_place, 0.8, @@ -1327,7 +1327,7 @@ class SummarizeTranslationProcess(Scene): def define_matrix(self): matrix = Matrix([[2, -1], [1, 1]]) matrix.set_color_columns(X_COLOR, Y_COLOR) - A, equals = map(TexMobject, list("A=")) + A, equals = list(map(TexMobject, list("A="))) equation = VGroup(A, equals, matrix) equation.arrange_submobjects() equation.to_corner(UP+LEFT) @@ -1344,7 +1344,7 @@ class SummarizeTranslationProcess(Scene): self.add(A, equals, matrix) self.play( Write(words), - *map(ShowCreation, [arrow1, arrow2]) + *list(map(ShowCreation, [arrow1, arrow2])) ) self.A_copy = A.copy() @@ -1420,10 +1420,10 @@ class Prerequisites(Scene): h_line.next_to(title, DOWN) self.add(title, h_line) - prereqs = map(TextMobject, [ + prereqs = list(map(TextMobject, [ "Linear transformations", "Matrix multiplication", - ]) + ])) for direction, words in zip([LEFT, RIGHT], prereqs): rect = Rectangle(height = 9, width = 16) rect.set_height(3.5) @@ -1466,7 +1466,7 @@ class RotationExample(LinearTransformationScene): ) self.wait() - i_coords, j_coords = coord_arrays = map(Matrix, self.t_matrix) + i_coords, j_coords = coord_arrays = list(map(Matrix, self.t_matrix)) for coords, vect in zip(coord_arrays, [self.i_hat, self.j_hat]): coords.scale(0.7) coords.rect = BackgroundRectangle(coords) @@ -1550,7 +1550,7 @@ class JennyWatchesRotation(JenniferScene): Rotate(mob, np.pi/2, run_time = 3) for mob in (self.jenny_plane, self.b1, self.b2) ], - map(Animation, [jenny, jenny.bubble, matrix]) + list(map(Animation, [jenny, jenny.bubble, matrix])) )) self.play(jenny.change_mode, "pondering") self.play(Blink(jenny)) @@ -1598,13 +1598,13 @@ class HowToTranslateAMatrix(Scene): def construct(self): self.add_title() - arrays = VGroup(*map(Matrix, [ + arrays = VGroup(*list(map(Matrix, [ [["1/3", "-2/3"], ["5/3", "-1/3"]], [-1, 2], [[2, -1], [1, 1]], [[0, -1], [1, 0]], [[2, -1], [1, 1]], - ])) + ]))) result, her_vector, cob_matrix, transform, inv_cob = arrays neg_1 = TexMobject("-1") neg_1.next_to(inv_cob.get_corner(UP+RIGHT), RIGHT) @@ -1759,7 +1759,7 @@ class JennyWatchesRotationWithMatrixAndVector(JenniferScene): Rotate(mob, np.pi/2, run_time = 3) for mob in (self.jenny_plane, self.b1, self.b2, vector) ], - map(Animation, [self.jenny, matrix, vector_array]), + list(map(Animation, [self.jenny, matrix, vector_array])), )) self.play( self.jenny.change_mode, "pondering", diff --git a/old_projects/eola/footnote.py b/old_projects/eola/footnote.py index 43a2a188..9b27ae02 100644 --- a/old_projects/eola/footnote.py +++ b/old_projects/eola/footnote.py @@ -139,10 +139,7 @@ class PutTogether3x3Matrix(Scene): )) matrix.to_edge(DOWN) - start_entries = reduce(op.add, map( - lambda a : a.get_entries().split(), - arrays - )) + start_entries = reduce(op.add, [a.get_entries().split() for a in arrays]) target_entries = matrix.get_mob_matrix().transpose().flatten() start_l_bracket = i_array.get_brackets().split()[0] start_r_bracket = k_array.get_brackets().split()[1] @@ -190,7 +187,7 @@ class ShowVCoordinateMeaning(Scene): coords = Matrix(["x", "y", "z"]) eq2 = eq.copy() if self.post_transform: - L, l_paren, r_paren = map(TexMobject, "L()") + L, l_paren, r_paren = list(map(TexMobject, "L()")) parens = VMobject(l_paren, r_paren) parens.scale(2) parens.stretch_to_fit_height( @@ -199,11 +196,11 @@ class ShowVCoordinateMeaning(Scene): VMobject(L, l_paren, coords, r_paren).arrange_submobjects(buff = 0.1) coords.submobjects = [L, l_paren] + coords.submobjects + [r_paren] - lin_comb = VMobject(*map(TexMobject, [ + lin_comb = VMobject(*list(map(TexMobject, [ "x", self.i_str, "+", "y", self.j_str, "+", "z", self.k_str, - ])) + ]))) lin_comb.arrange_submobjects( RIGHT, buff = 0.1, aligned_edge = ORIGIN if self.post_transform else DOWN @@ -223,7 +220,7 @@ class ShowVCoordinateMeaning(Scene): if not self.post_transform: lin_comb.shift(0.35*UP) - self.play(*map(Write, [v, eq, coords])) + self.play(*list(map(Write, [v, eq, coords]))) self.wait() self.play( Transform( @@ -259,7 +256,7 @@ class ShowMatrixVectorMultiplication(Scene): for col in matrix.copy().get_mob_matrix().transpose() ] coords = x, y, z = [m.copy() for m in vect.get_entries().split()] - eq, plus1, plus2 = map(TexMobject, list("=++")) + eq, plus1, plus2 = list(map(TexMobject, list("=++"))) everything = VMobject( matrix, vect, eq, x, col1, plus1, @@ -285,17 +282,17 @@ class ShowMatrixVectorMultiplication(Scene): matrix_brace, vect_brace, result_brace = braces - self.play(*map(Write, [matrix, vect]), run_time = 2) + self.play(*list(map(Write, [matrix, vect])), run_time = 2) self.play(Write(matrix_brace, run_time = 1)) self.play(Write(vect_brace, run_time = 1)) - sexts = zip( + sexts = list(zip( matrix.get_mob_matrix().transpose(), columns, vect.get_entries().split(), coords, [eq, plus1, plus2], [X_COLOR, Y_COLOR, Z_COLOR] - ) + )) for o_col, col, start_coord, coord, sym, color in sexts: o_col = VMobject(*o_col) self.play( @@ -386,12 +383,12 @@ class QuestionsToPonder(Scene): title = TextMobject("Questions to ponder") title.set_color(YELLOW).to_edge(UP) self.add(title) - questions = VMobject(*map(TextMobject, [ + questions = VMobject(*list(map(TextMobject, [ "1. Can you visualize these transformations?", "2. Can you represent them with matrices?", "3. How many rows and columns?", "4. When can you multiply these matrices?", - ])) + ]))) questions.arrange_submobjects(DOWN, buff = 1, aligned_edge = LEFT) questions.to_edge(LEFT) for question in questions.split(): diff --git a/old_projects/eola/footnote2.py b/old_projects/eola/footnote2.py index 965378cf..3a23de09 100644 --- a/old_projects/eola/footnote2.py +++ b/old_projects/eola/footnote2.py @@ -137,7 +137,7 @@ class PlaneStartState(LinearTransformationScene): def construct(self): self.add_title("Input space") labels = self.get_basis_vector_labels() - self.play(*map(Write, labels)) + self.play(*list(map(Write, labels))) self.wait() class OutputIn3dWords(Scene): @@ -440,12 +440,12 @@ class TwoDTo1DTransform(LinearTransformationScene): self.remove(plane_words) mobjects = self.get_mobjects() self.play( - *map(FadeOut, mobjects) + [ShowCreation(line)] + *list(map(FadeOut, mobjects)) + [ShowCreation(line)] ) self.play(Write(line_words)) self.wait() self.remove(line_words) - self.play(*map(FadeIn, mobjects)) + self.play(*list(map(FadeIn, mobjects))) self.apply_transposed_matrix(self.t_matrix) self.play(Write(VMobject(*line.get_number_mobjects()))) self.wait() diff --git a/old_projects/eulers_characteristic_formula.py b/old_projects/eulers_characteristic_formula.py index 19b598b6..1c35d768 100644 --- a/old_projects/eulers_characteristic_formula.py +++ b/old_projects/eulers_characteristic_formula.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -from __future__ import absolute_import + import numpy as np import itertools as it from copy import deepcopy @@ -396,10 +396,7 @@ class IntroduceCycle(WalkingRandolph): def construct(self): WalkingRandolph.construct(self) self.remove(self.randy) - encompassed_cycles = filter( - lambda c : set(c).issubset(self.path), - self.graph.region_cycles - ) + encompassed_cycles = [c for c in self.graph.region_cycles if set(c).issubset(self.path)] regions = [ self.region_from_cycle(cycle) for cycle in encompassed_cycles @@ -473,8 +470,8 @@ class DefineSpanningTree(GraphScene): )) self.wait(2) - unneeded_edges = filter(out_of_spanning_set, self.graph.edges) - for edge, limit in zip(unneeded_edges, range(5)): + unneeded_edges = list(filter(out_of_spanning_set, self.graph.edges)) + for edge, limit in zip(unneeded_edges, list(range(5))): line = Line(self.points[edge[0]], self.points[edge[1]]) line.set_color("red") self.play(ShowCreation(line, run_time = 1.0)) @@ -617,10 +614,7 @@ class FacebookGraphAsAbstractSet(Scene): class ExamplesOfGraphs(GraphScene): def construct(self): buff = 0.5 - self.graph.vertices = map( - lambda v : v + DOWN + RIGHT, - self.graph.vertices - ) + self.graph.vertices = [v + DOWN + RIGHT for v in self.graph.vertices] GraphScene.construct(self) self.generate_regions() objects, notions = Mobject(*TextMobject( @@ -667,7 +661,7 @@ class ExamplesOfGraphs(GraphScene): self.wait() def handle_english_words(self, words1, words2): - words = map(TextMobject, ["graph", "grape", "gape", "gripe"]) + words = list(map(TextMobject, ["graph", "grape", "gape", "gripe"])) words[0].shift(RIGHT) words[1].shift(3*RIGHT) words[2].shift(3*RIGHT + 2*UP) @@ -773,17 +767,11 @@ class DrawDualGraph(GraphScene): outer_region = self.regions.pop() outer_region_mob = region_mobs.pop() outer_dual_vertex = self.dual_vertices.pop() - internal_edges = filter( - lambda e : abs(e.start[0]) < FRAME_X_RADIUS and \ + internal_edges = [e for e in self.dual_edges if abs(e.start[0]) < FRAME_X_RADIUS and \ abs(e.end[0]) < FRAME_X_RADIUS and \ abs(e.start[1]) < FRAME_Y_RADIUS and \ - abs(e.end[1]) < FRAME_Y_RADIUS, - self.dual_edges - ) - external_edges = filter( - lambda e : e not in internal_edges, - self.dual_edges - ) + abs(e.end[1]) < FRAME_Y_RADIUS] + external_edges = [e for e in self.dual_edges if e not in internal_edges] self.wait() self.reset_background() @@ -1050,10 +1038,7 @@ class MortimerCannotTraverseCycle(GraphScene): ) all_lines.append(line) center = line.get_center() - distances = map( - lambda e : np.linalg.norm(center - e.get_center()), - self.edges - ) + distances = [np.linalg.norm(center - e.get_center()) for e in self.edges] matching_edges.append( self.edges[distances.index(min(distances))] ) diff --git a/old_projects/fc1.py b/old_projects/fc1.py index 312187cc..43f8ac13 100644 --- a/old_projects/fc1.py +++ b/old_projects/fc1.py @@ -14,10 +14,10 @@ class CrossingOneMillion(TeacherStudentsScene): number.scale(3) self.look_at(number, run_time=0) - confetti_spirils = self.confetti_spirils = map( + confetti_spirils = self.confetti_spirils = list(map( NormalAnimationAsContinualAnimation, get_confetti_animations(50) - ) + )) self.add(*confetti_spirils) self.play( ChangeDecimalToValue( @@ -138,12 +138,12 @@ class AllFeaturedCreators(MortyPiCreatureScene): dots.arrange_submobjects(DOWN, buff=LARGE_BUFF) dots.to_edge(LEFT, buff=2) - creators = VGroup(*map(TextMobject, [ + creators = VGroup(*list(map(TextMobject, [ "Think Twice", "LeiosOS", "Welch Labs", "Infinity plus one", - ])) + ]))) for creator, dot in zip(creators, dots): creator.next_to(dot, RIGHT) @@ -151,16 +151,16 @@ class AllFeaturedCreators(MortyPiCreatureScene): dot.scale(4) dot.set_fill(opacity=0) - rects = VGroup(*map(SurroundingRectangle, creators)) + rects = VGroup(*list(map(SurroundingRectangle, creators))) rects.set_stroke(WHITE, 2) rects.set_fill(BLUE_E, 1) - think_words = VGroup(*map(TextMobject, [ + think_words = VGroup(*list(map(TextMobject, [ "(thinks visually)", "(thinks in terms of communities)", "(thinks in terms of series)", "(thinks playfully)", - ])) + ]))) for word, creator in zip(think_words, creators): # word.move_to(creator, RIGHT) # word.align_to(RIGHT, LEFT) diff --git a/old_projects/fourier.py b/old_projects/fourier.py index 60c2a828..f3219a27 100644 --- a/old_projects/fourier.py +++ b/old_projects/fourier.py @@ -108,12 +108,12 @@ class TODOInsertUnmixingSound(TODOStub): class OtherContexts(PiCreatureScene): def construct(self): - items = VGroup(*map(TextMobject, [ + items = VGroup(*list(map(TextMobject, [ "Extracting frequencies from sound", "Uncertainty principle", "Riemann Zeta function and primes", "Differential equations", - ])) + ]))) items.arrange_submobjects( DOWN, buff = MED_LARGE_BUFF, aligned_edge = LEFT @@ -319,7 +319,7 @@ class AddingPureFrequencies(PiCreatureScene): D_label.target.next_to(D_graph.target, UP) self.play(*it.chain( - map(MoveToTarget, movers), + list(map(MoveToTarget, movers)), [ ApplyMethod(mob.shift, FRAME_Y_RADIUS*DOWN, remover = True) for mob in (randy, speaker) @@ -352,7 +352,7 @@ class AddingPureFrequencies(PiCreatureScene): self.revert_to_original_skipping_status() self.play(GrowFromCenter(v_line)) self.play(FadeOut(v_line)) - self.play(*map(ShowCreation, lines)) + self.play(*list(map(ShowCreation, lines))) self.wait() self.play(MoveToTarget(sum_lines, path_arc = np.pi/4)) self.wait(2) @@ -469,9 +469,9 @@ class AddingPureFrequencies(PiCreatureScene): thin_new_sum_graph = new_sum_graph.copy().fade() self.play(*it.chain( - map(ShowCreation, [F_axes, C_axes, F_graph, C_graph]), - map(Write, [F_label, C_label]), - map(FadeOut, [self.sum_graph]) + list(map(ShowCreation, [F_axes, C_axes, F_graph, C_graph])), + list(map(Write, [F_label, C_label])), + list(map(FadeOut, [self.sum_graph])) )) self.play(ReplacementTransform( graphs.copy(), thin_new_sum_graph @@ -598,7 +598,7 @@ class BreakApartSum(Scene): run_time = 8, rate_func = None, ) - self.play(*map(FadeOut, [dot, v_line])) + self.play(*list(map(FadeOut, [dot, v_line]))) self.set_variables_as_attrs(axes, graph) @@ -814,7 +814,7 @@ class FourierMachineScene(Scene): "x_max" : 5.0, "x_axis_config" : { "unit_size" : 1.4, - "numbers_to_show" : range(1, 6), + "numbers_to_show" : list(range(1, 6)), }, "y_min" : -1.0, "y_max" : 1.0, @@ -1125,7 +1125,7 @@ class WrapCosineGraphAroundCircle(FourierMachineScene): self.play( FadeIn(words), LaggedStart(FadeIn, braces), - *map(ShowCreation, v_lines) + *list(map(ShowCreation, v_lines)) ) self.wait() self.play( @@ -1639,10 +1639,7 @@ class DrawFrequencyPlot(WrapCosineGraphAroundCircle, PiCreatureScene): added_anims = kwargs.get("added_anims", []) anims = [self.get_frequency_change_animation(self.graph, new_freq)] if hasattr(self, "winding_freq_label"): - freq_label = filter( - lambda sm : isinstance(sm, DecimalNumber), - self.winding_freq_label - )[0] + freq_label = [sm for sm in self.winding_freq_label if isinstance(sm, DecimalNumber)][0] anims.append(ChangeDecimalToValue(freq_label, new_freq)) if hasattr(self, "v_lines_indicating_periods"): anims.append(self.get_period_v_lines_update_anim()) @@ -1731,7 +1728,7 @@ class ShowLowerFrequency(DrawFrequencyPlot): self.play( Write(bps_label), LaggedStart(FadeIn, braces), - *map(ShowCreation, v_lines), + *list(map(ShowCreation, v_lines)), run_time = 1 ) self.wait() @@ -1791,7 +1788,7 @@ class ShowLowerFrequency(DrawFrequencyPlot): Write(com_words) ) self.wait() - self.play(*map(FadeOut, [arrow, com_words])) + self.play(*list(map(FadeOut, [arrow, com_words]))) self.change_frequency(0.0) self.wait() @@ -2473,7 +2470,7 @@ class ApplyFourierToFourier(DrawFrequencyPlot): "y_max" : 1.5, "x_max" : 5, "x_axis_config" : { - "numbers_to_show" : range(1, 5), + "numbers_to_show" : list(range(1, 5)), "unit_size" : 2.5, }, }, @@ -2918,11 +2915,11 @@ class WriteComplexExponentialExpression(DrawFrequencyPlot): ambient_ghost_dot_movement.rate = 0 self.remove(*updates) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ update.mobject for update in updates if update.mobject is not vector - ])) + ]))) self.play(ghost_dot.move_to, ORIGIN) exp_expression[1].add(minus, f) @@ -2981,9 +2978,9 @@ class WriteComplexExponentialExpression(DrawFrequencyPlot): self.play(Blink(morty)) self.play(morty.change, "hooray", rect) self.wait(2) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ morty, rect, graph_y_vector, vector - ])) + ]))) self.integrand = integrand @@ -3371,10 +3368,10 @@ class ScaleUpCenterOfMass(WriteComplexExponentialExpression): to_squish.generate_target() squish_factor = 0.75 to_squish.target.stretch(squish_factor, 0, about_edge = LEFT) - pairs = zip( + pairs = list(zip( to_squish.family_members_with_points(), to_squish.target.family_members_with_points() - ) + )) to_unsquish = list(axes.x_axis.numbers) + list(axes.labels) for sm, tsm in pairs: if sm in to_unsquish: @@ -3573,7 +3570,7 @@ class SummarizeTheFullTransform(DrawFrequencyPlot): "x_max" : 5, "x_axis_config" : { "unit_size" : 1, - "numbers_to_show" : range(1, 5), + "numbers_to_show" : list(range(1, 5)), }, "y_max" : 2, "y_min" : -2, @@ -3910,10 +3907,10 @@ class BoundsAtInfinity(SummarizeFormula): }, default_num_graph_points = 1000, ) - axes.x_axis.add_numbers(*filter( + axes.x_axis.add_numbers(*list(filter( lambda x : x != 0, - range(-8, 10, 2), - )) + list(range(-8, 10, 2)), + ))) axes.shift(DOWN) self.add(axes) diff --git a/old_projects/fractal_dimension.py b/old_projects/fractal_dimension.py index f4d0c1e2..a4c2659e 100644 --- a/old_projects/fractal_dimension.py +++ b/old_projects/fractal_dimension.py @@ -1,4 +1,4 @@ -from __future__ import print_function + from big_ol_pile_of_manim_imports import * from functools import reduce @@ -605,9 +605,9 @@ class FourSelfSimilarShapes(Scene): self.mention_measurements() def get_titles(self): - titles = VGroup(*map(TextMobject, [ + titles = VGroup(*list(map(TextMobject, [ "Line", "Square", "Cube", "Sierpinski" - ])) + ]))) for title, x in zip(titles, np.linspace(-0.75, 0.75, 4)): title.shift(x*FRAME_X_RADIUS*RIGHT) titles.to_edge(UP) @@ -656,7 +656,7 @@ class FourSelfSimilarShapes(Scene): FadeIn(brace_text) ) self.wait() - self.play(*map(FadeOut, [brace, brace_text])) + self.play(*list(map(FadeOut, [brace, brace_text]))) self.wait() for title in titles: @@ -702,12 +702,12 @@ class FourSelfSimilarShapes(Scene): def mention_measurements(self): line, square, cube, sierpinski = self.shapes_copy - labels = map(TextMobject, [ + labels = list(map(TextMobject, [ "$1/2$ length", "$1/4$ area", "$1/8$ volume", "You'll see...", - ]) + ])) for label, shape in zip(labels, self.shapes_copy): label.next_to(shape, DOWN) label.to_edge(DOWN, buff = MED_LARGE_BUFF) @@ -735,9 +735,9 @@ class GeneralWordForMeasurement(Scene): mass = TextMobject("Mass") mass.move_to(measure) - words = VGroup(*map(TextMobject, [ + words = VGroup(*list(map(TextMobject, [ "Length", "Area", "Volume" - ])) + ]))) words.arrange_submobjects(RIGHT, buff = 2*LARGE_BUFF) words.next_to(measure, DOWN, buff = 2*LARGE_BUFF) colors = color_gradient([BLUE_B, BLUE_D], len(words)) @@ -763,7 +763,7 @@ class GeneralWordForMeasurement(Scene): class ImagineShapesAsMetal(FourSelfSimilarShapes): def construct(self): - titles = VGroup(*map(VGroup, self.get_titles())) + titles = VGroup(*list(map(VGroup, self.get_titles()))) shapes = self.get_shapes(titles) shapes.shift(DOWN) descriptions = VGroup(*[ @@ -1030,7 +1030,7 @@ class DefineTwoDimensional(PiCreatureScene): self.scale_factor, ) brace.target = Brace(shape.target, LEFT) - self.play(*map(MoveToTarget, group)) + self.play(*list(map(MoveToTarget, group))) self.play(bottom_L.next_to, brace, LEFT) self.wait() @@ -1384,7 +1384,7 @@ class DimensionOfKoch(Scene): Transform(third, formula[0]), Transform(fourth, formula[-1]), ) - self.play(*map(FadeIn, formula[1:-1])) + self.play(*list(map(FadeIn, formula[1:-1]))) self.remove(third, fourth) self.add(formula) self.wait(2) @@ -1888,7 +1888,7 @@ class BoxCountingWithDisk(BoxCountingScene): approx = TexMobject("\\approx 2^2") approx.next_to(decimal, RIGHT, aligned_edge = DOWN) approx.shift_onto_screen() - self.play(*map(Write, [frac_line, decimal])) + self.play(*list(map(Write, [frac_line, decimal]))) self.play(Write(approx)) self.wait() @@ -2010,7 +2010,7 @@ class BoxCountingSierpinski(BoxCountingScene): counting_label = self.get_counting_label() self.play(ShowCreation(sierp)) - self.play(*map(FadeIn, [corner_rect, counting_label])) + self.play(*list(map(FadeIn, [corner_rect, counting_label]))) self.wait() counting_mob = self.count_boxes(boxes) self.wait() @@ -2033,7 +2033,7 @@ class BoxCountingSierpinski(BoxCountingScene): equals_exp.next_to(approx_three, RIGHT, aligned_edge = DOWN) equals_exp.shift_onto_screen() - self.play(*map(Write, [frac_line, approx_three])) + self.play(*list(map(Write, [frac_line, approx_three]))) self.wait() self.play(Write(equals_exp)) self.wait() @@ -2458,12 +2458,12 @@ class ListDimensionTypes(PiCreatureScene): "use_morty" : False, } def construct(self): - types = VGroup(*map(TextMobject, [ + types = VGroup(*list(map(TextMobject, [ "Box counting dimension", "Information dimension", "Hausdorff dimension", "Packing dimension" - ])) + ]))) types.arrange_submobjects(DOWN, aligned_edge = LEFT) for text in types: self.play( @@ -2735,7 +2735,7 @@ class CompareBritainAndNorway(Scene): self.add(britain_label, norway_label) self.play( - *map(ShowCreation, [norway, britain]), + *list(map(ShowCreation, [norway, britain])), run_time = 3 ) self.wait() diff --git a/old_projects/hanoi.py b/old_projects/hanoi.py index d7a759f8..8bebbcca 100644 --- a/old_projects/hanoi.py +++ b/old_projects/hanoi.py @@ -372,8 +372,8 @@ class TowersOfHanoiScene(Scene): self.move_disk_to_peg(disk_index, next_peg_index, **kwargs) def move_subtower_to_peg(self, num_disks, next_peg_index, **kwargs): - disk_indices = range(num_disks) - peg_indices = map(self.disk_index_to_peg_index, disk_indices) + disk_indices = list(range(num_disks)) + peg_indices = list(map(self.disk_index_to_peg_index, disk_indices)) if len(set(peg_indices)) != 1: warnings.warn("These disks don't make up a tower right now") self.move_disks_to_peg(disk_indices, next_peg_index, **kwargs) @@ -470,7 +470,7 @@ def get_binary_tex_mobs(num_list): nudge = zero_width + SMALL_BUFF for num in num_list: bin_string = bin(num)[2:]#Strip off the "0b" prefix - bits = VGroup(*map(TexMobject, bin_string)) + bits = VGroup(*list(map(TexMobject, bin_string))) for n, bit in enumerate(bits): bit.shift(n*nudge*RIGHT) bits.move_to(ORIGIN, RIGHT) @@ -782,7 +782,7 @@ class KeithShowingBinary(Scene): randy.bubble.set_fill(BLACK, opacity = 1) randy.bubble.write("Hold on...how does \\\\ binary work again?") - binary_tex_mobs = get_binary_tex_mobs(range(16)) + binary_tex_mobs = get_binary_tex_mobs(list(range(16))) binary_tex_mobs.shift(keith.get_corner(UP+LEFT)) binary_tex_mobs.shift(0.5*(UP+RIGHT)) bits_list = binary_tex_mobs.split() @@ -934,7 +934,7 @@ class RhythmOfDecimalCounting(CountingScene): self.wait() self.play( ten_group.restore, - *map(FadeOut, [brace, two_digits]) + *list(map(FadeOut, [brace, two_digits])) ) for x in range(89): @@ -986,7 +986,7 @@ class DecimalCountingAtHundredsScale(CountingScene): ).update(1) for x in range(10): - this_range = range(8) if x == 0 else range(9) + this_range = list(range(8)) if x == 0 else list(range(9)) for y in this_range: self.increment(run_time_per_anim = 0.25) self.increment(run_time_per_anim = 1) @@ -1095,7 +1095,7 @@ class IntroduceBinaryCounting(BinaryCountingScene): Transform(twos_place, fours_place), ) self.play(Blink(randy)) - self.play(*map(FadeOut, [bubble, curr_content])) + self.play(*list(map(FadeOut, [bubble, curr_content]))) #Up to 1000 for x in range(4): @@ -1105,7 +1105,7 @@ class IntroduceBinaryCounting(BinaryCountingScene): self.play( randy.change_mode, "happy", randy.look_at, self.number_mob, - *map(MoveToTarget, [brace, twos_place]) + *list(map(MoveToTarget, [brace, twos_place])) ) for x in range(8): self.increment(total_run_time = 1) @@ -1176,7 +1176,7 @@ class BinaryCountingAtEveryScale(Scene): bit_mob.set_color(YELLOW) bit_mob[0].set_color(MAROON_B) self.play(get_run_through(bit_mobs[1:2**(self.num_bits-1)])) - self.play(*map(FadeIn, [upper_brace, roll_over])) + self.play(*list(map(FadeIn, [upper_brace, roll_over]))) self.play(Transform( VGroup(*reversed(list(curr_bits))), VGroup(*reversed(list(bit_mobs[2**(self.num_bits-1)]))), @@ -1344,7 +1344,7 @@ class IntroduceSolveByCounting(TowersOfHanoiScene): disk[1].set_fill, BLACK, eights_bit.restore, ) - self.play(*map(FadeOut, [brace, words])) + self.play(*list(map(FadeOut, [brace, words]))) for disk_index in get_ruler_sequence(2): self.play(self.get_increment_animation()) self.move_disk(disk_index, stay_on_peg = False) @@ -1522,7 +1522,7 @@ class RecursiveSolution(TowersOfHanoiScene): ) self.wait() self.blink() - self.play(*map(FadeOut, [bubble, bubble.content])) + self.play(*list(map(FadeOut, [bubble, bubble.content]))) big_disk.remove(self.eyes) self.move_subtower_to_peg(3, 2, run_time = 2, added_anims = [ self.eyes.look_at_anim(self.pegs[2].get_top()), @@ -1553,7 +1553,7 @@ class RecursiveSolution(TowersOfHanoiScene): self.wait() self.play( GrowFromCenter(sub_sub_steps_brace), - *map(FadeOut, [arc, q_mark]) + *list(map(FadeOut, [arc, q_mark])) ) #Disk 2 frustration @@ -2043,9 +2043,9 @@ class RecursiveSolutionToConstrained(RecursiveSolution): for steps in subdivisions ] sub_steps_brace, sub_sub_steps_brace = braces[:2] - steps = VGroup(title, *it.chain(*zip( + steps = VGroup(title, *it.chain(*list(zip( braces, subdivisions - ))) + )))) steps.arrange_submobjects(DOWN) steps.to_edge(UP) @@ -2405,13 +2405,13 @@ class TernaryCountingSelfSimilarPattern(Scene): title = TextMobject("Count to " + "2"*self.num_trits) for i, color in enumerate(colors): title[-i-1].set_color(color) - steps = VGroup(*map(TextMobject, [ + steps = VGroup(*list(map(TextMobject, [ "Count to %s,"%("2"*(self.num_trits-1)), "Roll over,", "Count to %s,"%("2"*(self.num_trits-1)), "Roll over,", "Count to %s,"%("2"*(self.num_trits-1)), - ])) + ]))) steps.arrange_submobjects(RIGHT) for step in steps[::2]: for i, color in enumerate(colors[:-1]): @@ -2572,7 +2572,7 @@ class DescribeSolutionByCountingToConstrained(SolveConstrainedWithTernaryCountin ) self.move_next_disk(stay_on_peg = True) self.wait() - self.play(*map(FadeOut, [brace, word])) + self.play(*list(map(FadeOut, [brace, word]))) #Count up to 22 for x in range(5): @@ -2595,7 +2595,7 @@ class DescribeSolutionByCountingToConstrained(SolveConstrainedWithTernaryCountin self.wait() self.move_next_disk(stay_on_peg = True) self.wait() - self.play(*map(FadeOut, [braces[2], words[2]])) + self.play(*list(map(FadeOut, [braces[2], words[2]]))) for x in range(20): self.increment() @@ -2743,7 +2743,7 @@ class RepeatingConfiguraiton(Scene): arrows = VGroup(*[Arrow(LEFT, RIGHT) for x in range(9)]) arrows.add(VGroup()) arrows.scale(0.5) - group = VGroup(*it.chain(*zip(dots, arrows))) + group = VGroup(*it.chain(*list(zip(dots, arrows)))) group.arrange_submobjects() title = TextMobject("Same state twice") title.shift(3*UP) @@ -2780,7 +2780,7 @@ class ShowSomeGraph(Scene): title.scale(2) title.to_edge(UP) - nodes = VGroup(*map(Dot, [ + nodes = VGroup(*list(map(Dot, [ 2*LEFT, UP, DOWN, @@ -2788,7 +2788,7 @@ class ShowSomeGraph(Scene): 2*RIGHT+2*UP, 2*RIGHT+2*DOWN, 4*RIGHT+2*UP, - ])) + ]))) edge_pairs = [ (0, 1), (0, 2), @@ -2904,7 +2904,7 @@ class SierpinskiGraphScene(Scene): min_distance = self.distance_between_nodes(0, 1) min_distance *= 1.1 ##Just a little buff to be sure node_radius = self.nodes[0].get_width()/2 - for i, j in it.combinations(range(3**self.num_disks), 2): + for i, j in it.combinations(list(range(3**self.num_disks)), 2): center1 = self.nodes[i].get_center() center2 = self.nodes[j].get_center() vect = center1-center2 @@ -3002,7 +3002,7 @@ class IntroduceGraphStructure(SierpinskiGraphScene): arc.set_color(YELLOW) node.arc = arc - self.play(*map(MoveToTarget, nodes)) + self.play(*list(map(MoveToTarget, nodes))) edge = Line( nodes[0].get_right(), nodes[1].get_left(), color = YELLOW, @@ -3070,7 +3070,7 @@ class DescribeTriforcePattern(SierpinskiGraphScene): node.target.set_height(6) node.target.center().next_to(ORIGIN, vect) - self.play(*map(MoveToTarget, nodes)) + self.play(*list(map(MoveToTarget, nodes))) self.wait() self.play(*[node.restore for node in nodes]) bold_edges = [ @@ -3079,14 +3079,14 @@ class DescribeTriforcePattern(SierpinskiGraphScene): ] self.play(ShowCreation(bold_edges[0])) self.wait() - self.play(*map(ShowCreation, bold_edges[1:])) + self.play(*list(map(ShowCreation, bold_edges[1:]))) self.wait() power_of_three = 3**(self.scale-1) index_sets = [ - range(0, power_of_three), - range(power_of_three, 2*power_of_three), - range(2*power_of_three, 3*power_of_three), + list(range(0, power_of_three)), + list(range(power_of_three, 2*power_of_three)), + list(range(2*power_of_three, 3*power_of_three)), ] if self.first_connect_0_and_2_islands: index_sets = [index_sets[0], index_sets[2], index_sets[1]] @@ -3100,7 +3100,7 @@ class DescribeTriforcePattern(SierpinskiGraphScene): run_time = 1, rate_func = wiggle ) - self.play(*map(wiggle_island, islands[:2])) + self.play(*list(map(wiggle_island, islands[:2]))) self.wait() self.play(wiggle_island(islands[2])) self.wait() @@ -3205,12 +3205,12 @@ class PatreonThanks(Scene): special_thanks.set_color(YELLOW) special_thanks.shift(3*UP) - left_patrons = VGroup(*map(TextMobject, + left_patrons = VGroup(*list(map(TextMobject, self.specific_patrons[:n_patrons/2] - )) - right_patrons = VGroup(*map(TextMobject, + ))) + right_patrons = VGroup(*list(map(TextMobject, self.specific_patrons[n_patrons/2:] - )) + ))) for patrons, vect in (left_patrons, LEFT), (right_patrons, RIGHT): patrons.arrange_submobjects(DOWN, aligned_edge = LEFT) patrons.next_to(special_thanks, DOWN) diff --git a/old_projects/highD.py b/old_projects/highD.py index ea27a68f..f877024f 100644 --- a/old_projects/highD.py +++ b/old_projects/highD.py @@ -553,20 +553,13 @@ class BackAndForth(Scene): self.wait(3) for tup, eq, to_draw in (pair, circle_eq, circle), (triplet, sphere_eq, VMobject()): for mob in tup, eq: - mob.xyz = VGroup(*filter( - lambda sm : sm is not None, - map(mob.get_part_by_tex, "xyz") - )) + mob.xyz = VGroup(*[sm for sm in map(mob.get_part_by_tex, "xyz") if sm is not None]) self.play( ReplacementTransform(tup.xyz, eq.xyz), - FadeOut(VGroup(*filter( - lambda sm : sm not in tup.xyz, tup - ))), + FadeOut(VGroup(*[sm for sm in tup if sm not in tup.xyz])), ) self.play( - Write(VGroup(*filter( - lambda sm : sm not in eq.xyz, eq - ))), + Write(VGroup(*[sm for sm in eq if sm not in eq.xyz])), ShowCreation(to_draw) ) self.wait(3) @@ -576,11 +569,11 @@ class SphereForming(ExternallyAnimatedScene): class PreviousVideos(Scene): def construct(self): - titles = VGroup(*map(TextMobject, [ + titles = VGroup(*list(map(TextMobject, [ "Pi hiding in prime regularities", "Visualizing all possible pythagorean triples", "Borsuk-Ulam theorem", - ])) + ]))) titles.to_edge(UP, buff = MED_SMALL_BUFF) screen = ScreenRectangle(height = 6) screen.next_to(titles, DOWN) @@ -604,10 +597,10 @@ class AskAboutLongerLists(TeacherStudentsScene): "$(x_1, x_2, x_3, x_4)?$" ) tup = question[1] - alt_tups = map(TextMobject, [ + alt_tups = list(map(TextMobject, [ "$(x_1, x_2, x_3, x_4, x_5)?$", "$(x_1, x_2, \\dots, x_{99}, x_{100})?$" - ]) + ])) self.student_says(question, run_time = 1) self.wait() @@ -649,11 +642,11 @@ class Professionals(PiCreatureScene): self.analogies() def introduce_characters(self): - titles = VGroup(*map(TextMobject, [ + titles = VGroup(*list(map(TextMobject, [ "Mathematician", "Computer scientist", "Physicist", - ])) + ]))) self.remove(*self.pi_creatures) for title, pi in zip(titles, self.pi_creatures): title.next_to(pi, DOWN) @@ -718,7 +711,7 @@ class Professionals(PiCreatureScene): examples.add(Circle()) examples.arrange_submobjects(RIGHT, buff = 2) examples.to_edge(UP, buff = LARGE_BUFF) - labels = VGroup(*map(TextMobject, ["2D", "3D"])) + labels = VGroup(*list(map(TextMobject, ["2D", "3D"]))) title = TextMobject("Fly by instruments") title.scale(1.5) @@ -791,7 +784,7 @@ class OfferAHybrid(SliderScene): self.add(titles, h_line, v_lines, equation) self.wait() - self.play(*map(MoveToTarget, [titles, v_lines, equation])) + self.play(*list(map(MoveToTarget, [titles, v_lines, equation]))) self.play(Write(self.sliders, run_time = 1)) self.initialize_ambiant_slider_movement() self.wait(10) @@ -799,9 +792,9 @@ class OfferAHybrid(SliderScene): self.wait() def get_titles(self): - titles = VGroup(*map(TextMobject, [ + titles = VGroup(*list(map(TextMobject, [ "Analytic", "Hybrid", "Geometric" - ])) + ]))) titles.to_edge(UP) titles[1].set_color(BLUE) titles.generate_target() @@ -833,11 +826,11 @@ class DismissProjection(PiCreatureScene): self.transition_to_next_scene() def show_all_spheres(self): - equations = VGroup(*map(TexMobject, [ + equations = VGroup(*list(map(TexMobject, [ "x^2 + y^2 = 1", "x^2 + y^2 + z^2 = 1", "x^2 + y^2 + z^2 + w^2 = 1", - ])) + ]))) colors = [YELLOW, GREEN, BLUE] for equation, edge, color in zip(equations, [LEFT, ORIGIN, RIGHT], colors): equation.set_color(color) @@ -927,7 +920,7 @@ class DismissProjection(PiCreatureScene): sphere = self.spheres[-1] morty = self.pi_creature - alt_dims = VGroup(*map(TextMobject, ["5D", "6D", "7D"])) + alt_dims = VGroup(*list(map(TextMobject, ["5D", "6D", "7D"]))) alt_dims.next_to(morty.eyes, UP, SMALL_BUFF) alt_dim = alt_dims[0] @@ -968,7 +961,7 @@ class DismissProjection(PiCreatureScene): self.descriptor, self.pi_creature ]))) - self.play(*map(MoveToTarget, [equation, tup])) + self.play(*list(map(MoveToTarget, [equation, tup]))) self.wait() ### @@ -1172,7 +1165,7 @@ class TwoDimensionalCase(Introduce4DSliders): red_rects = VGroup() for slider in self.sliders: for x1, x2 in (-0.5, 0.5), (0.75, 1.0), (-1.0, -0.75): - p1, p2 = map(slider.number_to_point, [x1, x2]) + p1, p2 = list(map(slider.number_to_point, [x1, x2])) rect = Rectangle( stroke_width = 0, fill_opacity = 0.5, @@ -1236,7 +1229,7 @@ class TwoDimensionalCase(Introduce4DSliders): self.reset_dials([1, 0], run_time = 1) self.reset_dials([0.9, -np.sqrt(0.19)], run_time = 2) self.play(FadeOut(self.real_estate_rects)) - self.play(*map(FadeOut, [x_brace, y_brace, x_text, y_text])) + self.play(*list(map(FadeOut, [x_brace, y_brace, x_text, y_text]))) self.wait() def note_circle_steepness(self): @@ -1623,7 +1616,7 @@ class TwoDBoxExample(Scene): rate_func = smooth, )) self.wait(0.5) - self.play(*map(FadeOut, [radius, r_equals_1])) + self.play(*list(map(FadeOut, [radius, r_equals_1]))) self.wait() self.corner_radius = radius @@ -1705,7 +1698,7 @@ class TwoDBoxExample(Scene): self.play(ReplacementTransform(sqrt_1_plus_1, sqrt_2)) self.play( Write(root_2_value, run_time = 1), - *map(FadeOut, [bottom_one, side_one]) + *list(map(FadeOut, [bottom_one, side_one])) ) self.wait() self.play(ShowCreation(corner_radius)) @@ -2040,7 +2033,7 @@ class TwoDBoxWithSliders(TwoDimensionalCase): ) self.wait(5) self.wind_down_ambient_movement(wait = False) - self.play(*map(FadeOut, [x_brace, phrases[0]])) + self.play(*list(map(FadeOut, [x_brace, phrases[0]]))) def swap_with_top_right_circle(self): alt_circle = self.corner_circles[0] @@ -2088,7 +2081,7 @@ class TwoDBoxWithSliders(TwoDimensionalCase): self.wait() self.wind_down_ambient_movement(0) self.reset_dials(target_vector) - self.play(*map(ShowCreation, [h_line, v_line])) + self.play(*list(map(ShowCreation, [h_line, v_line]))) self.wait() re_line = DashedLine( @@ -2480,7 +2473,7 @@ class FourDBoxExampleWithSliders(ThreeDBoxExampleWithSliders): sphere_words.shift(2*UP) self.add(sphere_words) - pairs = zip(self.coordinate_mobs, self.coordinates) + pairs = list(zip(self.coordinate_mobs, self.coordinates)) for coord_mob, coords in pairs[1:] + [pairs[0]]: coord_mob.set_color(GREEN) coord_mob_copy = coord_mob.copy() @@ -2503,9 +2496,9 @@ class FourDBoxExampleWithSliders(ThreeDBoxExampleWithSliders): self.play( self.sliders.center, sphere_words.shift, LEFT, - *map(FadeOut, [ + *list(map(FadeOut, [ self.coordinate_mobs, self.box_vertices_title - ]) + ])) ) self.initialize_ambiant_slider_movement() self.wait(4) @@ -3169,7 +3162,7 @@ class ProportionOfSphereInBox(GraphScene): "x_min" : 0, "x_max" : 50, "x_tick_frequency" : 5, - "x_labeled_nums" : range(10, 50, 10), + "x_labeled_nums" : list(range(10, 50, 10)), "num_graph_anchor_points" : 100, } def construct(self): @@ -3280,12 +3273,12 @@ class FunHighDSpherePhenomena(Scene): h_line.next_to(title, DOWN) self.add(title, h_line) - items = VGroup(*map(TextMobject, [ + items = VGroup(*list(map(TextMobject, [ "$\\cdot$ Most volume is near the equator", "$\\cdot$ Most volume is near the surface", "$\\cdot$ Sphere packing in 8 dimensions", "$\\cdot$ Sphere packing in 24 dimensions", - ])) + ]))) items.arrange_submobjects( DOWN, buff = MED_LARGE_BUFF, aligned_edge = LEFT ) @@ -3449,10 +3442,10 @@ class Announcements(TeacherStudentsScene): h_line.next_to(title, DOWN) self.add(title, h_line) - items = VGroup(*map(TextMobject, [ + items = VGroup(*list(map(TextMobject, [ "$\\cdot$ Where to learn more", "$\\cdot$ Q\\&A Followup (podcast!)", - ])) + ]))) items.arrange_submobjects(DOWN, aligned_edge = LEFT) items.next_to(h_line, DOWN) diff --git a/old_projects/hilbert/fractal_porn.py b/old_projects/hilbert/fractal_porn.py index 55617593..6199ff9e 100644 --- a/old_projects/hilbert/fractal_porn.py +++ b/old_projects/hilbert/fractal_porn.py @@ -132,12 +132,12 @@ class SurpriseFractal(Intro): class IntroduceKoch(Intro): def construct(self): - words = map(TextMobject, [ + words = list(map(TextMobject, [ "This is another famous fractal.", "The ``Koch Snowflake''", "Let's finish things off by seeing how to turn \ this into a space-filling curve" - ]) + ])) for text in words: text.to_edge(UP) @@ -185,12 +185,12 @@ class FromKochToSpaceFilling(Scene): def revisit_koch(self): - words = map(TextMobject, [ + words = list(map(TextMobject, [ "First, look at how one section of this curve is made.", "This pattern of four lines is the ``seed''", "With each iteration, every straight line is \ replaced with an appropriately small copy of the seed", - ]) + ])) for text in words: text.to_edge(UP) @@ -266,12 +266,12 @@ class FromKochToSpaceFilling(Scene): seed.shift(3*LEFT+2*DOWN) fractal = TextMobject("Fractal") fractal.shift(3*RIGHT+2*DOWN) - words = map(TextMobject, [ + words = list(map(TextMobject, [ "A sharper angle results in a richer curve", "A more obtuse angle gives a sparser curve", "And as the angle approaches 0\\dots", "We have a new space-filling curve." - ]) + ])) for text in words: text.to_edge(UP) sharper, duller, space_filling = [ diff --git a/old_projects/hilbert/section1.py b/old_projects/hilbert/section1.py index 5d797d91..d8ccdc2b 100644 --- a/old_projects/hilbert/section1.py +++ b/old_projects/hilbert/section1.py @@ -59,10 +59,10 @@ class AboutSpaceFillingCurves(TransformOverIncreasingOrders): "|\\mathds{N}|" ]).scale(2).split() infinity = TexMobject("\\infty").scale(2) - local_mobjects = filter( + local_mobjects = list(filter( lambda m : isinstance(m, Mobject), - locals().values(), - ) + list(locals().values()), + )) for mob in local_mobjects: mob.sort_points(np.linalg.norm) @@ -225,7 +225,7 @@ class SoundDataIsOneDimensional(Scene): center = 2*DOWN + UP*k ) for k, color in zip( - range(overtones), + list(range(overtones)), Color(BLUE_E).range_to(WHITE, overtones) ) ] @@ -600,7 +600,7 @@ class WeaveLineThroughPixels(Scene): side_length = unit, color = WHITE ).shift(x*right+y*up) - for x, y in it.product(range(2**order), range(2**order)) + for x, y in it.product(list(range(2**order)), list(range(2**order))) ]) squares.center() targets = Mobject() @@ -813,7 +813,7 @@ class Order3PseudoHilbertCurve(Scene): self.wait() self.play(ShowCreation(grid8)) self.wait() - self.play(*map(GrowFromCenter, mini_curves)) + self.play(*list(map(GrowFromCenter, mini_curves))) self.wait() self.clear() self.add(words, grid8, *mini_curves) diff --git a/old_projects/hilbert/section2.py b/old_projects/hilbert/section2.py index 73291a7a..67979514 100644 --- a/old_projects/hilbert/section2.py +++ b/old_projects/hilbert/section2.py @@ -16,7 +16,7 @@ def get_time_line(): tick_frequency = 10, leftmost_tick = 1720, number_at_center = 1870, - numbers_with_elongated_ticks = range(1700, 2100, 100) + numbers_with_elongated_ticks = list(range(1700, 2100, 100)) ) time_line.sort_points(lambda p : p[0]) time_line.set_color_by_gradient( @@ -24,7 +24,7 @@ def get_time_line(): PeanoCurve.CONFIG["end_color"] ) time_line.add_numbers( - 2020, *range(1800, 2050, 50) + 2020, *list(range(1800, 2050, 50)) ) return time_line @@ -599,7 +599,7 @@ class FormalDefinitionOfContinuity(Scene): Homotopy(self.output_homotopy, self.output_dot, **kwargs) ) - A, B = map(Mobject.get_center, [self.input_dot, self.output_dot]) + A, B = list(map(Mobject.get_center, [self.input_dot, self.output_dot])) A_text = TextMobject("A") A_text.shift(A+2*(LEFT+UP)) A_arrow = Arrow( diff --git a/old_projects/inventing_math.py b/old_projects/inventing_math.py index 76346d37..677d0f81 100644 --- a/old_projects/inventing_math.py +++ b/old_projects/inventing_math.py @@ -524,7 +524,7 @@ class OrganizePartialSums(Scene): partial_sums = TexMobject(PARTIAL_CONVERGENT_SUMS_TEXT, size = "\\small") partial_sums.scale(1.5).to_edge(UP) partial_sum_parts = partial_sums.split() - for x in [0] + range(2, len(partial_sum_parts), 4): + for x in [0] + list(range(2, len(partial_sum_parts), 4)): partial_sum_parts[x].set_color("yellow") pure_sums = [ partial_sum_parts[x] @@ -661,7 +661,7 @@ class ListOfPartialSums(Scene): size = "\\large" ).split()) numbers, equals, sums = [ - all_terms[range(k, 12, 3)] + all_terms[list(range(k, 12, 3))] for k in (0, 1, 2) ] dots = all_terms[12] @@ -738,10 +738,7 @@ class CircleZoomInOnOne(Scene): text = TextMobject( "All but finitely many dots fall inside even the tiniest circle." ) - numbers = map( - lambda s : TexMobject("\\frac{1}{%s}"%s), - ["100", "1,000,000", "g_{g_{64}}"] - ) + numbers = [TexMobject("\\frac{1}{%s}"%s) for s in ["100", "1,000,000", "g_{g_{64}}"]] for num in numbers + [text]: num.shift(2*UP) num.sort_points(lambda p : np.dot(p, DOWN+RIGHT)) @@ -796,10 +793,7 @@ class ZoomInOnOne(Scene): self.add(one) def zoom_with_numbers(self, numbers, next_numbers): - all_numbers = map( - lambda n_u: TexMobject(str(n_u[0])).scale(0.5).shift(0.4*DOWN+2*n_u[1]*RIGHT), - zip(numbers+next_numbers, it.cycle([-1, 1])) - ) + all_numbers = [TexMobject(str(n_u[0])).scale(0.5).shift(0.4*DOWN+2*n_u[1]*RIGHT) for n_u in zip(numbers+next_numbers, it.cycle([-1, 1]))] num_levels = 3 scale_factor = 10 @@ -887,8 +881,8 @@ class DefineInfiniteSum(Scene): if count % 3 == 2: self.wait(0.5) self.wait() - esses = np.array(terms)[range(0, len(terms), 3)] - other_terms = filter(lambda m : m not in esses, terms) + esses = np.array(terms)[list(range(0, len(terms), 3))] + other_terms = [m for m in terms if m not in esses] self.play(*[ ApplyMethod(ess.set_color, "yellow") for ess in esses @@ -988,14 +982,14 @@ class ChopIntervalInProportions(Scene): if mode == "p": num_terms = 4 prop = 0.7 - left_terms = map(TexMobject, ["(1-p)", ["p","(1-p)"]]+[ + left_terms = list(map(TexMobject, ["(1-p)", ["p","(1-p)"]]+[ ["p^%d"%(count), "(1-p)"] for count in range(2, num_terms) - ]) - right_terms = map(TexMobject, ["p"] + [ + ])) + right_terms = list(map(TexMobject, ["p"] + [ ["p", "^%d"%(count+1)] for count in range(1, num_terms) - ]) + ])) interval = zero_to_one_interval() left = INTERVAL_RADIUS*LEFT right = INTERVAL_RADIUS*RIGHT @@ -1315,7 +1309,7 @@ class ListPartialDivergentSums(Scene): for n in range(num_lines) ] terms = TexMobject( - list(it.chain.from_iterable(zip(rhss, lhss))) + ["\\vdots&", ""], + list(it.chain.from_iterable(list(zip(rhss, lhss)))) + ["\\vdots&", ""], size = "\\large" ).shift(RIGHT).split() words = TextMobject("These numbers don't \\\\ approach anything") @@ -1792,7 +1786,7 @@ class RoomsAndSubroomsWithNumbers(Scene): def draw_remaining_rectangles(self, rectangles): clusters = [] - centers = [ORIGIN] + map(Mobject.get_center, rectangles) + centers = [ORIGIN] + list(map(Mobject.get_center, rectangles)) shift_vals = [ 2*(c2 - c1)[0]*RIGHT for c1, c2 in zip(centers[1:], centers) @@ -1800,10 +1794,7 @@ class RoomsAndSubroomsWithNumbers(Scene): for rectangle, count in zip(rectangles, it.count(1)): cluster = [rectangle] for shift_val in shift_vals[:count]: - cluster += map( - lambda mob : mob.shift(shift_val), - deepcopy(cluster) - ) + cluster += [mob.shift(shift_val) for mob in deepcopy(cluster)] clusters.append(cluster) for rect in cluster[1:]: self.play(FadeIn(rect, run_time = 0.6**(count-1))) @@ -1875,7 +1866,7 @@ class RoomsAndSubroomsWithNumbers(Scene): def center_in_closest_rect(mobject, rectangles): center = mobject.get_center() diffs = [r.get_center()-center for r in rectangles] - mobject.shift(diffs[np.argmin(map(np.linalg.norm, diffs))]) + mobject.shift(diffs[np.argmin(list(map(np.linalg.norm, diffs)))]) def add_negative_one(self, num_mobs): neg_one = TexMobject("-1").scale(0.5) @@ -1901,10 +1892,7 @@ class RoomsAndSubroomsWithNumbers(Scene): self.add(text) self.clear_way_for_text(text, cluster) self.add(*cluster) - pairs = filter( - lambda a_b : (a_b[0]-a_b[1])%(2**count) == 0 and (a_b[0]-a_b[1])%(2**(count+1)) != 0, - it.combinations(range(16), 2) - ) + pairs = [a_b for a_b in it.combinations(list(range(16)), 2) if (a_b[0]-a_b[1])%(2**count) == 0 and (a_b[0]-a_b[1])%(2**(count+1)) != 0] for pair in sample(pairs, min(10, len(pairs))): for index in pair: num_mobs[index].set_color("green") @@ -2086,7 +2074,7 @@ class FuzzyDiscoveryToNewMath(Scene): ) ] midpoints = [] - triplets = zip(fuzzy_discoveries, new_maths, it.count(2, -1.75)) + triplets = list(zip(fuzzy_discoveries, new_maths, it.count(2, -1.75))) for disc, math, count in triplets: math.scale(0.65) for mob in disc, math: @@ -2095,7 +2083,7 @@ class FuzzyDiscoveryToNewMath(Scene): midpoints.append(count*UP) self.add(fuzzy, lines) - self.play(*map(ShimmerIn, fuzzy_discoveries)) + self.play(*list(map(ShimmerIn, fuzzy_discoveries))) self.wait() self.play(DelayByOrder(Transform( deepcopy(fuzzy), new_math diff --git a/old_projects/inventing_math_images.py b/old_projects/inventing_math_images.py index 655277cc..b6d1b712 100644 --- a/old_projects/inventing_math_images.py +++ b/old_projects/inventing_math_images.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -from __future__ import absolute_import + import numpy as np import itertools as it from copy import deepcopy @@ -30,7 +30,7 @@ class SimpleText(Scene): ] @staticmethod def args_to_string(text): - return initials(filter(lambda c : c in string.letters + " ", text)) + return initials([c for c in text if c in string.letters + " "]) def construct(self, text): self.add(TextMobject(text)) diff --git a/old_projects/leibniz.py b/old_projects/leibniz.py index 4499ae77..50aeca5f 100644 --- a/old_projects/leibniz.py +++ b/old_projects/leibniz.py @@ -43,7 +43,7 @@ class LatticePointScene(Scene): def setup_lattice_points(self): M = self.max_lattice_point_radius - int_range = range(-M, M+1) + int_range = list(range(-M, M+1)) self.lattice_points = VGroup() for x, y in it.product(*[int_range]*2): r_squared = x**2 + y**2 @@ -91,10 +91,7 @@ class LatticePointScene(Scene): return radial_line, root_label def get_lattice_points_on_r_squared_circle(self, r_squared): - points = VGroup(*filter( - lambda dot : dot.r_squared == r_squared, - self.lattice_points - )) + points = VGroup(*[dot for dot in self.lattice_points if dot.r_squared == r_squared]) points.sort_submobjects( lambda p : angle_of_vector(p-self.plane_center)%(2*np.pi) ) @@ -122,8 +119,8 @@ class LatticePointScene(Scene): def add_axis_labels(self, spacing = 2): x_max = int(self.plane.point_to_coords(FRAME_X_RADIUS*RIGHT)[0]) y_max = int(self.plane.point_to_coords(FRAME_Y_RADIUS*UP)[1]) - x_range = range(spacing, x_max, spacing) - y_range = range(spacing, y_max, spacing) + x_range = list(range(spacing, x_max, spacing)) + y_range = list(range(spacing, y_max, spacing)) for r in x_range, y_range: r += [-n for n in r] tick = Line(ORIGIN, MED_SMALL_BUFF*UP) @@ -297,7 +294,7 @@ class ShowSum(TeacherStudentsScene): for n in range(self.num_terms_to_add) ] partial_sums = np.cumsum(numbers) - points = map(line.number_to_point, partial_sums) + points = list(map(line.number_to_point, partial_sums)) arrows = [ Arrow( p1, p2, @@ -327,7 +324,7 @@ class ShowSum(TeacherStudentsScene): fading_terms = [ TexMobject(sign + "\\frac{1}{%d}"%(2*n + 1)) for n, sign in zip( - range(self.num_terms_to_add), + list(range(self.num_terms_to_add)), it.cycle("+-") ) ] @@ -473,7 +470,7 @@ class CertainRegularityInPrimes(LatticePointScene): self.get_radial_line_with_label(np.sqrt(p)) for p in primes ] - lines, labels = zip(*lines_and_labels) + lines, labels = list(zip(*lines_and_labels)) circles = [ self.get_circle(np.sqrt(p)) for p in primes @@ -617,7 +614,7 @@ class Outline(PiCreatureScene): self.wait() def show_chi(self): - input_range = range(1, 7) + input_range = list(range(1, 7)) chis = VGroup(*[ TexMobject("\\chi(%d)"%n) for n in input_range @@ -774,7 +771,7 @@ class CountLatticePoints(LatticePointScene): run_time = 2, ) self.wait(2) - self.play(*map(FadeOut, [label, lines, example_dot])) + self.play(*list(map(FadeOut, [label, lines, example_dot]))) def draw_lattice_points_in_circle(self): circle = self.get_circle() @@ -798,7 +795,7 @@ class CountLatticePoints(LatticePointScene): self.add_foreground_mobject(brace) self.draw_lattice_points() self.wait() - self.play(*map(FadeOut, [brace, radius])) + self.play(*list(map(FadeOut, [brace, radius]))) self.circle = circle @@ -1036,12 +1033,12 @@ class CountThroughRings(LatticePointScene): self.wait() self.play(Transform(distance, distance_num)) self.wait(3) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ self.example_circle, self.points_on_example_circle, distance, a, b, radial_line, h_line, v_line, label - ])) + ]))) def count_through_rings(self): counts = [ @@ -1053,7 +1050,7 @@ class CountThroughRings(LatticePointScene): "\\sqrt{%d} \\Rightarrow"%n, str(count) ) for n, count in zip( - range(self.num_rings_to_show_explicitly), + list(range(self.num_rings_to_show_explicitly)), counts ) ]) @@ -1285,11 +1282,11 @@ class LookAtExampleRing(LatticePointScene): self.wait() self.play(points.restore, run_time = 2) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ curr_label, curr_sum_of_squares, circle, points, radius, root_label - ])) + ]))) def analyze_11(self): R = np.sqrt(11) @@ -1406,7 +1403,7 @@ class IntroduceComplexConjugate(LatticePointScene): label.add_background_rectangle() label.next_to(dot, UP+RIGHT, buff = 0) - y_range = range(-9, 10, 3) + y_range = list(range(-9, 10, 3)) ticks = VGroup(*[ Line( ORIGIN, MED_SMALL_BUFF*RIGHT @@ -1440,14 +1437,14 @@ class IntroduceComplexConjugate(LatticePointScene): ) self.play(FadeIn(tuple_label)) self.wait() - self.play(*map(FadeOut, [tuple_label, y_coord])) - self.play(*map(FadeIn, [complex_label, imag_y_coord])) - self.play(*map(Write, [imag_coords, ticks])) + self.play(*list(map(FadeOut, [tuple_label, y_coord]))) + self.play(*list(map(FadeIn, [complex_label, imag_y_coord]))) + self.play(*list(map(Write, [imag_coords, ticks]))) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ v_arrow, h_arrow, x_coord, imag_y_coord, - ])) + ]))) self.complex_label = complex_label self.example_dot = dot @@ -1516,7 +1513,7 @@ class IntroduceComplexConjugate(LatticePointScene): morty = Mortimer().to_edge(DOWN) randy.make_eye_contact(morty) - self.play(*map(FadeIn, [randy, morty])) + self.play(*list(map(FadeIn, [randy, morty]))) self.play(PiCreatureSays( randy, "Wait \\dots why?", target_mode = "confused", @@ -1540,7 +1537,7 @@ class IntroduceComplexConjugate(LatticePointScene): self.play(Blink(morty)) self.play(randy.change_mode, "pondering") self.play(RemovePiCreatureBubble(morty)) - self.play(*map(FadeOut, [randy, morty])) + self.play(*list(map(FadeOut, [randy, morty]))) def expand_algebraically(self): x, y = self.example_coords @@ -1596,11 +1593,11 @@ class IntroduceComplexConjugate(LatticePointScene): Transform(expansion[1], alt_y_term), ) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ expansion[0].rect, expansion[1].rect, expansion - ])) + ]))) def discuss_geometry(self): randy = Randolph(color = BLUE_C) @@ -1613,7 +1610,7 @@ class IntroduceComplexConjugate(LatticePointScene): screen = ScreenRectangle(height = 3.5) screen.to_corner(DOWN+RIGHT, buff = MED_SMALL_BUFF) - self.play(*map(FadeIn, [randy, morty])) + self.play(*list(map(FadeIn, [randy, morty]))) self.play(PiCreatureSays( morty, "More geometry!", target_mode = "hooray", @@ -1639,7 +1636,7 @@ class IntroduceComplexConjugate(LatticePointScene): self.play(Blink(morty)) self.play(RemovePiCreatureBubble(randy, target_mode = "pondering")) self.wait() - self.play(*map(FadeOut, [randy, morty, screen])) + self.play(*list(map(FadeOut, [randy, morty, screen]))) def show_geometrically(self): dots = [self.example_dot, self.conjugate_dot] @@ -1795,7 +1792,7 @@ class NameGaussianIntegers(LatticePointScene): run_time = 1, rate_func = smooth, about_point = self.plane_center ), - *map(GrowFromCenter, dots) + *list(map(GrowFromCenter, dots)) ) self.play(Write(root_label)) self.wait() @@ -1841,10 +1838,10 @@ class NameGaussianIntegers(LatticePointScene): ]) dot.conjugate_dot = self.circle_dots[-i] - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ self.a_plus_bi, self.integers_label, self.gaussian_integers, - ])) + ]))) last_dot = None for dot in self.circle_dots: @@ -1857,7 +1854,7 @@ class NameGaussianIntegers(LatticePointScene): FadeIn(dot.equation), FadeIn(dot.label), ] - anims += map(ShowCreation, dot.line_pair) + anims += list(map(ShowCreation, dot.line_pair)) else: anims += [ last_dot.set_color, self.dot_color, @@ -2056,7 +2053,7 @@ class IntroduceGaussianPrimes(LatticePointScene, PiCreatureScene): VGroup(p1_dot, p2_dot) ) ) - self.play(*map(Write, [p1_label, p2_label])) + self.play(*list(map(Write, [p1_label, p2_label]))) self.wait() self.play(Write(gaussian_prime)) self.wait() @@ -2157,7 +2154,7 @@ class FromIntegerFactorsToGaussianFactors(TeacherStudentsScene): mob.copy(), mob.factors ), - *map(ShowCreation, mob.arrows) + *list(map(ShowCreation, mob.arrows)) ) self.wait() self.play(*[ @@ -2191,8 +2188,8 @@ class FactorizationPattern(Scene): x_min = 0, x_max = 36, unit_size = 0.4, - numbers_to_show = range(0, 33, 4), - numbers_with_elongated_ticks = range(0, 33, 4), + numbers_to_show = list(range(0, 33, 4)), + numbers_with_elongated_ticks = list(range(0, 33, 4)), ) line.shift(2*DOWN) line.to_edge(LEFT) @@ -2208,7 +2205,7 @@ class FactorizationPattern(Scene): for prime in primes ]) dots.set_color(GREEN) - prime_mobs = VGroup(*map(TexMobject, map(str, primes))) + prime_mobs = VGroup(*list(map(TexMobject, list(map(str, primes))))) arrows = VGroup() for prime_mob, dot in zip(prime_mobs, dots): prime_mob.next_to(dot, UP, LARGE_BUFF) @@ -2236,9 +2233,9 @@ class FactorizationPattern(Scene): factorization.add(v_dots) self.play(*it.chain( - map(Write, prime_mobs), - map(ShowCreation, arrows), - map(DrawBorderThenFill, dots), + list(map(Write, prime_mobs)), + list(map(ShowCreation, arrows)), + list(map(DrawBorderThenFill, dots)), )) self.wait() self.play(*[ @@ -2255,7 +2252,7 @@ class FactorizationPattern(Scene): submobject_mode = "lagged_start" )) self.wait(4) - self.play(*map(FadeOut, [movers, factorizations])) + self.play(*list(map(FadeOut, [movers, factorizations]))) def show_three_mod_four_primes(self): primes = [3, 7, 11, 19, 23, 31] @@ -2264,7 +2261,7 @@ class FactorizationPattern(Scene): for prime in primes ]) dots.set_color(RED) - prime_mobs = VGroup(*map(TexMobject, map(str, primes))) + prime_mobs = VGroup(*list(map(TexMobject, list(map(str, primes))))) arrows = VGroup() for prime_mob, dot in zip(prime_mobs, dots): prime_mob.next_to(dot, UP, LARGE_BUFF) @@ -2285,17 +2282,17 @@ class FactorizationPattern(Scene): ]) self.play(*it.chain( - map(Write, prime_mobs), - map(ShowCreation, arrows), - map(DrawBorderThenFill, dots), + list(map(Write, prime_mobs)), + list(map(ShowCreation, arrows)), + list(map(DrawBorderThenFill, dots)), )) self.wait() self.play( Write(words), - *map(ShowCreation, word_arrows) + *list(map(ShowCreation, word_arrows)) ) self.wait(4) - self.play(*map(FadeOut, [words, word_arrows])) + self.play(*list(map(FadeOut, [words, word_arrows]))) def ask_why_this_is_true(self): randy = Randolph(color = BLUE_C) @@ -2320,10 +2317,10 @@ class FactorizationPattern(Scene): self.wait() self.play(FadeIn(links_text)) self.wait(2) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ randy, randy.bubble, randy.bubble.content, links_text - ])) + ]))) def show_two(self): two_dot = Dot(self.number_line.number_to_point(2)) @@ -2493,9 +2490,9 @@ class IntroduceRecipe(Scene): factors = self.integer_factors symbols = ["="] + ["\\cdot"]*(len(factors)-1) - factorization = TexMobject(*it.chain(*zip( - symbols, map(str, factors) - ))) + factorization = TexMobject(*it.chain(*list(zip( + symbols, list(map(str, factors)) + )))) factorization.next_to(N_mob.target, RIGHT) self.play(MoveToTarget( @@ -2512,7 +2509,7 @@ class IntroduceRecipe(Scene): def subfactor_ordinary_factorization(self): factors = self.gaussian_factors factorization = TexMobject( - "=", *map(self.complex_number_to_tex, factors) + "=", *list(map(self.complex_number_to_tex, factors)) ) max_width = FRAME_WIDTH - 2 if factorization.get_width() > max_width: @@ -2628,7 +2625,7 @@ class IntroduceRecipe(Scene): ShowCreation(arrow) ) self.wait(3) - self.play(*map(FadeOut, [words, arrow])) + self.play(*list(map(FadeOut, [words, arrow]))) self.output_label_group = VGroup(words, arrow) @@ -2900,7 +2897,7 @@ class ThreeOutputsAsLatticePointsContinued(ThreeOutputsAsLatticePoints): self.play( FadeIn(words_group[0]), - *map(ShowCreation, lines) + *list(map(ShowCreation, lines)) ) for words, angle, color in zip(words_group[1:], angles, self.colors[1:]): self.play(FadeIn(words)) @@ -3315,7 +3312,7 @@ class SummarizeCountingRule(Show125Circle): MoveToTarget(choices_copy), FadeIn(equals_four) ) - self.play(*map(FadeIn, [final_choice_words, final_choice_arrow])) + self.play(*list(map(FadeIn, [final_choice_words, final_choice_arrow]))) self.wait() def ask_about_two(self): @@ -3387,7 +3384,7 @@ class RecipeFor10(IntroduceRecipe): MaintainPositionRelativeTo(times_i, arrow) ) self.wait(2) - self.play(*map(FadeOut, [arrow, times_i, curr_product])) + self.play(*list(map(FadeOut, [arrow, times_i, curr_product]))) class FactorsOfTwoNeitherHelpNorHurt(TeacherStudentsScene): def construct(self): @@ -3406,15 +3403,15 @@ class EffectOfPowersOfTwo(LatticePointScene): "square_radii" : [5, 10, 20, 40, 80], } def construct(self): - radii = map(np.sqrt, self.square_radii) - circles = map(self.get_circle, radii) - radial_lines, root_labels = zip(*map( + radii = list(map(np.sqrt, self.square_radii)) + circles = list(map(self.get_circle, radii)) + radial_lines, root_labels = list(zip(*list(map( self.get_radial_line_with_label, radii - )) - dots_list = map( + )))) + dots_list = list(map( self.get_lattice_points_on_r_squared_circle, self.square_radii - ) + )) groups = [ VGroup(*mobs) for mobs in zip(radial_lines, circles, root_labels, dots_list) @@ -3445,7 +3442,7 @@ class NumberTheoryAtItsBest(TeacherStudentsScene): class IntroduceChi(FactorizationPattern): CONFIG = { "numbers_list" : [ - range(i, 36, d) + list(range(i, 36, d)) for i, d in (1, 4), (3, 4), (2, 2) ], "colors" : [GREEN, RED, YELLOW] @@ -3510,13 +3507,13 @@ class IntroduceChi(FactorizationPattern): self.wait() def fade_out_labels(self): - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ self.last_dots, self.last_arrows, self.last_labels, self.number_line - ])) + ]))) def cyclic_pattern(self): - input_range = range(1, 9) + input_range = list(range(1, 9)) chis = VGroup(*[ TexMobject("\\chi(%d)"%n) for n in input_range @@ -3557,7 +3554,7 @@ class IntroduceChi(FactorizationPattern): )) self.wait() - self.play(*map(FadeOut, [chis, arrows, numbers])) + self.play(*list(map(FadeOut, [chis, arrows, numbers]))) def write_multiplicative_label(self): morty = Mortimer() @@ -3949,9 +3946,9 @@ class ExpandCountWith45(SummarizeCountingRule): self.factorization = factorization def expand_expression(self): - equals, four, lp, rp = map(TexMobject, [ + equals, four, lp, rp = list(map(TexMobject, [ "=", "4", "\\big(", "\\big)" - ]) + ])) expansion = VGroup(equals, four, lp) chi_pairs = list(it.product(*[ factor[1::2] @@ -4002,7 +3999,7 @@ class ExpandCountWith45(SummarizeCountingRule): for movers in mover_groups: self.wait() self.play(movers.next_to, rect, DOWN) - self.play(*map(MoveToTarget, movers)) + self.play(*list(map(MoveToTarget, movers))) self.play(Write(plusses)) self.wait() @@ -4010,9 +4007,9 @@ class ExpandCountWith45(SummarizeCountingRule): self.prime_pairs = prime_pairs def show_divisor_sum(self): - equals, four, lp, rp = map(TexMobject, [ + equals, four, lp, rp = list(map(TexMobject, [ "=", "4", "\\big(", "\\big)" - ]) + ])) divisor_sum = VGroup(equals, four, lp) num_pairs = list(it.product([1, 3, 9], [1, 5])) @@ -4102,7 +4099,7 @@ class CountLatticePointsInBigCircle(LatticePointScene): pi_R_squared_rect = BackgroundRectangle(pi_R_squared) pi_R_squared_group = VGroup(pi_R_squared_rect, pi_R_squared) - self.play(*map(FadeIn, [circle, radius, R_group])) + self.play(*list(map(FadeIn, [circle, radius, R_group]))) self.add_foreground_mobject(R_group) self.draw_lattice_points() self.wait() @@ -4123,7 +4120,7 @@ class CountLatticePointsInBigCircle(LatticePointScene): self.radius = radius def show_rings(self): - N_range = range(self.max_lattice_point_radius**2) + N_range = list(range(self.max_lattice_point_radius**2)) rings = VGroup(*[ self.get_circle(radius = np.sqrt(N)) for N in N_range @@ -4178,8 +4175,8 @@ class CountLatticePointsInBigCircle(LatticePointScene): ]) new_dots.sort_submobjects(np.linalg.norm) - self.play(*map(ShowCreation, [circle, arrow])) - self.play(*map(FadeOut, [circle, arrow])) + self.play(*list(map(ShowCreation, [circle, arrow]))) + self.play(*list(map(FadeOut, [circle, arrow]))) self.play(FadeOut(center_dot)) self.lattice_points.remove(center_dot) self.wait() @@ -4278,10 +4275,10 @@ class AddUpGrid(Scene): fours = VGroup() parens = VGroup() arrows = VGroup() - for N, radical in zip(range(1, 13), self.radicals): - arrow, four, lp, rp = map(TexMobject, [ + for N, radical in zip(list(range(1, 13)), self.radicals): + arrow, four, lp, rp = list(map(TexMobject, [ "\\Rightarrow", "4", "\\big(", "\\big)" - ]) + ])) fours.add(four) parens.add(lp, rp) arrows.add(arrow) @@ -4372,7 +4369,7 @@ class AddUpGrid(Scene): ) self.play(Blink(randy)) self.wait() - self.play(*map(FadeOut, [prime_rects, randy])) + self.play(*list(map(FadeOut, [prime_rects, randy]))) def organize_into_columns(self): left_x = self.arrows.get_right()[0] + SMALL_BUFF @@ -4390,8 +4387,8 @@ class AddUpGrid(Scene): ) self.play(*it.chain( - map(MoveToTarget, self.chi_mobs), - map(MoveToTarget, self.plusses), + list(map(MoveToTarget, self.chi_mobs)), + list(map(MoveToTarget, self.plusses)), ), run_time = 2) self.wait() @@ -4414,7 +4411,7 @@ class AddUpGrid(Scene): approx.next_to(words, RIGHT, SMALL_BUFF) words.add(approx) - self.play(*map(FadeIn, [rect, words])) + self.play(*list(map(FadeIn, [rect, words]))) self.wait() self.count_rect = rect @@ -4483,7 +4480,7 @@ class AddUpGrid(Scene): self.corner_four.generate_target() R_squared = TexMobject("R^2") dots = TexMobject("\\cdots") - lp, rp = map(TexMobject, ["\\big(", "\\big)"]) + lp, rp = list(map(TexMobject, ["\\big(", "\\big)"])) new_sum = VGroup( self.corner_four.target, R_squared, lp ) @@ -4519,8 +4516,8 @@ class AddUpGrid(Scene): R_movers.add(mover) self.play(*it.chain( - map(Write, [lp, rp, dots]), - map(MoveToTarget, full_sum_parts), + list(map(Write, [lp, rp, dots])), + list(map(MoveToTarget, full_sum_parts)), ), run_time = 2) self.remove(R_movers) self.add(R_squared) @@ -4550,10 +4547,10 @@ class AddUpGrid(Scene): ) self.play( - *map(FadeOut, [ + *list(map(FadeOut, [ self.chi_mobs, self.plusses, self.arrows, self.radicals, self.row_lines - ]) + [ + ])) + [ FadeOut(self.count_rect), Animation(self.new_sum), Animation(self.count_words), @@ -4786,7 +4783,7 @@ class Thumbnail(Scene): primes = [ n for n in range(2, 1000) - if all(n%k != 0 for k in range(2, n)) + if all(n%k != 0 for k in list(range(2, n))) ] prime_mobs = VGroup() x_spacing = 1.7 diff --git a/old_projects/lost_lecture.py b/old_projects/lost_lecture.py index ef22211f..8b2305e9 100644 --- a/old_projects/lost_lecture.py +++ b/old_projects/lost_lecture.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from big_ol_pile_of_manim_imports import * from old_projects.div_curl import VectorField @@ -985,7 +985,7 @@ class FeynmanElementaryQuote(Scene): to know ahead of time in order to understand it, except to have an infinite amount of intelligence. """ - quote_parts = filter(lambda s: s, quote_text.split(" ")) + quote_parts = [s for s in quote_text.split(" ") if s] quote = TextMobject( *quote_parts, tex_to_color_map={ @@ -1042,7 +1042,7 @@ class FeynmanElementaryQuote(Scene): images.arrange_submobjects(RIGHT, buff=LARGE_BUFF) images.to_edge(DOWN, buff=LARGE_BUFF) images[1].move_to(images[0]) - crosses = VGroup(*map(Cross, images)) + crosses = VGroup(*list(map(Cross, images))) crosses.set_stroke("RED", 10) for image, cross in zip(images, crosses): @@ -1135,16 +1135,13 @@ class TableOfContents(Scene): )) self.wait() for item in items: - other_items = VGroup(*filter( - lambda m: m is not item, - items - )) + other_items = VGroup(*[m for m in items if m is not item]) new_item = item.copy() new_item.scale(scale_factor, about_edge=LEFT) new_item.set_fill(WHITE, 1) self.play( Transform(item, new_item), - *map(MoveToTarget, other_items) + *list(map(MoveToTarget, other_items)) ) self.wait() @@ -1316,7 +1313,7 @@ class ShowEllipseDefiningProperty(Scene): self.play( ReplacementTransform(focus_words.copy(), foci_word), ) - self.play(*map(ShowCreation, connecting_lines)) + self.play(*list(map(ShowCreation, connecting_lines))) for word in list(focus_words) + [foci_word]: word.add_background_rectangle() self.add_foreground_mobjects(word) @@ -1619,10 +1616,10 @@ class ProveEllipse(ShowEmergingEllipse, ShowEllipseDefiningProperty): focal_sum_point = VectorizedPoint() focal_sum_point.move_to(circle.get_top()) dots = [self.ep_dot, self.center_dot] - colors = map(Mobject.get_color, dots) + colors = list(map(Mobject.get_color, dots)) def get_foci(): - return map(Mobject.get_center, dots) + return list(map(Mobject.get_center, dots)) focal_lines, focal_lines_update_animation = \ self.get_focal_lines_and_update(get_foci, focal_sum_point) @@ -1662,10 +1659,10 @@ class ProveEllipse(ShowEmergingEllipse, ShowEllipseDefiningProperty): ) self.wait() self.remove(*to_add) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ focal_lines, distance_labels, sum_expression, numbers - ])) + ]))) self.set_variables_as_attrs( focal_lines, focal_lines_update_animation, @@ -2027,7 +2024,7 @@ class ProveEllipse(ShowEmergingEllipse, ShowEllipseDefiningProperty): self.wait() self.remove(*self.focal_sum_things_to_add) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ radial_line, QP_line, P_dot, P_label, @@ -2038,7 +2035,7 @@ class ProveEllipse(ShowEmergingEllipse, ShowEllipseDefiningProperty): self.sum_expression, sum_rect, tangency_comment, - ])) + ]))) self.wait() # Show all lines @@ -2578,7 +2575,7 @@ class AngularMomentumArgument(KeplersSecondLaw): area_label.get_part_by_tex(tex).copy(), area_expression.get_part_by_tex(tex), ) - for tex in "=", "\\frac{1}{2}", "\\times" + for tex in ("=", "\\frac{1}{2}", "\\times") ]) self.play(Restore(R_term)) self.play(ReplacementTransform( @@ -2761,7 +2758,7 @@ class FeynmanRecountingNewton(Scene): FadeInAndShiftFromDirection( mob, direction=3 * LEFT ) - for mob in principia, principia.rect + for mob in (principia, principia.rect) ]) self.wait() @@ -2930,7 +2927,7 @@ class IntroduceShapeOfVelocities(AskAboutEllipses, MovingCameraScene): p1, p2 = [ ellipse.point_from_proportion(a) - for a in alpha, alpha + d_alpha + for a in (alpha, alpha + d_alpha) ] vector = Arrow( p1, p2, buff=0 @@ -3111,7 +3108,7 @@ class ShowEqualAngleSlices(IntroduceShapeOfVelocities): self.play( FadeIn(faders), - *map(ShowCreation, lines) + *list(map(ShowCreation, lines)) ) self.play(*[ LaggedStart( @@ -3670,7 +3667,7 @@ class UseVelocityDiagramToDeduceCurve(ShowEqualAngleSlices): frame.shift(3 * LEFT + 0.5 * UP) self.play(ApplyWave(ellipse)) - self.play(*map(GrowArrow, vectors)) + self.play(*list(map(GrowArrow, vectors))) self.play( LaggedStart( MoveToTarget, vectors, @@ -3908,7 +3905,7 @@ class UseVelocityDiagramToDeduceCurve(ShowEqualAngleSlices): self.wait() self.play(ShowCreation(cross)) self.wait() - self.play(*map(FadeOut, [v_line, arc, theta_q, cross])) + self.play(*list(map(FadeOut, [v_line, arc, theta_q, cross]))) self.wait() self.play( ReplacementTransform( @@ -4076,7 +4073,7 @@ class UseVelocityDiagramToDeduceCurve(ShowEqualAngleSlices): self.play( self.ghost_lines.set_stroke, {"width": 0.5}, self.eccentric_lines.set_stroke, {"width": 0.5}, - *map(WiggleOutThenIn, [e_line, c_line]) + *list(map(WiggleOutThenIn, [e_line, c_line])) ) for x in range(3): self.play( diff --git a/old_projects/moser_intro.py b/old_projects/moser_intro.py index 360e965d..e2047861 100644 --- a/old_projects/moser_intro.py +++ b/old_projects/moser_intro.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -from __future__ import absolute_import + import numpy as np import itertools as it import operator as op @@ -37,7 +37,7 @@ def count_sections(*radians): ] dots = [Dot(point) for point in points] interior = Region(lambda x, y : x**2 + y**2 < RADIUS**2) - for x in xrange(1, len(points)): + for x in range(1, len(points)): if x == 1: sc.animate(ShowCreation(dots[0]), ShowCreation(dots[1])) sc.add(dots[0], dots[1]) @@ -45,7 +45,7 @@ def count_sections(*radians): sc.animate(ShowCreation(dots[x])) sc.add(dots[x]) new_lines = Mobject(*[ - Line(points[x], points[y]) for y in xrange(x) + Line(points[x], points[y]) for y in range(x) ]) sc.animate(Transform(deepcopy(dots[x]), new_lines, run_time = 2.0)) sc.add(new_lines) @@ -53,7 +53,7 @@ def count_sections(*radians): regions = plane_partition_from_points(*points[:x+1]) for reg in regions: reg.intersect(interior) - regions = filter(lambda reg : reg.bool_grid.any(), regions) + regions = [reg for reg in regions if reg.bool_grid.any()] last_num = None for reg, count in zip(regions, it.count(1)): @@ -81,9 +81,9 @@ def summarize_pattern(*radians): ] dots = [Dot(point) for point in points] last_num = None - for x in xrange(len(points)): + for x in range(len(points)): new_lines = Mobject(*[ - Line(points[x], points[y]) for y in xrange(x) + Line(points[x], points[y]) for y in range(x) ]) num = TexMobject(str(moser_function(x + 1))).center() sc.animate( @@ -110,7 +110,7 @@ def connect_points(*radians): sc.add(*dots) anims = [] all_lines = [] - for x in xrange(len(points)): + for x in range(len(points)): lines = [Line(points[x], points[y]) for y in range(len(points))] lines = Mobject(*lines) anims.append(Transform(deepcopy(dots[x]), lines, run_time = 3.0)) diff --git a/old_projects/moser_main.py b/old_projects/moser_main.py index ec1cfc43..94a2f2e4 100644 --- a/old_projects/moser_main.py +++ b/old_projects/moser_main.py @@ -72,12 +72,9 @@ class CircleScene(Scene): self.remove(*self.lines) self.lines = [] for point_pair in it.combinations(self.points, 2): - int_points = filter( - lambda p : is_on_line(p, *point_pair), - self.intersection_points - ) + int_points = [p for p in self.intersection_points if is_on_line(p, *point_pair)] points = list(point_pair) + int_points - points = map(lambda p : (p[0], p[1], 0), points) + points = [(p[0], p[1], 0) for p in points] points.sort(cmp = lambda x,y: cmp(x[0], y[0])) self.lines += [ Line(points[i], points[i+1]) @@ -121,7 +118,7 @@ class CircleScene(Scene): def generate_regions(self): self.regions = plane_partition_from_points(*self.points) interior = Region(lambda x, y : x**2 + y**2 < self.radius**2) - map(lambda r : r.intersect(interior), self.regions) + list(map(lambda r : r.intersect(interior), self.regions)) self.exterior = interior.complement() @@ -136,8 +133,8 @@ class CountSections(CircleScene): ], run_time = 2.0) regions = plane_partition_from_points(*self.points) interior = Region(lambda x, y : x**2 + y**2 < self.radius**2) - map(lambda r : r.intersect(interior), regions) - regions = filter(lambda r : r.bool_grid.any(), regions) + list(map(lambda r : r.intersect(interior), regions)) + regions = [r for r in regions if r.bool_grid.any()] self.count_regions(regions, num_offset = ORIGIN) class MoserPattern(CircleScene): @@ -247,7 +244,7 @@ class HardProblemsSimplerQuestions(Scene): omega = np.array((0.5, 0.5*np.sqrt(3), 0)) dots = Mobject(*[ Dot(t*np.array((1, 0, 0)) + s * omega) - for t, s in it.product(range(-2, 3), range(-2, 3)) + for t, s in it.product(list(range(-2, 3)), list(range(-2, 3))) ]) for mob in dots, other_grid: mob.scale(0.5).shift(left_center + (0, 2, 0)) @@ -391,7 +388,7 @@ class GeneralPositionRule(Scene): ( np.arange(0, 2*np.pi, np.pi/3), "Not okay", - zip(range(3), range(3, 6)) + list(zip(list(range(3)), list(range(3, 6)))) ), ( RADIANS, @@ -401,7 +398,7 @@ class GeneralPositionRule(Scene): ( np.arange(0, 2*np.pi, np.pi/4), "Not okay", - zip(range(4), range(4, 8)) + list(zip(list(range(4)), list(range(4, 8)))) ), ( [2*np.pi*random() for x in range(5)], @@ -486,7 +483,7 @@ class IllustrateNChooseK(Scene): def __init__(self, n, k, *args, **kwargs): Scene.__init__(self, *args, **kwargs) - nrange = range(1, n+1) + nrange = list(range(1, n+1)) tuples = list(it.combinations(nrange, k)) nrange_mobs = TexMobject([str(n) + r'\;' for n in nrange]).split() tuple_mobs = TexMobjects( @@ -550,7 +547,7 @@ class IllustrateNChooseK(Scene): class IntersectionPointCorrespondances(CircleScene): args_list = [ - (RADIANS, range(0, 7, 2)), + (RADIANS, list(range(0, 7, 2))), ] @staticmethod def args_to_string(*args): @@ -569,7 +566,7 @@ class IntersectionPointCorrespondances(CircleScene): intersection_dot = Dot(intersection_point) intersection_dot_arrow = Arrow(intersection_point).nudge() self.add(intersection_dot) - pairs = list(it.combinations(range(len(radians)), 2)) + pairs = list(it.combinations(list(range(len(radians))), 2)) lines_to_save = [ self.lines[pairs.index((indices[p0], indices[p1]))] for p0, p1 in [(0, 2), (1, 3)] @@ -628,7 +625,7 @@ class LinesIntersectOutside(CircleScene): ) intersection_point = tuple(list(intersection_point) + [0]) intersection_dot = Dot(intersection_point) - pairs = list(it.combinations(range(len(radians)), 2)) + pairs = list(it.combinations(list(range(len(radians))), 2)) lines_to_save = [ self.lines[pairs.index((indices[p0], indices[p1]))] for p0, p1 in [(0, 1), (2, 3)] @@ -647,7 +644,7 @@ class LinesIntersectOutside(CircleScene): class QuadrupletsToIntersections(CircleScene): def __init__(self, radians, *args, **kwargs): CircleScene.__init__(self, radians, *args, **kwargs) - quadruplets = it.combinations(range(len(radians)), 4) + quadruplets = it.combinations(list(range(len(radians))), 4) frame_time = 1.0 for quad in quadruplets: intersection_dot = Dot(intersection( @@ -780,12 +777,12 @@ class EulersFormula(GraphScene): (key, mob) for key, mob in zip(terms, TexMobjects(terms)) ]) - for mob in form.values(): + for mob in list(form.values()): mob.shift((0, FRAME_Y_RADIUS-0.7, 0)) - formula = Mobject(*[form[k] for k in form.keys() if k != "=2"]) + formula = Mobject(*[form[k] for k in list(form.keys()) if k != "=2"]) new_form = dict([ (key, deepcopy(mob).shift((0, -0.7, 0))) - for key, mob in zip(form.keys(), form.values()) + for key, mob in zip(list(form.keys()), list(form.values())) ]) self.add(formula) colored_dots = [ @@ -870,7 +867,7 @@ class CannotDirectlyApplyEulerToMoser(CircleScene): class ShowMoserGraphLines(CircleScene): def __init__(self, radians, *args, **kwargs): - radians = list(set(map(lambda x : x%(2*np.pi), radians))) + radians = list(set([x%(2*np.pi) for x in radians])) radians.sort() CircleScene.__init__(self, radians, *args, **kwargs) n, plus_n_choose_4 = TexMobject(["n", "+{n \\choose 4}"]).split() @@ -931,7 +928,7 @@ class ShowMoserGraphLines(CircleScene): class HowIntersectionChopsLine(CircleScene): args_list = [ - (RADIANS, range(0, 7, 2)), + (RADIANS, list(range(0, 7, 2))), ] @staticmethod def args_to_string(*args): @@ -947,7 +944,7 @@ class HowIntersectionChopsLine(CircleScene): ) if len(intersection_point) == 2: intersection_point = list(intersection_point) + [0] - pairs = list(it.combinations(range(len(radians)), 2)) + pairs = list(it.combinations(list(range(len(radians))), 2)) lines = [ Line(self.points[indices[p0]], self.points[indices[p1]]) for p0, p1 in [(2, 0), (1, 3)] @@ -1041,11 +1038,11 @@ class ApplyEulerToMoser(CircleScene): for d in dicts: if not d: continue - main_key = d.keys()[0] - for key in d.keys(): + main_key = list(d.keys())[0] + for key in list(d.keys()): d[key].shift(shift_val) main_center = d[main_key].get_center() - for key in d.keys(): + for key in list(d.keys()): d[key] = deepcopy(d[main_key]).shift( d[key].get_center() - main_center ) @@ -1445,7 +1442,7 @@ class MoserSolutionInPascal(PascalsTriangleScene): ] ) self.wait() - term_range = range(0, min(4, n)+1, 2) + term_range = list(range(0, min(4, n)+1, 2)) target_terms = dict([ (k, deepcopy(self.coords_to_mobs[n][k]).set_color(term_color)) for k in term_range @@ -1643,7 +1640,7 @@ class ExplainNChoose4Formula(Scene): r"There are $(4 \cdot 3 \cdot 2 \cdot 1)$ total permutations" ).shift((0, -2, 0)) self.add(parens, num_perms_explain, *form_mobs) - perms = list(it.permutations(range(4))) + perms = list(it.permutations(list(range(4)))) for count in range(6): perm = perms[randint(0, 23)] new_quad_mobs = [ diff --git a/old_projects/mug.py b/old_projects/mug.py index 7f96ae48..b58bc072 100644 --- a/old_projects/mug.py +++ b/old_projects/mug.py @@ -9,9 +9,9 @@ from old_projects.efvgt import ConfettiSpiril class HappyHolidays(TeacherStudentsScene): def construct(self): - hats = VGroup(*map( + hats = VGroup(*list(map( self.get_hat, self.pi_creatures - )) + ))) self.add(self.get_snowflakes()) self.change_student_modes( *["hooray"]*3, @@ -642,7 +642,7 @@ class TwoKindsOfViewers(PiCreatureScene, UtilitiesPuzzleScene): words.to_edge(UP) eulers = words.get_part_by_tex("V-E+F") eulers.set_color(GREEN) - non_eulers = VGroup(*filter(lambda m : m is not eulers, words)) + non_eulers = VGroup(*[m for m in words if m is not eulers]) self.add(words) self.wait() @@ -676,10 +676,10 @@ class TwoKindsOfViewers(PiCreatureScene, UtilitiesPuzzleScene): self.wait() ### Out of thin air - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ non_eulers, pi1, pi2, pi1.bubble, know_eulers, dont - ])) + ]))) self.play(eulers.next_to, ORIGIN, LEFT, LARGE_BUFF) arrow = Arrow(eulers, objects, color = WHITE) self.play( @@ -766,7 +766,7 @@ class IntroduceRegions(UtilitiesPuzzleScene): FadeOut(back_region), FadeOut(front_regions[0]), FadeOut(paint_bucket), - *map(Animation, front_regions[1:]) + *list(map(Animation, front_regions[1:])) ) #Line tries to escape @@ -1055,9 +1055,9 @@ class LightUpNodes(IntroduceRegions): title.add(underline) self.add(title) self.count_titles = titles - self.v_count, self.e_count, self.f_count = self.counts = map( + self.v_count, self.e_count, self.f_count = self.counts = list(map( Integer, [1, 0, 1] - ) + )) for count, title in zip(self.counts, titles): count.next_to(title, DOWN) self.add(count) @@ -1097,9 +1097,9 @@ class LightUpNodes(IntroduceRegions): LaggedStart(GrowArrow, dim_arrows) ) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ lit_word, lit_arrow, dim_word, dim_arrows - ])) + ]))) def show_rule_for_lighting(self): lines = self.lines @@ -1318,7 +1318,7 @@ class ConcludeFiveRegions(LightUpNodes): remover = True, ), Indicate(self.f_count), - *map(Animation, self.mobjects) + *list(map(Animation, self.mobjects)) ) self.wait() @@ -1367,10 +1367,7 @@ class ConcludeFiveRegions(LightUpNodes): f_rect = SurroundingRectangle( VGroup(self.count_titles[-1], self.f_count) ) - on_screen_side_lines = VGroup(*filter( - lambda m : m in self.mobjects, - self.side_lines - )) + on_screen_side_lines = VGroup(*[m for m in self.side_lines if m in self.mobjects]) side_lines_rect = SurroundingRectangle(on_screen_side_lines) side_lines_rect.set_color(WHITE) @@ -1701,7 +1698,7 @@ class FiveRegionsFourEdgesEachGraph(Scene): self.play(FadeIn(r1), run_time = 0.5) self.play(FadeIn(r2), Animation(r1), run_time = 0.5) self.wait(0.5) - self.play(*map(FadeOut, [r2, r1, edge]), run_time = 0.5) + self.play(*list(map(FadeOut, [r2, r1, edge])), run_time = 0.5) self.remove_foreground_mobjects(edge) def ten_total_edges(self): @@ -1762,7 +1759,7 @@ class EulersFormulaForGeneralPlanarGraph(LightUpNodes, ThreeDScene): ]) points *= 0.75 points += DOWN - vertices = VGroup(*map(Dot, points)) + vertices = VGroup(*list(map(Dot, points))) vertices.set_color(YELLOW) edges = VGroup(*[ VGroup(*[ @@ -1817,9 +1814,9 @@ class EulersFormulaForGeneralPlanarGraph(LightUpNodes, ThreeDScene): groups = [count_titles, counts] for group in groups: - group.symbols = VGroup(*map(TexMobject, ["-", "+", "="])) + group.symbols = VGroup(*list(map(TexMobject, ["-", "+", "="]))) group.generate_target() - line = VGroup(*it.chain(*zip(group.target, group.symbols))) + line = VGroup(*it.chain(*list(zip(group.target, group.symbols)))) line.arrange_submobjects(RIGHT) line.to_edge(UP, buff = MED_SMALL_BUFF) VGroup(counts.target, counts.symbols).shift(0.75*DOWN) diff --git a/old_projects/music_and_measure.py b/old_projects/music_and_measure.py index 95091c2c..848cc99c 100644 --- a/old_projects/music_and_measure.py +++ b/old_projects/music_and_measure.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -from __future__ import absolute_import + import numpy as np import itertools as it from copy import deepcopy @@ -166,7 +166,7 @@ class IntervalScene(NumberLineScene): pause_time = 1.0, remove_as_you_go = True): shrink = not remove_as_you_go - for fraction, count in zip(rationals(), range(num_fractions)): + for fraction, count in zip(rationals(), list(range(num_fractions))): frac_mob, tick = self.add_fraction(fraction, shrink) self.wait(pause_time) if remove_as_you_go: @@ -189,7 +189,7 @@ class IntervalScene(NumberLineScene): def add_fraction_ticks(self, num_fractions = 1000, run_time = 0): long_tick_size = self.number_line.tick_size*TICK_STRETCH_FACTOR all_ticks = [] - for frac, count in zip(rationals(), range(num_fractions)): + for frac, count in zip(rationals(), list(range(num_fractions))): point = self.number_line.number_to_point(frac) tick_rad = 2.0*long_tick_size/frac.denominator tick = Line(point+tick_rad*DOWN, point+tick_rad*UP) @@ -255,7 +255,7 @@ class IntervalScene(NumberLineScene): class TwoChallenges(Scene): def construct(self): two_challenges = TextMobject("Two Challenges", size = "\\Huge").to_edge(UP) - one, two = map(TextMobject, ["1.", "2."]) + one, two = list(map(TextMobject, ["1.", "2."])) one.shift(UP).to_edge(LEFT) two.shift(DOWN).to_edge(LEFT) notes = ImageMobject("musical_notes").scale(0.3) @@ -832,10 +832,10 @@ class AllValuesBetween1And2(NumberLineScene): NumberLineScene.construct(self) irrational = 1.2020569031595942 cont_frac = [1, 4, 1, 18, 1, 1, 1, 4, 1, 9, 9, 2, 1, 1, 1, 2] - one, two, irr = map( + one, two, irr = list(map( self.number_line.number_to_point, [1, 2, irrational] - ) + )) top_arrow = Arrow(one+UP, one) bot_arrow = Arrow(irr+2*DOWN, irr) r = TexMobject("r").next_to(top_arrow, UP) @@ -876,7 +876,7 @@ class AllValuesBetween1And2(NumberLineScene): run_time = 0.5 ) self.wait(0.5) - points = map(self.number_line.number_to_point, [approx, irrational]) + points = list(map(self.number_line.number_to_point, [approx, irrational])) distance = np.linalg.norm(points[1]-points[0]) if distance < 0.3*FRAME_X_RADIUS and num_zooms < max_num_zooms: num_zooms += 1 @@ -1114,13 +1114,13 @@ class StepsToSolution(IntervalScene): def construct(self): IntervalScene.construct(self) self.spacing = 0.7 - steps = map(TextMobject, [ + steps = list(map(TextMobject, [ "Enumerate all rationals in (0, 1)", "Assign one interval to each rational", "Choose sum of the form $\\mathlarger{\\sum}_{n=1}^\\infty a_n = 1$", "Pick any $\\epsilon$ such that $0 < \\epsilon < 1$", "Stretch the $n$th interval to have length $\\epsilon/2^n$", - ]) + ])) for step in steps: step.shift(DOWN) for step in steps[2:]: @@ -1145,7 +1145,7 @@ class StepsToSolution(IntervalScene): anims = [] commas = Mobject() denom_to_mobs = {} - for frac, count in zip(rationals(), range(1,28)): + for frac, count in zip(rationals(), list(range(1,28))): mob, tick = self.add_fraction(frac, shrink = True) self.wait(0.1) self.remove(tick) @@ -1259,7 +1259,7 @@ class OurSumCanBeArbitrarilySmall(Scene): equals = TexMobject("=").next_to(epsilon) self.add(epsilon, equals) for num in np.arange(1, 0, -step_size): - parts = map(TexMobject, str(num)) + parts = list(map(TexMobject, str(num))) parts[0].next_to(equals) for i in range(1, len(parts)): parts[i].next_to(parts[i-1], buff = 0.1, aligned_edge = DOWN) @@ -1285,7 +1285,7 @@ class StillFeelsCounterintuitive(IntervalScene): def construct(self): IntervalScene.construct(self) ticks = self.add_fraction_ticks(run_time = 1.0) - epsilon, equals, num = map(TexMobject, ["\\epsilon", "=", "0.3"]) + epsilon, equals, num = list(map(TexMobject, ["\\epsilon", "=", "0.3"])) epsilon.shift(2*UP) equals.next_to(epsilon) num.next_to(equals) @@ -1347,7 +1347,7 @@ class WhatDoesItLookLikeToBeOutside(Scene): class ZoomInOnSqrt2Over2(IntervalScene): def construct(self): IntervalScene.construct(self) - epsilon, equals, num = map(TexMobject, ["\\epsilon", "=", "0.3"]) + epsilon, equals, num = list(map(TexMobject, ["\\epsilon", "=", "0.3"])) equals.next_to(epsilon) num.next_to(equals) self.add(Mobject(epsilon, equals, num).center().shift(2*UP)) diff --git a/old_projects/mvcr.py b/old_projects/mvcr.py index ee735049..aaf4806c 100644 --- a/old_projects/mvcr.py +++ b/old_projects/mvcr.py @@ -242,10 +242,10 @@ class ComputationalNetwork(MovingCameraScene): self.value_labels = value_labels self.revert_to_formula_animations = [ ApplyMethod(term.set_fill, {"opacity": 1}) - for term in x_in_f, x_in_g, f_in_h, g_in_h + for term in (x_in_f, x_in_g, f_in_h, g_in_h) ] + [ FadeOut(term) - for term in two_copy1, two_copy2, four_copy, one_copy + for term in (two_copy1, two_copy2, four_copy, one_copy) ] def compare_x_and_h_wiggling(self): @@ -552,7 +552,7 @@ class ComputationalNetwork(MovingCameraScene): group, submobject_mode="one_at_a_time" ) - for group in top_lines, bottom_lines + for group in (top_lines, bottom_lines) ]) self.wait() self.play(FadeOut(rect)) diff --git a/old_projects/name_animation.py b/old_projects/name_animation.py index 40131d3f..b1880ffe 100644 --- a/old_projects/name_animation.py +++ b/old_projects/name_animation.py @@ -1,7 +1,7 @@ #!/usr/bin/env python2 # -*- coding: utf-8 -*- -from __future__ import print_function + from big_ol_pile_of_manim_imports import * NAME_WITH_SPACES = "Prime Meridian" diff --git a/old_projects/nn/mnist_loader.py b/old_projects/nn/mnist_loader.py index 7687f413..74e6360f 100644 --- a/old_projects/nn/mnist_loader.py +++ b/old_projects/nn/mnist_loader.py @@ -10,7 +10,7 @@ function usually called by our neural network code. #### Libraries # Standard library -import cPickle +import pickle import gzip # Third-party libraries @@ -40,7 +40,7 @@ def load_data(): below. """ f = gzip.open('/Users/grant/cs/neural-networks-and-deep-learning/data/mnist.pkl.gz', 'rb') - training_data, validation_data, test_data = cPickle.load(f) + training_data, validation_data, test_data = pickle.load(f) f.close() return (training_data, validation_data, test_data) @@ -68,11 +68,11 @@ def load_data_wrapper(): tr_d, va_d, te_d = load_data() training_inputs = [np.reshape(x, (784, 1)) for x in tr_d[0]] training_results = [vectorized_result(y) for y in tr_d[1]] - training_data = zip(training_inputs, training_results) + training_data = list(zip(training_inputs, training_results)) validation_inputs = [np.reshape(x, (784, 1)) for x in va_d[0]] - validation_data = zip(validation_inputs, va_d[1]) + validation_data = list(zip(validation_inputs, va_d[1])) test_inputs = [np.reshape(x, (784, 1)) for x in te_d[0]] - test_data = zip(test_inputs, te_d[1]) + test_data = list(zip(test_inputs, te_d[1])) return (training_data, validation_data, test_data) def vectorized_result(j): diff --git a/old_projects/nn/network.py b/old_projects/nn/network.py index 7a984304..b8386028 100644 --- a/old_projects/nn/network.py +++ b/old_projects/nn/network.py @@ -8,7 +8,7 @@ using backpropagation. Note that I have focused on making the code simple, easily readable, and easily modifiable. It is not optimized, and omits many desirable features. """ -from __future__ import print_function + #### Libraries # Standard library @@ -18,7 +18,7 @@ import random import numpy as np import os from PIL import Image -import cPickle +import pickle from nn.mnist_loader import load_data_wrapper NN_DIRECTORY = os.path.dirname(os.path.realpath(__file__)) @@ -91,11 +91,11 @@ class Network(object): tracking progress, but slows things down substantially.""" if test_data: n_test = len(test_data) n = len(training_data) - for j in xrange(epochs): + for j in range(epochs): random.shuffle(training_data) mini_batches = [ training_data[k:k+mini_batch_size] - for k in xrange(0, n, mini_batch_size)] + for k in range(0, n, mini_batch_size)] for mini_batch in mini_batches: self.update_mini_batch(mini_batch, eta) if test_data: @@ -147,7 +147,7 @@ class Network(object): # second-last layer, and so on. It's a renumbering of the # scheme in the book, used here to take advantage of the fact # that Python can use negative indices in lists. - for l in xrange(2, self.num_layers): + for l in range(2, self.num_layers): z = zs[-l] sp = self.d_non_linearity(z) delta = np.dot(self.weights[-l+1].transpose(), delta) * sp @@ -196,7 +196,7 @@ def ReLU_prime(z): def get_pretrained_network(): data_file = open(PRETRAINED_DATA_FILE) - weights, biases = cPickle.load(data_file) + weights, biases = pickle.load(data_file) sizes = [w.shape[1] for w in weights] sizes.append(weights[-1].shape[0]) network = Network(sizes) @@ -210,7 +210,7 @@ def save_pretrained_network(epochs = 30, mini_batch_size = 10, eta = 3.0): network.SGD(training_data, epochs, mini_batch_size, eta) weights_and_biases = (network.weights, network.biases) data_file = open(PRETRAINED_DATA_FILE, mode = 'w') - cPickle.dump(weights_and_biases, data_file) + pickle.dump(weights_and_biases, data_file) data_file.close() def test_network(): @@ -241,7 +241,7 @@ def maximizing_input(network, layer_index, layer_vect, n_steps = 100, seed_guess else: pre_sig_guess = np.random.randn(weights[0].shape[1]) norms = [] - for step in xrange(n_steps): + for step in range(n_steps): activations = network.get_activation_of_all_layers( sigmoid(pre_sig_guess), layer_index ) @@ -269,19 +269,19 @@ def save_organized_images(n_images_per_number = 10): training_data, validation_data, test_data = load_data_wrapper() image_map = dict([(k, []) for k in range(10)]) for im, output_arr in training_data: - if min(map(len, image_map.values())) >= n_images_per_number: + if min(list(map(len, list(image_map.values())))) >= n_images_per_number: break value = int(np.argmax(output_arr)) if len(image_map[value]) >= n_images_per_number: continue image_map[value].append(im) data_file = open(IMAGE_MAP_DATA_FILE, mode = 'w') - cPickle.dump(image_map, data_file) + pickle.dump(image_map, data_file) data_file.close() def get_organized_images(): data_file = open(IMAGE_MAP_DATA_FILE, mode = 'r') - image_map = cPickle.load(data_file) + image_map = pickle.load(data_file) data_file.close() return image_map diff --git a/old_projects/nn/part1.py b/old_projects/nn/part1.py index 2863c0e4..a1123bd9 100644 --- a/old_projects/nn/part1.py +++ b/old_projects/nn/part1.py @@ -369,8 +369,8 @@ class ExampleThrees(PiCreatureScene): ), randy.change, "sassy", *it.chain( - map(GrowFromCenter, braces), - map(FadeIn, brace_labels) + list(map(GrowFromCenter, braces)), + list(map(FadeIn, brace_labels)) ) ) self.wait() @@ -415,9 +415,9 @@ class ExampleThrees(PiCreatureScene): self.wait(0.5) self.play( randy.change, "plain", - *map(FadeOut, [ + *list(map(FadeOut, [ self.bubble, self.arrow, self.real_three - ]) + [MoveToTarget(three)] + ])) + [MoveToTarget(three)] ) for alt_three in alt_threes[:2]: self.play(three.replace, alt_three) @@ -975,11 +975,11 @@ class BreakDownName(Scene): ) self.wait(2) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ name, randy, brain, q2, a1, a2, q1[0], q1[2] - ])) + ]))) self.neuron_word = q1[1] @@ -1335,7 +1335,7 @@ class DiscussChoiceForHiddenLayers(TeacherStudentsScene): network_mob.set_height(4) network_mob.to_edge(UP, buff = LARGE_BUFF) layers = VGroup(*network_mob.layers[1:3]) - rects = VGroup(*map(SurroundingRectangle, layers)) + rects = VGroup(*list(map(SurroundingRectangle, layers))) self.add(network_mob) two_words = TextMobject("2 hidden layers") @@ -1463,7 +1463,7 @@ class AskAboutLayers(PreviewMNistNetwork): ) for group in neuron_groups ]) - rects = map(SurroundingRectangle, neuron_groups[1:3]) + rects = list(map(SurroundingRectangle, neuron_groups[1:3])) self.play( Write(question, run_time = 1), @@ -1474,7 +1474,7 @@ class AskAboutLayers(PreviewMNistNetwork): ) ) self.wait() - self.play(*map(ShowCreation, rects)) + self.play(*list(map(ShowCreation, rects))) self.wait() class BreakUpMacroPatterns(IntroduceEachLayer): @@ -1506,7 +1506,7 @@ class BreakUpMacroPatterns(IntroduceEachLayer): ))[:,:,0].flatten()/255.0 for p in prefixes ] - mobjects = map(MNistMobject, vects) + mobjects = list(map(MNistMobject, vects)) for mob in mobjects: image = mob[1] self.make_transparent(image) @@ -1549,7 +1549,7 @@ class BreakUpMacroPatterns(IntroduceEachLayer): self.play(FadeIn(nine)) self.wait() - self.play(*map(FadeIn, parts)) + self.play(*list(map(FadeIn, parts))) self.wait() self.play( Write(equation[1]), @@ -1651,7 +1651,7 @@ class BreakUpMacroPatterns(IntroduceEachLayer): for pattern in patterns[5:]: pattern.fade(1) - self.play(*map(FadeOut, everything)) + self.play(*list(map(FadeOut, everything))) self.play( FadeIn( network_mob, @@ -1732,9 +1732,9 @@ class BreakUpMacroPatterns(IntroduceEachLayer): class GenerallyLoopyPattern(Scene): def construct(self): image_map = get_organized_images() - images = map(MNistMobject, it.chain( + images = list(map(MNistMobject, it.chain( image_map[8], image_map[9], - )) + ))) random.shuffle(images) for image in images: @@ -1914,7 +1914,7 @@ class SecondLayerIsLittleEdgeLayer(IntroduceEachLayer): nine_pa = self.nine[1].pixel_array n, k = 6, 4 colors = color_gradient([BLUE, YELLOW, RED, MAROON_B, GREEN], 10) - for i, j in it.product(range(n), range(k)): + for i, j in it.product(list(range(n)), list(range(k))): mob = ImageMobject(np.zeros((28, 28, 4), dtype = 'uint8')) mob.replace(self.nine[1]) pa = mob.pixel_array @@ -1955,7 +1955,7 @@ class SecondLayerIsLittleEdgeLayer(IntroduceEachLayer): Write(words, run_time = 2) ) self.wait() - self.play(*map(FadeOut, [rect, words])) + self.play(*list(map(FadeOut, [rect, words]))) def show_propogation(self): nine = self.nine @@ -2464,7 +2464,7 @@ class IntroduceWeights(IntroduceEachLayer): ) ] + [ Write(weighted_sum[i]) - for i in range(2, 12, 3) + [-4, -3] + for i in list(range(2, 12, 3)) + [-4, -3] ], run_time = 1.5 ) @@ -2715,8 +2715,8 @@ class IntroduceSigmoid(GraphScene): "y_max" : 2, "y_axis_label" : "", "graph_origin" : DOWN, - "x_labeled_nums" : range(-4, 5), - "y_labeled_nums" : range(-1, 3), + "x_labeled_nums" : list(range(-4, 5)), + "y_labeled_nums" : list(range(-1, 3)), } def construct(self): self.setup_axes() @@ -3277,7 +3277,7 @@ class WhenTheNetworkFails(MoreHonestMNistNetworkPreview): DrawBorderThenFill(box) ) self.wait() - self.play(*map(FadeOut, [words, box])) + self.play(*list(map(FadeOut, [words, box]))) def incorrect_classification(self): network = self.network @@ -3567,17 +3567,17 @@ class IntroduceWeightMatrix(NetworkScene): lwb.align_to(rwb, UP) row_1, row_k = [ - VGroup(*map(TexMobject, [ + VGroup(*list(map(TexMobject, [ "w_{%s, 0}"%i, "w_{%s, 1}"%i, "\\cdots", "w_{%s, n}"%i, - ])) + ]))) for i in ("1", "k") ] - dots_row = VGroup(*map(TexMobject, [ + dots_row = VGroup(*list(map(TexMobject, [ "\\vdots", "\\vdots", "\\ddots", "\\vdots" - ])) + ]))) lower_rows = VGroup(row_1, dots_row, row_k) lower_rows.scale(0.75) @@ -3671,9 +3671,9 @@ class IntroduceWeightMatrix(NetworkScene): self.show_meaning_of_lower_rows( arrow, brace, top_row_rect, result_terms ) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ result_terms, result_brackets, equals, column_rect - ])) + ]))) def show_meaning_of_lower_rows(self, arrow, brace, row_rect, result_terms): n1, n2, nk = neurons = VGroup(*[ @@ -3735,9 +3735,9 @@ class IntroduceWeightMatrix(NetworkScene): plus = TexMobject("+") b_brackets = a_column_brackets.copy() - b_column = VGroup(*map(TexMobject, [ + b_column = VGroup(*list(map(TexMobject, [ "b_0", "b_1", "\\vdots", "b_n", - ])) + ]))) b_column.scale(0.85) b_column.arrange_submobjects(DOWN, buff = 0.35) b_column.move_to(a_column) @@ -3855,13 +3855,13 @@ class IntroduceWeightMatrix(NetworkScene): self.wait(2) def fade_weighted_sum(self): - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ self.a1_label, self.a1_equals, self.sigma, self.sigma_parens, self.weighted_sum, self.bias_name, self.sigmoid_name, - ])) + ]))) ### @@ -3903,10 +3903,10 @@ class SigmoidAppliedToVector(Scene): tex.set_width(FRAME_WIDTH - 1) tex.to_edge(DOWN) indices = it.chain( - [0], range(1, 5), range(16, 16+4), - range(25, 25+2), [25+3], - range(29, 29+2), [29+3], - range(33, 33+2), [33+3], + [0], list(range(1, 5)), list(range(16, 16+4)), + list(range(25, 25+2)), [25+3], + list(range(29, 29+2)), [29+3], + list(range(33, 33+2)), [33+3], ) for i in indices: tex[i].set_color(YELLOW) @@ -4050,7 +4050,7 @@ class NeuronIsFunction(MoreHonestMNistNetworkPreview): self.play( FadeOut(self.network_mob), - *map(Animation, [neuron, edges, prev_layer]) + *list(map(Animation, [neuron, edges, prev_layer])) ) self.play(LaggedStart( ShowCreationThenDestruction, diff --git a/old_projects/nn/part2.py b/old_projects/nn/part2.py index 0882f593..6d96943c 100644 --- a/old_projects/nn/part2.py +++ b/old_projects/nn/part2.py @@ -1,4 +1,4 @@ -from __future__ import print_function + import sys import os.path import cv2 @@ -232,11 +232,11 @@ class PreviewLearning(NetworkScene): edge_group.copy() for edge_group in edge_groups ]) - tups = zip( + tups = list(zip( it.count(), nabla_b, nabla_w, delta_neuron_groups, neuron_groups, delta_edge_groups, edge_groups - ) + )) pc_color = self.positive_change_color nc_color = self.negative_change_color for i, nb, nw, delta_neurons, neurons, delta_edges, edges in reversed(tups): @@ -278,7 +278,7 @@ class PreviewLearning(NetworkScene): [ReplacementTransform( edge_groups.saved_state, edge_groups, )], - map(FadeOut, [delta_edge_groups, delta_neuron_groups]), + list(map(FadeOut, [delta_edge_groups, delta_neuron_groups])), added_outro_anims, )) @@ -476,7 +476,7 @@ class MNistDescription(Scene): FadeOut(word_group), ) else: - pairs = zip(last_group, group) + pairs = list(zip(last_group, group)) random.shuffle(pairs) time = 0 for t1, t2 in pairs: @@ -541,7 +541,7 @@ class NotSciFi(TeacherStudentsScene): class FunctionMinmization(GraphScene): CONFIG = { - "x_labeled_nums" : range(-1, 10), + "x_labeled_nums" : list(range(-1, 10)), } def construct(self): self.setup_axes() @@ -705,7 +705,7 @@ class IntroduceCostFunction(PreviewLearning): )) self.play( Write(weights_word), - *map(GrowArrow, weights_arrow_to_syms), + *list(map(GrowArrow, weights_arrow_to_syms)), run_time = 1 ) self.wait() @@ -748,11 +748,11 @@ class IntroduceCostFunction(PreviewLearning): rate_func = wiggle, run_time = 2 )) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ weights_word, weights_arrow_to_edges, bias_word, bias_arrow, formula - ])) + ]))) def bring_back_rest_of_network(self): network_mob = self.network_mob @@ -799,7 +799,7 @@ class IntroduceCostFunction(PreviewLearning): VGroup(*layer0.neurons[:n/2]).set_fill(opacity = 0), [ VectorizedPoint(layer0.dots.get_center()) - for x in xrange(len(neurons)-n) + for x in range(len(neurons)-n) ], VGroup(*layer0.neurons[-n/2:]).set_fill(opacity = 0), )) @@ -874,10 +874,10 @@ class IntroduceCostFunction(PreviewLearning): def fade_all_but_last_layer(self): network_mob = self.network_mob - to_fade = VGroup(*it.chain(*zip( + to_fade = VGroup(*it.chain(*list(zip( network_mob.layers[:-1], network_mob.edge_groups - ))) + )))) self.play(LaggedStart(FadeOut, to_fade, run_time = 1)) @@ -1328,10 +1328,10 @@ class EmphasizeComplexityOfCostFunction(IntroduceCostFunction): cost.next_to(arrow, DOWN) training_data, validation_data, test_data = load_data_wrapper() - training_examples = Group(*map( + training_examples = Group(*list(map( self.get_training_pair_mob, training_data[:self.n_examples] - )) + ))) training_examples.next_to(parameter_words, DOWN, buff = LARGE_BUFF) self.play( @@ -1631,8 +1631,8 @@ class SingleVariableCostFunction(GraphScene): ) self.wait() self.play(*it.chain( - map(GrowArrow, arrows), - map(FadeIn, q_marks), + list(map(GrowArrow, arrows)), + list(map(FadeIn, q_marks)), )) self.wait() @@ -1831,12 +1831,12 @@ class TwoVariableInputSpace(Scene): name = TextMobject("Input space") name.add_background_rectangle() name.next_to(plane.get_corner(UP+LEFT), DOWN+RIGHT) - x, y = map(TexMobject, ["x", "y"]) + x, y = list(map(TexMobject, ["x", "y"])) x.next_to(plane.coords_to_point(3.25, 0), UP, SMALL_BUFF) y.next_to(plane.coords_to_point(0, 3.6), RIGHT, SMALL_BUFF) self.play( - *map(Write, [plane, name, x, y]), + *list(map(Write, [plane, name, x, y])), run_time = 1 ) self.wait() @@ -2027,7 +2027,7 @@ class ShowFullCostFunctionGradient(PreviewLearning): ), LaggedStart(FadeIn, words), ) - self.play(*map(Write, [lb, rb, lhs]), run_time = 1) + self.play(*list(map(Write, [lb, rb, lhs])), run_time = 1) self.wait() self.column_vect = column_vect @@ -2040,10 +2040,7 @@ class ShowFullCostFunctionGradient(PreviewLearning): ) lhs.shift(2*RIGHT) lhs.set_color_by_tex("W", YELLOW) - old_decimals = VGroup(*filter( - lambda m : isinstance(m, DecimalNumber), - column_vect[1] - )) + old_decimals = VGroup(*[m for m in column_vect[1] if isinstance(m, DecimalNumber)]) new_decimals = VGroup() new_nums = [0.18, 0.45, -0.51, 0.4, -0.32, 0.82] for decimal, new_num in zip(old_decimals, new_nums): @@ -2754,7 +2751,7 @@ class ContinuouslyRangingNeuron(PreviewLearning): decimal.set_color(WHITE) decimal_color_anim = UpdateFromFunc(decimal, update_decimal_color) - self.play(*map(MoveToTarget, [neuron, decimal])) + self.play(*list(map(MoveToTarget, [neuron, decimal]))) for x in 0.7, 0.35, 0.97, 0.23, 0.54: curr_num = neuron.get_fill_opacity() self.play( @@ -3401,7 +3398,7 @@ class SomethingToImproveUpon(PiCreatureScene, TestPerformance): ) hidden_layers = network_mob.layers[1:3] - rects = VGroup(*map(SurroundingRectangle, hidden_layers)) + rects = VGroup(*list(map(SurroundingRectangle, hidden_layers))) np.random.seed(0) self.play(ShowCreation(rects)) @@ -3518,7 +3515,7 @@ class RandomlyLabeledImageData(Scene): group.shift(3*UP + 1.5*y*DOWN) groups.add(group) labels.add(group[-1]) - permutation = range(len(labels)) + permutation = list(range(len(labels))) while any(np.arange(len(labels)) == permutation): random.shuffle(permutation) for label, i in zip(labels, permutation): @@ -3561,7 +3558,7 @@ class TrainOnImages(PreviewLearning, RandomlyLabeledImageData): def construct(self): self.setup_network_mob() - image_names, label_names = zip(*self.image_label_pairs) + image_names, label_names = list(zip(*self.image_label_pairs)) label_names = list(label_names) random.shuffle(label_names) groups = [ diff --git a/old_projects/nn/part3.py b/old_projects/nn/part3.py index 3605801a..89fc73b1 100644 --- a/old_projects/nn/part3.py +++ b/old_projects/nn/part3.py @@ -146,7 +146,7 @@ class InterpretGradientComponents(GradientNudging): self.play(randy.change, "confused", words) self.play(Blink(randy)) self.wait() - self.play(*map(FadeOut, [randy, words, arrow])) + self.play(*list(map(FadeOut, [randy, words, arrow]))) def circle_magnitudes(self): rects = VGroup() @@ -286,9 +286,9 @@ class InterpretGradientComponents(GradientNudging): run_time = 2, ) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ w.dot, w.brace, w.number_line, w.words - ])) + ]))) ###### @@ -501,7 +501,7 @@ class ShowAveragingCost(PreviewLearning): words.scale(0.8) words.to_corner(UP+LEFT) - for x in xrange(self.n_adjustments): + for x in range(self.n_adjustments): if x < 2: self.play(FadeIn(words[x])) for train_in, train_out in training_data[:n_examples_per_adjustment]: @@ -660,7 +660,7 @@ class WalkThroughTwoExample(ShowAveragingCost): self.play( FadeOut(to_fade), - *map(MoveToTarget, movers) + *list(map(MoveToTarget, movers)) ) self.show_decimals(neurons) self.cannot_directly_affect_activations() @@ -1031,9 +1031,9 @@ class WalkThroughTwoExample(ShowAveragingCost): two_neuron_arrow.next_to(two_neuron, UP) VGroup(neuron_arrows, two_neuron_arrow).set_color(YELLOW) - neuron_rects = VGroup(*map( + neuron_rects = VGroup(*list(map( SurroundingRectangle, bright_neurons - )) + ))) two_neuron_rect = SurroundingRectangle(two_neuron) seeing_words = TextMobject("Seeing a 2") seeing_words.scale(0.8) @@ -1260,7 +1260,7 @@ class WalkThroughTwoExample(ShowAveragingCost): arrows_to_fade = VGroup(prev_neuron_arrows) output_labels = self.network_mob.output_labels - quads = zip(neurons, self.decimals, self.arrows, output_labels) + quads = list(zip(neurons, self.decimals, self.arrows, output_labels)) self.revert_to_original_skipping_status() self.play( @@ -1498,9 +1498,9 @@ class ConstructGradientFromAllTrainingExamples(Scene): self.v_lines = v_lines def setup_weights(self): - weights = VGroup(*map(TexMobject, [ + weights = VGroup(*list(map(TexMobject, [ "w_0", "w_1", "w_2", "\\vdots", "w_{13{,}001}" - ])) + ]))) for i, weight in enumerate(weights): weight.move_to(self.get_grid_position(i, 0)) weights.to_edge(LEFT, buff = MED_SMALL_BUFF) @@ -1520,7 +1520,7 @@ class ConstructGradientFromAllTrainingExamples(Scene): self.add(two) self.two_changes = VGroup() - for i in range(3) + [4]: + for i in list(range(3)) + [4]: weight = self.weights[i] bubble, change = self.get_requested_change_bubble(two) weight.save_state() @@ -1591,7 +1591,7 @@ class ConstructGradientFromAllTrainingExamples(Scene): self.get_random_decimal().move_to( self.get_grid_position(i, j) ) - for i in range(3) + [4] + for i in list(range(3)) + [4] for j in range(1, self.n_examples) ]) for change in changes: @@ -1624,7 +1624,7 @@ class ConstructGradientFromAllTrainingExamples(Scene): VGroup(two_change, *changes[k*i:k*(i+1)]) for i, two_change in enumerate(self.two_changes) ]) - for i in range(3) + [-1]: + for i in list(range(3)) + [-1]: self.change_rows[i].add(more_h_dots[i]) self.all_eyes = VGroup(*[ @@ -2212,10 +2212,7 @@ class SimplestNetworkExample(PreviewLearning): w.set_color(edge.get_color()) b_terms = expression.get_parts_by_tex("b_") variables = VGroup(*it.chain(w_terms, b_terms)) - other_terms = VGroup(*filter( - lambda m : m not in variables, - expression - )) + other_terms = VGroup(*[m for m in expression if m not in variables]) random.shuffle(variables.submobjects) self.play(ReplacementTransform(edges.copy(), w_terms)) @@ -2238,10 +2235,10 @@ class SimplestNetworkExample(PreviewLearning): self.remove(expression) def focus_just_on_last_two_layers(self): - to_fade = VGroup(*it.chain(*zip( + to_fade = VGroup(*it.chain(*list(zip( self.network_mob.layers[:2], self.network_mob.edge_groups[:2], - ))) + )))) for mob in to_fade: mob.save_state() self.play(LaggedStart( @@ -2316,7 +2313,7 @@ class SimplestNetworkExample(PreviewLearning): Write(not_exponents, run_time = 2) ) self.wait() - self.play(*map(FadeOut, [not_exponents, superscript_rects])) + self.play(*list(map(FadeOut, [not_exponents, superscript_rects]))) self.set_variables_as_attrs( a_labels, a_label_arrows, decimals, @@ -2343,7 +2340,7 @@ class SimplestNetworkExample(PreviewLearning): ) VGroup(words, rect, y_label).set_color(self.desired_output_color) - self.play(*map(FadeIn, [neuron, decimal])) + self.play(*list(map(FadeIn, [neuron, decimal]))) self.play( ShowCreation(rect), Write(words, run_time = 1) @@ -2391,9 +2388,7 @@ class SimplestNetworkExample(PreviewLearning): "(", "0.00", "-", "0.00", ")", "^2" ) numbers = expression.get_parts_by_tex("0.00") - non_numbers = VGroup(*filter( - lambda m : m not in numbers, expression - )) + non_numbers = VGroup(*[m for m in expression if m not in numbers]) expression.next_to(cost_equation, DOWN, aligned_edge = RIGHT) decimals = VGroup( self.decimals[0], @@ -2409,10 +2404,7 @@ class SimplestNetworkExample(PreviewLearning): ReplacementTransform(pre_y, y), ) self.play(LaggedStart( - FadeIn, VGroup(*filter( - lambda m : m not in [a, y], - cost_equation - )) + FadeIn, VGroup(*[m for m in cost_equation if m not in [a, y]]) )) self.play( MoveToTarget(decimals), @@ -2425,7 +2417,7 @@ class SimplestNetworkExample(PreviewLearning): ) self.play(C0.shift, MED_SMALL_BUFF*UP, rate_func = wiggle) self.wait() - self.play(*map(FadeOut, [decimals, non_numbers])) + self.play(*list(map(FadeOut, [decimals, non_numbers]))) self.set_variables_as_attrs( cost_equation, cost_word, cost_arrow @@ -2955,14 +2947,11 @@ class SimplestNetworkExample(PreviewLearning): graph_parts.scale, 0.7, graph_parts.get_bottom() ) self.wait(2) - self.play(*map(FadeOut, [rect, words])) + self.play(*list(map(FadeOut, [rect, words]))) def indicate_everything_on_screen(self): everything = VGroup(*self.get_top_level_mobjects()) - everything = VGroup(*filter( - lambda m : not m.is_subpath, - everything.family_members_with_points() - )) + everything = VGroup(*[m for m in everything.family_members_with_points() if not m.is_subpath]) self.play(LaggedStart( Indicate, everything, rate_func = wiggle, @@ -3091,7 +3080,7 @@ class SimplestNetworkExample(PreviewLearning): for d in (decimal, moving_decimals[0]) ] ) - self.play(*map(FadeOut, [double_arrow, moving_decimals])) + self.play(*list(map(FadeOut, [double_arrow, moving_decimals]))) #da_dz self.play( @@ -3292,11 +3281,11 @@ class SimplestNetworkExample(PreviewLearning): ) self.wait(2) self.cycle_through_altnernate_training_examples() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ VGroup(*full_derivative[3:]), lhs_brace, lhs_text, rhs_brace, rhs_text, - ])) + ]))) self.dC_dw = lhs @@ -3472,7 +3461,7 @@ class SimplestNetworkExample(PreviewLearning): ) ) self.wait(2) - self.play(*map(FadeOut, [dz_db, arrow, one])) + self.play(*list(map(FadeOut, [dz_db, arrow, one]))) self.dz_db = dz_db @@ -3726,7 +3715,7 @@ class GeneralFormulas(SimplestNetworkExample): all_subscript_rects.add(subscript_rects) start_labels, start_arrows = [ - VGroup(*map(VGroup, [group[i][0] for i in (0, 1)])).copy() + VGroup(*list(map(VGroup, [group[i][0] for i in (0, 1)]))).copy() for group in (all_labels, all_arrows) ] for label in start_labels: @@ -3734,7 +3723,7 @@ class GeneralFormulas(SimplestNetworkExample): self.add(all_decimals) self.play(*it.chain( - map(Write, start_labels), + list(map(Write, start_labels)), [GrowArrow(a[0]) for a in start_arrows] )) self.wait() @@ -3824,7 +3813,7 @@ class GeneralFormulas(SimplestNetworkExample): *[ ReplacementTransform(n1.decimal.copy(), n2.decimal) for n1, n2 in zip(layer.neurons, desired_output.neurons) - ] + map(GrowArrow, arrows) + ] + list(map(GrowArrow, arrows)) ) self.wait() @@ -3848,10 +3837,7 @@ class GeneralFormulas(SimplestNetworkExample): aj.target = cost_equation.get_part_by_tex("a^{(L)}_j") yj.target = cost_equation.get_part_by_tex("y_j") yj.target.set_color(self.desired_output_color) - to_fade_in = VGroup(*filter( - lambda m : m not in [aj.target, yj.target], - cost_equation - )) + to_fade_in = VGroup(*[m for m in cost_equation if m not in [aj.target, yj.target]]) sum_part = cost_equation.get_part_by_tex("sum") self.play(*[ @@ -3874,10 +3860,7 @@ class GeneralFormulas(SimplestNetworkExample): def show_example_weight(self): edges = self.network_mob.edge_groups[-1] edge = self.chosen_neurons[1].edges_in[1] - faded_edges = VGroup(*filter( - lambda e : e is not edge, - edges - )) + faded_edges = VGroup(*[e for e in edges if e is not edge]) faded_edges.save_state() for faded_edge in faded_edges: faded_edge.save_state() @@ -3974,10 +3957,7 @@ class GeneralFormulas(SimplestNetworkExample): aLm1_part ), ) - self.play(Write(VGroup(*filter( - lambda m : m not in [w_part, aLm1_part], - z_formula - )))) + self.play(Write(VGroup(*[m for m in z_formula if m not in [w_part, aLm1_part]]))) self.wait() self.play(ReplacementTransform( self.chosen_neurons[1].label.copy(), diff --git a/old_projects/nn/playground.py b/old_projects/nn/playground.py index f6b22e7b..231bd18f 100644 --- a/old_projects/nn/playground.py +++ b/old_projects/nn/playground.py @@ -112,7 +112,7 @@ class Test(Scene): out[k] = 1 in_vect = maximizing_input(network, layer, out) new_out = network.get_activation_of_all_layers(in_vect)[layer] - group = Group(*map(MNistMobject, [in_vect, new_out])) + group = Group(*list(map(MNistMobject, [in_vect, new_out]))) group.arrange_submobjects(DOWN+RIGHT, SMALL_BUFF) groups.add(group) groups.arrange_submobjects_in_grid() @@ -133,7 +133,7 @@ class Test(Scene): def get_set(self, network, test): test_in, test_out = test activations = network.get_activation_of_all_layers(test_in) - group = Group(*map(MNistMobject, activations)) + group = Group(*list(map(MNistMobject, activations))) group.arrange_submobjects(RIGHT, buff = LARGE_BUFF) return group diff --git a/old_projects/patreon.py b/old_projects/patreon.py index 30a18bd1..468b8a8f 100644 --- a/old_projects/patreon.py +++ b/old_projects/patreon.py @@ -122,7 +122,7 @@ class GrowingToDoList(Scene): underline = Line(title.get_left(), title.get_right()) underline.next_to(title, DOWN) - lines = VGroup(*map(TextMobject, [ + lines = VGroup(*list(map(TextMobject, [ "That one on topology", "Something with quaternions", "Solving puzzles with binary counting", @@ -136,7 +136,7 @@ class GrowingToDoList(Scene): "Fourier stuffs", "$1+2+3+\\cdots = -\\frac{1}{12}$", "Understanding entropy", - ])) + ]))) lines.scale(0.65) lines.arrange_submobjects(DOWN, buff = MED_SMALL_BUFF, aligned_edge = LEFT) lines.set_color_by_gradient(BLUE_C, YELLOW) @@ -461,7 +461,7 @@ class PythagoreanTransformation(Scene): b_square_tex.move_to(b_square) self.play(ShowCreation(tri1, run_time = 2)) - self.play(*map(Write, [a, b, c])) + self.play(*list(map(Write, [a, b, c]))) self.wait() self.play( FadeIn(c_square), @@ -479,7 +479,7 @@ class PythagoreanTransformation(Scene): self.remove(mover) self.add(big_square, *[tri1]+copies) self.wait(2) - self.play(*map(FadeOut, [a, b, c, c_square])) + self.play(*list(map(FadeOut, [a, b, c, c_square]))) self.play( tri3.shift, tri1.get_corner(UP+LEFT) -\ @@ -612,7 +612,7 @@ class IntegrationByParts(Scene): self.draw_curve(curve) self.play(ShowCreation(rect)) - self.play(*map(Write, [down_brace, left_brace, f_T, g_T])) + self.play(*list(map(Write, [down_brace, left_brace, f_T, g_T]))) self.wait() self.play(FadeIn(upper_right)) self.play( @@ -660,7 +660,7 @@ class IntegrationByParts(Scene): rate_func = None ) self.wait() - self.play(*map(FadeOut, [coords, dot])) + self.play(*list(map(FadeOut, [coords, dot]))) class EndScreen(TeacherStudentsScene): def construct(self): diff --git a/old_projects/pi_day.py b/old_projects/pi_day.py index 8445d7c1..fb4850c0 100644 --- a/old_projects/pi_day.py +++ b/old_projects/pi_day.py @@ -428,7 +428,7 @@ class ManyFormulas(Scene): angle_group = angle_groups[0] - self.play(*map(FadeIn, [circle, radius])) + self.play(*list(map(FadeIn, [circle, radius]))) self.play( circle.set_stroke, {"width" : 1,}, FadeIn(angle_group), @@ -722,7 +722,7 @@ class UsingTheta(Scene): class ThingsNamedAfterEuler(Scene): def construct(self): - group = VGroup(*map(TextMobject, [ + group = VGroup(*list(map(TextMobject, [ "Euler's formula (Complex analysis)", "Euler's formula (Graph theory)", "Euler's formula (Mechanical engineering)", @@ -733,7 +733,7 @@ class ThingsNamedAfterEuler(Scene): "Euler equations (fluid dynamics)", "Euler angles (rigid-body mechanics)", "Euler totient function (number theory)", - ])) + ]))) group.arrange_submobjects(DOWN, aligned_edge = LEFT) group.set_height(FRAME_HEIGHT - 1) @@ -973,12 +973,12 @@ class SpecialThanks(Scene): h_line.next_to(title, DOWN) h_line.set_stroke(WHITE, 1) - people = VGroup(*map(TextMobject, [ + people = VGroup(*list(map(TextMobject, [ "Ben Hambrecht", "University Library Basel", "Martin Mattmüller", "Library of the Institut de France", - ])) + ]))) people.arrange_submobjects(DOWN, aligned_edge = LEFT, buff = MED_LARGE_BUFF) people.next_to(h_line, DOWN) diff --git a/old_projects/playground_counting_in_binary.py b/old_projects/playground_counting_in_binary.py index df786cf9..070de121 100644 --- a/old_projects/playground_counting_in_binary.py +++ b/old_projects/playground_counting_in_binary.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -from __future__ import print_function + import numpy as np import itertools as it from copy import deepcopy @@ -191,10 +191,9 @@ class ShowCounting(SceneFromVideo): print(count) mob = TexMobject(str(count)).scale(1.5) mob.shift(0.3*LEFT).to_edge(UP, buff = 0.1) - index_range = range( + index_range = list(range( max(COUNT_TO_FRAME_NUM[count]-10, 0), - COUNT_TO_FRAME_NUM[count+1]-10 - ) + COUNT_TO_FRAME_NUM[count+1]-10)) for index in index_range: self.frames[index] = disp.paint_mobject( mob, self.frames[index] diff --git a/old_projects/putnam.py b/old_projects/putnam.py index eb8eae3a..51fa345d 100644 --- a/old_projects/putnam.py +++ b/old_projects/putnam.py @@ -100,7 +100,7 @@ class IntroducePutnam(Scene): self.play( ReplacementTransform(six_hours, three_hours), ReplacementTransform(six_hours.copy(), three_hours_copy), - *map(ShowCreation, rects) + *list(map(ShowCreation, rects)) ) self.wait() self.play(LaggedStart( @@ -180,11 +180,11 @@ class OtherVideoClips(Scene): rect.set_height(6.5) rect.center() rect.to_edge(DOWN) - titles = map(TextMobject, [ + titles = list(map(TextMobject, [ "Essence of calculus, chapter 1", "Pi hiding in prime regularities", "How do cryptocurrencies work?" - ]) + ])) self.add(rect) last_title = None @@ -363,7 +363,7 @@ class TwoDCase(Scene): self.play( morty.change, "happy", morty.fade, 1, - *map(FadeOut, [bubble, bubble.content]) + *list(map(FadeOut, [bubble, bubble.content])) ) self.remove(morty) @@ -498,9 +498,9 @@ class TwoDCase(Scene): arc = self.arc self.triangle.save_state() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ self.push_pins, self.triangle, self.arc_lines - ])) + ]))) self.update_animations.remove(self.triangle_update) self.update_animations += [ self.get_center_lines_update(self.point_mobs, self.center_lines), @@ -768,7 +768,7 @@ class TwoDCase(Scene): def get_point_mob_angles(self): point_mobs = self.point_mobs points = [pm.get_center() - self.center for pm in point_mobs] - return np.array(map(angle_of_vector, points)) + return np.array(list(map(angle_of_vector, points))) def have_p3_jump_around_randomly(self, n_jumps, wait_time = 0.75, run_time = 0): for x in range(n_jumps): @@ -881,7 +881,7 @@ class RevisitTwoDCase(TwoDCase): self.n_in += 1 else: self.n_out += 1 - nums = map(Integer, [self.n_in, self.n_in, self.n_out]) + nums = list(map(Integer, [self.n_in, self.n_in, self.n_out])) VGroup(*nums[:2]).set_color(self.positive_triangle_color) VGroup(*nums[2:]).set_color(self.negative_triangle_color) for num, placeholder, position in zip(nums, placeholders, positions): @@ -902,7 +902,7 @@ class RevisitTwoDCase(TwoDCase): nums = place_random_triangles(self.n_random_trials, 0.05) self.add(nums) self.wait() - self.play(*map(FadeOut, [frac, nums, title])) + self.play(*list(map(FadeOut, [frac, nums, title]))) def add_lines_and_comment_on_them(self): center_lines = self.get_center_lines() @@ -938,12 +938,12 @@ class RevisitTwoDCase(TwoDCase): self.play( center_lines.restore, center_lines.fade, 1, - *map(FadeOut, [ + *list(map(FadeOut, [ rect, words2, center_line_shadows, self.triangle, arcs, self.point_mobs, self.point_labels, - ]) + ])) ) center_lines.restore() self.remove(center_lines) @@ -960,12 +960,12 @@ class RevisitTwoDCase(TwoDCase): group = VGroup(random_procedure, underline) group.to_corner(UP+RIGHT) - words = VGroup(*map(TextMobject, [ + words = VGroup(*list(map(TextMobject, [ "Choose 3 random points", "Choose 2 random lines", "Flip coin for each line \\\\ to get $P_1$ and $P_2$", "Choose $P_3$ at random" - ])) + ]))) words.scale(0.8) words.arrange_submobjects(DOWN, buff = MED_LARGE_BUFF) words.next_to(underline, DOWN) @@ -1210,7 +1210,7 @@ class ContrastTwoRandomProcesses(TwoDCase): ) self.add(c2) n = len(c2) - len(c1) - self.play(*map(GrowFromCenter, c2[-n:])) + self.play(*list(map(GrowFromCenter, c2[-n:]))) class Rewrite3DRandomProcedure(Scene): def construct(self): @@ -1222,12 +1222,12 @@ class Rewrite3DRandomProcedure(Scene): group = VGroup(random_procedure, underline) group.to_corner(UP+LEFT) - words = VGroup(*map(TextMobject, [ + words = VGroup(*list(map(TextMobject, [ "Choose 4 random points", "Choose 3 random lines", "Choose $P_4$ at random", "Flip coin for each line \\\\ to get $P_1$, $P_2$, $P_3$", - ])) + ]))) words.scale(0.8) words.arrange_submobjects(DOWN, buff = MED_LARGE_BUFF) words.next_to(underline, DOWN) diff --git a/old_projects/pythagorean_proof.py b/old_projects/pythagorean_proof.py index b59eb9bc..8b13654c 100644 --- a/old_projects/pythagorean_proof.py +++ b/old_projects/pythagorean_proof.py @@ -165,7 +165,7 @@ class IndicateTroublePointFromParallelLines(AddParallelLines): vect = DOWN+RIGHT arrow = Arrow(circle.get_center()+2*vect, circle.get_boundary_point(vect)) arrow.set_color(circle.get_color()) - self.add_mobjects_among(locals().values()) + self.add_mobjects_among(list(locals().values())) class DrawAllThreeSquaresWithMoreTriangles(DrawAllThreeSquares): @@ -224,7 +224,7 @@ class IndicateBigRectangleTroublePoint(DrawAllThreeSquaresWithMoreTriangles): circle.shift(4*RIGHT) vect = DOWN+RIGHT arrow = Arrow(circle.get_center()+vect, circle.get_boundary_point(vect)) - self.add_mobjects_among(locals().values()) + self.add_mobjects_among(list(locals().values())) class ShowBigRectangleDimensions(DrawAllThreeSquaresWithMoreTriangles): args_list = [(10, False)] @@ -239,7 +239,7 @@ class ShowBigRectangleDimensions(DrawAllThreeSquaresWithMoreTriangles): b_plus_2a = TexMobject("b+2a").scale(TEX_MOB_SCALE_FACTOR) a_plus_2b.next_to(u_brace, DOWN) b_plus_2a.next_to(side_brace, LEFT) - self.add_mobjects_among(locals().values()) + self.add_mobjects_among(list(locals().values())) class FillInAreaOfBigRectangle(DrawAllThreeSquaresWithMoreTriangles): args_list = [(10, False)] @@ -267,7 +267,7 @@ class DrawOnlyABSquares(Scene): symobl.shift(mob.get_center()) self.add(symobl) triangle = Triangle() - self.add_mobjects_among(locals().values()) + self.add_mobjects_among(list(locals().values())) class AddTriangleCopyToABSquares(DrawOnlyABSquares): def construct(self): @@ -317,7 +317,7 @@ class DrawCSquareWithAllTraingles(Scene): ] @staticmethod def args_to_string(*toggle_vector): - return "".join(map(str, map(int, toggle_vector))) + return "".join(map(str, list(map(int, toggle_vector)))) def construct(self, *toggle_vector): if len(toggle_vector) == 0: @@ -388,7 +388,7 @@ class ZoomInOnTroublePoint(Scene): angle1_arc.filter_out(lambda x_y_z2 : not (x_y_z2[0] > 0 and x_y_z2[1] > 0 and x_y_z2[1] < x_y_z2[0]/3)) angle2_arc.filter_out(lambda x_y_z3 : not (x_y_z3[0] < 0 and x_y_z3[1] > 0 and x_y_z3[1] < -3*x_y_z3[0])) - self.add_mobjects_among(locals().values()) + self.add_mobjects_among(list(locals().values())) self.add_elbow() if rotate: for mob in self.mobjects: @@ -456,7 +456,7 @@ class CompletelyFillLargeSquare(LabelLargeSquare): LabelLargeSquare.construct(self) vertices = [2*(DOWN+LEFT), 2*(DOWN+RIGHT), 2*(UP+RIGHT), 2*(UP+LEFT)] vertices.append(vertices[0]) - pairs = zip(vertices, vertices[1:]) + pairs = list(zip(vertices, vertices[1:])) self.set_color_region(region_from_line_boundary(*pairs), color = BLUE) diff --git a/old_projects/qa_round_two.py b/old_projects/qa_round_two.py index e43f5657..9b7b477d 100644 --- a/old_projects/qa_round_two.py +++ b/old_projects/qa_round_two.py @@ -106,7 +106,7 @@ class PowersOfTwo(Scene): two_to_ten.replace(mob[0]) self.play( two_to_ten.restore, - *map(ShowCreation, lines) + *list(map(ShowCreation, lines)) ) curr_po2_outline = curr_po2[-1].copy() diff --git a/old_projects/tattoo.py b/old_projects/tattoo.py index af883894..7de497bb 100644 --- a/old_projects/tattoo.py +++ b/old_projects/tattoo.py @@ -255,9 +255,9 @@ class ExplainTrigFunctionDistances(TrigRepresentationsScene, PiCreatureScene): Write(one) ) self.wait(2) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ words, arrow, brace, one - ])) + ]))) self.radial_line_label = VGroup(brace, one) def show_sine_and_cosine(self): @@ -335,9 +335,9 @@ class ExplainTrigFunctionDistances(TrigRepresentationsScene, PiCreatureScene): self.wait() self.change_mode("confused") self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ tan_frac, cot_frac, self.sin_group, self.cos_group - ])) + ]))) self.wait() self.play( @@ -387,7 +387,7 @@ class ExplainTrigFunctionDistances(TrigRepresentationsScene, PiCreatureScene): self.tangent_line = self.get_tangent_line() self.add(self.tangent_line) self.play(*it.chain(*[ - map(FadeOut, [tan_group, cot_group]), + list(map(FadeOut, [tan_group, cot_group])), [Animation(self.theta_group[-1])] ])) @@ -472,9 +472,9 @@ class ExplainTrigFunctionDistances(TrigRepresentationsScene, PiCreatureScene): self.change_mode("confused") self.wait(2) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ sec_group, sec_frac - ])) + ]))) self.csc_group = csc_group self.csc_frac =csc_frac @@ -543,7 +543,7 @@ class ExplainTrigFunctionDistances(TrigRepresentationsScene, PiCreatureScene): self.pi_creature.change_mode, "confused" ) self.wait(2) - self.play(*map(FadeOut, [question, arrow])) + self.play(*list(map(FadeOut, [question, arrow]))) self.play(Write(opp_over_hyp)) @@ -578,11 +578,11 @@ class ExplainTrigFunctionDistances(TrigRepresentationsScene, PiCreatureScene): self.change_mode("happy") self.play(FadeOut(opp_over_hyp)) self.reciprocate(frac1, frac2) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ one, self.csc_group, tri1, frac1, frac2, self.csc_frac, arc_theta - ])) + ]))) def reciprocate(self, frac1, frac2): # Not general, meant only for these definitions: @@ -721,13 +721,13 @@ class RenameAllInTermsOfSine(Scene): "= \\frac{1}{\\sin(90^\\circ - \\theta)}", "= \\frac{\\sin(90^\\circ - \\theta)}{\\sin(\\theta)}", ] - mobs = VGroup(*map(TexMobject, texs)) + mobs = VGroup(*list(map(TexMobject, texs))) sin, cos, tan = mobs[:3] sin.target_color = YELLOW cos.target_color = GREEN tan.target_color = RED - rhs_mobs = VGroup(*map(TexMobject, equivs)) + rhs_mobs = VGroup(*list(map(TexMobject, equivs))) rhs_mobs.submobjects[0] = VectorizedPoint() for mob, shift_val in zip(mobs, shift_vals): mob.shift(shift_val) @@ -741,7 +741,7 @@ class RenameAllInTermsOfSine(Scene): VGroup(mob.target, rhs_mob).move_to(mob) sin.target.set_color(sin.target_color) self.play(*it.chain(*[ - map(MoveToTarget, mobs), + list(map(MoveToTarget, mobs)), [Write(rhs_mobs)] ])) self.wait(2) diff --git a/old_projects/tau_poem.py b/old_projects/tau_poem.py index 4ec0f705..fbb4111e 100644 --- a/old_projects/tau_poem.py +++ b/old_projects/tau_poem.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -from __future__ import absolute_import + import numpy as np import itertools as it from copy import deepcopy @@ -59,7 +59,7 @@ FORMULAE = [ # "\\sum_{n = 0}^\\infty \\frac{(-1)^n}{2n+1} = \\frac{\\pi}{4} \\\\", ] -DIGITS = map(str, list("62831853071795864769")) +DIGITS = list(map(str, list("62831853071795864769"))) DIGITS[1] = "." + DIGITS[1] #2->.2 BUFF = 1.0 @@ -84,7 +84,7 @@ class HappyTauDayWords(Scene): self.play(BlinkPiCreature(pi)) class TauPoem(Scene): - args_list = map(lambda x : (x,), range(len(POEM_LINES))) + args_list = [(x,) for x in range(len(POEM_LINES))] @staticmethod def args_to_string(line_num, *ignore): return str(line_num) diff --git a/old_projects/three_dimensions.py b/old_projects/three_dimensions.py index 304463ae..8c69a1e1 100644 --- a/old_projects/three_dimensions.py +++ b/old_projects/three_dimensions.py @@ -38,7 +38,7 @@ class CubeWithFaces(Mobject2D): self.set_color(BLUE) def unit_normal(self, coords): - return np.array(map(lambda x : 1 if abs(x) == 1 else 0, coords)) + return np.array([1 if abs(x) == 1 else 0 for x in coords]) class Cube(Mobject1D): def generate_points(self): @@ -87,7 +87,7 @@ class Dodecahedron(Mobject1D): ]).points #Rotate those 5 edges into all 30. for i in range(3): - perm = map(lambda j : j%3, range(i, i+3)) + perm = [j%3 for j in range(i, i+3)] for b in [-1, 1]: matrix = b*np.array([x[perm], y[perm], z[perm]]) self.add_points(np.dot(five_lines_points, matrix)) diff --git a/old_projects/triangle_of_power/end.py b/old_projects/triangle_of_power/end.py index b6defafc..bc2fb3d5 100644 --- a/old_projects/triangle_of_power/end.py +++ b/old_projects/triangle_of_power/end.py @@ -177,9 +177,9 @@ class TriangleOfPowerIsBetter(Scene): def construct(self): top = TOP("x", "y", "z", radius = 0.75) top.set_color(BLUE) - alts = VMobject(*map(TexMobject, [ + alts = VMobject(*list(map(TexMobject, [ "x^y", "\\log_x(z)", "\\sqrt[y]{z}" - ])) + ]))) for mob, color in zip(alts.split(), OPERATION_COLORS): mob.set_color(color) alts.arrange_submobjects(DOWN) diff --git a/old_projects/triangle_of_power/intro.py b/old_projects/triangle_of_power/intro.py index 1f0ee12f..61156e5b 100644 --- a/old_projects/triangle_of_power/intro.py +++ b/old_projects/triangle_of_power/intro.py @@ -332,11 +332,11 @@ class WhatTheHell(Scene): def construct(self): randy = Randolph() randy.to_corner(DOWN+LEFT) - exp, rad, log = map(TexMobject,[ + exp, rad, log = list(map(TexMobject,[ "2^3 = 8", "\\sqrt[3]{8} = 2", "\\log_2(8) = 3", - ]) + ])) # exp.set_color(BLUE_D) # rad.set_color(RED_D) # log.set_color(GREEN_D) @@ -458,9 +458,9 @@ class LogarithmProperties(Scene): class HaveToShare(Scene): def construct(self): - words = map(TextMobject, [ + words = list(map(TextMobject, [ "Lovely", "Symmetrical", "Utterly Reasonable" - ]) + ])) for w1, w2 in zip(words, words[1:]): w2.next_to(w1, DOWN) VMobject(*words).center() diff --git a/old_projects/triangle_of_power/triangle.py b/old_projects/triangle_of_power/triangle.py index 5fd7b2d7..c8eea676 100644 --- a/old_projects/triangle_of_power/triangle.py +++ b/old_projects/triangle_of_power/triangle.py @@ -22,14 +22,14 @@ def get_equation(index, x = 2, y = 3, z = 8, expression_only = False): return TexMobject(tex).set_color(OPERATION_COLORS[index]) def get_inverse_rules(): - return map(TexMobject, [ + return list(map(TexMobject, [ "x^{\\log_x(z)} = z", "\\log_x\\left(x^y \\right) = y", "\\sqrt[y]{x^y} = x", "\\left(\\sqrt[y]{z}\\right)^y = z", "\\sqrt[\\log_x(z)]{z} = x", "\\log_{\\sqrt[y]{z}}(z) = y", - ]) + ])) def get_top_inverse_rules(): result = [] @@ -283,9 +283,9 @@ class SixDifferentInverses(Scene): top_rule.set_height(1.5) top_rule.center() top_rule.shift(rule.get_center()) - self.play(*map(FadeOut, rules)) + self.play(*list(map(FadeOut, rules))) self.remove(*rules) - self.play(*map(GrowFromCenter, top_rules)) + self.play(*list(map(GrowFromCenter, top_rules))) self.wait() self.remove(general_idea) rules = get_inverse_rules() @@ -395,10 +395,7 @@ class AdditiveProperty(Scene): ApplyMethod(log_rule.set_color, RED), ) self.wait() - all_tops = filter( - lambda m : isinstance(m, TOP), - t_exp_rule.split()+t_log_rule.split() - ) + all_tops = [m for m in t_exp_rule.split()+t_log_rule.split() if isinstance(m, TOP)] self.put_in_circles(all_tops) self.set_color_appropriate_parts(t_exp_rule, t_log_rule) diff --git a/old_projects/triples.py b/old_projects/triples.py index 1734e7f7..8ab09044 100644 --- a/old_projects/triples.py +++ b/old_projects/triples.py @@ -67,21 +67,18 @@ class IntroduceTriples(TeacherStudentsScene): ) if c in [5, 13, 25]: if c == 5: - keys = range(0, 5, 2) + keys = list(range(0, 5, 2)) elif c == 13: - keys = range(0, 13, 3) + keys = list(range(0, 13, 3)) elif c == 25: - keys = range(0, 25, 4) - i_list = filter( - lambda i : (i%c) in keys and (i//c) in keys, - range(c**2) - ) + keys = list(range(0, 25, 4)) + i_list = [i for i in range(c**2) if (i%c) in keys and (i//c) in keys] else: - i_list = range(a**2) - not_i_list = filter( + i_list = list(range(a**2)) + not_i_list = list(filter( lambda i : i not in i_list, - range(c**2), - ) + list(range(c**2)), + )) c_square_parts = [ VGroup(*[c_square[i] for i in i_list]), VGroup(*[c_square[i] for i in not_i_list]), @@ -121,7 +118,7 @@ class IntroduceTriples(TeacherStudentsScene): self.play(Write(equation)) self.play(c_square.set_color, C_COLOR) self.wait() - self.play(*map(FadeOut, [full_group, equation])) + self.play(*list(map(FadeOut, [full_group, equation]))) class CompareToFermatsLastTheorem(TeacherStudentsScene): def construct(self): @@ -204,8 +201,8 @@ class ShowManyTriples(Scene): if triangle.get_width() > max_width: triangle.set_width(max_width) triangle.move_to(2*RIGHT) - num_strings = map(str, (a, b, c)) - labels = map(TexMobject, num_strings) + num_strings = list(map(str, (a, b, c))) + labels = list(map(TexMobject, num_strings)) for label, color in zip(labels, SIDE_COLORS): label.set_color(color) labels[0].next_to(triangle, DOWN) @@ -350,7 +347,7 @@ class PythagoreanProof(Scene): self.add(triangle, triangle_copy) self.play(Write(side_labels)) self.wait() - self.play(*map(DrawBorderThenFill, squares)) + self.play(*list(map(DrawBorderThenFill, squares))) self.add_labels_to_squares(squares, side_labels) self.wait() self.play( @@ -373,10 +370,10 @@ class PythagoreanProof(Scene): ) self.wait() - big_squares = VGroup(*map( + big_squares = VGroup(*list(map( self.get_big_square, [triangle, triangle_copy] - )) + ))) negative_space_words = TextMobject( "Same negative \\\\ space" ) @@ -389,12 +386,12 @@ class PythagoreanProof(Scene): FadeIn(big_squares), Write(negative_space_words), ShowCreation(double_arrow), - *map(FadeOut, squares) + *list(map(FadeOut, squares)) ) self.wait(2) self.play(*it.chain( - map(FadeIn, squares), - map(Animation, big_squares), + list(map(FadeIn, squares)), + list(map(Animation, big_squares)), )) self.wait(2) @@ -436,7 +433,7 @@ class PythagoreanProof(Scene): ##### def get_triangle_side_labels(self, triangle): - a, b, c = map(TexMobject, "abc") + a, b, c = list(map(TexMobject, "abc")) for mob, color in zip([a, b, c], SIDE_COLORS): mob.set_color(color) a.next_to(triangle, DOWN) @@ -603,7 +600,7 @@ class ReframeOnLattice(PiCreatureScene): Transform(group.line, new_group.line), ) self.wait(2) - self.play(*map(FadeOut, [group, group.triangle, group.line])) + self.play(*list(map(FadeOut, [group, group.triangle, group.line]))) def resize_plane(self): new_plane = ComplexPlane( @@ -638,7 +635,7 @@ class ReframeOnLattice(PiCreatureScene): self.play( MoveToTarget(self.plane), - *map(MoveToTarget, self.plane.coordinate_labels), + *list(map(MoveToTarget, self.plane.coordinate_labels)), run_time = 2 ) self.remove(self.plane) @@ -922,7 +919,7 @@ class ReframeOnLattice(PiCreatureScene): dot.target.move_to(line.target.get_end()) self.play( FadeOut(distance_label), - *map(MoveToTarget, [five, line, dot]), + *list(map(MoveToTarget, [five, line, dot])), run_time = 2 ) self.wait(2) @@ -930,12 +927,12 @@ class ReframeOnLattice(PiCreatureScene): #### def get_all_plane_dots(self): - x_min, y_min = map(int, self.plane.point_to_coords( + x_min, y_min = list(map(int, self.plane.point_to_coords( FRAME_X_RADIUS*LEFT + FRAME_Y_RADIUS*DOWN - )) - x_max, y_max = map(int, self.plane.point_to_coords( + ))) + x_max, y_max = list(map(int, self.plane.point_to_coords( FRAME_X_RADIUS*RIGHT + FRAME_Y_RADIUS*UP - )) + ))) result = VGroup(*[ Dot( self.plane.coords_to_point(x, y), @@ -964,8 +961,8 @@ class OneMoreExample(Scene): "unit_size" : 0.5, "plane_center" : 3*LEFT + 3*DOWN, "dot_color" : YELLOW, - "x_label_range" : range(-6, 25, 3), - "y_label_range" : range(3, 13, 3), + "x_label_range" : list(range(-6, 25, 3)), + "y_label_range" : list(range(3, 13, 3)), } def construct(self): self.add_plane() @@ -1319,8 +1316,8 @@ class FiveTwoExample(GeneralExample): CONFIG = { "number" : complex(5, 2), "unit_size" : 0.25, - "x_label_range" : range(-10, 40, 5), - "y_label_range" : range(0, 30, 5), + "x_label_range" : list(range(-10, 40, 5)), + "y_label_range" : list(range(0, 30, 5)), } class WriteGeneralFormula(GeneralExample): @@ -1419,7 +1416,7 @@ class WriteGeneralFormula(GeneralExample): line.set_color(self.square_color) - self.play(*map(FadeIn, [rect, top_line, second_line])) + self.play(*list(map(FadeIn, [rect, top_line, second_line]))) self.wait() self.play( real_part.copy().next_to, real_part_line.copy(), @@ -1504,10 +1501,10 @@ class WriteGeneralFormula(GeneralExample): triple_mobs.arrange_submobjects(DOWN) triple_mobs.next_to(triple_title, DOWN, MED_LARGE_BUFF) - self.play(*map(FadeIn, [ + self.play(*list(map(FadeIn, [ rect, h_line, v_line, uv_title, triple_title - ])) + ]))) self.play(*[ LaggedStart( FadeIn, mob, @@ -1522,8 +1519,8 @@ class VisualizeZSquared(Scene): "initial_unit_size" : 0.4, "final_unit_size" : 0.1, "plane_center" : 3*LEFT + 2*DOWN, - "x_label_range" : range(-12, 24, 4), - "y_label_range" : range(-4, 24, 4), + "x_label_range" : list(range(-12, 24, 4)), + "y_label_range" : list(range(-4, 24, 4)), "dot_color" : YELLOW, "square_color" : MAROON_B, "big_dot_radius" : 0.075, @@ -1644,7 +1641,7 @@ class VisualizeZSquared(Scene): label.next_to(point, vect) label.add_background_rectangle() - self.play(*map(FadeIn, [z_label, z_dot])) + self.play(*list(map(FadeIn, [z_label, z_dot]))) self.wait() self.play(ShowCreation(arrow)) self.play(ReplacementTransform( @@ -1662,9 +1659,9 @@ class VisualizeZSquared(Scene): arrows.add(arrow) dots.add(z_dot, square_dot) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ dots, arrows, self.z_to_z_squared - ])) + ]))) def draw_dots(self): min_corner, max_corner = [ @@ -1673,8 +1670,8 @@ class VisualizeZSquared(Scene): ) for u in (-1, 1) ] - x_min, y_min = map(int, min_corner[:2]) - x_max, y_max = map(int, max_corner[:2]) + x_min, y_min = list(map(int, min_corner[:2])) + x_max, y_max = list(map(int, max_corner[:2])) dots = VGroup(*[ Dot( @@ -1779,7 +1776,7 @@ class VisualizeZSquared(Scene): self.revert_to_original_skipping_status() self.play( - *map(MoveToTarget, movers), + *list(map(MoveToTarget, movers)), run_time = 3 ) self.wait(2) @@ -1876,8 +1873,8 @@ class PointsWeMiss(VisualizeZSquared): CONFIG = { "final_unit_size" : 0.4, "plane_center" : 2*LEFT + 2*DOWN, - "dot_x_range" : range(-5, 6), - "dot_y_range" : range(-4, 4), + "dot_x_range" : list(range(-5, 6)), + "dot_y_range" : list(range(-4, 4)), } def construct(self): self.add_plane() @@ -1915,11 +1912,11 @@ class PointsWeMiss(VisualizeZSquared): def show_missing_point(self): z_list = [complex(6, 8), complex(9, 12), complex(3, 4)] - points = map( + points = list(map( self.background_plane.number_to_point, z_list - ) - dots = VGroup(*map(Dot, points)) + )) + dots = VGroup(*list(map(Dot, points))) for dot in dots[:2]: dot.set_stroke(RED, 4) dot.set_fill(opacity = 0) @@ -1964,11 +1961,11 @@ class PointsWeMiss(VisualizeZSquared): def show_second_missing_point(self): z_list = [complex(4, 3), complex(8, 6)] - points = map( + points = list(map( self.background_plane.number_to_point, z_list - ) - dots = VGroup(*map(Dot, points)) + )) + dots = VGroup(*list(map(Dot, points))) dots[0].set_stroke(RED, 4) dots[0].set_fill(opacity = 0) labels = VGroup(*[ @@ -2067,10 +2064,10 @@ class DrawSingleRadialLine(PointsWeMiss): class DrawRadialLines(PointsWeMiss): CONFIG = { "final_unit_size" : 0.2, - "dot_x_range" : range(-4, 10), - "dot_y_range" : range(-4, 10), - "x_label_range" : range(-12, 40, 4), - "y_label_range" : range(-4, 32, 4), + "dot_x_range" : list(range(-4, 10)), + "dot_y_range" : list(range(-4, 10)), + "x_label_range" : list(range(-12, 40, 4)), + "y_label_range" : list(range(-4, 32, 4)), "big_dot_radius" : 0.05, } def construct(self): @@ -2214,8 +2211,8 @@ class RationalPointsOnUnitCircle(DrawRadialLines): self.from_rational_point_to_triple() def add_plane(self): - added_x_coords = range(-4, 6, 2) - added_y_coords = range(-2, 4, 2) + added_x_coords = list(range(-4, 6, 2)) + added_y_coords = list(range(-2, 4, 2)) self.x_label_range += added_x_coords self.y_label_range += added_y_coords DrawRadialLines.add_plane(self) @@ -2561,7 +2558,7 @@ class SupposeMissingPoint(PointsWeMiss): self.play(ShowCreation(circle)) self.add(dot.copy().fade()) self.add(line.copy().set_stroke(GREY, 1)) - self.play(*map(MoveToTarget, [dot, line])) + self.play(*list(map(MoveToTarget, [dot, line]))) self.wait() self.play( Write(rational_point_word), @@ -2643,7 +2640,7 @@ class FinalProof(RationalPointsOnUnitCircle): rise_text = rise_brace.get_text("Rise = $\\frac{b}{c}$") rise_text.add_background_rectangle() - self.play(*map(ShowCreation, [h_line, v_line])) + self.play(*list(map(ShowCreation, [h_line, v_line]))) self.wait() self.play( GrowFromCenter(rise_brace), @@ -2655,13 +2652,13 @@ class FinalProof(RationalPointsOnUnitCircle): FadeIn(run_text) ) self.wait(3) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ self.example_dot, self.example_label, self.secant_line, h_line, v_line, run_brace, rise_brace, run_text, rise_text, - ])) + ]))) def show_all_rational_slopes(self): lines = VGroup() @@ -2707,7 +2704,7 @@ class FinalProof(RationalPointsOnUnitCircle): Transform(label, new_label), ) self.wait() - self.play(*map(FadeOut, [line, label])) + self.play(*list(map(FadeOut, [line, label]))) def square_example_point(self): z = complex(2, 1) @@ -2948,8 +2945,8 @@ class BitOfCircleGeometry(Scene): group.set_color(color) group.add(arc, label) if len(groups) == 0: - self.play(*map(ShowCreation, [dot1, dot2])) - self.play(*map(ShowCreation, [line1, line2])) + self.play(*list(map(ShowCreation, [dot1, dot2]))) + self.play(*list(map(ShowCreation, [line1, line2]))) self.play(ShowCreation(arc)) self.play(FadeIn(label)) groups.add(group) @@ -3032,12 +3029,12 @@ class Thumbnail(DrawRadialLines): fill_opacity = 1, ) rect.to_corner(UP+RIGHT, buff = 0.01) - triples = VGroup(*map(TexMobject, [ + triples = VGroup(*list(map(TexMobject, [ "3^2 + 4^2 = 5^2", "5^2 + 12^2 = 13^2", "8^2 + 15^2 = 17^2", "\\vdots" - ])) + ]))) triples.arrange_submobjects(DOWN, buff = MED_LARGE_BUFF) triples.next_to(rect.get_top(), DOWN) self.add(rect, triples) diff --git a/old_projects/uncertainty.py b/old_projects/uncertainty.py index 134634b1..4aea680d 100644 --- a/old_projects/uncertainty.py +++ b/old_projects/uncertainty.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from __future__ import print_function + import scipy from big_ol_pile_of_manim_imports import * from old_projects.fourier import * @@ -423,7 +423,7 @@ class FourierTradeoff(Scene): ) time_axes.add(time_label) time_axes.center().to_edge(UP) - time_axes.x_axis.add_numbers(*range(1, 2*time_mean)) + time_axes.x_axis.add_numbers(*list(range(1, 2*time_mean))) frequency_axes = Axes( x_min = 0, @@ -780,7 +780,7 @@ class TwoCarsAtRedLight(Scene): axes.add(time_label, y_title) axes.to_corner(UP+LEFT, buff = MED_SMALL_BUFF) graph = axes.get_graph( - self.get_multispike_function(range(1, 4)), + self.get_multispike_function(list(range(1, 4))), x_min = 0.8, x_max = 3.8, ) @@ -894,7 +894,7 @@ class TwoCarsAtRedLight(Scene): n_spikes = 12 new_time_graph = time_axes.get_graph( - self.get_multispike_function(range(1, n_spikes+1)), + self.get_multispike_function(list(range(1, n_spikes+1))), x_min = 0.8, x_max = n_spikes + 0.8, ) @@ -972,12 +972,12 @@ class TwoCarsAtRedLight(Scene): self.play( FadeIn(label), GrowArrow(arrow), - *map(self.get_flashes, self.cars) + *list(map(self.get_flashes, self.cars)) ) self.play( GrowFromCenter(brace), Write(text, run_time = 1), - *map(self.get_flashes, self.cars) + *list(map(self.get_flashes, self.cars)) ) self.play(*[ self.get_flashes(car, num_flashes = 10) @@ -1095,7 +1095,7 @@ class VariousMusicalNotes(Scene): self.play( ShowCreation(long_graph), - *map(FadeOut, [last_brace, last_phrase]) + *list(map(FadeOut, [last_brace, last_phrase])) ) self.play( Write(short_signal_words), @@ -1128,7 +1128,7 @@ class CrossOutDefinitenessAndCertainty(TeacherStudentsScene): ) words.arrange_submobjects(DOWN) words.next_to(self.teacher, UP+LEFT) - crosses = VGroup(*map(Cross, words)) + crosses = VGroup(*list(map(Cross, words))) self.add(words) self.play( @@ -1175,7 +1175,7 @@ class FourierRecapScene(DrawFrequencyPlot): "x_max" : 10.0, "x_axis_config" : { "unit_size" : 0.7, - "numbers_to_show" : range(1, 10, 1), + "numbers_to_show" : list(range(1, 10, 1)), } }, "initial_winding_frequency" : 0.1, @@ -1247,10 +1247,10 @@ class FourierRecapScene(DrawFrequencyPlot): rate_func = wiggle, )) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ self.frequency_axes, fourier_graph, signal_label, fourier_label, - ])) + ]))) self.time_graph = time_graph self.set_variables_as_attrs(time_graph, fourier_label) @@ -1630,9 +1630,9 @@ class LongAndShortSignalsInWindingMachine(FourierRecapScene): run_time = 3 ) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ dot, arrow, self.center_of_mass_dot - ])) + ]))) #This is not great... for attr in "center_of_mass_dot", "fourier_graph_dot": self.__dict__.pop(attr) @@ -2802,16 +2802,16 @@ class AmbiguityInLongEchos(IntroduceDopplerRadar, PiCreatureScene): )) def get_graph(func): return frequency_axes.get_graph(func) - shifted_graphs = VGroup(*map( - get_graph, map(get_func, self.object_velocities) - )) + shifted_graphs = VGroup(*list(map( + get_graph, list(map(get_func, self.object_velocities)) + ))) shifted_graphs.match_style(fourier_graph) return shifted_graphs def get_sum_graph(self, axes, graphs): def get_func(graph): return graph.underlying_function - funcs = map(get_func, graphs) + funcs = list(map(get_func, graphs)) return axes.get_graph( lambda t : sum([func(t) for func in funcs]), ) @@ -2925,7 +2925,7 @@ class IntroduceDeBroglie(Scene): x_min = 1900, x_max = 1935, tick_frequency = 1, - numbers_with_elongated_ticks = range(1900, 1941, 10), + numbers_with_elongated_ticks = list(range(1900, 1941, 10)), color = BLUE_D ) time_line.stretch_to_fit_width(FRAME_WIDTH - picture.get_width() - 2) @@ -3486,7 +3486,7 @@ class HangingWeightsScene(MovingCameraScene): return spring alphas = np.linspace(0, 1, self.n_springs) bezier([0, 1, 0, 1]) - springs = self.springs = VGroup(*map(get_spring, alphas)) + springs = self.springs = VGroup(*list(map(get_spring, alphas))) k_tracker = self.k_tracker = VectorizedPoint() t_tracker = self.t_tracker = VectorizedPoint() @@ -3542,7 +3542,7 @@ class HangingWeightsScene(MovingCameraScene): arrows.set_color(WHITE) self.wait(3) - self.play(*map(GrowArrow, arrows)) + self.play(*list(map(GrowArrow, arrows))) self.play(*[ UpdateFromAlphaFunc( weight, lambda w, a : w.set_width( @@ -3650,7 +3650,7 @@ class HangingWeightsScene(MovingCameraScene): index = int(0.5*len(self.springs)) weights = VGroup(self.weights[index], self.weights[index+4]) - flashes = map(self.get_peak_flash_anim, weights) + flashes = list(map(self.get_peak_flash_anim, weights)) weights.save_state() weights.set_fill(RED) self.add(*flashes) @@ -3896,9 +3896,9 @@ class FourierTransformOfWaveFunction(Scene): run_time = 3, ) last_f = f - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ sinusoid, v_line, freq_label - ])) + ]))) def this_is_momentum(self): formula = TexMobject("p", "=", "h", "\\xi") @@ -3940,7 +3940,7 @@ class FourierTransformOfWaveFunction(Scene): run_time = 2 ) self.wait() - self.play(*map(FadeOut, [brace, words, formula])) + self.play(*list(map(FadeOut, [brace, words, formula]))) def show_tradeoff(self): for a in 5, 0.1, 0.01, 10, 0.5: @@ -4156,7 +4156,7 @@ class ProbabalisticDetection(FourierTransformOfWaveFunction): self.play( FadeIn(VGroup(axes, wave)), question_group.next_to, v_lines, UP, {"buff" : 0}, - *map(ShowCreation, v_lines) + *list(map(ShowCreation, v_lines)) ) self.wait(10) @@ -4355,9 +4355,9 @@ class ThinkOfHeisenbergUncertainty(PiCreatureScene): ] self.add(*continual_anims) - position, momentum, time, frequency = map(TextMobject, [ + position, momentum, time, frequency = list(map(TextMobject, [ "Position", "Momentum", "Time", "Frequency" - ]) + ])) VGroup(position, time).set_color(BLUE) VGroup(momentum, frequency).set_color(YELLOW) groups = VGroup() diff --git a/old_projects/wallis.py b/old_projects/wallis.py index 8fe78921..b35e1959 100644 --- a/old_projects/wallis.py +++ b/old_projects/wallis.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- -from __future__ import print_function + from big_ol_pile_of_manim_imports import * from once_useful_constructs.light import AmbientLight from once_useful_constructs.light import Lighthouse @@ -47,7 +47,7 @@ class WallisNumeratorDenominatorGenerator(object): def __next__(self): return next(self) - def next(self): + def __next__(self): n = self.n self.n += 1 if n % 2 == 0: @@ -127,7 +127,7 @@ class Introduction(Scene): rects = VGroup(*[ SurroundingRectangle(product_mob[:n]) - for n in range(3, 4 * n_terms, 4) + [4 * n_terms] + for n in list(range(3, 4 * n_terms, 4)) + [4 * n_terms] ]) rect = rects[0].copy() @@ -288,7 +288,7 @@ class SourcesOfOriginality(TeacherStudentsScene): ) ) self.play(big_rect.restore) - self.play(*map(ShowCreation, [left_rect, right_rect])) + self.play(*list(map(ShowCreation, [left_rect, right_rect]))) self.wait() self.play( math.match_color, left_rect, @@ -518,7 +518,7 @@ class ShowProduct(Scene): decimal.next_to(brace, DOWN) self.add(brace, decimal, dots[0], parts[0]) - tuples = zip(parts[1:], lines, dots[1:], partial_products[1:], braces[1:]) + tuples = list(zip(parts[1:], lines, dots[1:], partial_products[1:], braces[1:])) for part, line, dot, prod, new_brace in tuples: self.play( FadeIn(part), @@ -636,7 +636,7 @@ class ShowProduct(Scene): parts.prefix.generate_target() larger_parts.fade(0.5) full_product = VGroup(*it.chain( - *zip(larger_parts.prefix.target, smaller_parts.prefix.target) + *list(zip(larger_parts.prefix.target, smaller_parts.prefix.target)) )) for i, tex, vect in (0, "\\cdot", LEFT), (-1, "\\cdots", RIGHT): part = smaller_parts.prefix.target[i] @@ -682,8 +682,8 @@ class ShowProduct(Scene): decimal = DecimalNumber(next(partial_products_iter), num_decimal_places=4) decimal.next_to(brace, DOWN) - self.play(*map(FadeIn, [brace, decimal, dots[0]])) - tuples = zip(lines, dots[1:], braces[1:]) + self.play(*list(map(FadeIn, [brace, decimal, dots[0]]))) + tuples = list(zip(lines, dots[1:], braces[1:])) for line, dot, new_brace in tuples: self.play( Transform(brace, new_brace), @@ -766,14 +766,14 @@ class ShowProduct(Scene): y_max=y_max + 0.25, y_axis_config={ "unit_size": unit_size, - "numbers_with_elongated_ticks": range(1, y_max + 1), + "numbers_with_elongated_ticks": list(range(1, y_max + 1)), "tick_size": 0.05, }, ) axes.shift(6 * LEFT + 3 * DOWN - axes.coords_to_point(0, 0)) axes.y_axis.label_direction = LEFT - axes.y_axis.add_numbers(*range(1, y_max + 1)) + axes.y_axis.add_numbers(*list(range(1, y_max + 1))) return axes @@ -1131,10 +1131,7 @@ class IntroduceDistanceProduct(DistanceProductScene): d_terms.set_color(YELLOW) plusses = sum_of_inverse_squares.get_parts_by_tex("+") last_term = sum_of_inverse_squares[-6:] - non_d_terms = VGroup(*filter( - lambda m: m not in d_terms and m not in last_term, - sum_of_inverse_squares - )) + non_d_terms = VGroup(*[m for m in sum_of_inverse_squares if m not in d_terms and m not in last_term]) brace = Brace(sum_of_inverse_squares, DOWN) brace_text = brace.get_text("Total intensity of light") @@ -1563,7 +1560,7 @@ class FromGeometryToAlgebra(DistanceProductScene): self.play( FadeIn(spacing_words), arcs_anim, - *map(GrowArrow, arrows) + *list(map(GrowArrow, arrows)) ) self.play(FadeOut(arrows), arcs_anim) self.wait() @@ -1631,7 +1628,7 @@ class FromGeometryToAlgebra(DistanceProductScene): arrow.rotate(np.pi, about_point=point) outer_arrow = self.outer_arrow = outer_arrows[3].copy() - values = map(plane.point_to_number, self.get_lh_points()) + values = list(map(plane.point_to_number, self.get_lh_points())) complex_decimal = self.complex_decimal = DecimalNumber( values[3], num_decimal_places=3, @@ -1760,7 +1757,7 @@ class FromGeometryToAlgebra(DistanceProductScene): ) self.wait() self.add(line_ghost) - for i in range(2, self.num_lighthouses) + [0]: + for i in list(range(2, self.num_lighthouses)) + [0]: anims = [ Transform(angle_arc, angle_arcs[i]), Transform(angle_label, angle_labels[i]), @@ -1789,7 +1786,7 @@ class FromGeometryToAlgebra(DistanceProductScene): self.play( FadeOut(angle_arc), FadeOut(angle_label), - *map(ShowCreationThenDestruction, lines) + *list(map(ShowCreationThenDestruction, lines)) ) self.wait() @@ -2296,7 +2293,7 @@ class PlugObserverIntoPolynomial(DistanceProductScene): light[1:].fade(0.5) added_lights = self.lights.copy() added_lights.rotate(full_angle / 2, about_point=origin) - new_lights = VGroup(*it.chain(*zip(self.lights, added_lights))) + new_lights = VGroup(*it.chain(*list(zip(self.lights, added_lights)))) self.num_lighthouses *= 2 dot.generate_target() dot.target.move_to(self.get_circle_point_at_proportion( @@ -2592,7 +2589,7 @@ class DistanceProductIsChordF(PlugObserverIntoPolynomial): fraction_words[0][0].set_color(YELLOW) fraction_words.arrange_submobjects(DOWN, SMALL_BUFF, aligned_edge=LEFT) fraction_words.next_to(O_dot.label, RIGHT) - map(TexMobject.add_background_rectangle, fraction_words) + list(map(TexMobject.add_background_rectangle, fraction_words)) f_arc, new_arc = [ Arc( @@ -2771,7 +2768,7 @@ class ProveLemma2(PlugObserverIntoPolynomial): q_marks.match_color(product_decimal) zero_rects = VGroup( - *map(SurroundingRectangle, [dot, stacked_labels[0]])) + *list(map(SurroundingRectangle, [dot, stacked_labels[0]]))) self.play( LaggedStart(ShowCreation, lines), @@ -2790,7 +2787,7 @@ class ProveLemma2(PlugObserverIntoPolynomial): )) self.wait() self.add_foreground_mobject(zero_rects) - self.play(*map(ShowCreation, zero_rects)) + self.play(*list(map(ShowCreation, zero_rects))) self.wait(2) self.play( VGroup(light_to_remove, zero_rects[0] @@ -3175,7 +3172,7 @@ class KeeperAndSailor(DistanceProductScene, PiCreatureScene): ) if pi is sailor: arcs = self.get_halfway_indication_arcs() - self.play(*map(ShowCreationThenDestruction, arcs)) + self.play(*list(map(ShowCreationThenDestruction, arcs))) self.wait() def write_distance_product_fraction(self): @@ -3242,12 +3239,12 @@ class KeeperAndSailor(DistanceProductScene, PiCreatureScene): new_keeper_dp_decimal.replace(keeper_dp_decimal, dim_to_match=1) new_keeper_dp_decimal.set_color(YELLOW) - self.play(*map(ShowCreation, keeper_lines)) + self.play(*list(map(ShowCreation, keeper_lines))) self.play(ReplacementTransform( keeper_lines.copy(), VGroup(fraction[0]) )) self.play(FadeOut(keeper_lines)) - self.play(*map(ShowCreation, sailor_lines)) + self.play(*list(map(ShowCreation, sailor_lines))) self.play( ReplacementTransform( sailor_lines.copy(), @@ -3701,9 +3698,9 @@ class KeeperAndSailor(DistanceProductScene, PiCreatureScene): self.wait() # Organize fractions - fractions = VGroup(*it.chain(*zip( + fractions = VGroup(*it.chain(*list(zip( limit_fractions, cw_limit_fractions, - ))) + )))) fractions.generate_target() wallis_product = VGroup() dots = VGroup() @@ -4281,14 +4278,14 @@ class NonCommunitingLimitsExample(Scene): rows.center().to_edge(UP) rows[-1].shift(MED_SMALL_BUFF * UP) - row_rects = VGroup(*map(SurroundingRectangle, rows[:-1])) + row_rects = VGroup(*list(map(SurroundingRectangle, rows[:-1]))) row_rects.set_color(YELLOW) columns = VGroup(*[ VGroup(*[row[0][i] for row in rows]) for i in range(len(rows[0][0])) ]) - column_rects = VGroup(*map(SurroundingRectangle, columns)) + column_rects = VGroup(*list(map(SurroundingRectangle, columns))) column_rects.set_color(BLUE) row_arrows = VGroup(*[ @@ -4365,7 +4362,7 @@ class NonCommunitingLimitsExample(Scene): terms = [1] * (self.num_terms_per_row) if seven_index < len(terms): terms[seven_index] = 7 - row = VGroup(*map(Integer, terms)) + row = VGroup(*list(map(Integer, terms))) self.arrange_row(row) dots = self.get_row_dots(row) @@ -4497,9 +4494,9 @@ class DelicacyInIntermixingSeries(Scene): randy.flip() randy.to_corner(DR) - movers2 = VGroup(*it.chain(*zip( + movers2 = VGroup(*it.chain(*list(zip( top_product.parts, bottom_product.parts - ))) + )))) final_product = VGroup() for mover in movers2: mover.final_position = mover.copy() @@ -5217,7 +5214,7 @@ class Thumbnail(DistanceProductScene): product.scale(1.5) product.move_to(2.5 * UP) frac_lines = product.get_parts_by_tex("\\over") - frac_indices = map(product.index_of_part, frac_lines) + frac_indices = list(map(product.index_of_part, frac_lines)) parts = VGroup(*[ product[i-1:i+2] for i in frac_indices diff --git a/old_projects/waves.py b/old_projects/waves.py index a278940c..c67c866d 100644 --- a/old_projects/waves.py +++ b/old_projects/waves.py @@ -463,7 +463,7 @@ class WantToLearnQM(TeacherStudentsScene): self.wait(2) self.teacher_says( "First, lots and lots \\\\ of linear algebra", - added_anims = map(FadeOut, bubbles) + added_anims = list(map(FadeOut, bubbles)) ) self.wait() @@ -895,7 +895,7 @@ class CurlRelationBetweenFields(ThreeDScene): self.play( ShowCreation(M_vects, run_time = 2), - *map(FadeOut, self.E_vects[1:]) + *list(map(FadeOut, self.E_vects[1:])) ) self.wait() self.play( @@ -1008,11 +1008,11 @@ class ListRelevantWaveIdeas(TeacherStudentsScene): h_line = Line(title.get_left(), title.get_right()) h_line.next_to(title, DOWN, SMALL_BUFF) - topics = VGroup(*map(TextMobject, [ + topics = VGroup(*list(map(TextMobject, [ "- Superposition", "- Amplitudes", "- How phase influences addition", - ])) + ]))) topics.scale(0.8) topics.arrange_submobjects(DOWN, aligned_edge = LEFT) topics.next_to(h_line, DOWN, aligned_edge = LEFT) @@ -1240,7 +1240,7 @@ class ShowVectorEquation(Scene): y_min = -1.5, y_max = 1.5, ) - axes.x_axis.add_numbers(*range(1, 6)) + axes.x_axis.add_numbers(*list(range(1, 6))) t = TexMobject("t") t.next_to(axes.x_axis, UP, SMALL_BUFF, RIGHT) cos = self.x_without_phi.copy() @@ -1357,7 +1357,7 @@ class ShowVectorEquation(Scene): ShowCreation(arrow) ) self.wait(3) - self.play(*map(FadeOut, [words, arrow])) + self.play(*list(map(FadeOut, [words, arrow]))) self.corner_cos.add(corner_phi) @@ -1449,16 +1449,16 @@ class ShowVectorEquation(Scene): Arrow(kets_word.get_top(), ket, color = ket.get_color()) for ket in kets ]) - ket_rects = VGroup(*map(SurroundingRectangle, kets)) + ket_rects = VGroup(*list(map(SurroundingRectangle, kets))) ket_rects.set_color(WHITE) unit_vectors = VGroup(*[Vector(2*vect) for vect in (RIGHT, UP)]) unit_vectors.set_fill(YELLOW) self.play( FadeOut(self.brackets), - *map(MoveToTarget, [E_equals, x, y]) + *list(map(MoveToTarget, [E_equals, x, y])) ) - self.play(*map(Write, [right_ket, plus, up_ket]), run_time = 1) + self.play(*list(map(Write, [right_ket, plus, up_ket])), run_time = 1) self.play( Write(kets_word), LaggedStart(ShowCreation, arrows, lag_ratio = 0.7), @@ -1471,7 +1471,7 @@ class ShowVectorEquation(Scene): self.play(ReplacementTransform(ket[1][1].copy(), unit_vect)) self.wait() self.play(FadeOut(unit_vectors)) - self.play(*map(FadeOut, [kets_word, arrows])) + self.play(*list(map(FadeOut, [kets_word, arrows]))) self.kets = kets self.plus = plus @@ -1521,12 +1521,12 @@ class ShowVectorEquation(Scene): Transform(self.h_brace, new_h_brace), self.h_brace.A.next_to, new_h_brace, RIGHT, SMALL_BUFF, Transform(self.horizontally_polarized_words, words), - *map(FadeOut, [ + *list(map(FadeOut, [ self.corner_group, self.v_brace, self.v_brace.A, self.low_f_graph, - ]) + ])) ) - self.play(*map(MoveToTarget, movers)) + self.play(*list(map(MoveToTarget, movers))) self.wait(5) class ChangeFromHorizontalToVerticallyPolarized(DirectionOfPolarizationScene): @@ -1587,7 +1587,7 @@ class SumOfTwoWaves(ChangeFromHorizontalToVerticallyPolarized): self.set_camera_position(0.95*np.pi/2, -0.03*np.pi) def construct(self): - plus, equals = pe = VGroup(*map(TexMobject, "+=")) + plus, equals = pe = VGroup(*list(map(TexMobject, "+="))) pe.scale(2) pe.rotate(np.pi/2, RIGHT) pe.rotate(np.pi/2, OUT) @@ -1681,9 +1681,9 @@ class ShowTipToTailSum(ShowVectorEquation): h_line.update(h_line) v_line.update(v_line) self.play(*it.chain( - map(MoveToTarget, self.kets), + list(map(MoveToTarget, self.kets)), [Write(plus)], - map(ShowCreation, [h_line, v_line]), + list(map(ShowCreation, [h_line, v_line])), )) blue_black = average_color(BLUE, BLACK) self.play( @@ -1766,8 +1766,8 @@ class ShowTipToTailSum(ShowVectorEquation): self.play(*it.chain( - map(MoveToTarget, self.ket_sum), - map(Write, A_mobs), + list(map(MoveToTarget, self.ket_sum)), + list(map(Write, A_mobs)), [ UpdateFromAlphaFunc( ov.vector, @@ -2047,7 +2047,7 @@ class ShowPolarizingFilter(DirectionOfPolarizationScene): self.play( Write(words, run_time = 2), - *map(GrowFromCenter, lines) + *list(map(GrowFromCenter, lines)) ) self.wait(6) self.play(FadeOut(lines)) @@ -2494,7 +2494,7 @@ class DescribePhoton(ThreeDScene): y_unit_size = 2, y_radius = FRAME_X_RADIUS, ) - plane.add_coordinates(x_vals = range(-3, 4), y_vals = []) + plane.add_coordinates(x_vals = list(range(-3, 4)), y_vals = []) plane.rotate(np.pi/2, RIGHT) plane.rotate(np.pi/2, OUT) @@ -2583,7 +2583,7 @@ class DescribePhoton(ThreeDScene): Write(word, run_time = 1) ) self.wait() - self.play(*map(FadeOut, [new_alpha, group])) + self.play(*list(map(FadeOut, [new_alpha, group]))) def change_basis(self): superposition = self.superposition @@ -2647,7 +2647,7 @@ class DescribePhoton(ThreeDScene): self.equation.generate_target() - self.play(*map(MoveToTarget, movers)) + self.play(*list(map(MoveToTarget, movers))) self.wait(2) self.play(*[mob.restore for mob in movers]) self.wait() @@ -2676,11 +2676,11 @@ class DescribePhoton(ThreeDScene): rate_func = squish_rate_func(there_and_back) )) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ morty, words, rect, self.equation.rect, self.equation.words, - ])) + ]))) def write_components(self): d_brace = Brace(Line(ORIGIN, 2*RIGHT), UP, buff = SMALL_BUFF) @@ -2849,7 +2849,7 @@ class DescribePhoton(ThreeDScene): everything.remove(self.photon.mobject) everything.remove(self.axes) - self.play(*map(FadeOut, everything)) + self.play(*list(map(FadeOut, everything))) self.move_camera( phi = 0.8*np.pi/2, theta = -0.3*np.pi, @@ -3017,7 +3017,7 @@ class ShootPhotonThroughFilter(DirectionOfPolarizationScene): self.play( Write(words, run_time = 2), self.superposition_tex.h_rect.set_stroke, RED, 3, - *map(GrowFromCenter, lines)+\ + *list(map(GrowFromCenter, lines))+\ [ Animation(self.pol_filter), Animation(self.frozen_photon.mobject) @@ -3339,7 +3339,7 @@ class ThreeFilters(ShootPhotonThroughFilter): use_rectangular_stem = False, path_arc = 0.5*np.pi, ) - labels = VGroup(*map(TexMobject, ["0\\%", "25\\%"])) + labels = VGroup(*list(map(TexMobject, ["0\\%", "25\\%"]))) labels.scale(1.5) labels.next_to(arrow, DOWN) group = VGroup(arrow, labels) @@ -3405,7 +3405,7 @@ class ThreeFilters(ShootPhotonThroughFilter): n_to_block = int((1-ratio)*self.n_lines) random.seed(self.random_seed) indices_to_block = random.sample( - range(self.n_lines), n_to_block + list(range(self.n_lines)), n_to_block ) VGroup(*[lines[i] for i in indices_to_block]).set_stroke(width = 0) return lines diff --git a/old_projects/wcat.py b/old_projects/wcat.py index 7c3a4457..d04ba6e5 100644 --- a/old_projects/wcat.py +++ b/old_projects/wcat.py @@ -89,7 +89,7 @@ class ClosedLoopScene(Scene): pairs = adjacent_pairs(self.dots) else: n_pairs = len(list(self.dots))/2 - pairs = zip(self.dots[:n_pairs], self.dots[n_pairs:]) + pairs = list(zip(self.dots[:n_pairs], self.dots[n_pairs:])) for d1, d2 in pairs: line = Line(d1.get_center(), d2.get_center()) line.start_dot = d1 @@ -119,7 +119,7 @@ class ClosedLoopScene(Scene): dots = self.dots alphas = [] alpha_range = np.arange(0, 1, precision) - loop_points = np.array(map(self.loop.point_from_proportion, alpha_range)) + loop_points = np.array(list(map(self.loop.point_from_proportion, alpha_range))) for dot in dots: vects = loop_points - dot.get_center() norms = np.apply_along_axis(np.linalg.norm, 1, vects) @@ -228,7 +228,7 @@ class Introduction(TeacherStudentsScene): pi.generate_target() pi.target.change_mode("happy") pi.target.look_at(self.get_teacher().bubble) - self.play(*map(MoveToTarget, self.get_students())) + self.play(*list(map(MoveToTarget, self.get_students()))) self.random_blink(3) self.teacher_says( "Here's why \\\\ I'm excited...", @@ -236,7 +236,7 @@ class Introduction(TeacherStudentsScene): ) for pi in self.get_students(): pi.target.look_at(self.get_teacher().eyes) - self.play(*map(MoveToTarget, self.get_students())) + self.play(*list(map(MoveToTarget, self.get_students()))) self.wait() class WhenIWasAKid(TeacherStudentsScene): @@ -272,7 +272,7 @@ class WhenIWasAKid(TeacherStudentsScene): ) self.remove(self.get_teacher()) self.add(me) - self.play(*map(FadeIn, children[:-1] + [speaker])) + self.play(*list(map(FadeIn, children[:-1] + [speaker]))) self.random_blink() def run_class(self): @@ -354,10 +354,10 @@ class WhenIWasAKid(TeacherStudentsScene): self.play( Transform(me, morty), - *map(FadeOut, [ + *list(map(FadeOut, [ self.students, self.teacher, me.bubble, me.bubble.content - ]) + ])) ) self.remove(me) self.add(morty) @@ -623,12 +623,12 @@ class PairOfPairBecomeRectangle(Scene): ] midpoint = Dot(LEFT, color = RED) - words = VGroup(*map(TextMobject, [ + words = VGroup(*list(map(TextMobject, [ "Common midpoint", "Same distance apart", "$\\Downarrow$", "Rectangle", - ])) + ]))) words.arrange_submobjects(DOWN) words.to_edge(RIGHT) words[-1].set_color(BLUE) @@ -637,7 +637,7 @@ class PairOfPairBecomeRectangle(Scene): ShowCreation(dots), Write(labels) ) - self.play(*map(ShowCreation, lines)) + self.play(*list(map(ShowCreation, lines))) self.wait() self.play(*[ ApplyMethod( @@ -672,7 +672,7 @@ class PairOfPairBecomeRectangle(Scene): ShowCreation(rectangle), Animation(dots) ) - self.play(*map(Write, words[2:])) + self.play(*list(map(Write, words[2:]))) self.wait() class SearchForRectangleOnLoop(ClosedLoopScene): @@ -841,7 +841,7 @@ class PairOfRealsToPlane(Scene): DashedLine(dot, two_d_point, color = dot.get_color()) for dot in dots ]) - self.play(*map(ShowCreation, lines)) + self.play(*list(map(ShowCreation, lines))) self.play(ShowCreation(two_d_point)) everything = VGroup(*self.get_mobjects()) self.play( @@ -960,7 +960,7 @@ class DefineUnorderedPair(ClosedLoopScene): arrow_pairs = [VGroup(*arrows[:2]), VGroup(*arrows[2:])] for label, arrow_pair in zip(labels, arrow_pairs): - self.play(*map(FadeIn, [label, arrow_pair])) + self.play(*list(map(FadeIn, [label, arrow_pair]))) self.wait() for x in range(2): self.play( @@ -1114,7 +1114,7 @@ class RepresentPairInUnitSquare(ClosedLoopScene): self.play( FadeIn(square), Animation(self.dots), - *map(Write, right_words[1:]) + *list(map(Write, right_words[1:])) ) self.wait() @@ -1141,9 +1141,9 @@ class RepresentPairInUnitSquare(ClosedLoopScene): dot.target.get_center(), inner_dot.target.get_center() ) - self.play(*map(MoveToTarget, movers)) + self.play(*list(map(MoveToTarget, movers))) self.wait() - self.play(*map(FadeOut, [dashed_lines, self.dots])) + self.play(*list(map(FadeOut, [dashed_lines, self.dots]))) class EdgesOfSquare(Scene): def construct(self): @@ -1345,7 +1345,7 @@ class WigglingPairOfPoints(ClosedLoopScene): self.add_connecting_lines() self.dots.set_color_by_gradient(GREEN, RED) self.connecting_lines.set_color(YELLOW) - for x, pair in zip(range(20), it.cycle(alpha_pairs)): + for x, pair in zip(list(range(20)), it.cycle(alpha_pairs)): self.move_dots_to_alphas(pair, run_time = 0.3) @@ -1508,7 +1508,7 @@ class FoldUnitSquare(EdgesOfSquare): vect = UP+RIGHT if a < b else DOWN+RIGHT label.next_to(dot, vect, buff = SMALL_BUFF) - self.play(*map(FadeIn, [dot, label])) + self.play(*list(map(FadeIn, [dot, label]))) x_line = Line(point+a*unit*LEFT, point) y_line = Line(point+b*unit*DOWN, point) x_line.set_color(GREEN) @@ -1528,7 +1528,7 @@ class FoldUnitSquare(EdgesOfSquare): start_dots.add(dot) else: end_dots.add(dot) - self.play(*map(FadeOut, [x_line, y_line])) + self.play(*list(map(FadeOut, [x_line, y_line]))) self.start_dots, self.end_dots = start_dots, end_dots def perform_fold(self): @@ -1855,7 +1855,7 @@ class StripMustIntersectItself(TeacherStudentsScene): student.generate_target() student.target.change_mode("pondering") student.target.look_at(dot) - self.play(*map(MoveToTarget, self.get_students())) + self.play(*list(map(MoveToTarget, self.get_students()))) self.random_blink(4) class PairOfMobiusPointsLandOnEachother(Scene): @@ -1947,12 +1947,12 @@ class PatreonThanks(Scene): special_thanks.set_color(YELLOW) special_thanks.shift(2*UP) - left_patrons = VGroup(*map(TextMobject, + left_patrons = VGroup(*list(map(TextMobject, self.specific_patrons[:n_patrons/2] - )) - right_patrons = VGroup(*map(TextMobject, + ))) + right_patrons = VGroup(*list(map(TextMobject, self.specific_patrons[n_patrons/2:] - )) + ))) for patrons, vect in (left_patrons, LEFT), (right_patrons, RIGHT): patrons.arrange_submobjects(DOWN, aligned_edge = LEFT) patrons.next_to(special_thanks, DOWN) @@ -2027,11 +2027,11 @@ class CreditThree(Scene): self.add(randy) bubble = randy.get_bubble(width = 2, height = 2) - domains = VGroup(*map(TextMobject, [ + domains = VGroup(*list(map(TextMobject, [ "visualnumbertheory.com", "buymywidgets.com", "learnwhatilearn.com", - ])) + ]))) domains.arrange_submobjects(DOWN, aligned_edge = LEFT) domains.next_to(randy, UP, buff = LARGE_BUFF) domains.shift_onto_screen() diff --git a/old_projects/zeta.py b/old_projects/zeta.py index 9189cc8c..c0fa195d 100644 --- a/old_projects/zeta.py +++ b/old_projects/zeta.py @@ -1,4 +1,4 @@ -from __future__ import print_function + from big_ol_pile_of_manim_imports import * import mpmath @@ -437,7 +437,7 @@ class DefineForRealS(PiCreatureScene): x_min = 0, x_max = 3, tick_frequency = 0.25, - numbers_with_elongated_ticks = range(4), + numbers_with_elongated_ticks = list(range(4)), unit_size = 3, ) number_line.add_numbers() @@ -501,9 +501,9 @@ class DefineForRealS(PiCreatureScene): self.pi_creature.change_mode, "happy" ) self.wait(3) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ fracs, pi_arrow, pi_dot, approx, - ])) + ]))) self.lines = lines self.braces = braces self.dots = dots @@ -596,13 +596,13 @@ class DefineForRealS(PiCreatureScene): zeta_s_eq.shift(0.5*UP) inputs.add(*zeta_s_eq[2:2+n_input_chars]) - sum_terms = TexMobject(*it.chain(*zip( + sum_terms = TexMobject(*it.chain(*list(zip( [ "\\frac{1}{%d^{%s}}"%(d, input_string) for d in range(1, 1+num_shown_terms) ], it.cycle(["+"]) - ))) + )))) sum_terms.add(TexMobject("\\cdots").next_to(sum_terms)) sum_terms.next_to(zeta_s_eq, RIGHT) for x in range(num_shown_terms): @@ -841,7 +841,7 @@ class FromRealToComplex(ComplexTransformationScene): number_line = NumberLine( unit_size = 2, tick_frequency = 0.5, - numbers_with_elongated_ticks = range(-2, 3) + numbers_with_elongated_ticks = list(range(-2, 3)) ) number_line.add_numbers() input_dot = Dot(number_line.number_to_point(2)) @@ -966,7 +966,7 @@ class FromRealToComplex(ComplexTransformationScene): self.play(Blink(randy)) self.play(randy.change_mode, "happy") self.wait() - self.play(*map(FadeOut, [randy, bubble, frac, words])) + self.play(*list(map(FadeOut, [randy, bubble, frac, words]))) def show_s_equals_two_lines(self): self.input_label.save_state() @@ -1087,9 +1087,9 @@ class FromRealToComplex(ComplexTransformationScene): self.play(FadeIn(anti_domain)) self.play(Write(anti_domain_words)) self.wait(2) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ anti_domain, anti_domain_words, - ])) + ]))) self.domain_words = domain_words def ask_about_visualizing_all(self): @@ -1114,9 +1114,9 @@ class FromRealToComplex(ComplexTransformationScene): self.play( morty.change_mode, "pondering", morty.look_at, self.input_dot, - *map(FadeOut, [ + *list(map(FadeOut, [ bubble, bubble.content, self.domain_words - ]) + ])) ) arrow = Arrow(self.input_dot, self.output_dot, buff = SMALL_BUFF) arrow.set_color(WHITE) @@ -1169,7 +1169,7 @@ class FromRealToComplex(ComplexTransformationScene): ] power_sums = np.cumsum(powers) lines = VGroup(*[ - Line(*map(self.z_to_point, z_pair)) + Line(*list(map(self.z_to_point, z_pair))) for z_pair in zip(power_sums, power_sums[1:]) ]) widths = np.linspace(line_thickness, 0, len(list(lines))) @@ -1276,7 +1276,7 @@ class ComplexExponentiation(Scene): self.wait() self.play( imag_part.move_to, imag_part.get_left(), - *map(FadeOut, [brace, we_understand, real_part]) + *list(map(FadeOut, [brace, we_understand, real_part])) ) self.wait() self.imag_exponent = imag_part @@ -1544,7 +1544,7 @@ class ShowMultiplicationOfRealAndImaginaryExponentialParts(FromRealToComplex): imag_part.generate_target() real_part.target.next_to(brace, UP+RIGHT, buff = 0) imag_part.target.next_to(real_part.target, buff = 0) - self.play(*map(MoveToTarget, [real_part, imag_part])) + self.play(*list(map(MoveToTarget, [real_part, imag_part]))) self.wait() class ComplexFunctionsAsTransformations(ComplexTransformationScene): @@ -1587,7 +1587,7 @@ class ComplexFunctionsAsTransformations(ComplexTransformationScene): 2*RIGHT+DOWN, RIGHT+2*UP, ] - input_dots = VGroup(*map(Dot, input_points)) + input_dots = VGroup(*list(map(Dot, input_points))) input_dots.set_color(YELLOW) output_dots = VGroup(*[ Dot(ip + on) @@ -1634,7 +1634,7 @@ class VisualizingSSquared(ComplexTransformationScene): self.title = title def plug_in_specific_values(self): - inputs = map(complex, [2, -1, complex(0, 1)]) + inputs = list(map(complex, [2, -1, complex(0, 1)])) input_dots = VGroup(*[ Dot(self.z_to_point(z), color = YELLOW) for z in inputs @@ -1788,7 +1788,7 @@ class ShowZetaOnHalfPlane(ZetaTransformationScene): self.wait() self.play( morty.look_at, self.plane.get_bottom(), - *map(FadeOut, [bubble, bubble.content]) + *list(map(FadeOut, [bubble, bubble.content])) ) self.play(Blink(morty)) self.play(FadeOut(morty)) @@ -1799,10 +1799,10 @@ class ShowZetaOnHalfPlane(ZetaTransformationScene): words.next_to(ORIGIN, UP+LEFT) words.shift(LEFT+UP) - line = Line(*map(self.z_to_point, [ + line = Line(*list(map(self.z_to_point, [ complex(np.euler_gamma, u*FRAME_Y_RADIUS) for u in (1, -1) - ])) + ]))) line.set_color(YELLOW) arrows = [ Arrow(words.get_right(), point) @@ -1818,7 +1818,7 @@ class ShowZetaOnHalfPlane(ZetaTransformationScene): ) self.play(FadeOut(arrows[0])) self.wait(2) - self.play(*map(FadeOut, [words, line])) + self.play(*list(map(FadeOut, [words, line]))) def set_color_i_line(self): right_i_lines, left_i_lines = [ @@ -1998,9 +1998,9 @@ class SquiggleOnExtensions(ZetaTransformationScene): arrow = Arrow(label.get_right(), dot, buff = SMALL_BUFF) self.play(Write(label, run_time = 1)) - self.play(*map(ShowCreation, [arrow, dot])) + self.play(*list(map(ShowCreation, [arrow, dot]))) self.wait() - self.play(*map(FadeOut, [arrow, label])) + self.play(*list(map(FadeOut, [arrow, label]))) return dot def cycle_through_options(self): @@ -2166,7 +2166,7 @@ class IntroduceAnglePreservation(VisualizingSSquared): for index in 3, 7: randy.bubble.content[index].set_color(YELLOW) - self.play(*map(FadeIn, [randy, morty])) + self.play(*list(map(FadeIn, [randy, morty]))) self.play( randy.change_mode, "speaking", ShowCreation(randy.bubble), @@ -2182,11 +2182,11 @@ class IntroduceAnglePreservation(VisualizingSSquared): ) self.play(Blink(randy)) self.wait() - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ randy, morty, randy.bubble, randy.bubble.content, morty.bubble, morty.bubble.content, - ])) + ]))) def cycle_through_line_pairs(self): @@ -2215,10 +2215,10 @@ class IntroduceAnglePreservation(VisualizingSSquared): for y in np.arange(0, 3, 0.5) if not (x <= 0 and y == 0) ] - brackets = VGroup(*map( + brackets = VGroup(*list(map( self.get_right_angle_bracket, intersection_inputs - )) + ))) self.apply_function() self.wait() self.play( @@ -2300,7 +2300,7 @@ class IntroduceAnglePreservation(VisualizingSSquared): angle_group = VGroup(angle_tex, angle_arrow) - self.play(*map(ShowCreation, lines)) + self.play(*list(map(ShowCreation, lines))) self.play( Write(angle_tex), ShowCreation(angle_arrow), @@ -2321,7 +2321,7 @@ class IntroduceAnglePreservation(VisualizingSSquared): ShowCreation(arrow) ) self.wait(2) - self.play(*map(FadeOut, [arc, angle_tex, arrow])) + self.play(*list(map(FadeOut, [arc, angle_tex, arrow]))) def put_angle_tex_next_to_arc(self, angle_tex, arc): vect = arc.point_from_proportion(0.5)-interpolate( @@ -2478,10 +2478,10 @@ class NoteZetaFunctionAnalyticOnRightHalf(ZetaTransformationScene): for y in np.arange(-0.5, 0.5, 1./16) if abs(y) > 1./16 ] - brackets = VGroup(*map( + brackets = VGroup(*list(map( self.get_right_angle_bracket, intersection_inputs - )) + ))) self.play(ShowCreation(brackets, run_time = 3)) self.wait() @@ -2824,9 +2824,9 @@ class DiscussZeros(ZetaTransformationScene): self.play(Blink(randy)) self.wait() self.play(Blink(randy)) - self.play(*map(FadeOut, [ + self.play(*list(map(FadeOut, [ randy, bubble, bubble.content, trivial_zero_words - ])) + ]))) def show_critical_strip(self): strip = Rectangle( @@ -2884,9 +2884,9 @@ class DiscussZeros(ZetaTransformationScene): self.wait(3) self.play( photo.shift, 7*LEFT, - *map(FadeOut, [ + *list(map(FadeOut, [ primes, self.dots, strip - ]) + ])) ) self.remove(photo) self.critical_line = critical_line @@ -2911,7 +2911,7 @@ class DiscussZeros(ZetaTransformationScene): def get_dot_wandering_anims(self): self.dot_anim_count += 1 if self.dot_anim_count == 1: - return map(MoveToTarget, self.dots) + return list(map(MoveToTarget, self.dots)) denom = 4*(len(list(self.dots))) def get_rate_func(index): return lambda t : (float(self.dot_anim_count + 2*index + t)/denom)%1 @@ -3165,12 +3165,12 @@ class PatreonThanks(Scene): patreon_logo.set_height(1.5) patreon_logo.next_to(special_thanks, DOWN) - left_patrons = VGroup(*map(TextMobject, + left_patrons = VGroup(*list(map(TextMobject, self.specific_patrons[:n_patrons/2] - )) - right_patrons = VGroup(*map(TextMobject, + ))) + right_patrons = VGroup(*list(map(TextMobject, self.specific_patrons[n_patrons/2:] - )) + ))) for patrons, vect in (left_patrons, LEFT), (right_patrons, RIGHT): patrons.arrange_submobjects(DOWN, aligned_edge = LEFT) patrons.next_to(special_thanks, DOWN) diff --git a/once_useful_constructs/arithmetic.py b/once_useful_constructs/arithmetic.py index d61b655a..1f85b582 100644 --- a/once_useful_constructs/arithmetic.py +++ b/once_useful_constructs/arithmetic.py @@ -32,11 +32,11 @@ class RearrangeEquation(Scene): [n % len(start_mobs) for n in index_map] ) unmatched_end_indices.difference_update( - [n % len(end_mobs) for n in index_map.values()] + [n % len(end_mobs) for n in list(index_map.values())] ) mobject_pairs = [ (start_mobs[a], end_mobs[b]) - for a, b in index_map.iteritems() + for a, b in index_map.items() ] + [ (Point(end_mobs[b].get_center()), end_mobs[b]) for b in unmatched_end_indices diff --git a/once_useful_constructs/complex_transformation_scene.py b/once_useful_constructs/complex_transformation_scene.py index a10d6a55..e738e429 100644 --- a/once_useful_constructs/complex_transformation_scene.py +++ b/once_useful_constructs/complex_transformation_scene.py @@ -52,7 +52,7 @@ class ComplexTransformationScene(Scene): def play(self, *animations, **kwargs): Scene.play( self, - *list(animations) + map(Animation, self.foreground_mobjects), + *list(animations) + list(map(Animation, self.foreground_mobjects)), **kwargs ) diff --git a/once_useful_constructs/fractals.py b/once_useful_constructs/fractals.py index 711d6ac4..0bb29d45 100644 --- a/once_useful_constructs/fractals.py +++ b/once_useful_constructs/fractals.py @@ -32,7 +32,7 @@ def fractalify(vmobject, order=3, *args, **kwargs): return vmobject -def fractalification_iteration(vmobject, dimension=1.05, num_inserted_anchors_range=range(1, 4)): +def fractalification_iteration(vmobject, dimension=1.05, num_inserted_anchors_range=list(range(1, 4))): num_points = vmobject.get_num_points() if num_points > 0: # original_anchors = vmobject.get_anchors() @@ -667,7 +667,7 @@ class SnakeCurve(FractalCurve): DOWN * (self.radius - step / 2) for y in range(resolution): - x_range = range(resolution) + x_range = list(range(resolution)) if y % 2 == 0: x_range.reverse() for x in x_range: diff --git a/once_useful_constructs/graph_theory.py b/once_useful_constructs/graph_theory.py index c44dcfba..81a5fc36 100644 --- a/once_useful_constructs/graph_theory.py +++ b/once_useful_constructs/graph_theory.py @@ -170,7 +170,7 @@ class CompleteGraph(Graph): for x in range(self.num_vertices) for theta in [2 * np.pi * x / self.num_vertices] ] - self.edges = it.combinations(range(self.num_vertices), 2) + self.edges = it.combinations(list(range(self.num_vertices)), 2) def __str__(self): return Graph.__str__(self) + str(self.num_vertices) @@ -193,7 +193,7 @@ class DiscreteGraphScene(Scene): Scene.__init__(self, *args, **kwargs) def construct(self): - self.points = map(np.array, self.graph.vertices) + self.points = list(map(np.array, self.graph.vertices)) self.vertices = self.dots = [Dot(p) for p in self.points] self.edges = self.lines = [ Line(self.points[i], self.points[j]) @@ -263,7 +263,7 @@ class DiscreteGraphScene(Scene): ]) def annotate_edges(self, mobject, fade_in=True, **kwargs): - angles = map(np.arctan, map(Line.get_slope, self.edges)) + angles = list(map(np.arctan, list(map(Line.get_slope, self.edges)))) self.edge_annotations = [ mobject.copy().rotate(angle).move_to(edge.get_center()) for angle, edge in zip(angles, self.edges) @@ -320,7 +320,7 @@ class DiscreteGraphScene(Scene): self.generate_spanning_tree() root = self.spanning_tree_root color = self.spanning_tree.get_color() - indices = range(len(self.points)) + indices = list(range(len(self.points))) # Build dicts parent_of = dict([ tuple(reversed(pair)) diff --git a/once_useful_constructs/light.py b/once_useful_constructs/light.py index 841dd7bf..71d8be9c 100644 --- a/once_useful_constructs/light.py +++ b/once_useful_constructs/light.py @@ -242,10 +242,10 @@ class Spotlight(VMobject): def viewing_angles(self, screen): screen_points = screen.get_anchors() - projected_screen_points = map(self.project, screen_points) + projected_screen_points = list(map(self.project, screen_points)) - viewing_angles = np.array(map(self.viewing_angle_of_point, - projected_screen_points)) + viewing_angles = np.array(list(map(self.viewing_angle_of_point, + projected_screen_points))) lower_angle = upper_angle = 0 if len(viewing_angles) != 0: diff --git a/requirements.txt b/requirements.txt index 20b01a11..688dd407 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,9 @@ argparse==1.4.0 -colour==0.1.2 -numpy==1.11.1 -Pillow==3.4.2 -progressbar==2.3 -scipy==0.17.1 -tqdm==4.7.1 -opencv-python==3.1.0 +colour==0.1.5 +numpy==1.15.0 +Pillow==5.2.0 +progressbar==2.5 +scipy==1.1.0 +tqdm==4.24.0 +opencv-python==3.4.2.17 git+https://github.com/scottopell/aggdraw-64bits@c95aac4369038706943fd0effb7d888683860e5a#egg=aggdraw diff --git a/scene/graph_scene.py b/scene/graph_scene.py index 76def06b..dae98e83 100644 --- a/scene/graph_scene.py +++ b/scene/graph_scene.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from constants import * import itertools as it @@ -82,10 +82,7 @@ class GraphScene(Scene): x_axis.shift(self.graph_origin - x_axis.number_to_point(0)) if len(self.x_labeled_nums) > 0: if self.exclude_zero_label: - self.x_labeled_nums = filter( - lambda x: x != 0, - self.x_labeled_nums - ) + self.x_labeled_nums = [x for x in self.x_labeled_nums if x != 0] x_axis.add_numbers(*self.x_labeled_nums) if self.x_axis_label: x_label = TextMobject(self.x_axis_label) @@ -118,10 +115,7 @@ class GraphScene(Scene): y_axis.rotate(np.pi / 2, about_point=y_axis.number_to_point(0)) if len(self.y_labeled_nums) > 0: if self.exclude_zero_label: - self.y_labeled_nums = filter( - lambda y: y != 0, - self.y_labeled_nums - ) + self.y_labeled_nums = [y for y in self.y_labeled_nums if y != 0] y_axis.add_numbers(*self.y_labeled_nums) if self.y_axis_label: y_label = TextMobject(self.y_axis_label) @@ -258,11 +252,11 @@ class GraphScene(Scene): else: raise Exception("Invalid input sample type") graph_point = self.input_to_graph_point(sample_input, graph) - points = VGroup(*map(VectorizedPoint, [ + points = VGroup(*list(map(VectorizedPoint, [ self.coords_to_point(x, 0), self.coords_to_point(x + width_scale_factor * dx, 0), graph_point - ])) + ]))) rect = Rectangle() rect.replace(points, stretch=True) diff --git a/scene/moving_camera_scene.py b/scene/moving_camera_scene.py index 29e1430f..a0986d74 100644 --- a/scene/moving_camera_scene.py +++ b/scene/moving_camera_scene.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from scene.scene import Scene from camera.moving_camera import MovingCamera diff --git a/scene/reconfigurable_scene.py b/scene/reconfigurable_scene.py index 789f9156..b12670fc 100644 --- a/scene/reconfigurable_scene.py +++ b/scene/reconfigurable_scene.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from scene.scene import Scene from animation.transform import Transform diff --git a/scene/sample_space_scene.py b/scene/sample_space_scene.py index 357c2df4..b7479f7e 100644 --- a/scene/sample_space_scene.py +++ b/scene/sample_space_scene.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from constants import * from .scene import Scene @@ -141,7 +141,7 @@ class SampleSpaceScene(Scene): anims = [UpdateFromFunc(post_rects, update_rects)] if hasattr(post_rects, "braces"): - anims += map(Animation, [ + anims += list(map(Animation, [ post_rects.labels, post_rects.braces - ]) + ])) return anims diff --git a/scene/scene.py b/scene/scene.py index 61e9b21a..2cc50c35 100644 --- a/scene/scene.py +++ b/scene/scene.py @@ -1,4 +1,4 @@ -from __future__ import print_function + import inspect import itertools as it import numpy as np @@ -110,11 +110,11 @@ class Scene(Container): to share local variables. """ caller_locals = inspect.currentframe().f_back.f_locals - for key, value in caller_locals.items(): + for key, value in list(caller_locals.items()): for o in objects: if value is o: setattr(self, key, value) - for key, value in newly_named_objects.items(): + for key, value in list(newly_named_objects.items()): setattr(self, key, value) return self @@ -185,10 +185,7 @@ class Scene(Container): self.wait(wind_down_time) # TODO, this is not done with the remove method so as to # keep the relevant mobjects. Better way? - self.continual_animations = filter( - lambda ca: ca in continual_animations, - self.continual_animations - ) + self.continual_animations = [ca for ca in self.continual_animations if ca in continual_animations] def should_continually_update(self): return len(self.continual_animations) > 0 or self.always_continually_update @@ -207,7 +204,7 @@ class Scene(Container): for family in families ]) return num_families == 1 - return filter(is_top_level, mobjects) + return list(filter(is_top_level, mobjects)) def separate_mobjects_and_continual_animations(self, mobjects_or_continual_animations): mobjects = [] @@ -243,7 +240,7 @@ class Scene(Container): So a scene can just add all mobjects it's defined up to that point by calling add_mobjects_among(locals().values()) """ - mobjects = filter(lambda x: isinstance(x, Mobject), values) + mobjects = [x for x in values if isinstance(x, Mobject)] self.add(*mobjects) return self @@ -256,11 +253,8 @@ class Scene(Container): for list_name in "mobjects", "foreground_mobjects": self.restructure_mobjects(mobjects, list_name, False) - self.continual_animations = filter( - lambda ca: ca not in continual_animations and - ca.mobject not in to_remove, - self.continual_animations - ) + self.continual_animations = [ca for ca in self.continual_animations if ca not in continual_animations and + ca.mobject not in to_remove] return self def restructure_mobjects( diff --git a/scene/scene_from_video.py b/scene/scene_from_video.py index b422e761..64334def 100644 --- a/scene/scene_from_video.py +++ b/scene/scene_from_video.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + import cv2 @@ -24,11 +24,11 @@ class SceneFromVideo(Scene): start_frame = 0 end_frame = frame_count else: - start_frame, end_frame = map(lambda t: fps * t, time_range) + start_frame, end_frame = [fps * t for t in time_range] frame_count = end_frame - start_frame print("Reading in " + file_name + "...") - for count in show_progress(range(start_frame, end_frame + 1)): + for count in show_progress(list(range(start_frame, end_frame + 1))): returned, frame = cap.read() if not returned: break diff --git a/scene/three_d_scene.py b/scene/three_d_scene.py index 937fc748..58f79051 100644 --- a/scene/three_d_scene.py +++ b/scene/three_d_scene.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from constants import * diff --git a/scene/vector_space_scene.py b/scene/vector_space_scene.py index e694998b..32645885 100644 --- a/scene/vector_space_scene.py +++ b/scene/vector_space_scene.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + import numpy as np diff --git a/scene/zoomed_scene.py b/scene/zoomed_scene.py index 2d3d4ac0..3bc763b6 100644 --- a/scene/zoomed_scene.py +++ b/scene/zoomed_scene.py @@ -1,4 +1,4 @@ -from __future__ import absolute_import + from scene.moving_camera_scene import MovingCameraScene from camera.moving_camera import MovingCamera diff --git a/stage_scenes.py b/stage_scenes.py index 0caa31b9..d47f1b27 100644 --- a/stage_scenes.py +++ b/stage_scenes.py @@ -1,5 +1,5 @@ -from __future__ import absolute_import -from __future__ import print_function + + import inspect import os import sys @@ -39,7 +39,7 @@ def stage_animations(module_name): sorted_files = [] for scene_class in scene_classes: scene_name = scene_class.__name__ - for clip in filter(lambda f: f.startswith(scene_name + "."), files): + for clip in [f for f in files if f.startswith(scene_name + ".")]: sorted_files.append(os.path.join(animation_dir, clip)) animation_subdir = os.path.dirname(animation_dir) diff --git a/utils/color.py b/utils/color.py index f8999670..b5f308ba 100644 --- a/utils/color.py +++ b/utils/color.py @@ -47,7 +47,7 @@ def color_to_int_rgba(color, opacity=1.0): def color_gradient(reference_colors, length_of_output): if length_of_output == 0: return reference_colors[0] - rgbs = map(color_to_rgb, reference_colors) + rgbs = list(map(color_to_rgb, reference_colors)) alphas = np.linspace(0, (len(rgbs) - 1), length_of_output) floors = alphas.astype('int') alphas_mod1 = alphas % 1 @@ -66,7 +66,7 @@ def interpolate_color(color1, color2, alpha): def average_color(*colors): - rgbs = np.array(map(color_to_rgb, colors)) + rgbs = np.array(list(map(color_to_rgb, colors))) mean_rgb = np.apply_along_axis(np.mean, 0, rgbs) return rgb_to_color(mean_rgb) diff --git a/utils/config_ops.py b/utils/config_ops.py index 6bd067db..2c1be372 100644 --- a/utils/config_ops.py +++ b/utils/config_ops.py @@ -61,7 +61,7 @@ def digest_config(obj, kwargs, caller_locals={}): def merge_config(all_dicts): - all_config = reduce(op.add, [d.items() for d in all_dicts]) + all_config = reduce(op.add, [list(d.items()) for d in all_dicts]) config = dict() for c in all_config: key, value = c @@ -79,7 +79,7 @@ def soft_dict_update(d1, d2): Adds key values pairs of d2 to d1 only when d1 doesn't already have that key """ - for key, value in d2.items(): + for key, value in list(d2.items()): if key not in d1: d1[key] = value @@ -89,7 +89,7 @@ def digest_locals(obj, keys=None): inspect.currentframe().f_back.f_locals ) if keys is None: - keys = caller_locals.keys() + keys = list(caller_locals.keys()) for key in keys: setattr(obj, key, caller_locals[key]) diff --git a/utils/iterables.py b/utils/iterables.py index 9fa2b16e..e5fed77f 100644 --- a/utils/iterables.py +++ b/utils/iterables.py @@ -23,19 +23,19 @@ def list_update(l1, l2): Used instead of list(set(l1).update(l2)) to maintain order, making sure duplicates are removed from l1, not l2. """ - return filter(lambda e: e not in l2, l1) + list(l2) + return [e for e in l1 if e not in l2] + list(l2) def list_difference_update(l1, l2): - return filter(lambda e: e not in l2, l1) + return [e for e in l1 if e not in l2] def all_elements_are_instances(iterable, Class): - return all(map(lambda e: isinstance(e, Class), iterable)) + return all([isinstance(e, Class) for e in iterable]) def adjacent_pairs(objects): - return zip(objects, list(objects[1:]) + [objects[0]]) + return list(zip(objects, list(objects[1:]) + [objects[0]])) def batch_by_property(items, property_func): @@ -90,8 +90,8 @@ def make_even(iterable_1, iterable_2): list_1, list_2 = list(iterable_1), list(iterable_2) length = max(len(list_1), len(list_2)) return ( - [list_1[(n * len(list_1)) / length] for n in xrange(length)], - [list_2[(n * len(list_2)) / length] for n in xrange(length)] + [list_1[(n * len(list_1)) / length] for n in range(length)], + [list_2[(n * len(list_2)) / length] for n in range(length)] ) @@ -105,19 +105,8 @@ def make_even_by_cycling(iterable_1, iterable_2): ) -def composition(func_list): - """ - func_list should contain elements of the form (f, args) - """ - return reduce( - lambda (f1, args1), (f2, args2): (lambda x: f1(f2(x, *args2), *args1)), - func_list, - lambda x: x - ) - - def remove_nones(sequence): - return filter(lambda x: x, sequence) + return [x for x in sequence if x] # Note this is redundant with it.chain diff --git a/utils/simple_functions.py b/utils/simple_functions.py index 83d9445f..bf4540d6 100644 --- a/utils/simple_functions.py +++ b/utils/simple_functions.py @@ -12,8 +12,8 @@ def choose(n, r): return 0 if r == 0: return 1 - denom = reduce(op.mul, xrange(1, r + 1), 1) - numer = reduce(op.mul, xrange(n, n - r, -1), 1) + denom = reduce(op.mul, range(1, r + 1), 1) + numer = reduce(op.mul, range(n, n - r, -1), 1) return numer // denom # Just to have a less heavyweight name for this extremely common operation diff --git a/utils/strings.py b/utils/strings.py index 67ed144c..9034bca4 100644 --- a/utils/strings.py +++ b/utils/strings.py @@ -5,9 +5,7 @@ import itertools as it def to_camel_case(name): return "".join([ - filter( - lambda c: c not in string.punctuation + string.whitespace, part - ).capitalize() + [c for c in part if c not in string.punctuation + string.whitespace].capitalize() for part in name.split("_") ]) @@ -20,11 +18,11 @@ def initials(name, sep_values=[" ", "_"]): def camel_case_initials(name): - return filter(lambda c: c.isupper(), name) + return [c for c in name if c.isupper()] def complex_string(complex_num): - return filter(lambda c: c not in "()", str(complex_num)) + return [c for c in str(complex_num) if c not in "()"] def split_string_to_isolate_substrings(full_string, *substrings_to_isolate): @@ -39,12 +37,12 @@ def split_string_to_isolate_substrings(full_string, *substrings_to_isolate): if len(substrings_to_isolate) == 0: return [full_string] substring_to_isolate = substrings_to_isolate[0] - all_substrings = list(it.chain(*zip( + all_substrings = list(it.chain(*list(zip( full_string.split(substring_to_isolate), it.repeat(substring_to_isolate) - ))) + )))) all_substrings.pop(-1) - all_substrings = filter(lambda s: s != "", all_substrings) + all_substrings = [s for s in all_substrings if s != ""] return split_string_list_to_isolate_substring( all_substrings, *substrings_to_isolate[1:] ) diff --git a/utils/tex_file_writing.py b/utils/tex_file_writing.py index 7d9384d0..af58ebb2 100644 --- a/utils/tex_file_writing.py +++ b/utils/tex_file_writing.py @@ -1,4 +1,4 @@ -from __future__ import print_function + import os from constants import TEX_DIR from constants import TEX_TEXT_TO_REPLACE