A graphical simulation of the three body problem written in C++. This project is my first C++ project, it uses the fourth order Runge-Kutta numerical method to solve an ordinary differential equation to describe the motion of three particles. The project aimed to represent this problem using fancy OpenGl graphics. See bottom of Readme for running information.
The motion of the bodies included in the three body problem is described entirely by Newtons law of gravitation:
However, the 'problem' arises in choosing the inital conditions required to set the bodies into a 'stable' motion, the majority of states are extremely unstable ( When we slightly change initial conditions, the trajectory of each body changes dramatically). Solutions to this problem include the Euler, Lagrange and figure-of-eight solutions and can be understood in great detail using the 'Inital Conditions' reference. Two examples are given below
Running this program is relatively simple, once you have relevant libraries installed.
I used Apples xcode. To compile the project this way create a 'Command Line Tool' project template and copy the project into this template.
Then include the relevant graphics library following this youtube video:
Once the library is installed, include eigen which can be installed via:
brew install eigen
and can easily be added to an xcode project via; Build Settings -> Header Search Paths, once complete you should be able to compile the project.
If you are using Windows I'd recommend following Youtube or GLFW docs and use your usual cpp editor.