This small project is a light gravitational simulator written in C++. The goal is to simulate and visualize the trajectories of periodic solutions of the three-body problem.
The ruling equation for this simulation is pure Newtonian gravitational attraction, with
With
The simulator uses a fourth-order Runge-Kutta solver with fixed time step.
-
G: universal gravitational constant -
mi: mass of body$i$ , with$i=1,2,3$ - (
xi,yi): initial positions (for body$i$ ) - (
vxi,vyi): initial velocities (for body$i$ )
t_end: time of simulationdt: timestepsampling: how often the code writes solution in outputoutput: name of output file
- Adaptative time step
- Parser in a header file