Merge pull request #303 from ishandutta2007/move_to_py3

updated some breaking scenes to python3
This commit is contained in:
Grant Sanderson 2018-09-19 10:23:42 -07:00 committed by GitHub
commit 736493729b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 82 additions and 81 deletions

View file

@ -1,6 +1,6 @@
from big_ol_pile_of_manim_imports import * from big_ol_pile_of_manim_imports import *
from eop.bayes import IntroducePokerHand from active_projects.eop.bayes import IntroducePokerHand
SICKLY_GREEN = "#9BBD37" SICKLY_GREEN = "#9BBD37"
@ -1362,7 +1362,7 @@ class CompareNumbersInBothExamples(Scene):
"\\text{Not }", "\\text{%s}"%s2, ")", "\\text{Not }", "\\text{%s}"%s2, ")",
"=", "1/100" "=", "1/100"
) )
for s1, s2 in ("+", "Sick"), ("Correct", "Powers") for s1, s2 in [("+", "Sick"), ("Correct", "Powers")]
]) ])
priors.next_to(likelihoods, UP, LARGE_BUFF) priors.next_to(likelihoods, UP, LARGE_BUFF)
for group in priors, likelihoods: for group in priors, likelihoods:

View file

@ -65,7 +65,7 @@ class MillionFlips(Scene):
coins.replace, hundred_boxes[0] coins.replace, hundred_boxes[0]
) )
hundred_boxes[0].add(coins) hundred_boxes[0].add(coins)
for box, prop in zip(hundred_boxes, proportions)[1:]: for box, prop in list(zip(hundred_boxes, proportions))[1:]:
self.add(box) self.add(box)
self.increment(n_flips_count, 100) self.increment(n_flips_count, 100)
self.increment(n_heads_count, int(np.round(prop * 100))) self.increment(n_heads_count, int(np.round(prop * 100)))
@ -77,7 +77,7 @@ class MillionFlips(Scene):
hundred_boxes.replace, ten_k_boxes[0] hundred_boxes.replace, ten_k_boxes[0]
) )
ten_k_boxes[0].add(hundred_boxes) ten_k_boxes[0].add(hundred_boxes)
for box, prop in zip(ten_k_boxes, ten_k_proportions)[1:]: for box, prop in list(zip(ten_k_boxes, ten_k_proportions))[1:]:
self.add(box) self.add(box)
self.increment(n_flips_count, 10000) self.increment(n_flips_count, 10000)
self.increment(n_heads_count, int(np.round(prop * 10000))) self.increment(n_heads_count, int(np.round(prop * 10000)))

View file

@ -1783,7 +1783,7 @@ class IntroducePascalsTriangle(Scene):
mob.rect = SurroundingRectangle(mob, color = color) mob.rect = SurroundingRectangle(mob, color = color)
rects.add(mob.rect) rects.add(mob.rect)
rows_to_fade = VGroup(*rows[1:4] + rows[6:]) rows_to_fade = VGroup(*rows[1:4], *rows[6:])
rows_to_fade.save_state() rows_to_fade.save_state()
top_row = rows[4] top_row = rows[4]

View file

@ -1515,7 +1515,7 @@ class ShowAllEightConditionals(Scene):
equations.arrange_submobjects(DOWN) equations.arrange_submobjects(DOWN)
rect = SurroundingRectangle( rect = SurroundingRectangle(
VGroup(*equations[0][7:]+equations[-1][7:]), VGroup(*equations[0][7:], *equations[-1][7:]),
buff = SMALL_BUFF buff = SMALL_BUFF
) )
rect.shift(0.5*SMALL_BUFF*RIGHT) rect.shift(0.5*SMALL_BUFF*RIGHT)
@ -1845,7 +1845,7 @@ class ShowFullDistribution(Scene):
self.play(Transform(self.bar_chart, alt_charts[0])) self.play(Transform(self.bar_chart, alt_charts[0]))
self.wait() self.wait()
self.play(FadeOut(point_5_probs)) self.play(FadeOut(point_5_probs))
for rhs, chart in zip(alt_rhss, alt_charts)[1:]: for rhs, chart in list(zip(alt_rhss, alt_charts))[1:]:
self.play(Transform(new_prob[-1], rhs)) self.play(Transform(new_prob[-1], rhs))
self.play(Transform(self.bar_chart, chart)) self.play(Transform(self.bar_chart, chart))
self.wait(2) self.wait(2)

View file

@ -158,6 +158,7 @@ class TexMobject(SingleStringTexMobject):
split_list = split_string_list_to_isolate_substring( split_list = split_string_list_to_isolate_substring(
tex_strings, *substrings_to_isolate tex_strings, *substrings_to_isolate
) )
split_list = [item for sublist in split_list for item in sublist]
split_list = list(map(str.strip, split_list)) split_list = list(map(str.strip, split_list))
split_list = [s for s in split_list if s != ''] split_list = [s for s in split_list if s != '']
return split_list return split_list

