A double pendulum is a pendulum with another pendulum attached to its end. This code simulates the temporal evolution of the double pendulum by solving a set of coupled ordinary differential equations (using the Runge Kutta method) with given user specified initial conditions. The rendering is done using the SDL2 library.
- Install the C++ compiler g++ using the following command:
sudo apt-get install g++To check which version is installed run the following command:
g++ --version- Install the SDL2 library using the following command:
sudo apt install libsdl2-image-dev- Clone the remote repository to your local machine using the following command:
git clone https://github.com/frederic-hallein/double-pendulum- To compile the project, go inside the
double_pendulum/directory and run the following command:
make allThis should create a main executable file in the same directory.
- Run the executable by using the following command:
./mainTo set up custom initial conditions, simply press ENTER. This prompts the user the following variables that require custom input:
m_1: mass 1st pendulum [unitless]m_2: mass 2nd pendulum [unitless]L_1: length 1st pendulum [unitless]L_2: length 2nd pendulum [unitless]ini_theta_1: initial angle 1st pendulum [degrees]ini_theta_2: initial angle 2nd pendulum [degrees]With friction? (y/n): air friction
To run the default initial conditions, simply run the command d. The default setup is the following:
m_1 = 1m_2 = 1L_1 = 150L_2 = 150ini_theta_1 = 180ini_theta_2 = 180friction: no
Screencast of the simulation running the default setup.