From c538cac3c62c0a9552d200fd6bbae62a1b7111a4 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Mon, 1 Nov 2021 13:19:26 -0700 Subject: [PATCH] Tweaks to thumbnails, etc. --- _2021/holomorphic_dynamics.py | 3 +++ _2021/newton_fractal.py | 36 ++++++++++++++++++++++++++++++++++- _2021/quintic.py | 18 ++++++++++++++---- 3 files changed, 52 insertions(+), 5 deletions(-) diff --git a/_2021/holomorphic_dynamics.py b/_2021/holomorphic_dynamics.py index 72ce66f..11c668a 100644 --- a/_2021/holomorphic_dynamics.py +++ b/_2021/holomorphic_dynamics.py @@ -3562,6 +3562,9 @@ class MetaFractal(IntroNewtonFractal): frame.target.move_to(point1) frame.target.set_height(height1) + fractal.set_saturation_factor(2) + plane.remove(plane.coordinate_labels) + self.play( MoveToTarget(frame), run_time=8, diff --git a/_2021/newton_fractal.py b/_2021/newton_fractal.py index 23183e3..68dd7c7 100644 --- a/_2021/newton_fractal.py +++ b/_2021/newton_fractal.py @@ -3607,7 +3607,7 @@ class SimpleFractalScene(IntroNewtonFractal): colors = ROOT_COLORS_DEEP display_polynomial_label = False display_root_values = False - n_steps = 12 + n_steps = 25 def construct(self): self.init_fractal(root_colors=self.colors) @@ -5088,3 +5088,37 @@ class MetaFractal(IntroNewtonFractal): ), run_time=10 ) + + +class Thumbnail2(SimpleFractalScene): + def construct(self): + super().construct() + fractal = self.fractal + fractal.set_saturation_factor(4.5) + self.remove(self.plane) + self.remove(self.root_dots) + + frame = self.camera.frame + frame.set_height(4) + + fc = fractal.copy() + fc.set_saturation_factor(2) + fc.set_julia_highlight(0.01) + self.add(fc) + + # self.clear() + # back = fractal.copy() + # back.set_saturation_factor(0) + # back.set_opacity(0.1) + # self.add(back) + + # N = 20 + # for x in np.linspace(np.log(1e-3), np.log(0.1), N): + # jh = np.exp(x) + # fc = fractal.copy() + # fc.set_saturation_factor(1) + # fc.set_julia_highlight(jh) + # fc.set_opacity(2 / N) + # self.add(fc) + + self.embed() diff --git a/_2021/quintic.py b/_2021/quintic.py index 68c627d..891e047 100644 --- a/_2021/quintic.py +++ b/_2021/quintic.py @@ -591,11 +591,13 @@ class CubicFormula(RootCoefScene): ) def add_crt_dots(self): - crt_dots = Dot(**self.sqrt_dot_config).replicate(2) + crt_dots = Dot(**self.sqrt_dot_config).replicate(3) # TODO, refactor to prevent code duplication here def update_crt_dots(dots): - q, p, zero, one = self.get_coefs() + coefs = self.get_coefs() + roots = coefficients_to_roots(coefs) + q, p, zero, one = coefs disc = (q**2 / 4) + (p**3 / 27) deltas = get_nth_roots(disc, 2) # TODO add all the cube roots @@ -612,11 +614,17 @@ class CubicFormula(RootCoefScene): self.add(crt_dots) - # Scenes +class Cubic(RootCoefScene): + coefs = [1, -1, 0, 1] + + def construct(self): + self.embed() + + class AmbientRootSwapping(RootCoefScene): - n_swaps = 20 + n_swaps = 0 def construct(self): for x in range(self.n_swaps): @@ -625,6 +633,8 @@ class AmbientRootSwapping(RootCoefScene): self.swap_roots(*indices) self.wait() + self.embed() + class CubicFormulaTest(CubicFormula): def construct(self):