View file

@ -2209,7 +2209,7 @@ class GraphOnePlusOneOverX(GraphScene):
x_max=x_max, x_max=x_max,
color=self.func_graph_color, color=self.func_graph_color,
) )
for x_min, x_max in (-10, -0.1), (0.1, 10) for x_min, x_max in [(-10, -0.1), (0.1, 10)]
]) ])
func_graph.label = self.get_graph_label( func_graph.label = self.get_graph_label(
upper_func_graph, "y = 1 + \\frac{1}{x}", upper_func_graph, "y = 1 + \\frac{1}{x}",

View file

@ -2,7 +2,7 @@ import numpy as np
import itertools as it import itertools as it
from big_ol_pile_of_manim_imports import * from big_ol_pile_of_manim_imports import *
from brachistochrone.curves import Cycloid from old_projects.brachistochrone.curves import Cycloid
class PhysicalIntuition(Scene): class PhysicalIntuition(Scene):
def construct(self): def construct(self):

View file

@ -2,8 +2,8 @@ import numpy as np
import itertools as it import itertools as it
from big_ol_pile_of_manim_imports import * from big_ol_pile_of_manim_imports import *
from brachistochrone.light import PhotonScene from old_projects.brachistochrone.light import PhotonScene
from brachistochrone.curves import * from old_projects.brachistochrone.curves import *
class MultilayeredScene(Scene): class MultilayeredScene(Scene):

View file

@ -3,7 +3,7 @@ import itertools as it
import os import os
from big_ol_pile_of_manim_imports import * from big_ol_pile_of_manim_imports import *
from brachistochrone.drawing_images import sort_by_color from old_projects.brachistochrone.drawing_images import sort_by_color
class Intro(Scene): class Intro(Scene):
def construct(self): def construct(self):

View file

@ -14,7 +14,7 @@ def get_cursive_name(name):
return result return result
def sha256_bit_string(message): def sha256_bit_string(message):
hexdigest = sha256(message).hexdigest() hexdigest = sha256(message.encode('utf-8')).hexdigest()
return bin(int(hexdigest, 16))[2:] return bin(int(hexdigest, 16))[2:]
def bit_string_to_mobject(bit_string): def bit_string_to_mobject(bit_string):
@ -2316,7 +2316,7 @@ class YouListeningToBroadcasts(LedgerScene):
self.remove(self.ledger) self.remove(self.ledger)
corners = [ corners = [
FRAME_X_RADIUS*RIGHT*u1 + FRAME_Y_RADIUS*UP*u2 FRAME_X_RADIUS*RIGHT*u1 + FRAME_Y_RADIUS*UP*u2
for u1, u2 in (-1, 1), (1, 1), (-1, -1) for u1, u2 in [(-1, 1), (1, 1), (-1, -1)]
] ]
you = self.you you = self.you
you.scale(2) you.scale(2)
@ -5011,7 +5011,7 @@ class ShowManyExchanges(Scene):
path_arc = np.pi, path_arc = np.pi,
buff = MED_LARGE_BUFF buff = MED_LARGE_BUFF
) )
for p1, p2 in (LEFT, RIGHT), (RIGHT, LEFT) for p1, p2 in [(LEFT, RIGHT), (RIGHT, LEFT)]
]).set_color(WHITE) ]).set_color(WHITE)
exchanges = VGroup(*[ exchanges = VGroup(*[
VGroup(*[ VGroup(*[

View file

@ -272,7 +272,7 @@ class StreamLines(VGroup):
if get_norm(last_point) > self.cutoff_norm: if get_norm(last_point) > self.cutoff_norm:
break break
line = VMobject() line = VMobject()
step = max(1, len(points) / self.n_anchors_per_line) step = max(1, int(len(points) / self.n_anchors_per_line))
line.set_points_smoothly(points[::step]) line.set_points_smoothly(points[::step])
self.add(line) self.add(line)

View file

@ -2786,7 +2786,7 @@ class DihedralCubeHomomorphism(GroupOfCubeSymmetries, SymmetriesOfSquare):
in_place = True, in_place = True,
run_time = abs(angle/(np.pi/2)) run_time = abs(angle/(np.pi/2))
) )
for mob, axis in (square, raw_axis), (cube, posed_axis) for mob, axis in [(square, raw_axis), (cube, posed_axis)]
]) ])
self.wait() self.wait()
if i == 2: if i == 2:

View file

@ -2326,7 +2326,7 @@ class PlayingTowardsDADX(AreaUnderParabola, ReconfigurableScene):
equation.get_part_by_tex(tex), equation.get_part_by_tex(tex),
run_time = 2 run_time = 2
) )
for mob, tex in (x_squared, f_tex), (dx, "dx"), (dA, "dA") for mob, tex in [(x_squared, f_tex), (dx, "dx"), (dA, "dA")]
]) ])
self.play(Write(equation.get_part_by_tex("approx"))) self.play(Write(equation.get_part_by_tex("approx")))
self.wait() self.wait()
@ -2361,7 +2361,7 @@ class PlayingTowardsDADX(AreaUnderParabola, ReconfigurableScene):
Circle(color = color).replace( Circle(color = color).replace(
mob, stretch = True mob, stretch = True
).scale_in_place(1.5) ).scale_in_place(1.5)
for mob, color in (self.A_func, RED), (self.deriv_equation, GREEN) for mob, color in [(self.A_func, RED), (self.deriv_equation, GREEN)]
] ]
q_marks = TexMobject("???") q_marks = TexMobject("???")
q_marks.next_to(A_circle, UP) q_marks.next_to(A_circle, UP)

