Code to simulate n-body problem