Simulation of gravitational interactions