View file

@ -1789,7 +1789,7 @@ class HigherTermsDontMessUpLowerTerms(Scene):
path_arc = arc, path_arc = arc,
color = c.get_color() color = c.get_color()
) )
for c, arc in (c2, 0.9*np.pi), (c0, np.pi) for c, arc in [(c2, 0.9*np.pi), (c0, np.pi)]
]) ])
no_affect_words = TextMobject( no_affect_words = TextMobject(
"Doesn't affect \\\\ previous terms" "Doesn't affect \\\\ previous terms"

View file

@ -2085,11 +2085,11 @@ class SquareRootOfX(Scene):
stroke_width = 3 stroke_width = 3
).shift(s.get_corner(corner)) ).shift(s.get_corner(corner))
for corner, vect in [(DOWN+LEFT, RIGHT), (UP+RIGHT, DOWN)] for corner, vect in [(DOWN+LEFT, RIGHT), (UP+RIGHT, DOWN)]
for s in square, bigger_square for s in [square, bigger_square]
]) ])
little_braces = VGroup(*[ little_braces = VGroup(*[
Brace(VGroup(*line_pair), vect, buff = 0) Brace(VGroup(*line_pair), vect, buff = 0)
for line_pair, vect in (lines[:2], RIGHT), (lines[2:], DOWN) for line_pair, vect in [(lines[:2], RIGHT), (lines[2:], DOWN)]
]) ])
for brace in little_braces: for brace in little_braces:
tex = brace.get_text("$d\\sqrt{x}$", buff = SMALL_BUFF) tex = brace.get_text("$d\\sqrt{x}$", buff = SMALL_BUFF)

View file

@ -1919,7 +1919,7 @@ class FindAntiderivative(Antiderivative):
path_arc = -np.pi/6, path_arc = -np.pi/6,
run_time = 2, run_time = 2,
) )
for i, j in (0, 1), (1, 0), (1, 2) for i, j in [(0, 1), (1, 0), (1, 2)]
]) ])
self.wait() self.wait()
self.play(FadeIn(third)) self.play(FadeIn(third))

View file

@ -634,7 +634,7 @@ class HowToReadNotation(GraphScene, ReconfigurableScene):
ddf_over_dx_squared.get_part_by_tex(tex), ddf_over_dx_squared.get_part_by_tex(tex),
path_arc = -np.pi/2, path_arc = -np.pi/2,
) )
for mob, tex in (self.ddf, "df"), (self.dx_squared, "dx") for mob, tex in [(self.ddf, "df"), (self.dx_squared, "dx")]
] ]
) )
self.wait(2) self.wait(2)

View file

@ -1,5 +1,5 @@
from big_ol_pile_of_manim_imports import * from big_ol_pile_of_manim_imports import *
from eola.chapter0 import UpcomingSeriesOfVidoes from old_projects.eola.chapter0 import UpcomingSeriesOfVidoes
import random import random

View file

