Home » 2013 - 14 Academic Year » Double Inverted Pendulum in 2D and 3D Space

Double Inverted Pendulum in 2D and 3D Space

by Ryan Lee, V Form

modelopdobleThis summer, I went to Mathematica Summer Camp. Mathematica is computer software made by Wolfram Research. This tool is commonly used by mathematicians and scientists. In the camp, each student completes a project through Mathematica.

During the first week, we met our mentors and chose what we would create during the camp. At that time, I was particularly interested in Chaos Theory, a field of study in mathematics that focuses on “chaotic” behaviors that are sensitive to initial conditions, one example of which is the butterfly effect. When I was learning about Chaos Theory, the double inverted pendulum and Swinging Atwood’s Machine interested me. There were a few videos on the internet recording this type of mechanics, and I was fascinated by how unpredictable it was. Since there was already a model of Swinging Atwood’s Machine, I decided to create a demonstration on the behavior of a double inverted pendulum in 2D and 3D space.

First, let me explain what a double inverted pendulum is. Picture a pendulum. The top part of a rod is fixed to the ceiling, and there is a ball attached on the bottom. An inverted pendulum is a pendulum that has a fixed bottom and a ball on the top. The bottom is normally fixed to a moving object such as a cart. By moving the cart, one can balance the naturally unstable inverted pendulum.


A double inverted pendulum is an extension of an inverted pendulum. There is another ball attached to the first ball. Here is a picture of a double inverted pendulum:



The goal of my project was to model the natural behavior of the double inverted pendulum and to use control theory to balance the double inverted pendulum. By using Mathematica, it is possible to compute the position of a ball at a given time, using Euler-Lagrange Equation. The behavior of a pendulum in 2D space follows:

YouTube Video

The pendulum demonstrates the natural instability of the system. Similarly, the pendulum in 3D space is also very chaotic:

YouTube Video II

The second part of my project was to balance the pendulum. It takes both theory and practice to balance the pendulum, since the equation of force to balance the pendulum has many constants that must be balanced by experiments. The following result is a successful balancing formula. Each initial position is the same as the position for the natural behavior model, but the program succeeds in balancing the pendulum:

YouTube Video III

You Tube Video IV

Although the project may look daunting, the code itself is not as difficult as it seems. Because of the powerful functions inherent in Mathematica, it is possible to use Mathematica to calculate the Euler-Lagrange Equation to find the position of a ball in a short time without too much complex calculation.

The summer camp was two weeks long, from July 7th to 19th. Although I sometimes rushed to finish my project, the camp included many other activities related to math. The most memorable experience I had was learning how Mathematica could be used to create a 3D model that could be printed using a 3D printer. It showed me that this software, unlike its name, went beyond mathematics and could be used for diverse purposes such as biology, economics, and more. I was surprised to discover the abundant demonstrations Wolfram Research had on various topics unrelated to math.

Another experience I enjoyed was talking to various peers and mentors with similar interests and goals. In fact, we were remarkably similar. For instance, I was surprised to find out that most of them had read a Graph Theory book that I was reading. Talking and working with people whom I might be colleagues with in the future was a fresh, motivating experience. The mentors and the guest speakers showed me the possible careers I might pursue, and my peers showed me who I would work with, and how I would work with them.

Overall, the experience I had in Mathematica Summer Camp was outstanding. Although most of the time during the camp I focused on refining my project, our group had the chance to meet the Founder and CEO of Wolfram Research. It was a great opportunity, and it helped me visualize the professional world of mathematics. I visualized the world of cooperation where my coworkers and I would thoroughly discuss our ideas and help each other continue our exciting careers. Therefore, from this camp, I learned not only how to use Mathematica, but also the specifics of what careers I might pursue.

Here is the complete demonstration that I created on the Wolfram Demonstration Project website:

Complete Demonstration video

Ryan Lee is a V Former from Seoul, Korea, and he lives in Sawyer House.  He is passionate about math and computer science, and he often writes a post in his blog on math and computer science. In school, he is currently part of a math research class, where he and his classmates are conducting a research on arithmetic derivatives.

Search Volumes