(Simple) simulation of the dynamics of 3 planets interacting with each other, due to gravitational attraction.
To change the initial conditons of the simulation, change the parameters in the first section:
mi = ...; % the ith mass
xi0 = ...; yi0 = ...; zi0 = ...; % initial coordinates of the ith body
vxi0 = ...; vyi0 = ...; vzi0 = ...; % initial velocity of the ith body
The program solve a system of coupled ODEs obtained using a simple model, where the acceleration of the i-th mass only depends on the gravitational force of the other masses:
The code generates an avi-format video. Some examples are provided in the repository.