@ -1,8 +1,8 @@
from big_ol_pile_of_manim_imports import * from big_ol_pile_of_manim_imports import *
from eola.chapter1 import plane_wave_homotopy from old_projects.eola.chapter1 import plane_wave_homotopy
from eola.chapter3 import ColumnsToBasisVectors from old_projects.eola.chapter3 import ColumnsToBasisVectors
from eola.chapter5 import get_det_text from old_projects.eola.chapter5 import get_det_text
from eola.chapter9 import get_small_bubble from old_projects.eola.chapter9 import get_small_bubble
class OpeningQuote(Scene): class OpeningQuote(Scene):
@ -309,7 +309,7 @@ class AllXAxisVectorsAreEigenvectors(ExampleTranformationScene):
vectors = VGroup(*[ vectors = VGroup(*[
self.add_vector(u*x*RIGHT, animate = False) self.add_vector(u*x*RIGHT, animate = False)
for x in reversed(list(range(1, int(FRAME_X_RADIUS)+1))) for x in reversed(list(range(1, int(FRAME_X_RADIUS)+1)))
for u in -1, 1 for u in [-1, 1]
]) ])
vectors.set_color_by_gradient(YELLOW, X_COLOR) vectors.set_color_by_gradient(YELLOW, X_COLOR)
self.play(ShowCreation(vectors)) self.play(ShowCreation(vectors))
@ -360,7 +360,7 @@ class FullSneakyEigenspace(ExampleTranformationScene):
vectors = VGroup(*[ vectors = VGroup(*[
self.add_vector(u*x*(LEFT+UP), animate = False) self.add_vector(u*x*(LEFT+UP), animate = False)
for x in reversed(np.arange(0.5, 5, 0.5)) for x in reversed(np.arange(0.5, 5, 0.5))
for u in -1, 1 for u in [-1, 1]
]) ])
vectors.set_color_by_gradient(MAROON_B, YELLOW) vectors.set_color_by_gradient(MAROON_B, YELLOW)
words = TextMobject("Stretch by 2") words = TextMobject("Stretch by 2")
@ -391,14 +391,14 @@ class NameEigenvectorsAndEigenvalues(ExampleTranformationScene):
x_vectors = VGroup(*[ x_vectors = VGroup(*[
self.add_vector(u*x*RIGHT, animate = False) self.add_vector(u*x*RIGHT, animate = False)
for x in range(int(FRAME_X_RADIUS)+1, 0, -1) for x in range(int(FRAME_X_RADIUS)+1, 0, -1)
for u in -1, 1 for u in [-1, 1]
]) ])
x_vectors.set_color_by_gradient(YELLOW, X_COLOR) x_vectors.set_color_by_gradient(YELLOW, X_COLOR)
self.remove(x_vectors) self.remove(x_vectors)
sneak_vectors = VGroup(*[ sneak_vectors = VGroup(*[
self.add_vector(u*x*(LEFT+UP), animate = False) self.add_vector(u*x*(LEFT+UP), animate = False)
for x in np.arange(int(FRAME_Y_RADIUS), 0, -0.5) for x in np.arange(int(FRAME_Y_RADIUS), 0, -0.5)
for u in -1, 1 for u in [-1, 1]
]) ])
sneak_vectors.set_color_by_gradient(MAROON_B, YELLOW) sneak_vectors.set_color_by_gradient(MAROON_B, YELLOW)
self.remove(sneak_vectors) self.remove(sneak_vectors)
@ -1442,7 +1442,7 @@ class RevisitExampleTransformation(ExampleTranformationScene):
vectors = VGroup(*[ vectors = VGroup(*[
self.add_vector(u*x*(LEFT+UP), animate = False) self.add_vector(u*x*(LEFT+UP), animate = False)
for x in range(4, 0, -1) for x in range(4, 0, -1)
for u in -1, 1 for u in [-1, 1]
]) ])
vectors.set_color_by_gradient(MAROON_B, YELLOW) vectors.set_color_by_gradient(MAROON_B, YELLOW)
vectors.save_state() vectors.save_state()
@ -1635,7 +1635,7 @@ class ShearExample(RevisitExampleTransformation):
vectors = VGroup(*[ vectors = VGroup(*[
self.add_vector(u*x*RIGHT, animate = False) self.add_vector(u*x*RIGHT, animate = False)
for x in range(int(FRAME_X_RADIUS)+1, 0, -1) for x in range(int(FRAME_X_RADIUS)+1, 0, -1)
for u in -1, 1 for u in [-1, 1]
]) ])
vectors.set_color_by_gradient(YELLOW, X_COLOR) vectors.set_color_by_gradient(YELLOW, X_COLOR)
words = VGroup( words = VGroup(
@ -2110,9 +2110,9 @@ class ChangeToEigenBasis(ExampleTranformationScene):
VGroup(*[ VGroup(*[
self.add_vector(u*x*vect, animate = False) self.add_vector(u*x*vect, animate = False)
for x in range(num, 0, -1) for x in range(num, 0, -1)
for u in -1, 1 for u in [-1, 1]
]) ])
for vect, num in (RIGHT, 7), (UP+LEFT, 4) for vect, num in [(RIGHT, 7), (UP+LEFT, 4)]
] ]
x_vectors.set_color_by_gradient(YELLOW, X_COLOR) x_vectors.set_color_by_gradient(YELLOW, X_COLOR)
v_vectors.set_color_by_gradient(MAROON_B, YELLOW) v_vectors.set_color_by_gradient(MAROON_B, YELLOW)

View file

