Physics, Science, Programming, Deep Dives, Thoughts And Theory.
u_2=m_2.get_velocity() #Check if molecules are approaching or departing approach_sign=np.sign(np.dot(u_1-u_2,x_2-x_1)) #If molecules are approaching if approach_sign == 1: #Get masses ms_1=m_1.get_mass() ms_2=m_2.get_mass() #Calculate final velocities v_1=u_1 - 2*ms_2/(ms_1 + ms_2) *