Exemplo n.º 1
0
	def __init__(self,charge,mass,p_forces=[],place=vector(0,0),move=vector(0,0),forces=[]):
		self.charge=charge
		self.mass=mass
		self.p_forces=[]
		self.a=vector(0,0)
		particle.__init__(self,place=place,move=move,forces=forces)
Exemplo n.º 2
0
	def __init__(self,place=vector(0,0),move=vector(0,0),forces=[]):
		self.place=place
		self.move=move
		self.forces=forces
		self.digest()
Exemplo n.º 3
0
	def digest(self):
		temp=vector(0,0)
		for force in self.forces: temp+=force
		self.forces=[]
		self.force=temp
Exemplo n.º 4
0
		self.a=self.force/self.mass
		self.move=self.move-self.a/UIC_TIME
		self.place+=self.move/UIC_TIME
	def interact(self,other):
		self.temp=self.place-other.place
		dist2=abs(self.temp)
		self.temp/=(1.*dist2**(1./2))
		#print self.temp
		#self.temp=vector(0,1.)
		try:
			temp=(other.charge*self.charge/dist2)
			self.forces+=[-temp*self.temp]
			other.forces+=[temp*self.temp]
		except: pass
		try:
			temp=((self.mass*other.mass)/dist2)
			self.forces+=[temp*self.temp]
			other.forces+=[-temp*self.temp]
		except: pass
		return self.forces

#======================+
#  Programme principal |
#----------------------+

if __name__=='__main__': 
	a=eParticle(12,44,place=vector(0,1))
	b=eParticle(-22,33,place=vector(44,200))
	Bac=cuve()
	Bac.particules.append(a)
	Bac.live()