Numerical mechanics

For each point, you need to keep track of four numbers: the position and velocity in the two dimensions:

\[x_i, y_i, v_{x,i}, v_{y,i}\]

In the simplest numerical solver, the positions are updated by adding the velocities:

\[x_i(t+\Delta t) = x_i(t) + v_{x,i} \Delta t\]

The velocities are updated similarly by adding the accelerations in the different directions:

\[v_{x,i}(t+\Delta t) = v_{x,i}(t) + a_{x,i} \Delta t\]

The actual physical behaviour of the system is encoded in the calculation of the accelerations \(a_{x,i}\) at each time step. Sum up all forces acting in that direction, and divide by the mass of the point:

\[a_{x,i}(t) = \frac{ \sum_j{F_{x,ij}} }{ m_i }\]

Alternative methods

Like all numeric methods, this Euler method has several pitfalls to be aware of. The size of the numerical error at a given time scales with \(\Delta t\).

The Euler method is also not suited to oscillating problems (try it out to see why!), you should use something like the Runge-Kutta fourth-order method instead. At the cost of quadrupling the number of calculations, the error of the numerical result scales much better: with \(\Delta t^4\).

Ask for help if needed, solving the physics is not the core task here!