def construct(self):

        Amplitude = 0.4
        freq = 3
        angular_freq = (2*np.pi)*freq
        equation = lambda t: Amplitude*np.sin(t*angular_freq)

        photon = functions.FunctionGraph(equation,x_min=-5,x_max=-4)
        light_source = Dot(photon.points[0], radius=0.5, color=YELLOW)

        tip = Arrow(photon.points[-1],photon.points[-1]+RIGHT*0.4)
        self.play(GrowFromCenter(light_source))
        self.play(ShowCreation(photon))
        self.play(ShowCreation(tip))
        photon.add(tip)

        animation = ApplyMethod(photon.shift, (6,0,0))
        self.play(animation)
 def construct(self):
     wave = functions.FunctionGraph(np.sin,x_min=-5,x_max=4)
     dot  = Dot(wave.points[0],color=RED,radius=0.2)
     self.play(ShowCreation(wave))
     self.play(GrowFromCenter(dot))
     self.play(MoveAlongPath(dot,wave),rate_time=5)
 def soft_plus(self):
     function = lambda t: np.log(1+np.exp(t))
     curve = functions.FunctionGraph(function,x_min=-6,x_max=7)
     self.play(ShowCreation(curve))
    def sigmoid_function(self):

        function = helpers.sigmoid
        wave = functions.FunctionGraph(function,x_max=6,x_min=-6)
        self.play(ShowCreation(wave))
 def damped_sin_wave(self):
     # y(t) = e^(-t)*cos(2*pi*t)
     function = lambda t: np.exp(-t)*np.cos(2*np.pi*t)
     wave = functions.FunctionGraph(function,x_min=-1,x_max=5)
     self.play(ShowCreation(wave))
 def numpy_cos_function(self):
     function = np.cos
     wave = functions.FunctionGraph(function,x_min=-5,x_max=5,color=RED)
     self.play(ShowCreation(wave))
 def numpy_sin_function(self):
     function = np.sin
     wave = functions.FunctionGraph(function,x_min=-5,x_max=5)
     self.play(ShowCreation(wave))