Simulation of Chaotic Operation Of A Damped Driven Pendulum Using
Python
JOAN JANI
Department of Engineering Physics
Polytechnic University of Tirana
Rr. S. Delvina, 1001
ALBANIA
Abstract: In this paper, we are presenting a new pedagogical method for the introduction of the study of non-
linear systems. Our approach is based on the use of open-source software which is publicly available. In response
to this motivation, we are using the Python programming language which offers a holistic approach to scientific
research. We will present the analysis of the pendulum motion under the influence of an external force. The
differential equation governing the system will be presented and solved using numerical methods. Moreover, the
phase diagram of the system will be presented for various system parameters. We will describe the transition to
a chaotic operation and the key factors of this procedure. The chaotic behaviour is verified by calculating the
maximum Lyapunov exponent. This pedagogical approach emerging is based on the physical properties of the
system and not on the numerical methods used so that the student can understand the dynamics of the system more
comprehensively.
Key-Words: Chaos, simple harmonic oscillator, damped driven pendulum, phase space, Lyapunov exponent
Received: October 19, 2021. Revised: October 23, 2022. Accepted: November 25, 2022. Published: January 25, 2023.
Introduction
Computer modeling is an essential part of engineer-
ing education, as it provides students with the op-
portunity to develop and apply their knowledge in a
practical setting. By utilizing computer models, en-
gineers can gain a better understanding of how dif-
ferent components interact within complex systems,
[1]. For this purpose, the knowledge of computer
programming should be an integral part of the edu-
cation of engineers and scientists. In the past, lan-
guages such as Fortran, C, C++, etc. have been used
for expressing the mathematical models which are de-
scribing the system, [2]. Using these languages re-
quires experience and a deep understanding of how
computers work which should not be a prerequisite
for a new scientist to get an introduction to the field
of dynamical system study. On the other hand, the
Python programming language offers a user-friendly
working environment, offers fairly good documenta-
tion, and can be used even by the new scientist, [3].
Python is an ideal language for physics simula-
tion and modeling due to its ease of use, flexibil-
ity, and availability of a wide range of libraries for
physics. Python allows for fast prototyping of simu-
lations and models and can be used to quickly develop
user interfaces for visualization and control. Addi-
tionally, Python can be used to integrate data from
different sources, such as sensor data, to develop com-
plex models and simulations. Python is also well-
suited for developing physics-based models and sim-
ulations due to its powerful graphics capabilities. Fi-
nally, Python is a great choice for physics research
and engineering, as it can be used to automate data
analysis and the development of models and simula-
tions. The Python programming language has been
generally accepted as a scientific tool in the field of
the study of dynamical systems, [4].
There are several publicly available packages for
the Python programming language that offer ready-
to-use numerical methods, [5]. The use of these
methods focuses students’ interest in understanding
the model and the main parameters and constants
that govern it. As an example of the application of
these methods, we will present the use of the function
odeint() for solving differential the system of dif-
ferential equations which describe the behavior of the
system could be found in the library scipy which is
a scientific computation library that apart from ODE
(Ordinary Differential Equations) solvers offers mod-
ules for optimization, integration, interpolation, linear
algebra, FFT (Fast Fourier transform ), signal, and im-
age processing, [6]. The use of Python for teaching
purposes in the context of courses such as Computa-
tional Physics and Dynamical Systems is constantly
gaining ground over other languages, [7].
Chaos is the appearance of a lack of order in a
system that nevertheless follows laws or rules. [8]
Chaos is present in systems with non-linear behavior,
WSEAS TRANSACTIONS on ADVANCES in ENGINEERING EDUCATION
DOI: 10.37394/232010.2023.20.1