@ -1,9 +1,9 @@
from big_ol_pile_of_manim_imports import * from big_ol_pile_of_manim_imports import *
from eola.chapter1 import plane_wave_homotopy from old_projects.eola.chapter1 import plane_wave_homotopy
from eola.chapter3 import ColumnsToBasisVectors from old_projects.eola.chapter3 import ColumnsToBasisVectors
from eola.chapter5 import NameDeterminant, Blob from old_projects.eola.chapter5 import NameDeterminant, Blob
from eola.chapter9 import get_small_bubble from old_projects.eola.chapter9 import get_small_bubble
from eola.chapter10 import ExampleTranformationScene from old_projects.eola.chapter10 import ExampleTranformationScene
class Student(PiCreature): class Student(PiCreature):
CONFIG = { CONFIG = {
@ -505,7 +505,7 @@ class DeterminantAndEigenvectorDontCare(LinearTransformationScene):
vectors = VGroup(*[ vectors = VGroup(*[
Vector(u*x*v) Vector(u*x*v)
for x in range(7, 0, -1) for x in range(7, 0, -1)
for u in -1, 1 for u in [-1, 1]
]) ])
vectors.set_color_by_gradient(MAROON_A, MAROON_C) vectors.set_color_by_gradient(MAROON_A, MAROON_C)
result += list(vectors) result += list(vectors)

View file

@ -1,5 +1,5 @@
from big_ol_pile_of_manim_imports import * from big_ol_pile_of_manim_imports import *
from eola.chapter1 import plane_wave_homotopy from old_projects.eola.chapter1 import plane_wave_homotopy
class OpeningQuote(Scene): class OpeningQuote(Scene):
def construct(self): def construct(self):
@ -239,7 +239,7 @@ class ShowVaryingLinearCombinations(VectorScene):
) )
label_anims = [ label_anims = [
MaintainPositionRelativeTo(label, v) MaintainPositionRelativeTo(label, v)
for v, label in (v1, v1_label), (v2, v2_label) for v, label in [(v1, v1_label), (v2, v2_label)]
] ]
scalar_anims = self.get_scalar_anims(v1, v2, v1_label, v2_label) scalar_anims = self.get_scalar_anims(v1, v2, v1_label, v2_label)
self.last_scalar_pair = (1, 1) self.last_scalar_pair = (1, 1)
@ -270,13 +270,13 @@ class ShowVaryingLinearCombinations(VectorScene):
scale_factor = 0.75, scale_factor = 0.75,
value_function = get_val_func(v) value_function = get_val_func(v)
) )
for v, label in (v1, v1_label), (v2, v2_label) for v, label in [(v1, v1_label), (v2, v2_label)]
] ]
def get_rate_func_pair(self): def get_rate_func_pair(self):
return [ return [
squish_rate_func(smooth, a, b) squish_rate_func(smooth, a, b)
for a, b in (0, 0.7), (0.3, 1) for a, b in [(0, 0.7), (0.3, 1)]
] ]
def initial_scaling(self, v1, v2, label_anims, scalar_anims): def initial_scaling(self, v1, v2, label_anims, scalar_anims):

View file

@ -1,5 +1,5 @@
from big_ol_pile_of_manim_imports import * from big_ol_pile_of_manim_imports import *
from eola.chapter3 import MatrixVectorMultiplicationAbstract from old_projects.eola.chapter3 import MatrixVectorMultiplicationAbstract
class OpeningQuote(Scene): class OpeningQuote(Scene):

View file

@ -1,5 +1,5 @@
from big_ol_pile_of_manim_imports import * from big_ol_pile_of_manim_imports import *
from eola.chapter3 import MatrixVectorMultiplicationAbstract from old_projects.eola.chapter3 import MatrixVectorMultiplicationAbstract
class Blob(Circle): class Blob(Circle):

View file

@ -379,7 +379,7 @@ class SystemOfEquations(Scene):
Circle().replace(mob).scale_in_place(1.3) Circle().replace(mob).scale_in_place(1.3)
for mob in [ for mob in [
VMobject(*equations.split()[i].split()[j:j+2]) VMobject(*equations.split()[i].split()[j:j+2])
for i, j in (1, 3), (2, 6) for i, j in [(1, 3), (2, 6)]
] ]
]) ])
zero_circles.set_color(PINK) zero_circles.set_color(PINK)

View file

@ -1,5 +1,5 @@
from big_ol_pile_of_manim_imports import * from big_ol_pile_of_manim_imports import *
from eola.footnote2 import TwoDTo1DTransformWithDots from old_projects.eola.footnote2 import TwoDTo1DTransformWithDots
V_COLOR = YELLOW V_COLOR = YELLOW

View file

