from math import * R = 10.0 v = 0.2 u = 0.25 h = 0.001 t = 0 b_x = b_y = 0 m_x = R m_y = 0 def mother_pos(t): return (R*cos(v*t/R),R*sin(v*t/R)) while (b_x**2 + b_y**2) < R**2: mag = sqrt((m_x-b_x)**2 + (m_y - b_y)**2) db_x = u*(m_x - b_x)/mag db_y = u*(m_y - b_y)/mag b_x += db_x*h b_y += db_y*h (m_x,m_y) = mother_pos(t) t += h print t