A community-maintained Python framework for creating mathematical animations.
Starting eoc5, and how did I not notice the weird cow problem that snuck its way into the scene directory?
Grant Sandersonacfd23c82e4e
diff --git a/eoc/chapter5.py b/eoc/chapter5.pynew file mode 100644index 000000000..3fea8a947--- /dev/null+++ b/eoc/chapter5.py@@ -0,0 +1,39 @@+from helpers import *++from mobject.tex_mobject import TexMobject+from mobject import Mobject+from mobject.image_mobject import ImageMobject+from mobject.vectorized_mobject import *++from animation.animation import Animation+from animation.transform import *+from animation.simple_animations import *+from animation.playground import *+from topics.geometry import *+from topics.characters import *+from topics.functions import *+from topics.fractals import *+from topics.number_line import *+from topics.combinatorics import *+from topics.numerals import *+from topics.three_dimensions import *+from topics.objects import *+from scene import Scene+from scene.zoomed_scene import ZoomedScene+from scene.reconfigurable_scene import ReconfigurableScene+from camera import Camera+from mobject.svg_mobject import *+from mobject.tex_mobject import *++from eoc.chapter1 import OpeningQuote, PatreonThanks+from eoc.graph_scene import *++class Chapter3OpeningQuote(OpeningQuote):+ CONFIG = {+ "quote" : [+ "Using the chain rule is like peeling an onion: ",+ "you have to deal with each layer at a time, and ",+ "if it is too big you will start crying."+ ],+ "author" : "(Anonymous professor)"+ }\ No newline at end of filediff --git a/scene/test.py b/scene/test.pydeleted file mode 100644index f893b4754..000000000--- a/scene/test.py+++ /dev/null@@ -1,58 +0,0 @@-import numpy as np-import random--class CowProblem():- def __init__(self):- self.reset()- self.directions = [- (1, 0),- (1, 1),- (0, 1),- (-1, 1),- (-1, 0),- (-1, -1),- (0, -1),- (1, -1),- ]-- def reset(self):- self.field = np.ones((11, 11), dtype = 'bool')- self.cow_x = 0- self.cow_y = 0-- def step(self):- valid_step = False- while not valid_step:- step_x, step_y = random.choice(self.directions)- if self.cow_x + step_x > 0 and self.cow_x + step_x < 11 and self.cow_y + step_y > 0 and self.cow_y + step_y < 11:- valid_step = True- self.cow_x += step_x- self.cow_y += step_y- self.field[self.cow_x, self.cow_y] = False-- def total_grass_after_n_steps(self, n):- for x in range(n):- self.step()- return sum(sum(self.field))-- def num_steps_for_half_eaten(self):- result = 0- while sum(sum(self.field)) > 121/2:- self.step()- result += 1- return result-- def average_number_of_steps_for_half_eaten(self, sample_size):- run_times = []- for x in range(sample_size):- run_times.append(- self.num_steps_for_half_eaten()- )- self.reset()- return np.mean(run_times)------