@ -1,5 +1,5 @@
from big_ol_pile_of_manim_imports import * from big_ol_pile_of_manim_imports import *
from eola.chapter5 import get_det_text, RightHandRule from old_projects.eola.chapter5 import get_det_text, RightHandRule
U_COLOR = ORANGE U_COLOR = ORANGE
@ -1159,7 +1159,7 @@ class BiggerWhenPerpendicular(LinearTransformationScene):
w.target = w.copy().rotate(np.pi/5) w.target = w.copy().rotate(np.pi/5)
transforms = [ transforms = [
self.get_matrix_transformation([v1.get_end()[:2], v2.get_end()[:2]]) self.get_matrix_transformation([v1.get_end()[:2], v2.get_end()[:2]])
for v1, v2 in (v, w), (v.target, w.target) for v1, v2 in [(v, w), (v.target, w.target)]
] ]
start_square, end_square = [ start_square, end_square = [
square.copy().apply_function(transform) square.copy().apply_function(transform)

View file

@ -1,6 +1,6 @@
from big_ol_pile_of_manim_imports import * from big_ol_pile_of_manim_imports import *
from eola.chapter5 import get_det_text from old_projects.eola.chapter5 import get_det_text
from eola.chapter8 import * from old_projects.eola.chapter8 import *
class OpeningQuote(Scene): class OpeningQuote(Scene):

View file

@ -1,5 +1,5 @@
from big_ol_pile_of_manim_imports import * from big_ol_pile_of_manim_imports import *
from eola.chapter1 import plane_wave_homotopy from old_projects.eola.chapter1 import plane_wave_homotopy
V_COLOR = YELLOW V_COLOR = YELLOW

View file

@ -1,5 +1,5 @@
from big_ol_pile_of_manim_imports import * from big_ol_pile_of_manim_imports import *
from eola.chapter9 import Jennifer, You from old_projects.eola.chapter9 import Jennifer, You
class Chapter0(LinearTransformationScene): class Chapter0(LinearTransformationScene):
CONFIG = { CONFIG = {

View file

@ -2030,7 +2030,7 @@ class RecursiveSolutionToConstrained(RecursiveSolution):
"Move disk %d,"%d, "Move disk %d,"%d,
"Move %d-tower"%d, "Move %d-tower"%d,
).set_color_by_tex("Move disk %d,"%d, color) ).set_color_by_tex("Move disk %d,"%d, color)
for d, color in (3, GREEN), (2, RED), (1, BLUE_C) for d, color in [(3, GREEN), (2, RED), (1, BLUE_C)]
] ]
sub_steps, sub_sub_steps = subdivisions[:2] sub_steps, sub_sub_steps = subdivisions[:2]
for steps in subdivisions: for steps in subdivisions:

View file

