This is a simulation of gravity using Newton's law of motion:
[begin-latex]\sum{\overrightarrow{F}} = m\overrightarrow{a}[end-latex]
and Newton's law of gravity:
[begin-latex]\overrightarrow{F_{a \rightarrow b}} = G \frac{m_a m_b}{d_{ab}^2} \overrightarrow{u_{ba}}[end-latex]
To make things interesting, I've set the particles to repulse themselves if they come too close together. You can play with that parameter using the slider below.
Number of particles:
500
Repulsion distance:
50