def __init__(self, complex_homotopy, mobject = ComplexPlane, **kwargs): """ Complex Hootopy a function Cx[0, 1] to C """ def homotopy((x, y, z, t)): c = complex_homotopy((complex(x, y), t)) return (c.real, c.imag, z) Homotopy.__init__(self, homotopy, mobject, *args, **kwargs)
def discontinuous_point(self): point_description = TextMobject("Point where the function jumps") point_description.shift(3 * RIGHT) discontinuous_at_A = TextMobject("``Discontinuous at A''", size="\\Large") discontinuous_at_A.shift(2 * UP).to_edge(LEFT) text = TextMobject(""" Circle around ouput \\\\ points can never \\\\ be smaller than \\\\ the jump """) text.scale(0.75) text.shift(3.5 * RIGHT) input_value = 0.5 input_radius = 0.04 vary_circles = VaryCircles( self, input_value, input_radius, run_time=5, ) for dot in self.input_dot, self.output_dot: dot.center() kwargs = { "rate_func": lambda t: interpolate(0.45, input_value, smooth(t)) } self.play(Homotopy(self.input_homotopy, self.input_dot, **kwargs), Homotopy(self.output_homotopy, self.output_dot, **kwargs)) discontinuous_arrow = Arrow(discontinuous_at_A, self.input_dot) arrow = Arrow(point_description, self.output_dot, buff=0.05, color=self.output_color) self.play(ShimmerIn(point_description), ShowCreation(arrow)) self.dither() self.remove(point_description, arrow) tup = self.get_circles_and_points(input_value - input_radius, input_value + input_radius) input_circle, input_points, output_circle, output_points = tup input_points_copy = input_points.copy() self.play(ShowCreation(input_circle)) self.play(ShowCreation(input_points)) self.play(Transform(input_points_copy, output_points), run_time=2) self.play(ShowCreation(output_circle)) self.dither() self.play(ShimmerIn(text)) self.remove(input_circle, input_points, output_circle, input_points_copy) self.play(vary_circles) self.dither() self.play(ShimmerIn(discontinuous_at_A), ShowCreation(discontinuous_arrow)) self.dither(3) self.remove(vary_circles.mobject, discontinuous_at_A, discontinuous_arrow)
def draw_circles(self): input_value = 0.45 input_radius = 0.04 for dot in self.input_dot, self.output_dot: dot.center() kwargs = { "rate_func" : lambda t : interpolate(1, input_value, smooth(t)) } self.play( Homotopy(self.input_homotopy, self.input_dot, **kwargs), Homotopy(self.output_homotopy, self.output_dot, **kwargs) ) A, B = map(Mobject.get_center, [self.input_dot, self.output_dot]) A_text = TextMobject("A") A_text.shift(A+2*(LEFT+UP)) A_arrow = Arrow( A_text, self.input_dot, color = self.input_color ) B_text = TextMobject("B") B_text.shift(B+2*RIGHT+DOWN) B_arrow = Arrow( B_text, self.output_dot, color = self.output_color ) tup = self.get_circles_and_points( input_value-input_radius, input_value+input_radius ) input_circle, input_points, output_circle, output_points = tup for text, arrow in [(A_text, A_arrow), (B_text, B_arrow)]: self.play( ShimmerIn(text), ShowCreation(arrow) ) self.wait() self.remove(A_text, A_arrow, B_text, B_arrow) self.play(ShowCreation(input_circle)) self.wait() self.play(ShowCreation(input_points)) self.wait() input_points_copy = input_points.copy() self.play( Transform(input_points_copy, output_points), run_time = 2 ) self.wait() self.play(ShowCreation(output_circle)) self.wait() self.wait() self.remove(*[ input_circle, input_points, output_circle, input_points_copy ])
def move_dot(self): kwargs = { "rate_func" : None, "run_time" : 3 } self.play( Homotopy(self.input_homotopy, self.input_dot, **kwargs), Homotopy(self.output_homotopy, self.output_dot, **kwargs), ShowCreation(self.output, **kwargs) ) self.wait()