mbostock.github.io:

N-Body Problem (animation)
The n-body problem involves predicting the motion of celestial objects under mutual gravitation. With many objects, this simulation can be computationally taxing due to n2 force calculations. Here we simulate two hundred massive objects, using the Barnes–Hut algorithm to approximate forces in O(n log n). Using dynamic properties, we can easily encode speed using color, and velocity with a white arrow. Watch as worlds collide, undergo planetary accretion, and spin out of control!

mbostock.github.io:

N-Body Problem (animation)

The n-body problem involves predicting the motion of celestial objects under mutual gravitation. With many objects, this simulation can be computationally taxing due to n2 force calculations. Here we simulate two hundred massive objects, using the Barnes–Hut algorithm to approximate forces in O(n log n). Using dynamic properties, we can easily encode speed using color, and velocity with a white arrow. Watch as worlds collide, undergo planetary accretion, and spin out of control!