@ -1977,7 +1977,7 @@ class TwoDBoxWithSliders(TwoDimensionalCase):
slider.number_to_point(0)-slider.number_to_point(slider.center_value) slider.number_to_point(0)-slider.number_to_point(slider.center_value)
) )
for slider in self.sliders for slider in self.sliders
for mob in slider.real_estate_ticks, slider.dial for mob in [slider.real_estate_ticks, slider.dial]
] ]
) )
self.center_point = [0, 0] self.center_point = [0, 0]
@ -1996,7 +1996,7 @@ class TwoDBoxWithSliders(TwoDimensionalCase):
slider.number_to_point(x)-slider.number_to_point(0) slider.number_to_point(x)-slider.number_to_point(0)
) )
for x, slider in zip(original_center_point, self.sliders) for x, slider in zip(original_center_point, self.sliders)
for mob in slider.real_estate_ticks, slider.dial for mob in [slider.real_estate_ticks, slider.dial]
] ]
) )
self.center_point = original_center_point self.center_point = original_center_point
@ -2296,7 +2296,7 @@ class ThreeDBoxExampleWithSliders(SliderScene):
re_words.to_corner(UP+LEFT) re_words.to_corner(UP+LEFT)
re_line = DashedLine(*[ re_line = DashedLine(*[
self.sliders[i].number_to_point(target_x) + MED_SMALL_BUFF*vect self.sliders[i].number_to_point(target_x) + MED_SMALL_BUFF*vect
for i, vect in (0, LEFT), (2, RIGHT) for i, vect in [(0, LEFT), (2, RIGHT)]
]) ])
new_arrow = Arrow( new_arrow = Arrow(
re_words.get_corner(DOWN+RIGHT), re_line.get_left(), re_words.get_corner(DOWN+RIGHT), re_line.get_left(),
@ -2322,7 +2322,7 @@ class ThreeDBoxExampleWithSliders(SliderScene):
def compare_to_halfway_point(self): def compare_to_halfway_point(self):
half_line = Line(*[ half_line = Line(*[
self.sliders[i].number_to_point(0.5)+MED_SMALL_BUFF*vect self.sliders[i].number_to_point(0.5)+MED_SMALL_BUFF*vect
for i, vect in (0, LEFT), (2, RIGHT) for i, vect in [(0, LEFT), (2, RIGHT)]
]) ])
half_line.set_stroke(MAROON_B, 6) half_line.set_stroke(MAROON_B, 6)
half_label = TexMobject("0.5") half_label = TexMobject("0.5")
@ -2507,7 +2507,7 @@ class FourDBoxExampleWithSliders(ThreeDBoxExampleWithSliders):
target_vector = 0.5*np.ones(4) target_vector = 0.5*np.ones(4)
re_line = DashedLine(*[ re_line = DashedLine(*[
self.sliders[i].number_to_point(0.5)+MED_SMALL_BUFF*vect self.sliders[i].number_to_point(0.5)+MED_SMALL_BUFF*vect
for i, vect in (0, LEFT), (-1, RIGHT) for i, vect in [(0, LEFT), (-1, RIGHT)]
]) ])
half_label = TexMobject("0.5") half_label = TexMobject("0.5")
half_label.scale(self.sliders[0].number_scale_val) half_label.scale(self.sliders[0].number_scale_val)
@ -2655,7 +2655,7 @@ class TwoDInnerSphereTouchingBox(TwoDBoxWithSliders, PiCreatureScene):
randy = self.randy randy = self.randy
tangency_points = VGroup(*[ tangency_points = VGroup(*[
Dot(self.plane.coords_to_point(x, y)) Dot(self.plane.coords_to_point(x, y))
for x, y in (1, 0), (0, 1), (-1, 0), (0, -1) for x, y in [(1, 0), (0, 1), (-1, 0), (0, -1)]
]) ])
tangency_points.set_fill(YELLOW, 0.5) tangency_points.set_fill(YELLOW, 0.5)
@ -2747,7 +2747,7 @@ class FiveDBoxExampleWithSliders(FourDBoxExampleWithSliders):
target_x = 1-np.sqrt(0.2) target_x = 1-np.sqrt(0.2)
re_line = DashedLine(*[ re_line = DashedLine(*[
self.sliders[i].number_to_point(target_x)+MED_SMALL_BUFF*vect self.sliders[i].number_to_point(target_x)+MED_SMALL_BUFF*vect
for i, vect in (0, LEFT), (-1, RIGHT) for i, vect in [(0, LEFT), (-1, RIGHT)]
]) ])
re_words = TextMobject( re_words = TextMobject(
"$0.2$", "units of real \\\\ estate each" "$0.2$", "units of real \\\\ estate each"
@ -2785,7 +2785,7 @@ class FiveDBoxExampleWithSliders(FourDBoxExampleWithSliders):
def show_halfway_point(self): def show_halfway_point(self):
half_line = Line(*[ half_line = Line(*[
self.sliders[i].number_to_point(0.5)+MED_SMALL_BUFF*vect self.sliders[i].number_to_point(0.5)+MED_SMALL_BUFF*vect
for i, vect in (0, LEFT), (-1, RIGHT) for i, vect in [(0, LEFT), (-1, RIGHT)]
]) ])
half_line.set_color(MAROON_B) half_line.set_color(MAROON_B)
half_label = TexMobject("0.5") half_label = TexMobject("0.5")
@ -2943,7 +2943,7 @@ class TenDBoxExampleWithSliders(FiveDBoxExampleWithSliders):
target_x = 1-np.sqrt(1./self.n_sliders) target_x = 1-np.sqrt(1./self.n_sliders)
re_line = DashedLine(*[ re_line = DashedLine(*[
self.sliders[i].number_to_point(target_x)+MED_SMALL_BUFF*vect self.sliders[i].number_to_point(target_x)+MED_SMALL_BUFF*vect
for i, vect in (0, LEFT), (-1, RIGHT) for i, vect in [(0, LEFT), (-1, RIGHT)]
]) ])
re_rects = VGroup() re_rects = VGroup()

View file

@ -1,5 +1,5 @@
from big_ol_pile_of_manim_imports import * from big_ol_pile_of_manim_imports import *
from hilbert.curves import * from old_projects.hilbert.curves import *
class Intro(TransformOverIncreasingOrders): class Intro(TransformOverIncreasingOrders):
@staticmethod @staticmethod

View file

@ -3443,7 +3443,7 @@ class IntroduceChi(FactorizationPattern):
CONFIG = { CONFIG = {
"numbers_list" : [ "numbers_list" : [
list(range(i, 36, d)) list(range(i, 36, d))
for i, d in (1, 4), (3, 4), (2, 2) for i, d in [(1, 4), (3, 4), (2, 2)]
], ],
"colors" : [GREEN, RED, YELLOW] "colors" : [GREEN, RED, YELLOW]
} }

View file

@ -747,7 +747,7 @@ class RenameAllInTermsOfSine(Scene):
self.wait(2) self.wait(2)
anims = [] anims = []
for mob, rhs_mob in zip(mobs, rhs_mobs)[1:3]: for mob, rhs_mob in list(zip(mobs, rhs_mobs))[1:3]:
anims += [ anims += [
FadeOut(rhs_mob), FadeOut(rhs_mob),
mob.restore, mob.restore,

View file

@ -1,6 +1,6 @@
from big_ol_pile_of_manim_imports import * from big_ol_pile_of_manim_imports import *
from triangle_of_power.triangle import TOP, OPERATION_COLORS from old_projects.triangle_of_power.triangle import TOP, OPERATION_COLORS
class DontLearnFromSymbols(Scene): class DontLearnFromSymbols(Scene):
def construct(self): def construct(self):

View file

@ -1741,7 +1741,7 @@ class VisualizeZSquared(Scene):
def show_triangles(self): def show_triangles(self):
z_list = [ z_list = [
complex(u, v)**2 complex(u, v)**2
for u, v in (2, 1), (3, 2), (4, 1) for u, v in [(2, 1), (3, 2), (4, 1)]
] ]
triangles = self.get_triangles(z_list) triangles = self.get_triangles(z_list)
triangle = triangles[0] triangle = triangles[0]

View file

@ -3483,7 +3483,7 @@ class KeeperAndSailor(DistanceProductScene, PiCreatureScene):
anims += [ anims += [
MoveToTarget(part) MoveToTarget(part)
for pi in self.observers for pi in self.observers
for part in pi, pi.dot, pi.title for part in [pi, pi.dot, pi.title]
] ]
anims += added_anims anims += added_anims
@ -4908,7 +4908,7 @@ class KeeperAndSailorForSineProduct(KeeperAndSailor):
FadeOut(product_lines), FadeOut(product_lines),
*[ *[
ReplacementTransform(product[i], one_minus_f_over_k[j]) ReplacementTransform(product[i], one_minus_f_over_k[j])
for i, j in (3, 1), (4, 2), (5, 3), (2, 4), (1, 5) for i, j in [(3, 1), (4, 2), (5, 3), (2, 4), (1, 5)]
] ]
) )
self.wait() self.wait()

View file

@ -1777,7 +1777,7 @@ class ShowTipToTailSum(ShowVectorEquation):
np.array(ov.A_vect) np.array(ov.A_vect)
) )
) )
for ov, A in (h_ov, h_A), (v_ov, v_A) for ov, A in [(h_ov, h_A), (v_ov, v_A)]
] ]
)) ))
self.wait(4) self.wait(4)
@ -1917,7 +1917,7 @@ class AlternateBasis(ShowTipToTailSum):
"(\\dots)", "(\\dots)",
"|\\!\\%sarrow\\rangle"%s2, "|\\!\\%sarrow\\rangle"%s2,
) )
for s1, s2 in ("right", "up"), ("ne", "nw") for s1, s2 in [("right", "up"), ("ne", "nw")]
] ]
for superposition in superpositions: for superposition in superpositions:
superposition.set_color_by_tex("rangle", YELLOW) superposition.set_color_by_tex("rangle", YELLOW)
@ -2519,7 +2519,7 @@ class DescribePhoton(ThreeDScene):
color = color, color = color,
normal_vector = RIGHT, normal_vector = RIGHT,
) )
for color, direction in (self.x_color, UP), (self.y_color, OUT) for color, direction in [(self.x_color, UP), (self.y_color, OUT)]
] ]
v_arrow.move_to(h_arrow.get_end(), IN) v_arrow.move_to(h_arrow.get_end(), IN)
h_part = VGroup(*self.equation[1][2:4]).copy() h_part = VGroup(*self.equation[1][2:4]).copy()
@ -3905,7 +3905,7 @@ class CompareWaveEquations(TeacherStudentsScene):
radius = 0.05, radius = 0.05,
color = color color = color
) )
for x, color in (-0.5, RED), (0.5, GREEN) for x, color in [(-0.5, RED), (0.5, GREEN)]
] ]
new_alpha.target.next_to(alpha_dot, UP+LEFT, 0.5*SMALL_BUFF) new_alpha.target.next_to(alpha_dot, UP+LEFT, 0.5*SMALL_BUFF)
new_alpha.target.set_color(RED) new_alpha.target.set_color(RED)

