@whuyyf
2016-06-14T09:20:51.000000Z
字数 1839
阅读 906
作业
name:姚逸飞
student number:2013301020096
This passage will discuss about the fluctuate model.In physics, a wave is an oscillation accompanied by a transfer of energy that travels through medium (space or mass). Frequency refers to the addition of time. Wave motion transfers energy from one point to another, which displace particles of the transmission medium — that is, with little or no associated mass transport. Waves consist, instead, of oscillations or vibrations (of a physical quantity), around almost fixed locations.
——wikipedia
First, we should write down the wave function as follow:
We can use the approximation to simplify the equation:
This picture is about that the two waves encounter.
This picture is about that the wave after encounter.
def __init__(self):
self.x=np.linspace(0,1,n)
self.y0=np.exp(-k*(self.x-x0)**2)+np.exp(-k*(self.x-x1)**2)
self.y=[self.y0]
self.temp_y=np.linspace(0,0,n)
for j in range(n-2):
self.temp_y[j+1]=2*(1-r**2)*self.y0[j+1]-self.y0[j+1]+r**2*(self.y0[j+2]+self.y0[j])
self.y.append(self.temp_y)
#print self.y0
def update(self):
self.new_y=np.linspace(0,0,n)
for j in range(n-2):
self.new_y[j+1]=2*(1-r**2)*self.y[-1][j+1]-self.y[-2][j+1]+r**2*(self.y[-1][j+2]+self.y[-1][j])
def fire(self):
while (len(self.y)<=(N+1)):
self.update()
self.y.append(self.new_y)
From the stable picture,we can find that the waves have the quality of addtion.
The total cods are here
Thanks for wikipedia
Thanks for matplotlib