The Pendulum Project

Synopsis: The pendulum project was one that I undertook in university to create an inertial double pendulum simulator. The goal was to understand chaos, and to understand how chaos adapts and evolves in a controlled environment. On this page, we talk about point mass pendulum (where the center of gravity is located at the very end of the arm. The report associated with this assignment was based on an inertial double pendulum, where the center of mass is distributed along the entire arm. I have changed it up here for two reasons. Firstly, to make it unique to the assignment, so if some future student goes to copy my work, they will at least have to change some of the maths to get it to work, and secondly, it is far easier to do the maths on a point mass pendulum then it is to to do on an inertial pendulum.


In the world of physics, knowing exact initial conditions will always result in knowing exactly how an object will behave. In most cases, knowing approximate initial conditions can lead to an approximate solution. In other cases, such as that of the double pendulum, a tiny shift of any initial conditions will cause the trajectory of the pendulum to change drastically over time. The moment there is any difference in conditions, the result will be completely unique.

Why undertake the study of something like this? Well, two reasons, it is an excellent example of lagrangian mechanics, and chaotic objects inspire fascination in humans. We feel like we can predict it, understand it, and then the universe taunts us, spitting in our faces and doing exactly what we don’t expect and being chaotic. As Einstein said, “God does not play dice with the universe,” and chaotic systems feel like dice. Well, I see this as me fighting back against the universe, trapping its chaos in a simulation and forcing it to bow to my whim, my control, all the while pulling data from it, and performing analysis on it. The study of chaos is a traditional man vs god story, within a wrapper of fascinating mathematics and science.

The Maths

Before doing the maths on this, we need to understand what is going on, and define our variables. We are going to use the following image to define our variables for our maths. We can see from the diagram below the angles and values that we will be using.

So with that in mind, we can start doing the maths. The first thing we will need to do is figure out the positioning of the two masses with respect to each-other. This can be defined as below (on a side note, how pretty is it having LateX on a website):

    \begin{equation*} x = x + 1 \end{equation*}

    \begin{equation*}  x_1 = l_1 \cdot sin \theta  \end{equation*}

    \begin{equation*} y_1 = -l_1 \cdot cos \theta \end{equation*}

    \begin{equation*}  x_2 = l_1 \cdot sin \theta + l_2 \cdot sin \psi  \end{equation*}

    \begin{equation*} y_2 = l_1 \cdot cos \theta - l_2 \cdot cos \psi \end{equation*}

In order to properly calculate the lagrangian we will need the kinetic energy, which will require the velocities of the two pendulum, which can be found by taking the derivative of the displacement, which can be seen as follows:

    \begin{equation*} \dot{x}_1 = l_1 \dot{\theta}\cdot cos \theta \end{equation*}

    \begin{equation*} \dot{y}_1 = l_1 \dot{\theta} \cdot sin \theta \end{equation*}

    \begin{equation*} \dot{x}_2 = l_1 \cdot \dot{\theta} \cdot cos \theta + l_2 \cdot \dot{\psi} \cdot cos \psi  \end{equation*}

    \begin{equation*} \dot{y}_2 = l_1 \cdot \dot{\theta} \cdot sin \theta + l_2 \cdot \dot{\psi} \cdot sin \psi \end{equation*}

Now we have our velocity and position functions, we need to find our lagrangian. The lagrangian is given by:

    \begin{equation*} \mathcal{L} = T - V \end{equation*}

Where T is our Kinetic Energy, and V is our Potential Energy. We will use the classical kinetic energy formula as below:

    \begin{equation*} K_e = \frac{1}{2} \cdot m \cdot v^2 = T \end{equation*}

And the formula for potential energy:

    \begin{equation*} P_e = m \cdot h = V \end{equation*}

So, plugging our variables into our energy equations and then into the lagrangian we can see the following:

    \begin{equation*} \mathcal{L} =\frac{1}{2}(m_1 + m_2) \cdot l_1 ^2 \cdot \dot{\theta}^2 +  \frac{1}{2}m_2 \cdot l_2 ^2 \cdot \dot{\psi}^2 + m_1 \cdot l_1 \cdot l_2 \cdot \dot{\theta} \cdot \dot{\psi} \cdot cos(\theta - \psi) + (m_1 +m_2)\cdot l_1 \cdot g \cdot cos \theta\cdot  m_2 \cdot g \cdot l_2 \cdot cos \psi \end{equation*}

Now we come to what is possibly the most beautiful equation in all of physics, one that revolutionized the way that physics works in the real world, the Euler Lagrange Equation. It is considered to be so revolutionary that there is an entire branch of studying mechanics revolving around applications of this equation. It is no understatement to say that it is possibly my favourite equation in the history of mathematics. So much so, that I stole this snazzy graphic below to show how much I like the euler lagrange equation.

∂L/∂q - d/dt(∂L/∂q') = 0

What a beautiful equation. So by applying the Euler-Lagrange equation to our formula, we get the following.

    \begin{equation*} (m_1 + m_2)\cdot l_1 \cdot \ddot{\psi} + m_2 \cdot l_2  \cdot\ddot{\psi} \cdot cos(\theta - \psi) + m_2 \cdot l_2 \cdot \dot{\theta}^2 \cdot sin(\theta - \psi) + (m_1 +m_2)\cdot g \cdot \theta = 0 \end{equation*}

    \begin{equation*} m_2 \cdot l_2\cdot  \ddot{\psi} + m_2 \cdot l_1 \cdot \ddot{\theta} \cdot cos(\theta - \psi) - m_2 \cdot l_1 \cdot \dot{\theta}^2 \cdot sin(\theta - \psi) + m_2 \cdot g \cdot sin \psi = 0 \end{equation*}

Right, now we have our equations of motion, time to build our pendulum.

The pendulum

See our pretty pendulum, actually moving below

There is every intention of adding variables here to change conditions, but I am not interested in adding them right now. Maybe at a later date :).


The real reason to do any science is to get some graphs. So, I have made a bunch of graphs to plot the velocity, acceleration and angle of the pendulum below.

Adding to this, we would also like to graph the velocity, so, consider that graphed below.

So, not only can we see our beautiful pendulum swinging too and fro, exhibiting chaos, we can also plot its angle, and velocity against time. If we wanted too, we could go more in depth for that, but not much of it is too fun to put on a website, so I have attached the report that goes VERY in depth into chaos analysis below. If you have any questions, queries or concerns, or wish to reach out to me to discuss this project, feel free to email me on

The report