View file

@ -526,7 +526,7 @@ class DefineInscribedSquareProblem(ClosedLoopScene):
dot_pairs = [ dot_pairs = [
VGroup(self.dots[i], self.dots[j]) VGroup(self.dots[i], self.dots[j])
for i, j in (0, 2), (1, 3) for i, j in [(0, 2), (1, 3)]
] ]
pair_colors = MAROON_B, PURPLE_B pair_colors = MAROON_B, PURPLE_B
diag_lines = [ diag_lines = [
@ -549,7 +549,7 @@ class RectangleProperties(Scene):
]) ])
dot_pairs = [ dot_pairs = [
VGroup(vertex_dots[i], vertex_dots[j]) VGroup(vertex_dots[i], vertex_dots[j])
for i, j in (0, 2), (1, 3) for i, j in [(0, 2), (1, 3)]
] ]
colors = [MAROON_B, PURPLE_B] colors = [MAROON_B, PURPLE_B]
diag_lines = [ diag_lines = [
@ -615,7 +615,7 @@ class PairOfPairBecomeRectangle(Scene):
dots[j].get_center(), dots[j].get_center(),
color = dots[i].get_color() color = dots[i].get_color()
) )
for i, j in (0, 1), (2, 3) for i, j in [(0, 1), (2, 3)]
] ]
groups = [ groups = [
VGroup(dots[0], dots[1], labels[0], labels[1], lines[0]), VGroup(dots[0], dots[1], labels[0], labels[1], lines[0]),