Classical Mechanics A Computational Approach With Examples Using Mathematica and Python Second Edition (Christopher W. Kulp, Vasilis Pagonis) (Z-Library)
Classical Mechanics A Computational Approach With Examples Using Mathematica and Python Second Edition (Christopher W. Kulp, Vasilis Pagonis) (Z-Library)
Classical Mechanics: A Computational Approach with Examples Using Mathematica and Python
provides a unique, contemporary introduction to classical mechanics, with a focus on computational meth-
ods. In addition to providing clear and thorough coverage of key topics, this textbook includes integrated
instructions and treatments of computation.
This newly updated and revised second edition includes two new appendices instructing the reader in both
the Python and Mathematica languages. All worked example problems in the second edition contain both
Python and Mathematica code. New end-of-chapter problems explore the application of computational
methods to classical mechanics problems.
Full of pedagogy, it contains both analytical and computational example problems within the body of each
chapter. The example problems teach readers both analytical methods and how to use computer algebra
systems and computer programming to solve problems in classical mechanics. End-of-chapter problems
allow students to hone their skills in problem solving with and without the use of a computer. The methods
presented in this book can then be used by students when solving problems in other fields both within and
outside of physics.
It is an ideal textbook for undergraduate students in physics, mathematics, and engineering studying clas-
sical mechanics.
Key Features:
• Gives readers the “big picture” of classical mechanics and the importance of computation in the
solution of problems in physics
• Numerous example problems using both analytical and computational methods, as well as explana-
tions as to how and why specific techniques were used
• Online resources containing specific example codes to help students learn computational methods
and write their own algorithms
A solutions manual is available via the Routledge Instructor Hub and all example codes in the book are
available via the Support Material tab, and at the book’s GitHub page: [Link]
sical_Mechanics_2nd_Edition
Christopher W. Kulp received his PhD in Physics from the College of William and Mary in 2004 and
is currently a Professor of Physics at Lycoming College, where he teaches physics at all levels. Dr. Kulp’s
research interests focus on the fields of nonlinear dynamics and complex systems. He has published more
than 20 publications in peer-reviewed journals and conference proceedings and has written two book
chapters. More than 10 of his publications have undergraduate co-authors. Much of his work focuses on
distinguishing between chaotic and stochastic behaviour in time series data. His current research interests
focus on using machine learning to analyse time series and model complex systems.
Vasilis Pagonis is Professor of Physics Emeritus at McDaniel College, Maryland, where he taught undergraduate
courses and did research for 36 years. He is currently a Senior Associate Editor of the international journal “Radia-
tion Measurements”. His research areas of interest is luminescence dosimetry, and applications of thermally and
optically stimulated luminescence (TL and OSL). He has taught courses in classical and quantum mechanics, ana-
log and digital electronics and mathematical physics, as well as numerous general science courses. Dr. Pagonis’
resume lists more than 200 peer-reviewed publications in international journals. He is the co-author with Dr Kulp
of the textbook “Mathematical methods using Python” (CRC, 2024). He has also co-authored five graduate level
books in the field of luminescence dosimetry.
Classical Mechanics
A Computational Approach with Examples
Using Mathematica and Python
Second Edition
Reasonable efforts have been made to publish reliable data and information, but the author and publisher cannot assume responsibility for
the validity of all materials or the consequences of their use. The authors and publishers have attempted to trace the copyright holders of all
material reproduced in this publication and apologize to copyright holders if permission to publish in this form has not been obtained. If any
copyright material has not been acknowledged please write and let us know so we may rectify in any future reprint.
Except as permitted under U.S. Copyright Law, no part of this book may be reprinted, reproduced, transmitted, or utilized in any form by
any electronic, mechanical, or other means, now known or hereafter invented, including photocopying, microfilming, and recording, or
in any information storage or retrieval system, without written permission from the publishers.
For permission to photocopy or use material electronically from this work, access [Link] or contact the Copyright Clear-
ance Center, Inc. (CCC), 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400. For works that are not available on CCC please contact
mpkbookspermissions@[Link]
Trademark notice: Product or corporate names may be trademarks or registered trademarks and are used only for identification and
explanation without intent to infringe.
DOI: 10.1201/9781003454854
Typeset in LM Roman
by KnowledgeWorks Global Ltd.
Publisher’s note: This book has been prepared from camera-ready copy provided by the authors.
Dedication
Chris dedicates this book to his wife Gail, mother Linda, and his late father
Chester; without their support, this book would not have been possible.
Vasilis dedicates this book to his wife, Mary Jo Boylan, and to his students at
McDaniel College.
Contents
vii
viii Contents
Chapter 5 Energy......................................................................................................159
5.1 Work and energy in one-dimensional systems.................................159
5.2 Potential energy and equilibrium points .........................................163
5.3 Work and line integrals ...................................................................173
5.4 Work-kinetic energy theorem, revisited...........................................180
5.5 Conservative forces and potential energy........................................180
5.6 Energy and multiparticle system ....................................................186
5.7 Chapter summary ...........................................................................188
5.8 End-of-chapter problems .................................................................189
Bibliography ....................................................................................................................585
Index ..............................................................................................................................587
PREFACE TO THE SECOND EDITION
We believe that computation should be front and center in a science education. Program-
ming is a core skill for scientists and engineers, that should be taught alongside traditional
physics instruction. It is in this spirit that we created this textbook, which merges instruc-
tion in Classical Mechanics and programming, into a single presentation. In our approach,
computer programming and computer algebra systems are treated as simply one more tool
for problem-solving.
xiii
xiv Contents
A NOTE TO INSTRUCTORS
One of our motivations for writing this book was to better prepare our students for the large
variety of careers students pursue after graduating from a physics program. We have found
that after graduation, our students are increasingly taking on careers where computation is
a critical element. While in college, our students often take at least one computer science
course. However, we found they were not always making the connection of how to apply the
programming skills they learned in computer science for the purpose of solving problems in
physics. Part of the reason is because traditional physics courses are still focused on closed-
form solutions and, when computation is used, it is generally focused on using computer
algebra systems to perform complicated integrals, with the occasional numerical solution of
a differential equation thrown in for good measure.
ACKNOWLEDGMENTS
We thank Danny Kielty at CRC Press for working with us to significantly increase the
length of the book, in order to accommodate important additions to this textbook.
Given the forces acting on an object and its initial state, what is the resulting motion
of that object?
In the rest of this chapter, we will lay down the important foundations for classical
mechanics, starting with the next section where we will explore the basic assumptions of
classical mechanics.
1
2 Foundations of Motion and Computation
When thinking about any discipline of science, first ask what are the basic foundations
of the field? Sometimes, these foundations are assumptions. For classical mechanics we can
start with space and time:
• Space serves as a background in which physical processes occur. Unlike in the theory
of general relativity, space has no effect on the behavior of physical systems.
• Time progresses at the same rate for every observer (unlike in the theories of special
and general relativity).
Classical mechanics addresses the problem of predicting an object’s motion given the forces
acting on the object. For now, we will consider the object to be a point particle. The advan-
tage of working with point particles is that they have no size and no internal dynamics. In
addition, point particles do not rotate nor do they deform, further simplifying their dynam-
ics. It turns out that treating objects as point particles can be a very good approximation
for describing translational motion. In later chapters, we will study the physics of extended
bodies and rotational dynamics, where we will no longer restrict ourselves to working with
point particles.
r = x î + y ĵ + z k̂ (1.2.1)
where î, ĵ, and k̂ are the Cartesian unit vectors along the x, y, and z axes, respectively.
The variables x, y, and z in (1.2.1) give the distance between the particle and the origin
along each axis and are called the components of the vector. Also note that in (1.2.1) each
component is a function of time: r = r(t), x = x(t), y = y(t), and z = z(t). In this book,
vectors are denoted by boldface font. In Chapter 3, we will discuss vector quantities in more
detail.
The vector in (1.2.1) tells us that in order to get to the location of the particle, r,
one needs to move a distance x parallel to the x-axis (as denoted by î), turn and move a
distance y along the y-axis (as denoted by ĵ), and then turn and move a distance z parallel
to the z-axis (as denoted by k̂). The notation used in this book is that a hat (the ^ symbol)
represents a unit vector, a vector of length 1. Hence, we can think of r as the sum of three
vectors: x î, y ĵ, and z k̂, each representing a displacement from the origin along one of the
axes.
Basic descriptors of motion 3
A vector quantity contains information about both magnitude (amount) and direction.
In this case, the vector ∆r tells us how far (magnitude) and in which direction the particle
traveled. Example 1.1 shows how to represent graphically position vectors in a Cartesian
coordinate system using Python and Mathematica.
Python Code
In the first line of the code, we import the [Link] library and use the
alias plt to refer to it in the rest of the code. The next two lines use the commands
[Link]() and add_subplot(projection='3d') to set up a 3D plot.
We define the values of the coordinates of the vector r to be plotted as Ax=Ay=Az=1
and plot the arrows for the vectors r, î, ĵ, k̂ using the quiver command. For example,
to plot the unit vector î we use the command [Link](0,0,0,1,0,0) to plot the
arrow from the origin (0, 0, 0) to the point (1, 0, 0).
The commands ax.set_xlabel and ax.set_xlimit set the labels and the limits of
the x-axis. The command [Link] places appropriate text near the tips of the arrows.
The final plot is shown in Figure 1.1a.
4 Foundations of Motion and Computation
fig = [Link]()
ax = fig.add_subplot(projection='3d') # set up 3D plot
Mathematica Code
We use the commands Graphics3D and Arrow to create four separate 3D plots for
the vectors r, î, ĵ, k̂ . These four plots are combined using the Show command. Note the
semicolons after each of the four plots, which suppress the graphical output each time.
To create for example the vector r we draw the arrow from the origin (0, 0, 0) to the
point (1, 1, 1). The text next to each arrow is shown with its own color and with a large
font size 22, using for example the options Red,22. The final plot is shown in Figure
1.1b.
Basic descriptors of motion 5
(a) (b)
Figure 1.1: Plot of the vector r = î + ĵ + k̂ and the unit vectors î, ĵ, k̂ for Example 1.1,
using (a) Python and (b) Mathematica.
You may also see the unit vectors in the form x̂, ŷ, and ẑ, sometimes used to clarify
that one is working in the Cartesian coordinate system. In addition, occasionally it will be
easier to use a more generic notation for vectors where r1 , r2 , and r3 are used instead of
the components x, y, and z and the unit vectors ê1 , ê2 , and ê3 are used instead of î, ĵ, and
k̂. This generic notation allows for a more compact method of writing vectors:
X
3
r = r1 ê1 + r2 ê2 + r3 ê3 = ri êi (1.2.3)
i=1
There are other coordinate systems which we will explore later in this book. Each co-
ordinate system will have its own components and unit vectors; however, the basic idea of
position and displacement will be the same.
6 Foundations of Motion and Computation
1.2.2 VELOCITY
The velocity v of a particle is the particle’s displacement (change of position) per unit
time and is measured in meters per second (m/s). The instantaneous velocity is found by
computing the time derivative of the position vector:
dr ∆r
v= = lim (1.2.4)
dt ∆t→0 ∆t
where ∆r = r(t + ∆t) − r(t). All the vectors we typically come across in physics are
differentiable, and the limits will exist. Furthermore, the derivative in (1.2.4) will behave
like derivatives you have encountered before. Therefore, we can use the standard derivative
rules:
d dr1 dr2
(r1 + r2 ) = + (1.2.5)
dt dt dt
d dc dr
(cr) =r + c (1.2.6)
dt dt dt
where c is a scalar function of time. The rules in (1.2.5) and (1.2.6) allow us to distribute
the derivative to each vector component. In addition, if the unit vectors are constant, like
they are in Cartesian coordinates (but not in other systems!), then we can compute the
velocity using (1.2.5):
dr
v= (1.2.7)
dt
d
= xî + y ĵ + z k̂ (1.2.8)
dt
dx dy dz
= î + ĵ + k̂ (1.2.9)
dt dt dt
or: v = vx î + vy ĵ + vz k̂ where vx = dx/dt, and so on. Note that there are only three terms
(and not six) in (1.2.9) because the Cartesian unit vectors are constant. The speed of a
particle is the magnitude of its velocity vector. We will discuss how to calculate vector
properties in Chapter 3.
Finally, we can further simplify the notation by using dots to denote differentiation with
respect to time (i.e., ẋ = dx/dt). Hence:
We will find the dot notation to be very useful in the chapters to come.
1.2.3 ACCELERATION
Acceleration, a, is the change of velocity per unit time and is measured in meters per second
squared (m/s2 ). The acceleration of an object is computed similarly to velocity:
dv
a= (1.2.11)
dt
d
= vx î + vy ĵ + vz k̂ (1.2.12)
dt
dvx dvy dvz
= î + ĵ + k̂ (1.2.13)
dt dt dt
=v̇x î + v̇y ĵ + v̇z k̂ (1.2.14)
Basic descriptors of motion 7
which, like velocity, can be rewritten as a = ax î + ay ĵ + az k̂. The acceleration is also the
second derivative of the position vector and using the dot notation we can write:
d2 r
a= (1.2.15)
dt2
= ẍî + ÿ ĵ + z̈ k̂ (1.2.16)
As we will see in future chapters, the acceleration is very important in classical mechan-
ics. Much of what is discussed in this book is about how to develop an equation for the
acceleration, which can then be integrated to get the motion of the system. All measure-
ments of position, velocity, and acceleration, are relative to the frame of reference (choice of
origin and axes) from which the measurements are made. We will return to the important
idea of reference frames in Section 1.5.
Example 1.2 demonstrates how to obtain the velocity and acceleration vectors v and a,
when the position vector r is known.
v = b a cos (a t) ĵ + 2c t k̂
The acceleration a of the particle is found from the time derivative of the velocity:
dv dvx dvy dvz
a= = î + ĵ + k̂
dt dt dt dt
a = −b a2 sin (a t) ĵ + 2 c k̂
Python Code
In the beginning of any Python code, we must specify the symbols. In this example
we use the symbols command to define a,b,c,t as real variables.
In the next line we import the library the command CoordSys3D from the Symbolic
Python (SymPy) library. This command allows us to describe vectors in a Cartesian
system.
Here we define a coordinate system R = CoordSys3D('R') in which the Cartesian
coordinates (x, y, z) are represented internally as the symbols R.x, R.y, R.z. The
corresponding unit vectors î, ĵ, k̂, are represented by R.i, R.j, R.k. Note that there
is nothing special about choosing the letter R, any other letter could have been chosen
instead.
The vector r = a î + b sin (a t) ĵ + t2 k̂ is represented in this coordinate system
symbolically as r = a*R.i + b*sin(a*t)*R.j +c*t**2*R.k. We evaluate the time
derivative of this vector r using the command diff(r,t). Similarly the acceleration is
evaluated from the time derivative of v using the command diff(v,t).
8 Foundations of Motion and Computation
The output of the Python program is included below the words CODE OUTPUT.
You will notice the line print('-'*28,'CODE OUTPUT','-'*29) in many of the Python
codes in this book, it is used to separate the code from the output generated by the
code.
print('-'*28,'CODE OUTPUT','-'*29,'\n')
# define symbols
a, b, c, t = symbols('a, b, c, t ', real=True)
Mathematica Code
The first line in the code Clear["`*"] clears all previously defined variables in
Mathematica, and you will see this command in many of the codes in this book. The
position r is defined as a Mathematica list and its time derivative is evaluated using
the command D[r,t]. Similarly the acceleration is evaluated by taking the derivative
of the velocity parameter v using D[v,t].
The Print command is used to output the results of the code in a manner that is
easy to read.
Basic descriptors of motion 9
Clear[“`* ”]
v = D[r, t];
Print[“Position = ”, r]
Print[“Velocity = ”, v]
Print[“Acceleration = ”, acc]
Position = a, b Sin[a t], c t2
Velocity = {0, a b Cos[a t], 2ct}
Acceleration = 0, −a2 b Sin[a t], 2c
The basic descriptors of motion simply provide a means of describing how an object
is moving. If we want to understand why an object moves as it does, then we need to
understand the concepts of mass and force.
1.2.4 MASS
The mass of an object is a measure of the object’s inertia, how strongly the object resists
acceleration. For example, a loaded shopping cart is more difficult to accelerate than an
empty one. Recall from your introductory physics course that mass is a scalar quantity
because in order to describe mass, only a magnitude is needed.
To compare the mass of objects, one could use a beam balance. In order to speak
quantitatively about mass, it is helpful to have a standard mass to which all other masses
could be compared. Other physical quantities, such as the meter and second, are based on
fundamental constants. As mentioned earlier, the meter is based on the speed of light, and
the second is based on the ground state hyperfine splitting frequency of cesium-133 atoms,
respectively. The definition of the kilogram has recently changed in order to be based on a
fundamental constant.
As of May 2019, the kilogram was redefined by setting the Planck constant to be
6.62607015 × 10 -34 kg m2 s-1 .
Regardless of how the kilogram is defined, you might be wondering why we can use a
beam balance to compare masses. We can use a beam balance because weight is proportional
to mass according to the weak equivalence principle, which says that gravitational mass
is equal to inertial mass. Gravitational mass is the mass that determines gravitational
forces between objects, whereas the inertial mass determines the acceleration of an object
experiencing a given force. At the time of this writing, experiments show that the two
masses are equivalent to about one part in 1012 , and future experiments are planned for
even more precise testing.
1.2.5 FORCE
Like mass, the concept of force is one with which we are intuitively familiar. A force is a
push or a pull in a particular direction. You push forward on a shopping cart to move it in
the direction you wish to go. However, if someone steps in front of your cart as it is moving,
10 Foundations of Motion and Computation
you would pull back on the cart to make it stop. From our everyday experience, we know
that forces cause motion and that multiple forces can be acting on an object. For example,
if you are in the gym lifting weights, then you are exerting a force to raise a dumbbell. If you
let go of the dumbbell, it will fall, demonstrating that the force of gravity is also acting on
the dumbbell. Hence, we see that in order to understand the motion of an object, we need
to know about all of the forces acting on the object. When accounting for all of the forces,
we need to know both the magnitude (or amount) and direction of each force. Similar to
displacement, velocity, and acceleration, force is a vector quantity.
The unit of force is the Newton (abbreviated N) and 1 N is the total amount of force
needed to provide an acceleration of 1 m/s2 to a 1 kg mass. We know from everyday
experiences that there is a direct linear relationship between force and acceleration. For
example, a 4 N net force will cause a 1 kg object to accelerate 4 m/s2 . Of course, the
acceleration is caused by the vector sum of the forces. When you hold your cell phone, you
are exerting a force upwards that matches the downward force of gravity; hence the two
forces are equal in magnitude but opposite in direction, and therefore, their sum is zero.
Hence, the cell phone does not accelerate.
We have now laid out all of the tools needed to describe and explain an object’s motion.
Next, we will discuss the core topic of classical mechanics, Newton’s Laws of Motion, which
will explain the role of force and mass in determining the motion of an object.
A particle’s velocity remains constant if the net force acting on the particle is
equal to zero.
Let us look carefully at what the first law says. The first law says that a particle’s
velocity remains constant if the vector sum of the forces (net force) is zero. The term “net
force” is important because there can be forces acting on the particle, but if all of those
Newton’s laws of motion 11
forces sum to zero, then the particle’s velocity doesn’t change. The first law is sometimes
referred to as the law of inertia because it says that an object will continue moving with a
constant velocity forever, if there are no net forces acting on it. Inertia is, simply put, an
object’s resistance to acceleration. Hence, the particle’s inertia will ensure that the particle
will continue moving in a straight line with a constant velocity or remain at rest (zero
velocity), until it experiences a force that will change the particle’s speed, direction, or
both.
We know that acceleration is the change of velocity and hence, the first law states that
a non-zero net force is needed to cause an acceleration.
Finally, the first law provides a definition for the term equilibrium. A particle is in
equilibrium if the acceleration of the particle is equal to zero. Hence, one condition for
equilibrium is that the net force acting on a particle must be zero. We will later see that
when we study rotational dynamics, we will also need the net torque to be equal to zero as
an additional condition for equilibrium.
A particle’s time rate of change of linear momentum, p, is equal to the net force, F,
applied to the particle:
F = ṗ (1.3.1)
where the linear momentum of a particle with a mass m and velocity v is defined to be:
p = mv (1.3.2)
Equation (1.3.1) might not be the way you are used to seeing Newton’s second law. If we
consider a system with constant mass m, such as a single particle experiencing a non-zero
net force, then we have:
dp d
F= = (mv) (1.3.3)
dt dt
F = ma (1.3.4)
and we recover the more familiar form of the second law. However, when studying the
motion of an object whose mass m is changing with time, such as in the case of a rocket,
the form of the second law presented in (1.3.1) will be the one needed in order to derive the
object’s equations of motion.
Although we will use the form of Newton’s second law F = ma most often for calcula-
tional purposes in this book, we find it helpful to think of the second law in the form:
12 Foundations of Motion and Computation
F
a= (1.3.5)
m
We find this form to be more useful when understanding the concepts behind Newton’s
second law. Equation (1.3.5) tells us:
• Acceleration is in the same direction as the net force. There is no minus sign in front
of F to denote an acceleration in the opposite direction, nor is there any mathematical
transformation done to the vector F to rotate it.
• The magnitude of the acceleration is directly proportional to the magnitude of the net
force. In other words, net forces with a large magnitude produce larger magnitude
accelerations than net forces with small magnitudes. Mathematically, this can be seen
because F appears in the numerator of the fraction in the right-hand side of (1.3.5)
and by thinking of the equation as: |a| = |F|/m.
• Mass “resists” acceleration. The mass m appears in the denominator of the fraction in
the right-hand side of (1.3.5). Large denominators result in smaller overall fractions
when compared to a small denominator with the same numerator (i.e., 1/4 < 1/2).
In other words, with the same given force, objects with a larger mass experience a
smaller acceleration, and smaller mass objects experience a larger acceleration.
All three of the above bullet points are contained in the one simple equation (1.3.5)! This is
one of the reasons why physicists prefer math as the language for describing the universe.
A lot can be said in one simple equation. As a physicist, you should learn how to “read
equations” like we did above.
Notice the consistency between the first and second laws. If F = 0, i.e., a zero net force
is acting on the particle, then a = 0, and the particle’s velocity is not changing, just as
stated in the first law. Likewise, we could have restated Newton’s first law as: “A particle’s
momentum remains constant if no external net force acts on the particle.”
As we mentioned, the second law will be used to produce differential equations which
describe the motion of a particle. As a simple example, we will consider a particle moving
in one dimension (along a line) under the influence of a constant force, where a = ẍî and
F = F î. Recall that the dots above the x denote a second derivative with respect to time.
We can use (1.3.5) to write:
ẍ = F/m = a (1.3.6)
Equation (1.3.6) says that the solution x(t) is a function such that its second derivative
is equal to the constant, a. The second-order differential equation (1.3.6) is similar to an
algebra problem, except instead of finding a number, you are asked to find a function.
Differential equations are the mathematical language used by physicists to describe the
motion of a particle. We will solve them both in closed form (analytically) and numerically.
Just to whet your appetite, if a is constant, the solution to (1.3.6) is:
1
x(t) = x0 + v0 t + at2 (1.3.7)
2
where x0 = x(0) and v0 = v(0) are the initial position and velocity, respectively. You can
check this for yourself by taking two derivatives of (1.3.7) and showing that it satisfies
(1.3.6) in the case of a constant a. In Chapter 2, we will go through the steps to derive
(1.3.7) and other solutions to differential equations.
Newton’s laws of motion 13
Finally, we can return to the weak equivalence principle. Suppose a particle is near the
surface of the Earth and experiences only the force of gravity (weight W ):
F =W
mi a =mg g (1.3.8)
where mi , mg are the inertial and gravitational masses. Here we have dropped the vector
notation, assumed “downward” is the positive direction, and used g for the acceleration due
to gravity (9.8 m/s2 ). The inertial mass mi in this equation is the m from Newton’s second
law, i.e., it is the mass that “resists” acceleration, and was defined as the inertial mass.
The mass mg is the mass that is affected by gravity and was defined as the gravitational
mass. As discussed previously in this chapter, the weak principle of equivalence says that
mi = mg , and therefore the masses cancel, hence a = g for a freely falling body near the
surface of the Earth. If the weak equivalence principle were not true, then the mass of an
object would affect its acceleration due to gravity. So far, physicists have not been able to
detect any mass dependence (outside experimental error) on an object’s acceleration due to
gravity, even in the most sensitive of experiments.
If object 2 exerts a force F12 on object 1, then object 1 exerts a force F21 on object 2
such that:
Notice that the minus sign and lack of a scalar multiple in (1.3.9) says that the force
exerted by object 2 on object 1 is equal in magnitude (shown by the lack of a scalar multiple
which, if present, would change the magnitude), but opposite in direction (denoted by the
minus sign) to the force object 1 applies on 2. Many of the interaction forces we will study
in this book will be central forces. Central forces are forces that act along the line that joins
the centers of the two interacting objects, such as gravity and electrostatic forces, and obey
Newton’s third law. Velocity-dependent forces are not central, and the third law may not
apply. An example is the force between two moving electric charges; the Lorentz force is
velocity-dependent, and the magnetic force vectors between the two charged particles do
not lie along the same line, hence the resulting net forces do not obey Newton’s third law.
Let us take (1.3.9) a little further:
F21 = − F12 (1.3.10)
m1 a1 = m2 (−a2 ) (1.3.11)
Not surprisingly, we see that the accelerations of each object are in opposite directions. If
we continue manipulating (1.3.11), we find:
m1 a2
=− (1.3.12)
m2 a1
14 Foundations of Motion and Computation
where we have taken the magnitude of the acceleration vectors. Notice that the ratio of the
accelerations is inverse to the ratio of the masses. In other words, if m1 > m2 then a1 < a2 ,
in order for the right-hand side of (1.3.12) to be a fraction greater than one. As an example,
consider the classic scenario of a mosquito hitting the windshield of a moving automobile.
Let the mosquito be object 2 and the car be object 1. Clearly, the automobile has more mass
than the mosquito, m1 > m2 , and according to (1.3.12), the acceleration of the mosquito is
greater than that of the automobile, a2 > a1 . It is a bad day for the mosquito. Another way
to interpret (1.3.12) is that an object cannot accelerate without another object accelerating
in the opposite direction.
Next, we need to address one other important fundamental concept for classical me-
chanics: reference frames. Once we have a working understanding of reference frames, we
will have finished laying out the foundations of classical mechanics, and we will be ready to
do some physics!
xS = xS ′ + d (1.4.1)
allows the two frames to consistently describe the motion in each frame. First, we will
consider the case where S ′ is moving at a constant speed relative to S, in other words, u = d˙
is constant. Differentiating (1.4.1) with respect to time will give us the transformations of
the velocity between coordinate systems:
Figure 1.2: The frame S ′ is moving at a constant velocity with respect to the fixed frame,
S. The particle (black dot) is measured to have a position xS in the reference frame S and
xS ′ in the reference frame S ′ . The distance between the references frames is d.
where we used the fact that u (the relative velocity between frames) is constant. Note that
(1.4.5) says that the measured accelerations in the two frames are the same, thus (1.4.5)
also tells us that the forces measured on the particle in each reference frame are the same
and therefore Newton’s laws hold in their typical form in each frame. In other words, if we
measured the acceleration of the particle in each reference frame, we would find that the
measured acceleration can be accounted for by considering all of the forces acting on the
particle. The reference frame S ′ is called an inertial reference frame because it is moving
with a constant velocity. Newton’s second law holds in inertial reference frames.
Let us now contrast that with the case of S ′ accelerating with respect to S. In this case,
(1.4.3) doesn’t change, and (1.4.5) becomes:
aS = aS ′ + u̇ (1.4.6)
̸ 0. Now the two measured accelerations are not the same, and therefore the measured
and u̇ =
forces in each frame are different. In particular, the acceleration of a particle in a noninertial
reference frame cannot be accounted for by summing all of the forces acting on the particle.
For example, on certain carnival rides that involve rotation, you will experience an apparent
outward force which is not caused by any forces acting on you from the ride itself. This is
an example of a noninertial reference frame where Newton’s laws no longer hold in their
standard form, because there is an acceleration measured in S that is not apparent in S ′ .
16 Foundations of Motion and Computation
As we will see in a later chapter, we can modify Newton’s laws in order to address the case
of noninertial frames. Such modifications involve treating the acceleration u̇ as coming from
an inertial force, a force that is not created by physical interactions, but rather is due to an
accelerating frame. While the surface of the Earth typically approximates an inertial frame,
the Earth does rotate and revolve around the Sun; hence, the velocity of a reference frame
“glued” to the Earth’s surface is not constant. There are cases where the noninertial nature
of the “glued” frame needs to be accounted for. Such cases include long-distance motion
such as missile trajectories and the motion of wind and water currents.
where we matched the lower and upper limits on each side. Notice that the lower-limit
on the right-hand side is t = 0, and the lower limit on the left-hand side is the value of v
at t = 0, similar for the upper limits. In addition, we included a prime on our variables
of integration, to distinguish them from the limits of integration. Finally we integrate,
noting that a is constant:
v(t) = v0 + at (1.5.3)
The result shows that the velocity is a linear function of time, as expected for motion
with a constant acceleration.
Example 1.3 is an example of a problem that is “done by hand”, meaning that we were
able to perform the necessary mathematical manipulations to solve the differential equation
(1.5.1) without the aid of a computer. Equation (1.5.3) is called a “closed-form” solution to
the differential equation (1.5.1) because it gives a specific solution consisting of functions
and mathematical operations. What is considered as “closed-form” is somewhat arbitrary
because, for example, a solution in the form of an infinite sum may not be considered in
“closed-form.”
As you will see in this book, solving physics problems very often involves finding the
solution to differential equations. Some of these equations have no closed-form solution,
while others are very difficult to find. In those cases, computation can be extremely helpful.
For the purposes of this book, we consider two forms of computation:
• Symbolic Computation: involves using a computer to help find closed-form solutions
to differential equations, integrals, eigenvalues, and more. You enter the equation or
integral you want solved, and the computer program returns a closed-form solution.
Recall tables of derivatives and integrals; symbolic computation is a much more so-
phisticated version of those.
• Numerical Computation: provides a list of numerical values representing a solution.
For example, a numerical solution to (1.5.1) can be thought of as a table of values with
two columns, t and v(t), where each row contains a specific time t, and the value of v
at time t. Numerical solutions are often best represented as a graph of ordered pairs
(and sometimes triplets, depending on the dimension of the problem being solved).
In the next two subsections we demonstrate symbolic and numerical computation, by solving
Example 1.3 using Python and Mathematica.
print('-'*28,'CODE OUTPUT','-'*29,'\n')
speed = v[t]/.solution[[1]];
In Example 1.3 we see that Mathematica requires a much shorter code to solve this
problem than Python. This is because Mathematica is designed, in part, for symbolic ma-
nipulations. Computer algebra systems (CAS) like Mathematica are very convenient and
easy to use when performing symbolic computations. The disadvantage is that it is propri-
etary and much more expensive than other options.
Next, we will look at an example of a numeric computation and compare the two lan-
guages in that context.
Python Code
We import three libraries, NumPy, SciPy, and the graphics library Matplotlib. From
the SciPy library we import only the function odeint, which is used to numerically
solve the differential equation (1.5.4). After the libraries are imported, we assign the
numerical values of the initial condition variable v0 and the acceleration a.
To solve the differential equation numerically, we create a new function in Python
that we called velderiv(v,t), which contains the differential equation we are solving.
In Python, function definition is done using the command def. The arguments of the
function are v and t, and they are included in parentheses following the function name.
The next few lines contain the actual calculation of the function. Notice we included
a local variable dvdt, which stays within the function and is equal to the first derivative
of v. The last line of the function is return dvdt, which returns the value of the variable
dvdt. Note also that the contents of a Python function are always indented.
We also need to tell Python for which values of t we will be computing v(t). In
this case, times is an array which contains the list [t0 , t1 , . . . , t30 ] = [0, 0.1, . . . , 3.0],
and hence we will be solving for v(0), v(0.1), . . . , v(3.0). Next, we solve the differential
equation using the command odeint, which is imported from the [Link]
library. The odeint command in this example is:
velocity = odeint(velderiv,v0,times).
This command has three arguments: the differential equation (as the user-defined func-
tion velderiv), the initial value (v0), and the list of times times. The result is an
array which we called velocity, and it contains values [v0 , v1 , . . .], where vi = v(ti ).
The last group of lines in the program set up the graph of v versus t, and the plot of
v(t) is shown in Figure 1.3.
Computation in physics 21
import numpy as np
from [Link] import odeint
import [Link] as plt
Clear[“`* ”]
PlotRange->All];
a = 9.8;
speed = v[t]/.solution[[1]];
30
25
20
v(t) m/s
15
10
5
0
0.0 0.5 1.0 1.5 2.0 2.5 3.0
time, s
Figure 1.3: Plot of the solution v(t) = v0 + a t of the simple differential equation in Example
1.4.
Again, the Python code is longer than the Mathematica code. Does that make Mathe-
matica better than Python? That answer depends on what you are trying to do. If you are
interested in quick development and implementation, then Mathematica might be a very
useful tool for you. However, as we mentioned before, Mathematica is proprietary and more
expensive than Python. The proprietary nature of Mathematica means that you don’t have
access to the source code, and this can be a problem if you want to know exactly what
the commands are doing. Python is open source software, so if you want to know what is
“going on under the hood”, you can find out. The open source nature of Python is valuable
when doing research, and when you want to identify if unexpected results are due to bugs
in the code, or they are due to new science. That said, Mathematica is a language of its
own, and you can write your own programs in it. Finally, Python is free, and your budget
may dictate your choice. When working on their own research problems, the authors of this
book will often use both programs, choosing the most appropriate tool for the particular
job at hand.
It should be pointed out that sometimes, a closed-form solution to a differential equation
doesn’t exist or is difficult to find. In those cases, we rely on numerical solutions to give
us the information we need. You may think that numerical solutions are of limited value,
but as we will see throughout this book, there is a lot that can be found using numerical
Computation in physics 23
solutions (also called numerics). In Chapter 13, we will study nonlinear oscillators, and we
will learn how to obtain a lot of information from numerical solutions.
It is easy to walk away from an undergraduate physics education thinking that all physics
problems have closed-form solutions. This conclusion arises from the types of problems that
undergraduate students solve as part of their education. The truth of the matter is that
most problems physicists work on outside of the classroom require numerical solutions. The
differential equations governing real-world systems are often complex and not solvable in
closed-form. In those cases, numerics may be the only option to gaining any kind of insight
into the problem. A physicist with strong computational skills will be well-prepared to tackle
a wide variety of problems, not just in classical mechanics, but in any field of physics or
engineering.
Furthermore, physicists find themselves working on a variety of problems outside the
traditional subfields of physics. Physicists often end up working on problems in finance,
economics, biology, climate science, and materials science, just to name a few. Today’s
physicists are involved in modeling economies, disease propagation, and social networks.
These types of problems allow physicists to apply their skills, including strong computational
and modeling skills, to interesting problems. It is our hope that this book will not only
prepare you well in physics, but also set you on the path of developing strong computational
skills, so that you may tackle the exciting problems both inside and outside of physics,
wherever your career may take you.
the problems in the text. We tended to produce codes that focused on pedagogy over
efficiency. We encourage you to rewrite the programs contained within, to see if you can
improve them and make them more efficient. By playing around with the codes, you’ll get
a better understanding of the algorithms and programming in general. Have fun!
F = dp/dt = ṗ (1.6.4)
Newton’s third law: If object 2 exerts a force F12 on object 1, then object 1 exerts a
force F21 on object 2 such that:
F21 = −F12 (1.6.5)
All measurements are made with respect to a reference frame. A reference frame is a
choice of origin (spatial x and temporal t), and a set of axes with respect to which all
measurements are made.
Two reference frames S, S ′ are called inertial reference frames when Newton’s laws
hold, and the forces measured in S ′ are the same forces as those measured in S.
Two reference frames S, S ′ are called noninertial reference frames when Newton’s
laws no longer hold in their standard form, because there is an acceleration measured
in S that is not apparent in S ′ .
Computation is an important tool for physicists. In this book, we will focus on
two types of computation, symbolic and numerical. Symbolic computation involves
using a computer to help find closed-form solutions to differential equations, integrals,
eigenvalues, etc. Numerical computation, or “numerics,” provides a list of numerical
values representing a solution to differential equations, integrals, eigenvalues, etc.
End-of-chapter problems 25
1. The position of a particle with mass m =0.50 kg can be described using the vector
function:
r = 3a tî − 2b t2 ĵ + 7c t−2 k̂
where a, b, c are constants.
a. What are the SI units of each of the coefficients a, b, c? Assume that time t is
measured in seconds and position is measured in meters.
b. Evaluate the velocity of the particle and the force acting on it at t = 3 seconds
and for a = b = c = 1, both analytically and using the symbolic capabilities of
Mathematica and/or Python.
2. Consider the position vector r = 3 t ρ̂, where ρ̂ = cos ϕ î + sin ϕ ĵ and ϕ = ϕ(t) is a
scalar function of time t. Compute the velocity and acceleration of the particle, both
analytically and using a CAS.
4. Consider the vectors A = î + 2ĵ + 2k̂ and B = î + ĵ + k̂. Plot these two vectors
and their sum A + B on a 3D Cartesian coordinate system using Python and/or
Mathematica.
5. Consider the vectors A = î + 2ĵ and B = î + ĵ. Plot these two vectors and their
sum A + B on a 2D Cartesian coordinate system using Python and/or Mathematica.
Section 1.3: Newton’s Laws of Motion
6. Consider the following applications of Newton’s laws of motion:
a. Using Newton’s third law, explain why a gun recoils when it is fired. Explain
why the gun’s recoil velocity is smaller than that of the bullet.
b. Consider a universe where the weak equivalence principle was not true. How
would Newton’s universal law of gravitation be changed?
c. Using Newton’s laws, explain what would happen to the Earth’s trajectory if the
Sun were to suddenly disappear.
7. Consider the four situations below. Qualitatively describe the velocity and acceleration
(as a function of time) of a particle of mass m experiencing each of these forces:
a. A particle starting at rest at a location x = A from the origin experiences a force
F = −kx, where x is a position coordinate which represents a displacement from
an equilibrium position (where FNet = 0) located at the origin and k is a positive
constant.
26 Foundations of Motion and Computation
c
b. A particle starting at rest at the origin experiences a force F = t2 +a2 î, where t
is time and c and a are positive constants.
c. A particle starting at the origin moving with an initial velocity v0 in the positive
x-direction experiences a force F = −bv î, where v is velocity and b is a positive
constant.
d. An object released from rest at a large height H above the Earth’s surface expe-
riences a force F = (mg − bv) ĵ, where g is the acceleration due to gravity, b is a
constant, and v is velocity. Assume the positive y-direction is toward the Earth’s
surface.
Section 1.4 Reference Frames
8. Consider a reference frame S which is at rest, and another reference frame S ′ whose
origin is at a location r0 = c t2 î relative to the origin of S, where c is a positive
constant. A particle of mass m has a position in S ′ , which described by the vector
function r′ = b t3 î, where b is a positive constant.
a. Compute the acceleration of the particle as measured in each frame.
b. Compute the force on the particle measured in each frame. Why are the two
forces different?
9. Consider a reference frame S which is at rest, and another reference frame S ′ , whose
origin is at a location r0 = a t î + b t ĵ relative to the origin in S, where a and b
are positive constants and t represents time. Compute the velocity of a particle as
measured in S, whose position in S ′ is described by r′ (t) = −c t2 î, where c is a
positive constant.
10. Consider a reference frame S which is at rest, and another reference frame S ′ , whose
origin is at a location r0 = 3t2 î−5t3 ĵ relative to the origin of frame S, and t represents
time. A particle’s position in S ′ is described by the vector function r′ (t) = −t2 î+3t2 ĵ.
Find the force measured in each frame if the mass of the particle is m.
11. Consider a reference frame S which is at rest, and another reference frame S ′ , whose
origin is at a location r0 with respect to the origin of S. Is the momentum of the particle
p = mv, as measured in each frame, the same? Show that if S and S ′ are inertial
frames, then the force on the particle, as measured in S’ is the same as that measured
in S. In other words, F′ = dp′ /dt = dp/dt = F where p (p′ ) is the momentum of a
particle of mass m in S (S ′ ). Is the angular momentum ℓ = r × p the same in each
frame? How about the torque N = r × F?
12. In the theory of special relativity, we need to alter the transformation equations
between two frames. Let S be a rest frame, and S ′ a frame moving at a speed v
relative to S. Suppose that S ′ moves in the x-direction, in other words, S ′ moves
parallel to the x-axis of the frame S. The theory of special relativity then states that
measurements made in S and S ′ are related by the formulas:
x′ = γ(x − vt)
y′ = y
z′ = z
vx
t′ = γ t − 2
c
End-of-chapter problems 27
p
where γ = 1 − v 2 /c2 and c is the speed of light.
a. Consider that two events in S occur at two locations x = 0 and x = a at time
t = 0. Find the times of the two events as measured in S ′ . Notice that events
that are simultaneous in S are not simultaneous in S ′ . Which event was seen
first in S ′ ?
b. Show that the space-time interval (∆s)2 = c2 t2 − x2 − y 2 − z 2 stays invariant
in the system S ′ , i.e., (∆s)2 = (∆s′ )2 = c2 (t′ ) − (x′ )2 − (y ′ )2 − (z ′ )2 . Do this
2
13. Solve the following differential equation analytically and numerically using Python
and/or Mathematica :
df
= 5 sin x − 4e−x
dx
with the initial condition f (0) = 0. Plot the solution for x = 0 to 3 with a step size of
0.1.
14. Assign the values 5 and 6 to the variables a and b, respectively. Then compute the
following expressions within two decimal points using Python and/or Mathematica:
a. (a + b) sin(0.25π)
b. a b e3 /(sinh a)
√ √
c. 7 ab /(a + b i) where i = −1
15. Define an array x (sometimes called a list) which contains the numbers 0 through
2π in steps of 0.01. Define the function f (x, m, k) = e−mx cos(2πkx) of three variables
m, k, x. Plot the function f (x, m, k) with k = 1 and m = 0.5. Label the axes and
choose a color and plotting symbol other than the default for your curve. Save the
resulting graph to a .jpg or .png file.
16. Plot f (x) = x2 and g(x) = x on the same graph, for the range x = 0 to x = 10.
Each function should have its own color, label and plotting symbol in the graph.
17. A conditional statement is an important tool for helping computers deal with
contingencies. They take the form “if-then-else.” Conditional statements allow for
computers to do different things, depending on whether or not a condition is true. In
other words, if a condition is true, then do one thing, if it is not true (else) then do
something different. For example, if a variable x is less than 5 assign the value 1 to
the variable a; otherwise, assign the value 0 to a. Write a code in which you assign a
value to the variable x and then prints “x is less than 5” if x < 5 , and prints “x is
greater than or equal to 5” if x ≥ 5.
18. Using the conditional if statement, described in Problem 17, define the piecewise
function (
0 x<5
f (x) =
x x≥5
2
evaluate f (x) for x = 0.5 and x = 2, and plot f (x) for the range x = 0 to x = 3.
28 Foundations of Motion and Computation
19. Computers are very good at repeating tasks over and over again, in a procedure
called a loop. The basic types of loops are for loops, do loops, and while loops. Using
any of these three types of loops, compute 6! (factorial) and display the result.
21. Use symbolic computation and the solve command in Python and Roots com-
mand in Mathematica, to solve the following equations for x. Note that you will get
complex roots for some of the solutions.
a. 7x + 5 = 0
b. x2 − 5x + 2 = 0
c. x3 + 7x − 5 = 3
22. Use symbolic computation and the solve command in Python, and Solve in
Mathematica, to solve the following system of equations for (x, y):
2x − 5y = 7
x+y =2
d2 x
F =m (2.1.2)
dt2
dv
F =m (2.1.3)
dt
dv
F = mv (2.1.4)
dx
Notice that each of the above equations is a differential equation which can be solved
once the net force F acting on the particle is specified. Each of the above equations yields
29
30 Single-Particle Motion in One Dimension
a different equation of motion: (2.1.2) can be solved for x(t), (2.1.3) for v(t), and (2.1.4) for
v(x). Equation (2.1.4) comes from the chain rule and is used when the force is dependent
upon the particle’s position x:
dv dv dx dv
m =m = mv (2.1.5)
dt dx dt dx
Throughout the rest of this chapter, we will solve (2.1.1) for several different cases where
forces are constant (F = F0 ), time-dependent (F = F (t)), velocity-dependent (F = F (v)),
and position-dependent (F = F (x)). However, before solving (2.1.1), we will make a few
comments about differential equations in general.
dx =7dt (2.2.2)
Z Z
dx = 7dt (2.2.3)
x =7t + c (2.2.4)
To solve (2.2.1), we carried out the integral after separating variables. Note that both
integrals would produce constants of integration, but since both are constants, we can
combine them into one arbitrary constant. You can double-check the solution by computing
the derivative of 7t + c, to check that it satisfies (2.2.1).
Ordinary differential equations 31
What happens in the case of second-order ODEs? Second-order ODEs are common
in physics. There are many techniques to solve them, but we will demonstrate only one.
Consider the ODE,
d2 x
=7 (2.2.5)
dt2
Separation of variables does not make sense here, because we typically do not integrate
terms like d2 x. However, we can define a new variable v, such that, v = dx/dt. Then (2.2.5)
becomes,
dv
=7 (2.2.6)
dt
which we know gives the answer v(t) = 7t + c1 , where c1 is the constant of integration.
However, we want x(t), so we use v = dx/dt:
dx
=7t + c1 (2.2.7)
Z dt Z
dx = (7t + c1 ) dt (2.2.8)
where c2 is the constant of integration obtained by performing the integral in (2.2.8). Hence,
we pick up an additional constant of integration in our solution, giving two arbitrary con-
stants for the solution of the second-order ODE (2.2.5). Loosely speaking, we see that the
number of arbitrary constants in the solution of an nth -order ODE is equal to n, because
we need to do n integrations in order to solve the equation, and each integration produces
an arbitrary constant.
Next, we return to (2.2.1). Suppose (2.2.1) was an equation we wanted to use in order
to find the position of a particle as a function of time. The infinite number of solutions is
not helpful. Which solution describes the actual path taken by the particle? In order to
specify the particular solution for an ODE, we need to include initial conditions, the value
of our function at a particular time (normally at t = 0). Suppose we know that at t = 0, the
particle is at a position, x(0) = 3. Then we can solve for the arbitrary constant by inserting
the initial condition into our general solution,
which gives c = 3. Our particular solution is then, x(t) = 7t + 3. A different initial condition
will give a different particular solution.
Now suppose we wanted to find a particular solution to (2.2.5); in that case one initial
condition will not be enough, because it will leave out one arbitrary constant. Hence, we
will need to specify both x(t) and dx/dt at a particular time (usually t = 0). Suppose that
x(0) = 3 and v(0) = 1, where v = dx/dt. Then we have:
2
x(0) = 3.5 (0) + c1 (0) + c2 =3 (2.2.11)
v(0) = 7 (0) + c1 =1 (2.2.12)
where (2.2.12) is the derivative of the general solution evaluated at t = 0. The result is
c1 = 1 and c2 = 3, and the particular solution is x(t) = 3.5t2 + t + 3.
In summary, in order to solve for the particular solution of an nth -order ODE, we need n
initial conditions. In addition, we can also specify x using knowledge of the value of x at two
different times, as opposed to knowing initial values of x and its first derivative. In classical
mechanics, it is most common to know the initial conditions of the position and velocity.
32 Single-Particle Motion in One Dimension
where c1 is the constant of integration. The constant, c1 , can be found using the initial
condition of v(t0 ) = v0 , where v0 is the initial velocity at the initial time t0 . When t0 = 0,
(2.3.3) gives v(0) = c1 or c1 = v0 . Therefore, the solution to the differential equation (2.3.1)
is:
v(t) = v0 + a t (2.3.4)
Before moving forward, we should mention that there is an alternate method for finding
(2.3.3), which can be found by explicitly inserting the initial and final conditions when
integrating (2.3.2):
Z v(t) Z t
dv ′ = adt′ (2.3.5)
v0 t0
v(t) − v0 =a(t − t0 ) (2.3.6)
where we have introduced primes to the variables of integration, in order to distinguish
them from the limits of integration. Notice that the lower limit in the left-hand side of
(2.3.5) corresponds to the value of v(t) when t = t0 , the lower limit of the right-hand side
of (2.3.5), and with similar considerations for the upper limits. It is very important that
the limits match on both sides of the equation.
Next, we can get an equation for x(t) by writing v = dx/dt :
dx
= at + v0 (2.3.7)
dt
and separating variables, we obtain:
Z x(t) Z t
dx′ = (at′ + v0 )dt′ (2.3.8)
x0 t0
Constant forces 33
Notice how all the time-dependent and constant terms are on the same side of the equation.
In this context, separation of variables always involves multiplication and division, never
addition and subtraction. Choosing t0 = 0 and performing the integral results in:
1 2
x(t) = at + v0 t + x0 (2.3.9)
2
Together, equations (2.3.4) and (2.3.9) are the only equations you need to know, in
order to solve for the position and velocity of a particle moving in one-dimension while
experiencing a constant net force.
Finally, if we want v(x), we can solve (2.1.4):
dv F0
v = (2.3.10)
dx m
vdv =adx (2.3.11)
Z v Z x
v ′ dv ′ =a dx′ (2.3.12)
v0 x0
v − v02 =2a(x − x0 )
2
(2.3.13)
where a = F0 /m was used in (2.3.11). We could have also obtained this result by eliminating
t between equations (2.3.4) and (2.3.9). The box below summarizes all of the constant force
equations, sometimes called the kinematic equations. These are equations that you should
memorize.
v(t) = v0 + at (2.3.14)
1
x(t) = x0 + v0 t + at2 (2.3.15)
2
v(x)2 = v02 + 2a (x − x0 ) (2.3.16)
In the case of a freely falling particle near the surface of the Earth, we use a = −g =
−9.8 m/s2 (assuming “down” is in the negative direction), where g is the acceleration due
to gravity. The kinematic equations become:
We used y as the position variable, which is common when describing vertical motion.
Notice that these are not different equations from the kinematic equations, but simply the
kinematic equations with a specific value of a. We now look at some well-known examples
of situations in which the acceleration of the system is constant.
Assume that m2 > m1 . Find the acceleration a of the masses and the tension of the
string.
a a
T
m1
T
w m2
1
w
2
Figure 2.1: Free body diagrams of the two hanging masses of the Atwood machine.
Solution:
We can derive an equation for the acceleration by using force analysis. The only
forces we must consider are: tension (T ) and weight of the two masses (W1 = m1 g and
W2 = m2 g ). The tension acting on each mass will be the same, because the tension
is constant throughout the string. Because the string is inextensible, the magnitude of
the acceleration of each mass will also be the same, although they will be in opposite
directions.
To find the acceleration, we need to consider the forces affecting each individual
mass. First, we need to define a frame of reference. In this case, we will choose +y is
downwards so that the heavier mass, m2 , moves in a positive direction. Newton’s second
law can be used to derive a system of equations:
)
m1 g − T = − m1 a
(2.3.20)
m2 g − T =m2 a
where the right hand side of the top (bottom) equation of (2.3.20) is the net force acting
on m1 (m2 ). The upward motion of m1 has been made explicit by including a minus
sign on the right-hand side of the equation describing the forces affecting m1 .
We can solve the system (2.3.20) by subtracting the equations to eliminate T . We
can also use a computer algebra system (see below).
Either way, the result is
m2 − m1 2m1 m2
a =g T = g (2.3.21)
m1 + m2 m1 + m2
Constant forces 35
Once a has been found, we can find the position x(t) and velocity v(t) of the masses
using (2.3.15) and (2.3.14). Note that for the position and velocity of m1 , we would
need to insert −a in the kinematic equations.
We can check if these results makes physical sense, and also if the units are correct.
If the two masses are equal m1 = m2 , these equations give a = 0 and T = m1 g = m2 g.
This result makes physical sense, since equal masses mean that the system is stationary
(a = 0), and the tension T will be equal to the weights of either mass.
In addition, the fraction (m2 −m1 )/(m1 +m2 ) is dimensionless, so that the units for a
in (2.3.21) are the same as the units of g. The units for the fraction (2m1 m2 )/(m1 +m2 )
are kg, so that the units of T are kg m/s2 or Newtons.
Python Code
We solve the system of equations using the solve command, which requires that
the equations to be solved to have a zero right-hand side. After defining the necessary
symbols, we store (2.3.20) into the variables eq_1 and eq_2 and use the solve command
which outputs a Python dictionary. We can identify each solution by using square
brackets behind the variable name soln, which contains the solutions.
print('-'*28,'CODE OUTPUT','-'*29,'\n')
Mathematica Code
We define the equations (2.3.20) as the variables eq1 and eq2. Note the use of == to
demonstrate the equality of the equation. Next, we use the Solve command which has
two arguments, the equations to be solved and the variables for which the equations are
being solved. Notice that the result is a list of replacement rules /., which Mathematica
can use for further calculations.
36 Single-Particle Motion in One Dimension
eq1 = m1 ∗ g − T == − m1 ∗ a;
eq2 = m2 ∗ g − T ==m2 ∗ a;
N
f
mgsin(θ) m
mgcos(θ)
The normal force here represents the force applied by the plane against the object
(and vice versa). The magnitude of the normal force N can be calculated from the free
body diagram, as shown in Figure 2.2, to be N = mg cos θ, where g is the acceleration
due to gravity, and θ is the angle of the inclined surface measured from the horizontal.
The component of the weight W = mg, which acts along the direction of the plane, is
again found from the force diagram to be F = mg sin θ.
The total force along the x-axis (downward direction along the plane) is:
This acceleration can then be used in (2.3.15) and (2.3.14) to get x(t) and v(t):
1
x(t) = x0 + v0 t + (g sin θ − µg cos θ) t2 (2.3.25)
2
Python Code
In the code, we use dsolve to solve Newton’s law in the form:
d2 x
= a = g sin θ − µg cos θ
dt2
with the initial conditions x(0)=x0 and x'(0)=v0. We start by defining the parameters
g, θ, µ, x0, v0 as g,theta,mu,x0,v0,t using the command symbols. The parameter x
is defined as a function by using the command Function in SymPy.
The parameter initconds stores the initial conditions. Note that dsolve contains
now a third parameter ics=initconds which tells SymPy to obtain the solution of
the differential equation using the given initial conditions. The solution of the ODE is
stored in the variable solnx, and we select the right-hand side of the solution using the
method .rhs.
The speed v(t) = dx/dt is evaluated as the time derivative using diff(solnx,t).
print('-'*28,'CODE OUTPUT','-'*29,'\n')
g, theta, mu, x0, v0, t = symbols('g, theta, mu, x0, v0, t',real=True)
x = Function('x') # define position function x
Mathematica Code
The Mathematica command DSolve is used to solve the differential equation
d2 x
= a = g sin θ − µg cos θ (2.3.26)
dt2
In DSolve the first argument is a list containing the ODE and the initial conditions,
and the result for the position x(t) is stored in the variable posx. The speed v = dx/dt
is evaluated using the derivative command D[posx,t].
a = g ∗ Sin[θ] − µ ∗ g ∗ Cos[θ];
posx = x[t]/.soln[[1]];
dv F (t)
= (2.4.1)
dt m
and by separating variables and integrating from t′ = t0 to t we find:
Z
1 t
v(t) − v(t = 0) = F (t′ ) dt′ (2.4.2)
m t′ =t0
Z t
1
v(t) = v0 + F (t′ ) dt′ (2.4.3)
m t′ =0
Once we know v(t), we can find x(t) by integrating v = dx/dt and using the initial
conditions x(t0 ) = x0 to obtain:
Z t
x(t) − x0 = v(t′ ) dt′ (2.4.4)
t′ =0
Time-dependent forces 39
In the next example, we demonstrate how to find the equations of motion for a particle
experiencing a time-dependent force. We will obtain the solution both by hand and using
Python and Mathematica.
Python Code
In the code we use dsolve to solve the ODE, specifying its initial conditions using
the ics option. We use the textwrap library so that the output would fit on the page of
this book. Notice that the argument for [Link] must be a string. Hence the use
of str(solnx),70) and the number 70 specifies that the output should be restricted
to 70 spaces per line.
40 Single-Particle Motion in One Dimension
In order to plot the symbolic result from SymPy, we use lambdify to obtain NumPy
arrays for the position and speed variables position and velocity. The Python method
.subs is used to substitute the numerical values of the parameters c,m,x0,b.
Note also that Python does not combine the logarithmic functions in the output.
m, c, b, t, x0 = symbols('m, c, b, t, x0',real=True)
x = Function('x')
position = lambdify(t,xt,'numpy')
velocity = lambdify(t, vt,'numpy')
times = [Link](0,10,20) # times t=0-10
v(t) = c*atan(t/b)/(b*m)
Mathematica Code
The Mathematica command DSolve is used to solve the differential equation,
Time-dependent forces 41
d2 x c
= 2 m (2.4.10)
dt2 t + b2
This code is very similar to the Mathematica code in Example 2.2. The graphics
command GraphicsGrid is used to create two side-by-side plots of x(t) and v(t).
position = x[t]/.ODEsolution[[1]]
c ArcTan[ bt ]
bm
c = 1; m = 1; b = 1;
GraphicsGrid[
12 1.5
10
8 1.0
v, m/s
x, m
6
4 0.5
2
0 0.0
0 2 4 6 8 10 0 2 4 6 8 10
time, s time, s
(a) (b)
Figure 2.3: Plot of (a) the position and (b) the velocity for Example 2.3. Notice the linear
nature of x(t) as t gets large and that the speed v(t) approaches a constant value.
42 Single-Particle Motion in One Dimension
where D is the diameter of the sphere in meters. Fortunately, one usually doesn’t need to
include both the linear and quadratic terms for air resistance. In order to determine which
term, linear or quadratic, is the most important in a given situation, one can compute the
ratio:
cv 2 0.25D2 v 2
γ= = = 1.6 × 103 D v (2.5.4)
bv 1.6 × 10−4 D v
Note that v should be in meters per second, and D in meters. If γ >> 1, then the quadratic
term dominates, and the linear term can be neglected. If γ << 1, then the linear term
dominates, and the quadratic term can be neglected. However, if γ ≈ 1, then both the
linear and quadratic terms need to be included. So for a soccer ball with a diameter of 0.22
m, the quadratic term dominates for speeds approximately greater than 0.003 m/s (or 3
mm/s), while for lower speeds the linear term dominates. Both linear and quadratic terms
would need to be included in the drag force formula if the soccer ball is traveling near 3
mm/s.
To obtain equations for position and velocity as functions of time, we will consider a
generic form for F (v). Newton’s second law (2.1.1) gives:
dv F (v)
= (2.5.5)
dt m
Air resistance and velocity-dependent forces 43
Z v
dv ′
t − t0 = m (2.5.7)
v ′ =v0 F (v ′ )
By solving (2.5.7), we can find v(t), the velocity as a function of time. Once we know v(t),
we can integrate once more using (2.4.4) to find x(t) with the initial condition x(t0 ) = x0 .
We can follow a similar procedure for finding v(x). Newton’s second law gives:
dv
mv = F (v) (2.5.8)
dx
After rearranging, we obtain:
Z v
v ′ dv ′
x − x0 = m (2.5.9)
v ′ =v0 F (v ′ )
m v0
1 − e− m
bt
x(t) = x0 + (2.5.13)
b
As the time t increases, the second term 1 − exp (−b t/m) in x(t) increases and
approaches 1, so that x(t) at very large times reaches the constant value of x0 + m v0 /b
where the motion stops (v → 0).
44 Single-Particle Motion in One Dimension
Python Code
We use the method [Link](t,oo) to find the limit of the variable solnx
(representing x(t)), as t → ∞. The infinity symbol in SymPy is oo. As discussed above,
these limits are v(t) → 0 and x(t) → x0 + m v0 /b, as t → ∞.
v(t) = v0*exp(-b*t/m)
The limit of v(t) at large time t = 0
The limit of x(t) at large time t = (b*x0 + m*v0)/b
Mathematica Code
The Collect command gathers together terms that involve the same powers of the
objects in the curly brackets (second argument of Collect). It is a useful command for
simplifying algebraic terms and for identifying coefficients.
We find the limit of the functions velocity and position as t → ∞ using the
Mathematica Limit command with the assumptions b > 0 and m > 0.
Air resistance and velocity-dependent forces 45
ODEsolution = DSolve[{mx”[t] == −bx′ [t], x[0] == xo, x′ [0] == vo}, x[t], t];
velocity = D[position, t]
vo − e− m −vo + e m vo
bt bt
vo = 1; xo = 0; m = 1; b = 1;
1.0 1.0
0.8 0.8
0.6 0.6
x
0.4 0.4
0.2 0.2
0.0 0.0
0 2 4 6 8 10 0 2 4 6 8 10
time time
(a) (b)
Figure 2.4: (a) Position and (b) velocity as a function of time for Example 2.4. Notice the
position asymptotes to x = 1 m, and that the velocity decays to zero.
46 Single-Particle Motion in One Dimension
Note that we have factored out the constant b from the denominator of the integral
before performing the integration. Solving for v(t), we obtain:
mg m g −bt
v(t) = + v0 − e m (2.5.17)
b b
We also find y(t) from (2.4.4):
Z Z hm g
t
′ ′
t
m g − b t′ i ′
y(t) − y0 = v(t ) dt = + v0 − e m dt (2.5.18)
t′ =t0 t′ =t0 b b
Figure 2.5 shows the plots of x(t) and v(t) found in Example 2.5. The numerical values
of the parameters are b = 0.2, m = 1, x(0) = 0, v(0) = 0, g = 9.8 (all in SI units). Notice
that the velocity of the object approaches a constant value as the object falls for a long
period of time.
Air resistance and velocity-dependent forces 47
50
1200
40
1000
800 30
v
600
x
20
400
10
200
0 0
0 5 10 15 20 25 30 0 5 10 15 20 25 30
time time
(a) (b)
Figure 2.5: Plots of (a) x(t), (b) v(t) from Example 2.5. The plot shows the linear increase
of x(t) after terminal velocity is reached (at v = m g/b = 49 m/s). See this book’s website
for the code used to generate this plot.
Next, we use (2.5.7) to find v(t) by integrating from the initial velocity v0 to the final
velocity v: Z v Z
dv ′ m v dv ′
t=m ′2
= (2.5.21)
0 −c v + m g c 0 vt2 − v ′2
We rewrite this equation by factoring the integrand, in order to avoid the presence
of imaginary numbers in logarithmic functions in Python. However, this issue is not
present in the Mathematica code.
Z v
m 1 1
t= + dv ′ (2.5.22)
2 vt c 0 vt + v ′ vt − v ′
m vt − v
t= ln
2 vt c vt + v
After some straightforward algebra, this can be simplified to:
m −1 v
t= tanh
c vt vt
We can now easily solve this equation for v to obtain the speed:
hc v i
t
v(t) = vt tanh t (2.5.23)
m
48 Single-Particle Motion in One Dimension
Python Code
After defining the parameters in SymPy as positive using the option
real=True,positive=True in the symbols command, we use integrate to evaluate
the integral in (2.5.22), in order to obtain an expression for the time t. The answer
produced for t by SymPy is complex, and contains several logarithmic terms. These
terms are combined using the function logcombine with the option force=True, to en-
sure that they are combined regardless of the signs of the parameters. We use solve to
obtain the speed v(t), with the result agreeing with the analytical solution in (2.5.23).
Finally integrate is used to obtain the position x(t).
Mathematica Code
We use the command Integrate to perform the integral. When you perform inte-
grals, you may not always think about the signs of variables. For example you know that
the terminal velocity is positive. However, Mathematica makes no such assumptions.
In order to perform the integral, and get the above analytical result, we need to tell
Mathematica that both the final velocity (vf in the code), and terminal velocity, (vt
in the code) are positive, and that vf < vt. Physically, this is making the assumptions:
m, g, k, t, v > 0 and also mg > kv 2 (i.e., the air resistance cannot exceed the weight
W = mg). The symbol && represents the logical operator AND. These assumptions are
provided in the Assuming command in the code. So by placing the command Integrate
inside the Assuming command, we are telling Mathematica to integrate with the listed
assumptions.
The numerical values of the parameters for the plot in Figure 2.6 are c = 0.2, m = 1,
x(0) = 0, v(0) = 0, g = 9.8 (all in SI units).
SetOptions[Plot, Frame->True, BaseStyle->{FontSize->16}, PlotRange->All];
Assuming[vt > 0&&t > 0&&m > 0&&c > 0, Solve[integral ∗ m/c==t, vf]];
velocity = First[vf/.%];
7
30
6
25
5
20
v, m/s
4
x, m
15 3
10 2
5 1
0 0
0 1 2 3 4 5 0 1 2 3 4 5
time, s time, s
(a) (b)
Figure 2.6: (a) Position vs. time and (b) Velocity vs. time graph for Example 2.6. Notice
that after t ≃ 2 s, the displacement increases linearly with time, and the velocity approaches
a constant value of 7 m/s.
A comparison between the velocity of the falling body in the cases of linear air resistance
F (v) = −bv + mg and quadratic air resistance F (v) = −cv 2 + mg is shown in Figure 2.7,
where m = 1.0 kg, b = 0.2 Ns/m, and c = 0.2 Ns2 /m. The velocity on the y-axis has been
normalized by dividing with the corresponding terminal velocity. Notice that the quadratic
air resistance (dashed line) leads to the object obtaining terminal velocity in a significantly
shorter time than linear air resistance (solid line). This is not surprising; the magnitude of
the quadratic drag force will be higher than the linear force for a given velocity, v.
1.0
0.8
0.6
v/vt
0.4
Linear
Quadratic
0.2
0.0
0 5 10 15 20
time
Figure 2.7: Comparison of the velocity of falling body in the presence of linear and quadratic
air resistance. The two curves have been scaled by dividing the speed with the terminal
velocities, so that the plots produce the same result as t → ∞. The code used to produce
this graph can be found on this book’s website.
By separating the variables v and x, and using the initial conditions x = x0 and v = v0
when t = 0 , we obtain:
Z x Z v
′ ′ 1 1
F (x ) dx = m v ′ dv ′ = m v 2 − m v02 (2.6.2)
x0 v0 2 2
Solving for the velocity v(x) as a function of the position x:
sZ
x
2 1
v (x) = F (x′ ) dx′ + m v02 (2.6.3)
m x0 2
By substituting v = dx/dt, separating the variables, and integrating with the initial
condition x = x0 when t = t0 , we obtain the relationship between position x and time t:
Z x ′
m qR dx
t − t0 = (2.6.4)
2 x0
x
F (x′ ) dx + 21 m v02
x0
After performing the integral in equation (2.6.4), one would then try to invert this
formula to find x(t), something that is not always easy or possible to do. Often, one relies
on computer methods in such cases.
The next example will involve one of the most important problems in all of classical
mechanics, simple harmonic motion (SHM). In fact, we will devote a whole chapter to it!
As we will see in Chapter 6, SHM is a common model used for small amplitude oscillations.
Although SHM is often thought of as a “mass on a spring”, it is also a useful model for
other small amplitude oscillations including pendulums, small amplitude water waves, and
loudspeakers—to name a few. Besides presenting the SHM, the next example also includes
a demonstration of using Python to find the solution to a second-order differential equation
in closed form.
which gives the velocity v(x) as a function of the position x. Next we will find x(t) by
using (2.6.4):
Z x r x r
dx′ m −1 x m x π
t= q = sin = sin−1 − (2.6.6)
x0 k
(x2 − x′2 ) k x0 k x0 2
m 0 x 0
52 Single-Particle Motion in One Dimension
Python Code
In the code we use the dsolve command from the SymPy library.
After importing the necessary commands, we specify that the variables m, k, t are
real and positive. The command D is used in place of diff (see the import command)
and represents the derivative of x with respect to time (two t’s in the argument means
second derivative). The parameter init contains the initial conditions for the motion.
If we did not specify that m and k are real and positive, and we had only defined
those variables as symbols, Python still solves the differential equation but produces
a hyperbolic cosine function (cosh) instead of the cosine function. It is important to
remember that it is not unusual to have to do additional algebra on results provided
by CAS algorithms, in order to get a result that is useful. This is an additional reason
not to forget your math skills and not to rely solely on the computer!
print('-'*28,'CODE OUTPUT','-'*29,'\n')
x = Function('x')
t, x0, v0 = symbols('t, x0, v0',real=True)
k, m = symbols('k, m',real=True, positive=True)
# initial conditions
init = {x(0):x0,D(x(t),t).subs(t,0):v0}
Mathematica Code
Using DSolve, we can find the position as a function of time. Note that in order to
isolate the solution, we had to reference the variable soln.
Euler’s method of numerically solving ODEs 53
position = x[t]/.soln[[1]];
Print[“x(t)=”, position]
h√ i
x(t)=x0 Cos √kmt
Not all differential equations can be easily solved in closed form, and some cannot be
solved in closed form at all. In cases where closed-form solutions are not possible to obtain,
we can solve the differential equation using a numerical method. In the next section, we will
discuss a simple method of numerically solving ordinary differential equations.
x(t)
xi+1
xi
t
idt (i+1)dt
Figure 2.8: The slope f (xi ) (diagonal dashed line) of the true solution (curve) is used to
approximate xi+1 using the Euler method. Note the mismatch between the value of xi+1
and that of the true solution at time (i + 1)dt.
d2 x
= f (x, v) (2.7.5)
dt2
can then be rewritten as the coupled first-order system
dx
=v
dt (2.7.6)
dv
= f (x, v)
dt
Using Euler’s method, we can rewrite (2.7.6) as
)
xi = xi−1 + vi−1 dt
(2.7.7)
vi = vi−1 + f (xi−1 , vi−1 ) dt
The step size dt must be small for Euler’s method to provide a good solution. Euler’s
method works by using the slope f (xi ) of the solution xi at a time idt for a linear approxi-
mation of xi+1 , the value of the solution at a time (i + 1)dt. If the step size is too large, then
the slope may not do a good job of approximating xi+1 because the true solution x(t) may
change significantly over the time interval dt. An example of a poor approximation of xi+1
is shown in Figure 2.8. Notice that in Figure 2.8, the slope (diagonal dashed line) gives a
reasonable approximation to the solution x(t) (curve) when dt is small. However, for larger
values of dt, the difference between the value extrapolated by the slope and x(t) increases.
Choosing too small of a step size will compound rounding errors made when computing
each Euler step. The best choice of dt is somewhere between these two extremes.
The Euler method is not commonly used in practice. We present it here only to show
the reader the basic concept of a numerical ODE solver. Instead, it is common to use more
Euler’s method of numerically solving ODEs 55
d2 x
m = mg − cv 3 (2.7.8)
dt
Using v = dx/dt, we can rewrite the ODE using Euler’s method
xi = xi−1 + vi−1 dt
c 3 (2.7.9)
vi = vi−1 + g − vi−1 dt
m
Python Code
The Python code for Euler’s method is below. We begin the code by defining the
necessary parameters. Recall that [Link] creates a list of values that starts at the
first argument, but ends one step (third argument) before the second argument. Hence,
we use t_max + dt to ensure the list of times ends at t = 1. Notice that after defining
the necessary parameters, a for loop was used to calculate each iteration of Euler’s
method. Like [Link], for ends one step before its second argument. Hence, we
need to use num_steps + 1 as the second argument to ensure x and v are calculated
for the full time range. The plots of x and v can be found in Figure 2.9.
56 Single-Particle Motion in One Dimension
for i in range(1,num_steps+1):
x[i] = x[i-1] + v[i-1] * dt
v[i] = v[i-1] + f(v[i-1]) * dt
Figure 2.9: Plots of (a) x(t), and (b) v(t) for Examples 2.8 and 2.9. Notice that the position
x(t) increases linearly with time after the velocity v(t) becomes constant.
Python Code
To use odeint() in this example, we need to rewrite Fd = m g − c v 3 as system of two
first-order ODEs, similar to Euler’s method in Example 2.8:
dx
=v
dt (2.8.1)
dv c 3
=g − v
dt m
In the code we define a function deriv(y,time) whose arguments are a vector y and the
time variable time. In our example, the first component y[0] of the vector y represents
58 Single-Particle Motion in One Dimension
the position x, and the second component y[1] is the speed v = dx/dt. The function
deriv evaluates and returns a vector with components (v, dv/dt).
The function odeint(deriv, yinit, t) is called with three arguments. The first ar-
gument is the function deriv which contains the information on the first-order ODE
to be solved, the second argument is the initial conditions vector yinit, and the third
argument is the time variable t.
The line t = [Link](0, 1, 20) defines the time interval over which the ODE
will be integrated, in this case between t = 0 and t = 1 s. The variable yinit = (0,0)
defines the initial conditions x(0) = 0 m, and v(0) = 0 m/s. Note that the result of
odeint is a matrix, where the first row soln[:,0] is the position x(t), and the second
row soln[:,1] is the speed v. The rows are used in the plot commands at the end of
the code, with the result shown in Figure 2.9.
Mathematica Code
The command NDSolve is used to solve the ODE
d2 x
m = m g − c v3
dt2
We store the solution found by NDSolve in the variable soln. The first argument of
NDSolve is a list which includes the ODE (note the == sign as opposed to =), and also
Evaluation of integrals with numerical integration functions 59
contains the initial conditions. Primes are used to denote derivatives in Mathematica.
The second argument of NDSolve is the function being solved for, in this case x(t). The
third and final argument is the range of times.
In this example we let Mathematica adjust automatically the integration conditions,
to ensure that the solution converges. However, if desirable, the number of integration
steps and the integration step size can be specified using the options for NDSolve listed
in Mathematica’s help files.
When creating the plots, notice that we use the “replace with” command /., in
order to specify that x[t] and x'[t] are found using the result of NDSolve stored in
soln.
SetOptions[Plot, Frame->True, Axes->False, BaseStyle->{FontSize->16}];
tMax = 1.0;
{t, 0, tMax}];
Although this integral can be done analytically, we will solve it using quad and
NIntegrate.
Python Code
The command quad from SciPy’s integrate library is used for numerical calculations
of integrals. The function to be integrated F is first defined as a lambda function, using
the command lambda. Lambda functions are useful when a function needs to only be
used for a short time in the code. The quad command has three arguments, the function
to be integrated, the lower limit, and the upper limit of integration. The output is a
tuple. The tuple’s first argument is the value of the integral, and the second argument
is the estimated absolute error on the integration procedure.
print('-'*28,'CODE OUTPUT','-'*29,'\n')
integral = quad(F,0,3)
Mathematica Code
In Mathematica, NIntegrate is used to evaluate the definite integral after defining
the necessary parameters.
a0 = 0.3; ω = 1.5; ϕ = π/3;
0.543057
Simpson’s rules for numerical evaluation of integrals 61
where f (x) is a function of a single variable and x0 and xN are constant limits of integration.
Recall that integrals measure the area between the function f (x) and the x-axis.
In introductory calculus, the trapezoid rule approximates the area under f (x) by the
area of a trapezoid, whose four corners are the limits of integration on the x-axis and the
value of the function at those limits.
Z xN
xN − x0
f (x′ )dx ≈ [f (xN ) − f (x0 )] (2.10.2)
x0 2
Simpson’s rule estimates the value of the integral by breaking the region of integration
into two steps, by sampling the function f (x) at three points x0 , x1 , and xN , equally spaced
by a distance h. The formula for Simpson’s rule is:
Z xN
h
f (x′ )dx′ ≈ [f (x0 ) + 4f (x1 ) + f (xN )] (2.10.3)
x0 3
However, both the trapezoid rule and Simpson’s rule are often not accurate enough
for practical calculation. We can improve upon Simpson’s rule by breaking the interval of
integration up into even more steps, each separated by a distance h. The result is called the
extended Simpson’s rule
Z xN
h 1
f (x′ )dx′ = (f1 +4f2 +2f3 +4f4 + · · · + 2fN −2 + 4fN −1 + fN ) + O (2.10.4)
x1
3 N4
Python Code
In the code we calculate the integral using the extended Simpson’s rule, and also
using SymPy for an exact solution. After defining the force function F, we compute the
integral. The coefficients used in the extended Simpson’s rule depend on the index of
each term in the right-hand side of (2.10.4). The coefficient of fi is 4 when i is even, and
is 2 when i is odd, except for i = 1 and i = N . In order to handle these dependencies,
we used the if and elif conditional statements. The if statement tests whether or
not a condition is true and if so, the indented line is executed.
The first if statement tests to see if i = 1 or i = N . If so, then the term hF (x)/3 is
added to the sum. Notice that the variable extended contains the sum of the terms on
62 Single-Particle Motion in One Dimension
the right-hand side of (2.10.4), and that the command +- adds to and overwrites the
variable extended. If i ̸= 1 or N , then the next conditional statement is evaluated.
The next conditional statement is elif, or else-if, which tests to see if i is even by
calculating i modulo 2. In Python, the % symbol is used for the modulo calculation. The
elif statement provides an additional conditional statement to test after the first if
statement, and it is useful when there are multiple possible outcomes for a conditional
(in this case i can be even, odd, 1, or N ). Finally, if none of the above conditional
statements return True, then i must be odd. The else conditional statement tells
Python what to execute if no other prior conditionals are true; in this case, the term
4
3 hF (x) is added to the sum.
import numpy as np
from sympy import integrate, pi, sin, symbols
t = symbols('t')
print('-'*28,'CODE OUTPUT','-'*29,'\n')
def F(t):
return a0*[Link](omega*t + phi)**2
for i in range(0,N):
x = a + i*h
if i==0 or i==(N-1):
extended += h*F(x)/3.0
elif i%2 == 0:
extended += 2.0*h*F(x)/3.0
else:
extended += 4.0*h*F(x)/3.0
Newton’s second law gives the equation of motion for a particle. This equation of
motion is a differential equation and can be written in three forms:
d2 x dv dv
F =m =m = mv
dt2 dt dx
F = m dv
dt is a first-order ODE, because the highest derivative is a first derivative.
2
F = m ddt2x is a second-order ODE, because the highest derivative is a second
derivative.
The number of arbitrary constants in the general solution of an ODE is equal to the
order of the ODE.
The magnitude of the air resistance f (v) has, in general, both a linear and a
quadratic component in v:
f (v) = bv + cv 2
We find the terminal velocity for a falling object by setting the air resistance force
to be equal to the weight of the object, f (v) = bv + cv 2 = mg.
When the force is a function of the position only, F (x), we can integrate Newton’s
second law in the form:
dv
F (x) = ma = mv
dx
to obtain the function v(x). Then integrate once more the v(x) = dx/dt equation to
obtain the position x(t).
An important system in mechanics is the mass-spring system described by Hooke’s
Law:
d2 x
F (x) = m 2 = −kx
dt
64 Single-Particle Motion in One Dimension
With the initial conditions v(0) = 0 and x(0) = x0 at t = 0, this equation has
solutions x(t) and v(t) given by:
r ! r !
k k
x(t) = x0 cos t v(t) = dx/dt = −ωx0 sin t
m m
and the mass oscillates about the equilibrium position x0 with the natural frequency ω
of the oscillator: r
k
ω=
m
Euler’s method is a simple numerical technique for integrating differential equations
which uses the derivative of the function to approximate future values of the differential
equation’s solution.
dN
= −λN (2.12.1)
dt
where λ > 0. Solve this differential equation by hand in the case where N (0) = N0 .
Plot N (t) as a function of time for various values of λ and various values of N0 . How
does the size of λ affect the solution? What happens to the solution if you change N0 ?
2. In Chapter 6, we will see the following differential equation:
d2 x
= −ω 2 x (2.12.2)
dt2
where x(t) is the position of a particle as a function of time. One method of solving
second-order differential equations is by using a trial solution. In this case, the equation
says that the second derivative of the function x(t) returns itself with a constant and
negative sign. What functions behave this way? Certainly sine and cosine however, an
exponential solution x(t) = Aeλt would also work. Insert into the differential equation
the exponential function as a trial solution. What values of λ are required in order for
Aeλt to be a solution to the differential equation?
3. Consider the linear differential equation ẍ + ẋ + x = f1 (t) + f2 (t), where f1 and f2
are smooth continuously differentiable functions of time. In this case, the ODE is
called a nonhomogeneous differential equation, because there are terms in the ODE
which explicitly depend on the independent variable, t. Suppose that you know two
functions, x1 (t), which solves the ODE ẍ1 + ẋ1 + x1 = f1 (t), and x2 (t), which solves
the ODE ẍ2 + ẋ2 + x2 = f2 (t). Show that the solution to ẍ + ẋ + x = f1 (t) + f2 (t) is
x(t) = x1 (t) + x2 (t). Generalize this proof to the solution of the ODE: ẍ + ẋ + x =
PN
i=1 fi (t), where you know all xi (t), each of which solves ẍi + ẋi + xi = fi (t).
End-of-chapter problems 65
4. Prove that the result from Problem 3 holds for any linear nonhomogeneous ODE.
7. Victor slides a puck with mass m up a long ramp with a coefficient of kinetic friction
µ. The ramp makes an incline θ with the horizontal. If the puck starts at the bottom
of the ramp with an initial velocity of v0 , find how far up the ramp the puck goes
before coming to a stop. Find the puck’s position and velocity as a function of time.
8. An airplane flying at an altitude H needs to drop supplies at the center of a small
village. The plane is flying horizontally with a speed v0 . Neglecting air resistance,
how far ahead of the village’s center should the pilot drop the supplies in order for
the supplies to land in the center of the village?
9. A ball with mass m is thrown up an incline plane with a speed v0 . The plane has an
incline of θ with the horizontal, and the ball is thrown at an angle ϕ with respect to
the horizontal direction. Neglecting air resistance,
a. Show that the range of the ball is
10. Consider the double Atwood machine shown in Figure 2.10. Compute the acceler-
ation of the mass m1 in terms of g, M , and m2 . Ignore friction and assume the pulleys
are massless and the strings are massless and inextensible.
66 Single-Particle Motion in One Dimension
m
m 2
1
Figure 2.10: A double Atwood machine in Problem 2.10.
11. A particle of mass m starts at position x0 with speed v0 , and experiences the
following forces (assume all constants a, b, A and ω are positive). Find x(t) and/or
v(t), both analytically and using a CAS.
a. F = a + b t
b. F = A cos(ω t)
c. F = a t e−bt
12. A 1.0 kg particle experiences a force F = −ae−βt , where a = 0.5 N, β = 0.25 s−1 ,
and the minus sign denotes that the force opposes the particle’s velocity. If the parti-
cle’s initial position and velocity are x0 = 0 m and v0 = 10 m/s, find the position and
velocity of the particle as a function of time. Do the problem analytically and using a
CAS.
13. Lilly repeats Victor’s experiment (from Problem 7) but her ramp starts horizontal
and increases its inclination at a rate of ω rad/s. How far along the ramp has Lilly’s
puck traveled by the time the ramp has an incline of π/3 radians with respect to the
horizontal? The coefficient of friction between the puck and the ramp is µ. Give the
result in terms of ω, v0 , µ, and g.
Section 2.5: Air Resistance and Velocity-Dependent Forces
14. Find the terminal velocity of a sphere with a 0.25 meter diameter and mass m
experiencing a linear and quadratic air resistance, as well as a gravitational force,
i.e., F (v) = b v + c v 2 − m g. Using numerical methods, find and plot the particle’s
position and velocity as a function of time if the particle is released from rest at a
height y0 = H. To make the plot, use the equation for the coefficients b and c from
Section 2.5, and set m = 1 kg and H = 100 m.
15. An object of mass m experiences a force, F (v) = −cv 2 . What are the SI units of c?
If the particle starts at the origin with an initial velocity v(0) = v0 , find the particle’s
position and velocity as a function of time. Use a CAS to verify your results.
End-of-chapter problems 67
16. A ball is thrown upwards with an initial velocity of 10 m/s. The ball has a mass
m =0.10 kg and experiences a drag force F = −bv that scales linearly with the ball’s
velocity with b = 0.2:
a. What are the SI units of b?
b. How high does the ball travel? Compare your answer to the one you would get
in the case of no air resistance.
17. In Example 2.4 we saw that the position and velocity of a falling particle in the
presence of linear air resistance are:
m v0
1 − e− m
bt
x(t) = x0 + (2.12.4)
b
v(t) = v0 e− m
bt
(2.12.5)
By taking the limits of t → 0 and t → ∞, discuss whether these equations make sense
for the position and velocity of a particle falling under the forces of gravity and linear
drag.
18. An object is thrown vertically upward with an initial velocity v0 .
a. Find the amount of time it takes for the object to reach its highest point when
there is no air resistance.
b. How much time is required for the object to reach its maximum height if there
is linear air resistance F = −b v?
c. How about the case of a quadratic air resistance F = −b v 2 ? Use a mass m = 1
kg, v0 = 10 m/s for the ball’s initial velocity, and b = 0.2 (SI units) for the
coefficients of both types of drag forces.
19. Repeat Example 2.5 in this chapter, by using a computer algebra system. The force
in this example is given by F (v) = −bv+mg. Find y(t) and v(t), and plot the solutions
for m = 1.0 kg, b = 0.2 Ns/m, x0 = 0 m, and v0 = 0 m/s. Using the CAS, take the
limit of v(t) as t → ∞. You may need to do a little extra work to manipulate the
solution provided by your CAS, so that it looks like the results found in Example 2.5.
This is not unusual, and one should expect to need to do some algebraic manipulation
of a computer-generated solution, in order to put it into a form that is more easily
readable. Another reason why one should not forego their algebra skills and rely solely
on computers!
20. Evelyn repeats Victor’s experiment from Problem 7. However, this time, the ramp
Evelyn is using exerts a force of F (v) = −cv 2 on the puck instead of the usual force of
friction, µN . If the initial velocity of the puck up the ramp is v0 , how far up the ramp
does the puck travel? How much time is required for the puck to reach its maximum
height?
21. Consider a boat of mass m moving through water experiencing a resisting force,
F (v) = −aebv . The boat starts at the origin with a velocity of v0 .
a. Find the boat’s velocity as a function of time, both analytically and using a CAS.
22. Consider a spherical raindrop with a diameter of 0.5 mm falling through the air at a
velocity of 1.0 m/s at time t = 0.
a. Which is the dominant form of air resistance acting on the raindrop, linear or
quadratic?
b. Find an equation that describes the motion of the raindrop and compute the
raindrop’s terminal velocity.
23. A mass m with an initial velocity of v0 is sliding along a horizontal surface. The mass
experiences a resistance, F (v) = −cv 3/2 . If the mass starts at the origin, what is the
maximum distance traveled by the mass?
24. Sarah, who has a mass of 55 kg, parachutes out of an airplane flying at an altitude of
3 km.
a. How long will it take her to fall if the parachute fails to open and air resistance
is ignored?
b. How long will it take her to fall if the parachute opens? Assume that the parachute
opens immediately and that the drag force on Sarah with the parachute open is
described by,
1
f = − cd ρAv 2 (2.12.6)
2
where the drag coefficient for the parachute with an area A=46 m2 is cd = 1.5.
The density of air is ρ = 1.22 kg/m3 .
25. Consider a falling object whose mass is 1 kg and experiences an air resistance force
of F (v) = −c |v| v, where c = 0.5 Ns2 /m2 .
a. Assuming the falling object starts at rest, use a computer to calculate the time
it takes the object to fall a distance of 1 km.
b. Does the velocity of the falling object ever become constant? In other words, is
there a terminal velocity for this force?
27. Find the velocity v(x) and position x(t) of a particle of mass m starting at rest at
the origin experiencing the force F = a + b x where a, b are constants with appropriate
SI units. For simplification, use the numerical values a = 2 , b = 2 and mass m = 2.
28. Compute the value of the acceleration due to gravity as a function of an object’s
height y above the Earth’s surface. Plot your result from y = 0 to 25 km. Hint: Use
Newton’s universal law of gravitation:
Gm1 m2
Fg = − (2.12.7)
r2
where G = 6.67 × 10−11 Nm2 /kg2 is the universal gravitation constant, m1 and m2 are
the masses of the interacting bodies, and r is the distance between the centers of m1
and m2 . Assume that the falling object is a point particle and ignore air resistance.
End-of-chapter problems 69
29. As found in Problem 28, the acceleration of a falling object is not constant with
height. It turns out that the acceleration varies as:
9.8 m/s2
g= 2 (2.12.8)
1 + Rye
where Re = 6.37 × 106 m is the radius of the Earth, y is the altitude of the object
above the Earth’s surface, and g is in m/s2 . Compute the time it takes for a m = 1
kg object with a diameter D = 1 m to fall from an altitude of 25 km and land on the
Earth’s surface, assuming quadratic air resistance. What is the object’s final velocity?
You will need a computer to solve this problem.
30. A particle of mass m experiences a force F = cvx, where c > 0 and x, v are the position
and speed. If at t = 0, the particle is passing through the origin with a velocity v = v0 ,
find the particle’s position as a function of time.
Section 2.7: Numerical Methods
31. Using Euler’s method, solve the ODE from Problem 1 with N0 = 105 particles
and λ = 0.1 s−1 for 0 ≤ t ≤ 10 seconds. Plot the Euler solution and the exact
analytical solution N = N0 exp (−λ t) on the same graph. The function N (t) should
decay exponentially. Choose a small enough value of dt such that you get the correct
functional form.
d2 x
= −ω 2 x (2.12.9)
dt2
Rewrite the ODE as a coupled system of first-order ODEs using the variable v = dx/dt.
Use ω = 1 rad/s and Euler’s method to solve the coupled ODEs with an initial
condition of x(0) = 1.0 m and v(0) = 0 m/s for the time range 0 ≤ t ≤ 30 s. Use
dt = 0.01 s.
34. Consider Problem 33. Repeat the problem, using larger values of dt. What happens
to the solution when dt gets too large? Plot your result for different values of dt.
35. The Euler-Cromer method produces solutions that are stable for oscillatory sys-
tems. Consider an ODE in the form of Newton’s second law
d2 x
=a (2.12.10)
dt2
where a is an acceleration (not necessarily constant) and we have set the mass m = 1
(SI units). Using the variable v = dx/dt, (2.12.10) can be rewritten using the Euler-
Cromer method as
)
vn+1 =vn + an dt
(2.12.11)
xn+1 =xn + vn+1 dt
70 Single-Particle Motion in One Dimension
Note the subscript for v in the second line of (2.12.11). Using Python, write an al-
gorithm which solves (2.12.10) using the Euler-Cromer method with the same initial
conditions and parameter values as Problem 33.
Write a program which uses the Midpoint Rule to solve Example 2.10, in which we
evaluated the integral
Z 3
v(3) = a0 sin2 (ωt + ϕ) dt (2.12.13)
0
2
where a0 = 0.3 m/s , ω = 1.5 rad/s, and ϕ = π/3 radians.
Compare the result of the Midpoint Rule with the extended Simpson’s rule (using the
same step size), and by using the quad library from SciPy.
39. The velocity of a particle (in SI units) can be described using the function
where λ = 0.001 s−1 and ω = 1.0 rad/s. Assume the particle starts at the origin.
a. Evaluate the position of the particle x(t) analytically and using a CAS.
where p is the momentum of a particle experiencing the force F (t). Suppose a mass
End-of-chapter problems 71
m =1.0 kg experiences a force F (t) = c/ t3 + b3 where b = 1.0 s and c = 2.0 Ns3 .
Using a numerical integration technique of your choice, find the momentum of the
particle at a time t = 2.5 seconds. Assume the particle is at rest at a time t0 = 0.
3 Motion in Two and Three
Dimensions
In the previous chapter, the kinematics and dynamics aspects of particle motion were exam-
ined in one dimension by using the scalar position parameter x. In this chapter, we will first
describe the motion of particles in two and three dimensions using Cartesian coordinates
(x, y, z). Describing motion in two and three dimensions requires the use of vectors. After
reviewing the basic properties of vectors and introducing the dot and cross products, we
will introduce vector derivatives. Vector derivatives are necessary in order to compute the
velocity and acceleration vectors. We then describe polar, cylindrical, and spherical coordi-
nates, and demonstrate how to describe a particle’s position, velocity, and acceleration in
those coordinate systems. Finally, we conclude the chapter with special vector derivatives
commonly used in all fields of physics, such as the gradient, the divergence, and the curl.
The magnitude of a vector is often thought of as its length and would correspond to a
quantity measured from the vector. For example, suppose A represents the position of a
particle located at the point A = 3 mî + 4 mĵ. The magnitude of A is |A| = 5 m and
represents the distance between the particle and the origin.
It is often useful to know the direction in which a vector points. This is easily found
for simple vectors like A = 3î, which points along the x-axis. However, other vectors like
A = aî + bĵ do not lie along either the x- or y-axis. In that case, we need a unit vector
which points in the same direction as the vector A but has a length of 1. We can obtain a
unit vector  in the direction of any vector A, by dividing A by its magnitude:
A A
 = =q (3.1.3)
|A| Ax + A2y + A2z
2
73
74 Motion in Two and Three Dimensions
Find a unit vector along the direction of the vector a=[1, 3, −1].
Solution:
We write the vector as a = ax î + ax ĵ + ax k̂ = 1î + 3ĵ − 1k̂. In order to find the unit
vector, divide the vector with its magnitude:
Python Code
As we saw in Chapter 1, vectors in Python can be described using the CoordSys3D
command imported from the [Link] library. Within this library we define a
coordinate system C= CoordSys3D('C') in which the Cartesian coordinates (x, y, z)
are represented internally as C.x, C.y, C.z. The corresponding unit vectors î, ĵ, k̂,
are represented by C.i, C.j, C.k. There is nothing special about choosing the letter
C; any other letter could have been chosen instead.
The vector a=[1, 3, −1] is represented as a = 1*C.i +3* C.j - C.k and we use the
[Link] method √ to find the unit
√ vector â. Note that SymPy does not automatically
simplify the term 11/11 into 1/ 11.
print('-'*28,'CODE OUTPUT','-'*29,'\n')
Mathematica Code
In the Mathematica code, the vector is represented as A={1,3,-1} and we use the
Norm(A) command to find the magnitude of the given vector. We normalize the vector
by dividing by its magnitude.
Position, velocity, and acceleration in cartesian coordinate systems 75
A = {1, 3, −1};
If we know the coordinates of two points P1 and P2 in space, then we can find the
vector connecting these two points by subtracting their respective x-, y-, z-components. For
example, in Figure 3.1b, let r1 be the vector from the origin to P1 , and r2 the vector from
the origin to P2 . The vector r12 from P2 to P1 can be drawn by the head-to-tail method,
and is given by (see Figure 3.1b):
r12 = r2 − r1 (3.1.4)
Now that we have covered some of the basic concepts behind vectors, we can apply
them to the basic descriptors of motion. As discussed in Chapter 1, the position vector
function r(t) = (x(t), y(t), z(t)) for a particle in three dimensions as described by Cartesian
coordinates is written as:
Position Vector
This is a vector-valued function, and x(t), y(t), z(t) are the scalar functions representing
the position along the x-, y-, and z-axis at time t, respectively. The vector r(t) has its tail
at the origin, and its head at the position of the particle at time t. The magnitude of the
position vector is equal to the distance between the particle and the origin.
(a) (b)
Figure 3.1: (a) Cartesian components of vector A = Ax î + Ay ĵ + Az k̂; (b) The vector
r12 = r2 − r1 connecting two points P1 and P2 in space.
76 Motion in Two and Three Dimensions
The derivative of the position vector is the velocity v(t) of the particle. To find the
velocity, we need to know how to differentiate vectors. Figure 3.2 illustrates the derivative
of a vector function r. Without loss of generality, r can be thought of as a position vector;
however, what follows is true for any vector. For the derivative of a vector function to
exist, the vector function must be a continuous function of the scalar variable t. The vector
function r(t) is shown as the dashed line in Figure 3.2, where the vector r is shown at
times t and t + ∆t. The vector ∆r = r(t + ∆t) − r(t) represents the change in the value of
the vector function and will decrease in magnitude as ∆t → 0. Therefore, we can find the
derivative using the standard formula:
dr(t) d
= x(t)î + y(t)ĵ + z(t)k̂ (3.1.9)
dt dt
d d d
= x(t)î + y(t)ĵ + z(t)k̂ (3.1.10)
dt dt dt
However, the unit vectors in Cartesian coordinates are constant vectors. Therefore, the
velocity vector can be found as:
Velocity Vector
dr dx dy dz
v(t) = = î + ĵ + k̂ (3.1.11)
dt dt dt dt
Because the velocity vector is the derivative of the position vector, the velocity vector
is going to be always tangent to the path followed by the particle.
The magnitude v(t) of the velocity vector v(t) is called the speed:
s 2 2
2
dx dy dz
v(t) = |v(t)| = + + (3.1.12)
dt dt dt
Equation (3.1.12) can also be written in terms of the arc length s along the curve C de-
scribing the motion, as measured from some initial position along the curve. In order to use
the arc length, we need to define an infinitesimal displacement along the curve,
ds = dx î + dy ĵ + dz k̂ (3.1.13)
Position, velocity, and acceleration in cartesian coordinate systems 77
Figure 3.2: The vector function r is illustrated at times t and t + ∆t. In the limit ∆t → 0,
the vector ∆r/∆t becomes the derivative vector function dr/dt, which is tangent to the
curve.
The differential distance ds is the magnitude of the infinitesimal displacement and is given
by q
2 2 2
ds = (dx) + (dy) + (dz) (3.1.14)
Equation (3.1.12) can now be written in terms of the arc length s, as:
ds
v(t) = |v(t)| = (3.1.15)
dt
A unit tangent vector v̂ along the curve C describing the motion is obtained by dividing
the velocity vector v(t) by its magnitude v:
v(t)
v̂ = (3.1.16)
v(t)
Note that the unit tangent vector v̂ points along the direction of the velocity and is always
tangent to the curve C. An example of how to calculate the unit tangent vector is given in
Example 3.2.
Similarly, the derivative of the velocity vector dv/dt is the acceleration vector function,
which in Cartesian coordinates is:
Acceleration Vector
dv d2 r d2 x dy 2 d2 z
a(t) = = 2 = 2 î + 2 ĵ + 2 k̂ (3.1.17)
dt dt dt dt dt
Solution:
(b) The unit vector v̂, which is tangent to the curve C at any time t, is found from:
v(t) 1 dx(t) dy(t) dz(t)
v̂ = = î + ĵ + k̂
v(t) v(t) dt dt dt
By evaluating the derivatives and substituting the speed v(t) from part (a):
1 1
v̂ = 2 cos(2t)î + 2tĵ = q 2 cos(2t)î + 2tĵ
v(t) 2 2
[2 cos(2t)] + (2t)
The next example shows how to calculate the position vector when one is given an
acceleration vector. As you might expect, the problem involves integrating the acceleration.
Solution:
Since a(t) = dv(t)/dt, we can find the velocity and position by integration. Just like
differentiating a vector, integrating a vector can be done one component at a time:
Z
v(t) = a(t)dt
Z
= sin (2t) î + cos (2t) ĵ dt
Z Z
= sin (2t) îdt + cos (2t) ĵdt
1
which gives c = 2 î.
The three vector functions r(t), v(t), and a(t) depend on the single parameter t, rep-
resenting time. If we are given the explicit functions x(t), y(t), z(t) then the path of the
moving particle can be plotted in a so-called parametric plot in three dimensions using a
computer; see Examples 3.4 and 3.5 that follow. A parametric plot uses the functions x(t),
y(t), and z(t) to graph a curve that represents the path taken by a particle. Each point in
the curve corresponds to the x-, y-, and z-coordinates for various times t.
In the case of two-dimensional motion, if we are given explicit functions x(t) and y(t), one
may be able to eliminate the variable t from the simultaneous equations x = x(t), y = y(t).
If one of these equations can be solved for t, the expression obtained can be substituted
into the other equation to obtain an expression for y(x). In some cases, there is no single
equation in closed form that is equivalent to the parametric equations. A similar process
can be used in three dimensions in order to get z(x, y). Examples 3.4 and 3.5 show how to
create parametric plots in two and three dimensions in Mathematica and Python.
y = cos(2 t) = 2x2 − 1
Python Code
We import Matplotlib and use linspace in NumPy to define the time values t. Both
the Python and Mathematica codes produce the same plot, and the result of the Math-
ematica code is shown in Figure 3.3.
import numpy as np
import [Link] as plt
[Link]("x")
[Link]("y")
[Link]()
Mathematica Code
1.0
0.5
0.0 x
-0.5
-1.0
-1.0 -0.5 0.0 0.5 1.0
Figure 3.3: Parametric plot of function (x(t), y(t)) in two dimensions, produced by the codes
in Example 3.4.
Position, velocity, and acceleration in cartesian coordinate systems 81
x = d + a cos(2 t) y = e + b sin(2 t) z = ct
where the time parameter t is in the range 0 to T . Plot the motion using the numerical
values a = 2, b = 4, c = 1, d = 1, e = 2, T = 12 (all quantities in SI units).
Solution:
The time parameter t can be eliminated from the x(t), y(t) equations by solving the
equations for cos(t) and sin(t) and substituting in the identity cos2 (u) + sin2 (u) = 1:
2 2
x−d y−e
+ = cos2 (2 t) + sin2 (2 t) = 1
a b
This is the equation of an ellipse on the xy-plane with center at (d, e). Since z = ct,
one then expects the motion to be in the form of an elliptical helix moving along the
z-axis with a uniform speed c.
Python Code
The code creates a parametric plot of these (x, y, z) equations in three dimensions.
Both the Python code and the Mathematica code produce the same plot, shown as
Figure 3.4.
x = 1+2*[Link](2*t)
y = 2+4*[Link](2*t) # define x(t), y(t), z(t)
z = t
Mathematica Code
The code in Mathematica uses the ParametricPlot3D command, and the graphics
options are set up using SetOptions[ParametricPlot3D].
82 Motion in Two and Three Dimensions
(a) (b)
Figure 3.4: Parametric plot of function (x(t), y(t), z(t)) in three dimensions, produced by
(a) Python and (b) Mathematica codes in Example 3.5.
SetOptions[ParametricPlot3D, BaseStyle->FontSize->20];
AxesLabel->{x, y, z}]
A · B = Ax Bx + Ay By + Az Bz (3.2.1)
A · B = AB cos θ (3.2.2)
where A and B are the magnitude of the vectors A and B, respectively, and θ is the angle
between the two vectors as shown in Figure 3.5. Notice that the dot product is multiplying
the magnitude of B by the component of A, which is parallel to B. A physical example
involving the dot product is the definition of work. The work done by a constant force can be
computed as W = F · r, where a force F is applied to a particle along a displacement r. The
component of the force doing work on the particle is parallel to the particle’s displacement.
Vector products 83
The dot product is used to compute the work because we need the component of F parallel
to r.
Equation (3.2.2) can be used to obtain the angle between two vectors:
A·B Ax Bx + Ay By + Az Bz
cos θ = = q q . (3.2.3)
AB Ax + A2y + A2z
2 Bx2 + By2 + Bz2
The dot product can also be interpreted geometrically as the scalar projection of vector
A on the direction of vector B, as shown in Figure 3.5. This is useful if you want to know
the component of the vector A along the direction of the vector B. First, we create the
unit vector B̂ =B/ |B| pointing in the direction of B. The scalar projection is equal to
AB = A · B̂ = |A| cos θ. The vector projection of A onto B is, projB A = AB B̂.
Figure 3.5: The scalar projection of vector A on the direction of vector B, is A·B̂ = |A| cos θ,
where B̂ is the unit vector in the direction of B.
There are several algebraic relationships for the dot products of two vectors A and B,
and most of them are intuitive. The following properties hold if A, B, and C are real vectors
and c is a scalar.
The dot product is commutative:
A·B=B·A (3.2.4)
A · (B + C) = A · B + A · C (3.2.5)
A · (cB) = c (A · B) (3.2.6)
A·B=0 (3.2.7)
The geometric interpretation of the orthogonality of vectors is that they are perpendicular,
i.e., the angle between them θ = π/2. Finally, the product rule applies to the dot product:
d dA dB
(A · B) = ·B+A· (3.2.8)
dt dt dt
84 Motion in Two and Three Dimensions
Python Code
In the Python code, the command CoordSys3D is imported from the [Link]
library, and we define a coordinate system C= CoordSys3D('N') in which the Carte-
sian coordinates (x, y, z) are represented internally as N.x, N.y, N.z. The [Link](B)
method is used to evaluate the dot product of the two vectors.
print('-'*28,'CODE OUTPUT','-'*29,'\n')
dotprod = [Link](B)
Mathematica Code
The Mathematica code uses the command Dot[A,B], and the vectors A, B are
entered in the form of lists of their Cartesian components.
A = {3, 4, −1};
The desired unit vector N in this perpendicular direction is obtained by dividing dv̂/dt
by its magnitude:
2î−4ĵ
dv̂
(5)3/2 2î − 4ĵ
N= dt
= √ = √
| dv̂
dt |
20 20
(5)3/2
Figure 3.6: (a) The cross product in respect to a right-handed coordinate system; (b) finding
the direction of the cross product by the right-hand rule; (c) the area of a parallelogram
formed by two vectors A and B, is equal to the magnitude of the cross product of these
two vectors.
A × B = a b sin θ n̂ (3.2.9)
where θ is the angle between A and B (0 ≤ θ ≤ π), a = |A| and b = |B| are the magnitudes
of vectors A and B, and n̂ is a unit vector perpendicular to the plane containing A and
B in the direction given by the right-hand rule as in Figure 3.6(a). If the vectors A and B
are parallel (i.e., the angle θ between them is either 0 radians or π radians), then the cross
product of A and B is the zero vector 0.
The magnitude of the cross product is the product of the magnitude of the vector A,
and the component of B perpendicular to A. We can compute the torque applied to a door
by using the formula N = r × F, where N is the torque applied by the force F, and r is the
vector which points from the axis of rotation to the point where the force is applied. For
a door, the vector r lies along the door, pointing from the hinges to the edge of the door,
where the force to open it is applied. We know that the component of the force responsible
for the rotation of the door is perpendicular to the door, and that the component of the
force parallel to the door is not causing the rotation. Therefore, the cross product is used
to compute the torque, because we need the component of the force perpendicular to r.
The cross product of two vectors a = [a1 , a2 , a3 ] and b = [b1 , b2 , b3 ] can also be
represented by the determinant of a formal matrix:
î ĵ k̂
a × b = a1 a2 a3 (3.2.10)
b1 b2 b3
This determinant can be expanded by using cofactor expansion along the first row to yield:
a2 a3 a a3 a a2
a×b= î − 1 ĵ + 1 k̂ (3.2.11)
b2 b3 b1 b3 b1 b2
Vector products 87
which gives the components of the resulting cross product vector directly:
a × b = (a2 b3 − a3 b2 )î + (a3 b1 − a1 b3 )ĵ + (a1 b2 − a2 b1 )k̂ (3.2.12)
Like the dot product, the cross product has some familiar algebraic identities. The cross
product is distributive with addition:
a × (b + c) = a × b + a × c (3.2.13)
Likewise, with a scalar c, we can show:
(ca) × b = a × (cb) = c (a × b) (3.2.14)
Unlike the dot product, the cross product is anti-commutative, i.e.,
b×a = −(a × b) (3.2.15)
This property is easily concluded by considering the right-hand rule; when the two vectors
are interchanged, the sign of the cross-product vector is reversed. The product rule for
derivatives also applies to the cross product:
d da db
(a × b) = ×b+a× (3.2.16)
dt dt dt
î ĵ k̂
4 −1 3 −1 3 4
A×B= 3 4 −1 = î − ĵ + k̂ = −5î + 2ĵ − 7k̂
−1 −1 1 −1 1 −1
1 −1 −1
Python Code
We define the reference frame N using CoordSys3D('N'). The [Link](B) method
is used to evaluate the dot product of the two vectors.
print('-'*28,'CODE OUTPUT','-'*29,'\n')
crossprod = [Link](B)
Mathematica Code
The Mathematica code uses the command Cross[A,B], and the vectors A, B are
entered in the form of lists of their Cartesian components.
A = {3, 4, −1};
î ĵ k̂
3 −1 1 −1 1 3
c=a×b= 1 3 −1 = î − ĵ + k̂ = 1î − 5ĵ − 14k̂.
−2 1 4 1 4 −2
4 −2 1
To find the unit vector, divide this vector by its magnitude. The magnitude of a × b
is: p √
|a × b| = 12 + 52 + (−14)2 = 222
The desired unit vector is
Python Code
In the Python code, we define a coordinate system C= CoordSys3D('N') and the
[Link](B) method is used to evaluate the cross product of the two vectors. The
.normalize method is used to find the unit vector along the direction of the cross
product.
Vector products 89
print('-'*28,'CODE OUTPUT','-'*29,'\n')
crossprod = [Link](B)
answer = [Link]()
print('The normalized vector is = \n',answer)
Mathematica Code
In the Mathematica code below, we use the Cross[A,B] command to find the cross
product, and we use the Norm(c) command to find the magnitude of the given vector.
A = {1, 3, −1};
c = Cross[A, B];
A useful mathematical construction involving the cross product is the triple product,
which is used in two different forms.
The scalar triple product of three vectors is defined as
a · (b × c) (3.2.17)
Notice that this expression means that we first calculate the cross product of vectors b
and c, followed by the dot product between the vectors a and b × c. The magnitude of the
triple scalar product represents the volume V of the parallelopiped with edges a, b, and
c. Since these three vectors a, b, c can be interchanged, the following three scalar triple
products are equal to each other and to the volume V :
a · (b × c) = b · (c × a) = c · (a × b) = V (3.2.18)
90 Motion in Two and Three Dimensions
The vector triple product is the cross product of a vector with the result of another cross
product and is related to the dot product by the following identity:
The mnemonic “BAC minus CAB” is often used to remember the order of the vectors
in the right-hand side of this equation. This formula is used in physics to simplify vector
calculations. Another useful identity relates the cross product to the scalar triple product:
(a × b) × (a × c) = (a · (b × c))a (3.2.20)
a · (b × c) = b · (c × a)
Python Code
In the coordinate system N the vector ax î + ay ĵ + az k̂ is written as
ax*N.i+ay*N.j+az*N.k. The [Link](B) and [Link](B) method are used to evalu-
ate the cross and dot product of the two vectors. The identity is tested by using the
double equal logical sign ==, which evaluates here as True.
Mathematica Code
By combining the Dot and Cross commands, the identities are verified in the code
below. The two sides of the identities are set equal, by using the Boolean equality sign
== and Mathematica returns True for the logical statements.
x = r cos θ (3.3.1)
y = r sin θ (3.3.2)
We can also write the position vector as a complex number in the following form by
using Euler’s equations:
z = x + iy = r(cos θ + i sin θ) = reiθ (3.3.5)
and the complex conjugate of this complex number is:
z̄ = r(cos θ − i sin θ) = re−iθ (3.3.6)
Figure 3.7: The radius r and angle θ locate a particle in polar coordinates, and they also
represent a complex number: z = x + iy = r(cos θ + i sin θ) = r eiθ . The two unit vectors
r̂ and θ̂ (in blue in the e-book) in polar coordinates change direction as the particle moves
in the xy-plane along a curved path (in red in the e-book).
By adding and subtracting the last two equations, we obtain Euler’s formulas for sine
and cosine functions. These equations provide a powerful connection between analysis and
trigonometry and should be memorized.
Euler’s Identities
eiθ + e−iθ
cos θ = (3.3.7)
2
eiθ − e−iθ
sin θ = (3.3.8)
2i
eiθ = cos θ + i sin θ (3.3.9)
e−iθ = cos θ − i sin θ (3.3.10)
While polar coordinates can be convenient for describing the position of a particle,
especially a particle constrained to move along an arc or a circle, the unit vectors require
special attention. In Cartesian coordinates, the unit vectors î and ĵ always point along the
x- and y-axis respectively, regardless of the particle’s location. However, the directions of
the unit polar vectors r̂ and θ̂ change with the location of the particle. This can be clearly
seen in Figure 3.7.
The unit vector r̂ always points in the radially outward direction. The position vector
of the particle moving in the xy-plane can be written in terms of the unit vector r̂ as:
r = rr̂ (3.3.11)
Position, velocity, and acceleration in non-cartesian coordinate systems 93
In order to find the velocity and acceleration in polar coordinates, we first need to write
the unit vectors r̂ and θ̂ in terms of î and ĵ. Using the geometry shown in Figure 3.7, we
can write:
r̂ = cos θ î + sin θ ĵ (3.3.12)
θ̂ = − sin θ î + θ̂ cos θ ĵ (3.3.13)
where as expected |θ̂| = |r̂| = 1, and the two unit vectors are perpendicular to each other,
i.e., θ̂·r̂ = 0.
The unit vectors r̂ and θ̂ vary in direction with time, and we can calculate their time
derivatives by using the chain rule:
d d h i dθ dθ dθ h i
r̂ = cos θî + sin θĵ = − sin θ î + cos θ ĵ = − sin θî + cos θĵ (3.3.14)
dt dt dt dt dt
By combining the previous two equations, we obtain:
dr̂ dθ
= θ̂ (3.3.15)
dt dt
By working in a similar manner, we obtain the time derivative of the unit vector θ̂:
dθ̂ dθ
= − r̂ (3.3.16)
dt dt
We can now calculate the velocity vector in polar coordinates by taking the first time
derivative of the position vector r:
dr d dr dr̂
v= = (rr̂) = r̂ + r (3.3.17)
dt dt dt dt
By substituting (3.3.15) into (3.3.17), we obtain the velocity vector in polar coordinates:
dr dr dθ
v= = r̂ + r θ̂ (3.3.18)
dt dt dt
The two components of the velocity in this equation have distinct physical meanings.
The first term vr = dr
dt r̂ represents the radial component of the velocity, which points along
the radius r. The second term vθ = r dθ dt θ̂ = rω θ̂ is proportional to the angular velocity
ω = dθ/dt, and represents the velocity of the particle along the θ̂ direction. This second
component also represents the velocity of uniform circular motion.
From (3.3.18), we obtain the infinitesimal displacement ds between two points in space
in polar coordinates by canceling the differential time dt from both sides of this equation:
ds = drr̂ + rdθθ̂ (3.3.19)
Based on this expression, the infinitesimal area element dA in polar coordinates can then
be written as:
dA = dxdy = rdθdr (3.3.20)
and we can calculate double integrals of any function f (x, y) in polar coordinates by using
the transformation:
Z Z Z Z
f (x, y) dxdy = f (r cos θ, r sin θ) r dr dθ (3.3.21)
In summary, the unit vectors in polar coordinates and their derivatives are given by:
94 Motion in Two and Three Dimensions
The following example shows how to create polar plots in Python and Mathematica.
Python Code
The Python code defines the range of the radius using linspace and the polar plot
is set up using subplot(111,projection='polar') from the matplotlib graphics
library.
import numpy as np
import [Link] as plt
ax =[Link](111,projection='polar')
[Link](theta,r)
ax.set_rticks([0.5, 1, 1.5, 2]) # set values of radial ticks
[Link]()
Mathematica Code
The polar plot is created using the PolarPlot command, and the graphics options
are set up using SetOptions[PolarPlot].
Polar coordinates are very useful in describing the motion of celestial bodies around
each other, as we will explore in detail in a later chapter. The following example shows
how polar coordinates can simplify the mathematical description of the elliptical motion of
planets around the Sun.
Position, velocity, and acceleration in non-cartesian coordinate systems 95
1.0
0.5
0.0 x
-0.5
-1.0
-1.5
Figure 3.8: Polar plot of function r = θ/2π produced by (a) Python, and (b) Mathematica,
in Example 3.11.
or in parametric form
x = a cos θ y = b sin θ.
(a) Use the symbolic capabilities of Mathematica to show that the general equation for
this ellipse in polar coordinates is:
ab
r= √ (3.3.25)
a2 − c2 cos2 θ
√
where c = a2 − b2 (with a > b). √
(b) Show that by shifting the x-axis by the quantity c = a2 − b2 , the equation of
the ellipse in polar coordinates simplifies to:
b2 /a a 1 − e2
r= = (3.3.26)
1 + (c/a) cos θ 1 + e cos θ
p
where e = c/a = 1 − b2 /a2 (with a > b) is the eccentricity of the ellipse.
As we will see in Chapter 9, this expression is fundamental in the mathematical
description of planetary motion, with the Sun located at one of the foci of this ellipse.
(c) Plot the above expressions of the two ellipses and in Mathematica using the
PolarPlot command.
Mathematica Code
96 Motion in Two and Three Dimensions
(a) The code performs the necessary algebraic steps for deriving (3.3.25), and then
it plots the ellipse with parameters a √= 2.2, b = 1.1. After defining the parametric
forms x = a cos θ and y = b sin θ = b 1 − cos2 θ, the code uses the Solve command
to find the distance r as a function of cos θ. The command “replace with” /. is used
to define a parameter rellipse for the desired equation r = r(θ). Since there are two
solutions obtained from the Solve command, we chose the positive solution by selecting
the second (positive) square root.
SetOptions[PolarPlot, BaseStyle->FontSize->16];
x = r ∗ Cos[θ];
y = r ∗ Sqrt[1 − Cos[θ]∧2];
rellipse = r/.sol[[2]]
q 1
Cos[θ]2 Cos[θ]2
1
b2
+ a2
− b2
SetOptions[PolarPlot, BaseStyle->FontSize->16];
c = Sqrt[a∧ 2 − b∧ 2];
rellipse2 = r/.sol2[[1]]//FullSimplify;
Print[rellipse2]
d d
Using the derivatives of the unit vectors dt θ̂ and dt r̂, we can now also calculate the
acceleration vector as the second derivative of the position in polar coordinates (see the
Position, velocity, and acceleration in non-cartesian coordinate systems 97
y y
1.0 1.0
0.5 0.5
x x
-2 -1 1 2 -4 -3 -2 -1
-0.5 -0.5
-1.0 -1.0
(a) (b)
Figure 3.9: Plots of the ellipses produced by Mathematica, for (a) the original ellipse and
(b) for the shifted ellipse, in Example 3.12.
h The two terms in (3.3.27) again have distinct physical meanings. The first term ar =
d2 r
i
dθ 2
− r dt
dt2 r̂ represents the radial component of the acceleration, which points along the
h 2 i
radius r. The first part of this radial term is ddt2r r̂ and represents the rate of change of the
2
radial velocity dr/dt. The second part of this radial term is −r dθ dt = −rω 2 , and points
2
in the opposite direction from the ddt2r term, and represents the centripetal acceleration
ac = v 2 /r.
The second term in (3.3.27)
2
d θ dr dθ
aθ = r 2 + 2 θ̂ (3.3.28)
dt dt dt
2
also contains two terms; the first term r ddt2θ = r dω
dt = rα is the angular acceleration along
the θ̂ direction. The last term represents the Coriolis force and will be discussed in Chapter
10.
In summary, the position, velocity, and acceleration vectors in polar coordinates are
given by:
r = rr̂ (3.3.29)
dr dr dθ
v= = r̂ + r θ̂ (3.3.30)
dt dt dt
" #
2
dv d2 r dθ d2 θ dr dθ
a= = − r r̂ + r + 2 θ̂ (3.3.31)
dt dt2 dt dt2 dt dt
98 Motion in Two and Three Dimensions
x = ρ cos θ (3.3.32)
y = ρ sin θ (3.3.33)
z=z (3.3.34)
Figure 3.10: Cylindrical coordinates (ρ, θ, z) and the corresponding unit vectors ρ̂, θ̂, ẑ.
We can define three unit vectors ρ̂, θ̂, ẑ in cylindrical coordinates, which are shown in
Figure 3.10. Since cylindrical coordinates are essentially an extension of polar coordinates in
three dimensions, we can write the unit vectors immediately by analogy with the equations
in the previous section:
Position, velocity, and acceleration in non-cartesian coordinate systems 99
Similar to the unit vectors in polar coordinates, the unit vectors in cylindrical coordinates
change direction with the location of the particle, with the exception of ẑ, which is identical
to k̂ and does not change direction. Note also that the cylindrical unit vectors are related
to the Cartesian unit vectors by a rotation matrix of the form:
ρ̂ cos θ sin θ 0 î
θ̂ = − sin θ cos θ 0 ĵ (3.3.41)
ẑ 0 0 1 k̂
We can compute the position and velocity vectors in cylindrical coordinates in a manner
similar to that used for polar coordinates. The difference is that for cylindrical coordinates
there is an additional direction, ẑ. However, ẑ does not change direction with position and
is therefore constant. Hence, the position, velocity, and acceleration vectors in cylindrical
coordinates are given by:
dr dρ dθ dz
v== ρ̂ + ρ θ̂ + ẑ (3.3.43)
dt dt dt dt
" 2 # 2
2
dv d ρ dθ d θ dρ dθ d2 z
a= = − ρ ρ̂ + ρ + 2 θ̂ + ẑ (3.3.44)
dt dt2 dt dt2 dt dt dt2
This section concludes with some additional useful expressions. By analogy to (3.3.19),
which was derived for polar coordinates, the infinitesimal displacement ds between two
points in space in cylindrical coordinates can be written as:
ds = dρ ρ̂ + ρ dθ θ̂ + dz ẑ (3.3.45)
When computing infinitesimal areas, it is important to keep in mind the specific area on
the cylinder that is relevant to your problem. For example, it is common to work with the
infinitesimal area element that is on the surface of the body of the cylinder. The infinitesimal
area element dA on the surface of a cylinder of radius ρ, can be written as:
dA = ρ dθ dz (3.3.46)
Keep in mind, however, that if one is interested in the top or bottom of the cylinder,
then the polar infinitesimal area element is written as dA = ρdρdθ. An infinitesimal volume
element in cylindrical coordinates is given by:
dV = dx dy dz = ρ dρ dθ dz (3.3.47)
100 Motion in Two and Three Dimensions
and we can calculate triple integrals of any function f (x, y, z) by using the transformation
into cylindrical coordinates:
ZZZ ZZZ
f (x, y, z) dx dy dz = f (ρ cos θ, ρ sin θ, z) ρ dρ dθ dz (3.3.48)
These triple integrals will become useful in calculating, for example, the center of mass and
moment of inertia of an object using cylindrical coordinates.
Figure 3.11: Spherical coordinates (r, θ, ϕ) and the corresponding unit vectors. The angle
ϕ is defined on the xy-plane and can vary between 0 to 2π, while the azimuthal angle θ can
vary between 0 to π only.
Similar to the unit vectors in cylindrical coordinates, the orientation of the spherical
coordinate unit vectors r̂, θ̂, ϕ̂ depends on the position of the particle. We define these
three unit vectors as shown in Figure 3.11.
These unit vectors r̂, θ̂, ϕ̂ for spherical coordinates are related to the Cartesian unit
vectors by the following equations:
Like the cylindrical coordinate unit vectors, the spherical unit vectors are related to the
Cartesian unit vectors by a rotation matrix:
r̂ sin θ cos ϕ sin θ sin ϕ cos θ î
θ̂ = cos θ cos ϕ cos θ sin ϕ − sin θ ĵ (3.3.58)
ϕ̂ − sin ϕ cos ϕ 0 k̂
In order to calculate velocity and acceleration in spherical coordinates, we need the time
derivatives of the unit vectors. They are given by (see End-of-Chapter problems for this
section):
By using these equations, it can be shown that the velocity vector in spherical coordinates
is given by:
v = ṙ r̂ + r θ̇ θ̂ + r ϕ̇ sin θ ϕ̂ (3.3.62)
Multiplying both sides of this equation by dt, we obtain the infinitesimal displacement ds
between two points in spherical coordinates:
By multiplying the coefficients of the unit vectors in this equation, the infinitesimal volume
element dV in spherical coordinates is found to be:
dV = dx dy dz = r2 sin θ dr dθ dϕ (3.3.64)
102 Motion in Two and Three Dimensions
We can also calculate triple integrals in spherical coordinates by using the transformation
equation:
ZZZ ZZZ
f (x, y, z) dx dy dz = f (r sin θ cos ϕ, r sin θ sin ϕ, r cos θ)r2 sin θ dr dθ dϕ (3.3.65)
r = rr̂ (3.3.67)
a = r̈ − rϕ̇2 sin2 θ − rθ̇2 r̂ + rθ̈ + 2ṙθ̇ − rϕ̇2 sin θ cos θ θ̂
+ rϕ̈ sin θ + 2ṙϕ̇ sin θ + 2rθ̇ϕ̇ cos θ ϕ̂ (3.3.69)
3.4.1 GRADIENT
Consider a scalar function f (x). Suppose we want to know how much the function f (x)
changes when we change its argument x by a small amount, say from x to x + dx. A Taylor
series expansion of f (x) gives:
df
f (x + dx) = f (x) + dx + · · · (3.4.1)
dx
We can ignore terms of dx2 and higher, because dx is very small. Next, we define the
differential df = f (x + dx) − f (x) and interpret it as the change of the value of f when we
change x by a small amount dx. Then from (3.4.1) we find:
df
df = dx (3.4.2)
dx
Equation (3.4.2) can be interpreted as follows. The amount df by which f changes when
x is changed (by a small amount), is equal to the product of the rate of change of f with
respect to x, and the amount by which x is changed (dx). This is similar to the familiar
equation d = vt, which says the distance traveled by a particle is the product of how fast it
is traveling (i.e., the rate v at which the distance changes with time), and of the length of
time t traveled.
Next, we can extend (3.4.2) to scalar functions in three dimensions. Let us consider a
scalar function f (x, y, z) in Cartesian coordinates. We would like to know how f (x, y, z)
Gradient, divergence, and curl 103
changes when we change each of its variables by a small amount. A multi-variable Taylor
series expansion gives:
∂f ∂f ∂f
f (x + dx, y + dy, z + dz) = f (x, y, z) + dx + dy + dz + · · · (3.4.3)
∂x ∂y ∂z
In this expression, ∂f ∂f ∂f
∂x , ∂y , ∂z are the partial derivatives of f with respect to (x, y, z)
respectively. Similar to the one-dimensional case, we define the differential as df = f (x +
dx, y + dy, z + dz) − f (x, y, z) and interpret it as the change of f as we change all of its
variables. Using (3.4.3), we can write the differential in dot product form:
∂f ∂f ∂f
df = dx + dy + dz (3.4.4)
∂x ∂y ∂z
∂f ∂f ∂f
= î + ĵ + k̂ · dxî + dy ĵ + dz k̂ (3.4.5)
∂x ∂y ∂z
Again, we get an equation similar to d = vt, where the first term is similar to a rate of
change, and the second term is a change in the coordinates. The first term in (3.4.5) can
be rewritten as:
∂ ∂ ∂
î + ĵ + k̂ f (3.4.6)
∂x ∂y ∂z
and it describes the rate of change of f in each direction. The operator appearing in (3.4.6)
is very important in physics and is called the del or gradient operator denoted by ∇:
The symbol ∇ is also called nabla. The del operator is a vector operator and in (3.4.7),
it is written in Cartesian coordinates. As you might expect, the del operator takes different
forms in cylindrical and spherical coordinates. We will present the del operator in other
coordinates later in this section, but for now we will consider only Cartesian coordinates.
When the del operator is applied to a scalar function f , then ∇f is called the gradient
of f and the result is a vector function.
df = ∇f · dr (3.4.9)
To better understand the gradient of a scalar field, we will introduce the concept of level
sets of the function f . The level set of a scalar function f is a curve in two dimensions, or
a surface in three dimensions, on which the value of f is constant. Hence, along the curve
of a level set we would have df = 0. If dr is a displacement along a level set of f , then:
df = ∇f · dr = 0 (3.4.10)
104 Motion in Two and Three Dimensions
and therefore the two vectors ∇f and dr are perpendicular to each other, i.e., ∇f ⊥ dr. We
conclude that the gradient of f is perpendicular to the level sets of f .
Python Code
We define the coordinate system R with the unit vectors in this reference frame
denoted by R.i,R.j,R.k and the Cartesian coordinates x, y, and z denoted by
R.x,R.y,R.z respectively. The gradient is calculated with the command gradient(f)
where f = exp(−x2 − y 2 ) is the given scalar function.
In part (b) we use the command contour(x,y,T,5) to plot five contours for the
function, and quiver(x,y,x_grad,y_grad) to draw the arrows for the gradient at
points (x,y) on the Cartesian plane. The result is shown in Figure 3.12a.
print('-'*28,'CODE OUTPUT','-'*29,'\n')
x, y = [Link](xyrange,xyrange)
Mathematica Code
Notice that Mathematica outputs the gradient as a list, where the first element of the
list is the x-component, the second element is the y-component, and the third element
is the z-component. Additionally, the command Grad(f,x,y) is used to compute the
gradient, and Mathematica needs to know what variables are needed for differentiation.
Note also that by default, Mathematica computes the gradient in Cartesian coordinates.
As we will see below, the gradient is different in cylindrical and spherical coordinates.
Mathematica can compute symbolically the gradient in those coordinates as well, when
the user specifies which coordinate system to use.
The commands ContourPlot and VectorPlot are used to create the two sets of
plots.
The contour curves shown in Figure 3.12b are the level sets of f , with lighter colors
corresponding to greater values of f . The vectors represent the gradient vector field.
The size of the arrows corresponds to the magnitude of the gradient at that point.
Notice that the vectors are perpendicular to the level sets.
106 Motion in Two and Three Dimensions
1.0
0.5
0.0
-0.5
-1.0
-1.0 -0.5 0.0 0.5 1.0
(a) (b)
Figure 3.12: Plots of the gradient and the contours of a scalar function produced by (a)
Python and (b) Mathematica, in Example 3.13.
SetOptions[ContourPlot, BaseStyle->FontSize->16];
f = Exp[−(x∧ 2 + y ∧ 2)];
gr2 = VectorPlot[gradf, {x, −1, 1}, {y, −1, 1}, VectorStyle->Red, VectorPoints->10];
Show[gr1, gr2]
The gradient plays a very important role in classical mechanics. For example, as we will
show in Chapter 5, for a particle with potential energy V (x, y, z), the force vector F (x, y, z)
acting on the particle is given by the negative gradient of the potential energy:
∂V ∂V ∂V
F (x, y, z) = −∇V (x, y, z) = − î − ĵ − k̂ (3.4.11)
∂x ∂y ∂z
Although we will discuss the relationship between force, energy, and equilibrium states of a
mechanical system in more detail in Chapter 5, it is worth noting that the above equation
says that forces point in the direction of most rapidly decreasing potential energy (because
of the minus sign).
In order to get a complete picture of the gradient, we next need to discuss the concept
of the directional derivative.
The directional derivative df /dn of a scalar field f gives the rate of change of f (x, y, z)
in the direction of the unit vector n̂ = nx î + ny ĵ + nz k̂, and is defined as the dot product:
df ∂f ∂f ∂f
= n̂ · ∇f = nx + ny + nz (3.4.12)
dn ∂x ∂y ∂z
Gradient, divergence, and curl 107
Now we ask the question, in what direction does the scalar field f change most rapidly?
We can compute the dot product as:
df
= n̂ · ∇f = |n̂| |∇f | cos θ (3.4.13)
dn
where θ is the angle between n̂ and ∇f . The direction in which the directional derivative is
greatest would occur when n̂ · ∇f is maximal, i.e., when the angle θ equals zero. Therefore,
∇f points in the direction of the most rapid increase of f . Likewise, the direction of greatest
decrease in the scalar field is −∇f . As an example, consider a surface whose height above
sea level at a point (x, y) is H(x, y). The gradient of H at a point (x, y) is a vector pointing
in the direction of the steepest slope, or steepest grade at that point. The steepness of the
slope at that point is given by the magnitude of the gradient vector.
df 2 2 1
= â · ∇f = (2xy + z) + x2 (− ) + x
da 3 3 3
In the final step we substitute the given point (1, 2, −1):
df 5
= â · ∇f =
da 3
Python Code
In this example we show two different libraries which can evaluate the directional deriva-
tive.
In the codes we import the CoordSys3D command from the [Link] library.
Within this library we define a coordinate system C= CoordSys3D('C').
In the first method we first evaluate the normalized vector n̂, by using the method
[Link]() in SymPy. We evaluate the gradient using gradient(f), and then find
the dot product of n̂ and ∇f using the method [Link](gradient(f)).
The method .subs is used to substitute the given point (1, 2, −1) ,i.e., x = 1, y = 2,
z = −1.
108 Motion in Two and Three Dimensions
print('-'*28,'CODE OUTPUT','-'*29,'\n')
C = CoordSys3D('C') # Cartesian system named C
# has unit vectors C.i , C.j , C.k
Mathematica Code
In this code we define the vector a as a list, and we normalize it by dividing by
its magnitude Norm(a). The command ResourceFunction[“DirectionalD”] is used
to evaluate the directional derivative function. Finally we use the replacement rule
dirderiv/.{x->1,y->2, z->−1} to substitute the values of the given point (1, 2, −1),
i.e., x = 1, y = 2, z = −1.
Gradient, divergence, and curl 109
n = a/Norm[a];
Print[dirderiv]
In order to get the form of the gradient in other coordinate systems, we return to the
fact that the total differential df of the scalar function is given by:
∂f ∂f ∂f ∂f ∂f ∂f
df = dx + dy + dz = dρ + dθ + dz = ∇f · ds (3.4.14)
∂x ∂y ∂z ∂ρ ∂θ ∂z
where in Cartesian coordinates ds = dx î + dy ĵ + dz k̂, and we used the chain rule for
f (ρ, θ, z). We can use this equation to obtain expressions for the gradient in cylindrical and
spherical coordinates, as follows.
The gradient of any scalar function f in cylindrical coordinates (ρ, θ, z) will be of the
general form:
∇f (x, y, z) = (∇f )ρ ρ̂ + (∇f )θ θ̂ + (∇f )z k̂ (3.4.15)
where (∇f )ρ , (∇f )θ , (∇f )z are the components of the gradient along the unit vectors
ρ̂, θ̂, ẑ in cylindrical coordinates. From the previous section we recall that ds in cylindrical
coordinates is given by:
ds = dρ ρ̂ + ρ dθ θ̂ + dz ẑ (3.4.16)
By evaluating the dot product of (3.4.15) and (3.4.16), and substituting into (3.4.14), we
obtain:
∂f ∂f ∂f
dρ + dθ + dz = (∇f )ρ dρ + (∇f )θ ρ dθ + (∇f )z dz (3.4.17)
∂ρ ∂θ ∂z
By equating the corresponding coefficients of (dρ, dθ, dz) on the two sides of (3.4.17), we
find:
∂f 1 ∂f ∂f
(∇f )ρ = (∇f )θ = (∇f )z =
∂ρ ρ ∂θ ∂z
Therefore by using (3.4.15), the expression of the gradient in cylindrical coordinates is:
∂f 1 ∂f ∂f
∇f (ρ, θ, z) = ρ̂ + θ̂ + ẑ (3.4.18)
∂ρ ρ ∂θ ∂z
110 Motion in Two and Three Dimensions
The gradient in spherical coordinates can also be obtained with the same method, and is
of the form:
∂f 1 ∂f 1 ∂f
∇f (, θ, ϕ) = r̂ + θ̂ + ϕ̂ (3.4.19)
∂r r ∂θ r sin θ ∂ϕ
Note that our work above has also given us the del operator in various coordinate systems:
The next example shows how to evaluate the gradient of a scalar function in cylindrical
coordinates using a CAS.
∂f 1 ∂f ∂f
∇f = ρ̂ + θ̂ + ẑ = ρ̂ sin θ cos z + θ̂ cos θ cos z + ẑ (−ρ sin θ sin z)
∂ρ ρ ∂θ ∂z
Python Code
In the Python code we import the CoordSys3D command from the [Link] li-
brary. Within this library we define a coordinate system c and transform it into cylindri-
cal coordinates, by using transformation='cylindrical'. This transformed system
incorporates the cylindrical coordinate parameters (ρ, θ, z) which are represented in-
ternally as c.r, c.t, c.z. The corresponding unit vectors ρ̂, θ̂, ẑ are represented by
c.R, c.T, c.Z respectively.
The gradient within this library is evaluated using gr = gradient(f), and we use
[Link]() to find the coefficients of the unit vectors in the cylindrical system.
Gradient, divergence, and curl 111
import textwrap
print('-'*28,'CODE OUTPUT','-'*29,'\n')
# define Cartesian system named c, with unit vectors c.i, c.j, c.k
# Transform it to system with cylindrical coordinates (rho, theta, z)
scalar = c.r*sin(c.t)*cos(c.z)
print('scalar =',scalar)
gr = gradient(scalar)
print('\nThe gradient of this scalar in cylindrical is:')
print([Link](str(gr),63))
Mathematica Code
The first line in the Mathematica code defines the function f (ρ, θ, z) = ρ sin θ cos z,
and the command Grad[f,{rho,theta,z},''Cylindrical''] is used to compute the
gradient in cylindrical coordinates.
112 Motion in Two and Three Dimensions
The “derivative” properties of the gradient are shown in the following identity, which is
similar to the derivative product rule:
Solution:
∂ (f g) ∂ (f g) ∂ (f g)
∇ (f g) = î + ĵ + k̂
∂x ∂y ∂z
∂g ∂f ∂g ∂f ∂g ∂f
=f î + g î + f ĵ + g ĵ + f k̂ + g k̂
∂x ∂x ∂y ∂y ∂z ∂z
∂g ∂g ∂g ∂f ∂f ∂f
=f î + ĵ + k̂ + g î + ĵ + k̂
∂x ∂y ∂z ∂x ∂y ∂z
= f (∇g) + g (∇f )
Python Code
In the Python code we define the coordinate system C within [Link], with unit
vectors C.i, C.j, C.k. We define the symbols f, g to be functions of the coordinate
parameters C.x, C.y, C.z, and we evaluate the left-hand side (LHS) and right-hand
side (RHS) of (3.4.24) using the gradient() function.
We verify that the two sides of (3.4.24) are identical by using the logical statement
LHS==RHS, which returns a True value for the equation.
Gradient, divergence, and curl 113
print('-'*28,'CODE OUTPUT','-'*29,'\n')
Mathematica Code
We use the command Grad[f[x_,y_,z_]*g[x_,y_,z_]] to evaluate the ∇ (f g),
and Grad[f[x_,y_,z_]*g[x_,y_,z_]], Grad[g[x_,y_,z_]*f[x_,y_,z_]] to repre-
sent the ∇ (f ) g and f ∇ (g), respectively. The double equal sign == is used to test
whether the identity is True or False.
LHS = Grad[f [x_, y_, z_] ∗ g[x_, y_, z_], {x, y, z}];
RHS = Grad[f [x_, y_, z_], {x, y, z}] ∗ g[x_, y_, z_]+
In vector calculus, the del operator is a vector differential operator. As we have seen,
when applied to a scalar field, the del operator produces the gradient of a scalar field ∇f .
However, when applied to a vector field, the del operator can produce two quantities, the
divergence of a vector field ∇·v, and the curl of a vector field ∇×v. In the next subsections,
we will illustrate these new quantities.
114 Motion in Two and Three Dimensions
3.4.2 DIVERGENCE
The divergence of a vector field v = vx î + vy ĵ + vz k̂ is a scalar function that can be
represented as:
∂vx ∂vy ∂vz
∇·v= + + (3.4.25)
∂x ∂y ∂z
The divergence is obtained by taking a dot product between the del operator and a vector
field. The divergence of a vector field is not frequently encountered in classical mechan-
ics, but it does appear prominently in fluid dynamics and in electromagnetism. In this
subsection, we provide only a brief overview of the divergence.
The divergence is roughly a measure of a vector field’s change in magnitude along the
direction in which it points. More accurately, it is a measure of that field’s tendency to
converge toward or repel from a point, and is sometimes referred to as the “net outward
flow rate” of a vector field. For example, consider air as it is heated or cooled. The relevant
vector field for this example is the velocity of the moving air at a point is pace. If air is
heated in a region, it will expand in all directions such that the velocity field points outward
from that region and towards regions with lower temperature. Therefore, the divergence of
the velocity field in that region would have a positive value, and the region is called a source.
If the air cools and contracts, the divergence is negative and the region is called a sink. In
vector calculus, divergence is a vector operator that measures the magnitude of a vector
field’s source or sink at a given point, in terms of a signed scalar.
In physical terms, the divergence of a three-dimensional vector field is the extent to which
the vector field flow behaves like a source or a sink at a given point. It is a local measure
of its “outgoingness”–the extent to which there is more “material” exiting an infinitesimal
region of space than entering it. If the divergence is non-zero at some point, then there must
be a source or sink at that position. Note that when we use the terms source and sink, we
are imagining a vector like the velocity vector field of a fluid in motion.
If the divergence of a vector field A(x, y, z) is zero everywhere in space, this vector field
is called solenoidal.
If u, v are any vector functions and f is any scalar function, the divergence obeys the
following product rule:
∇ · (f v) = f (∇ · v) + v · ∇f (3.4.27)
However, note that the divergence of a cross-vector product is less intuitive:
∇ · (u × v) = v · (∇ × u) − u · (∇ × v) (3.4.28)
The following are the Python and Mathematica codes for the gradient.
Python Code
The command CoordSys3D('R') defines the coordinate system R, the unit vectors
in this reference frame are denoted by R.i,R.j,R.k.
We use the package [Link] from SymPy.
The divergence is calculated with the command divergence(v) where v = x y z î +
x y z ĵ + x y z k̂ is the given vector field. We test whether the vector field is solenoidal
by using the command is_solenoidal. In this example, the function returns the value
False in Python, so that this field is not solenoidal.
print('-'*28,'CODE OUTPUT','-'*29,'\n')
test = is_solenoidal(v)
print('\nThe statement The vector field is solenoidal is:', test)
Mathematica Code
Notice that Mathematica outputs the divergence as a scalar function, and the vector
field is entered as a list. The command Div[f,x,y] is used to compute the divergence,
and Mathematica needs to know what variables are needed for differentiation. By de-
fault, Mathematica computes the divergence in Cartesian coordinates.
v = {x ∗ y ∗ z, x ∗ y ∗ z, x ∗ y ∗ z};
Note that the divergence takes on a different form in cylindrical and spherical coordi-
nates. To compute the divergence in these coordinate systems, choose the appropriate form
of the del operator, and compute the dot product of the appropriate form of the del operator
from (3.4.20), (3.4.21), and (3.4.22), and the vector of interest. The results are (see also the
problems at the end of this chapter):
116 Motion in Two and Three Dimensions
3.4.3 CURL
The divergence uses the del operator to measure the outflow rate of a vector field. We can
also use a form of the del operator to measure the rotational properties of a vector field,
called the curl. The curl of a vector field v(x, y, z) = vx î + vy ĵ + vz k̂ is a vector function
that can be represented as:
∂vz ∂vy ∂vx ∂vz ∂vy ∂vx
∇×v= − î + − ĵ + − k̂ (3.4.32)
∂y ∂z ∂z ∂x ∂x ∂y
From a physical point of view, the curl at a point (x, y, z) is proportional to the on-axis
torque to which a tiny pinwheel would be subjected, if it were centered at that point.
The cross-product operation can be written as a pseudo-determinant in Cartesian coor-
dinates:
î ĵ k̂
∇ × v = ∂x ∂y ∂z
∂ ∂ ∂ (3.4.33)
vx vy vz
If u and v are any vector functions and f is any scalar function, the curl also follows a
product rule:
∇ × (f v) = (∇f ) × v + f ∇ × v (3.4.34)
However, the curl of a cross product is more complex:
∇ × (u × v) = (u ∇ · v) − (v ∇ · u) + (v · ∇)u − (u · ∇)v (3.4.35)
The curl takes a different form in cylindrical and spherical coordinates. To compute the curl
in spherical and cylindrical coordinates, choose the appropriate form of the del operator from
(3.4.20), (3.4.21), and (3.4.22) and evaluate the cross product between del and the vector
of interest. The results are:
1 ∂ ∂vθ 1 1 ∂vr ∂
∇×v= (vϕ sin θ) − r̂ + − (rvϕ ) θ̂+
r sin θ ∂θ ∂ϕ r sin θ ∂ϕ ∂r
1 ∂ (rvθ ) ∂vr
+ − ϕ̂ (3.4.38)
r ∂r ∂θ
Gradient, divergence, and curl 117
The curl has many uses in physics. For example, as we will study in more detail in
Chapter 5, the necessary and sufficient condition for a force F (x, y, z) to be conservative is
that its curl equals zero:
î ĵ k̂
∂(x y) ∂(x z) ∂(y 2 z) ∂(x y)
∇×v= ∂
∂x
∂
∂y
∂
∂z
= − î + − ĵ
2
∂y ∂z ∂z ∂x
y z xz xy
∂(x z) ∂(y 2 z)
+ − k̂
∂x ∂y
∇ × v = (x − x) î + y 2 − y ĵ + (z − 2y z) k̂ = (0) î + y 2 − y ĵ + (z − 2y z) k̂
Python Code
We define the coordinate system CoordSys3D('R') and compute the curl using the
function curl(v) and note that the curl is non-zero, so that this field is not conservative.
To check if a vector field is conservative, we can also use the function
is_conservative . In this example, the function returns the value False.
print('-'*28,'CODE OUTPUT','-'*29,'\n')
v = R.y**2*R.z*R.i+R.x*R.z*R.j+R.x*R.y*R.k
test = is_conservative(v)
print('\nThe statement The vector field is conservative is:', test)
Mathematica Code
The command Curl[v,x,y,z] is used to compute the curl, and we must specify
the variables for differentiation. The output is in the form of a list, where the three
elements of the list correspond to the x-, y- and z-components of the curl, respectively.
The curl is computed in Cartesian coordinates and it is non-zero, which means that the
vector field is not conservative.
v = {y ∧ 2 ∗ z, x ∗ z, x ∗ y};
∂2 ∂2 ∂2
∇2 = ∇ · ∇ = 2
+ 2+ 2 (3.4.40)
∂x ∂y ∂z
The Laplacian is ubiquitous throughout modern mathematical physics, appearing in
Laplace’s equation, Poisson’s equation, the heat equation, the wave equation, and the
Schrödinger equation, to name a few.
When the del operator acts on the gradient, divergence, and curl of a vector, it produces
five possible second derivatives; the use of the scalar Laplacian and vector Laplacian gives
two more. Here are these second derivatives created by applying the del operator:
These second derivatives are of interest, principally because they are not always unique or
independent of each other. As long as the functions v and f are well-behaved, two of these
identities are always zero:
∇ × (∇f ) = 0 (3.4.41)
∇ · (∇ × v) = 0 (3.4.42)
The first identity states that the curl of the gradient of any scalar field is always equal to
zero, and the second one states that the divergence of the curl of any vector field is always
equal to zero.
Two of the above second derivatives are always equal:
∇ · (∇f ) = ∇2 f (3.4.43)
∇ × (∇ × v) = ∇(∇ · v) − ∇2 v (3.4.44)
Chapter summary 119
∂2 ∂2 ∂2
2
+ 2 + 2 = ∇ · ∇ = ∇2
∂x ∂y ∂z
To find the curl of the gradient, we calculate the cross product, (∇ × ∇V ). This
quantity is always zero, as seen in (3.4.41) for the curl of a gradient.
Motion in two and three dimensions is described using vectors. In this book, we use
the following conventions for a vector, its magnitude, and a unit vector:
p
A = Ax î + Ay ĵ + Az k̂ A = |A| = A2x + A2y + A2z
A A
 = = p
|A| contourA2x curves + A2y + A2z
The dot product between two vectors A and B and its derivative are found from
the following relationships:
d dA dB
A · B = Ax Bx + Ay By + Az Bz = AB cos θ (A · B) = B+A
dt dt dt
The cross product between two vectors A and B and its derivative are found from:
A × B = |A||B| sin θ n̂
î ĵ k̂
A2 A3 A A3 A A2
A × B = A1 A2 A3 = î − 1 ĵ + 1 k̂
B2 B3 B1 B3 B1 B2
B1 B2 B3
d dA dB
A × B = −B × A (A × B) = × B + A×
dt dt dt
There are several relationships that can simplify expressions with multiple dot or
cross products. They are:
120 Motion in Two and Three Dimensions
∂f ∂f ∂f
∇f (x, y, z) = î + ĵ + k̂
∂x ∂y ∂z
î ĵ k̂
∂vz ∂vy ∂vx ∂vz ∂vy ∂vx
∇×v = ∂
∂x
∂
∂y
∂
∂z
= − î + − ĵ + − k̂
∂y ∂z ∂z ∂x ∂x ∂y
vx vy vz
The gradient gives the direction of most rapid change in a scalar field. The divergence
measures the magnitude of a vector field’s source or sink at a given point. The curl at
a point is proportional to the on-axis torque to which a tiny pinwheel is subjected.
The directional derivative df /dn in the direction n̂ = nx î + ny ĵ + nz k̂ is:
df ∂f ∂f ∂f
= n̂ · ∇f = nx + ny + nz
dn ∂x ∂y ∂z
A force F will be conservative if and only if its curl is zero: ∇×F=0
Second derivatives of vector and scalar fields are also important in mechanics. The
Laplacian ∇2 is a scalar operator that can be applied to either vector or scalar fields:
∂2 ∂2 ∂2
∇2 = 2
+ 2+ 2
∂x ∂y ∂z
∇ × (∇f ) = 0
∇ · (∇ × v) = 0
Motion in two and three dimensions can sometimes be best described by non-Cartesian
coordinates. Euler’s important identities are:
x = r cos θ y = r sin θ
p
r = x2 + y 2 θ = tan−1 (y/x)
The unit vectors in polar coordinates are:
a. Find expressions for the magnitude of the velocity and acceleration at any point
in space.
b. Find an expression for the unit tangent vector at any point along the motion.
122 Motion in Two and Three Dimensions
3. The acceleration of a mass moving in two dimensions is given by a = (3î − 4ĵ) m/s2 .
At time t = 0 the body is located at the origin and is moving with a speed of 1 m/s.
a. Find the velocity vector v(t).
b. Find the position vector r(t).
4. Find the tangent vector at any point of the curve (x, y, z) = (t3 , 3t2 − 1, 2t − 5) ,
where t represents time, and physical quantities are in SI units.
5. A particle moves along the curve (x, y, z) = (t2 , t3 , sin t). Find the tangential and
normal component of the velocity and acceleration vectors at time t = 1 s.
6. Consider the 3D curve (x, y, z) = (t3 , 3t2 − 1, 2t − 5) where t is time, and all
physical quantities are in SI units.
a. Plot the 3D curve and the tangent vector at t = 2.
b. Plot the angle between the position and velocity vectors as a function of time.
11. Find the area of the triangle defined by the points A (1, 1, 1), B (2, 3, 0), and C
(1, −1, 0).
12. If the magnitude of a vector A is constant, then show that A and dA/dt are perpen-
dicular vectors.
13. The force on a particle of mass m is given by F = 3r, where r is the position vector
(x, y, z). Show analytically and using symbolic algebra that the angular momentum
L = m (r × v) of the body is conserved, i.e., that the derivative dL/dt = 0. Here v is
the velocity of the particle.
14. By using the derivative properties of the dot and cross product, show analytically
and using Mathematica and/or Sympy that for any vector v the following identity is
true:
d dv d2 v dv d3 v
v. × 2 = v. × 3
dt dt dt dt dt
15. If the position of a particle on the xy-plane is given by r = cos(ωt)î + sin(ωt)ĵ, show
that the vector r × v is a constant vector. What is the physical meaning of this result?
16. Use the symbolic capabilities of Mathematica and SymPy to demonstrate the
following identities for any vectors A, B, C:
A × (B × C) + B × (C × A) + C × (A × B) = 0
2
(A × B) · [(B × C) × (C × A)] = (A · [B × C])
d2 r
m = f (r) r̂
dt2
where r is the position vector of P measured from an origin O, r̂ is a unit vector in
the direction r, and f (r) is a function of the distance of P from the origin O.
a. Show that
dr
r× =c
dt
where c is a constant vector.
b. Interpret physically the cases f (r) < 0 and f (r) > 0.
124 Motion in Two and Three Dimensions
c. What is the physical meaning of the result in (a)? Note that the angular momen-
tum vector of the particle is defined as the cross product L = m (r × v), where
v is the velocity of the particle.
d. Describe how the results obtained in (a)-(c) relate to the motion of the planets
in our solar system.
19. In this chapter the dot and cross products were evaluated using SymPy in Python. An
alternative method of evaluating dot and cross products in NumPy is using functions
of the form dot(A,B) and cross(A,B). Write a Python code to implement the dot
and cross product of two vectors in NumPy using functions of this type.
20. A mass m hangs from a string of length L, so that it moves on a horizontal circle.
The string makes an angle Θ with the vertical line. Calculate the period T of the
rotational motion.
21. Show that the acceleration vector in polar coordinates is given by:
" 2 # 2
dv d2 r dθ d θ dr dθ
a= = −r r̂ + r 2 + 2 θ̂
dt dt2 dt dt dt dt
One possible method is by taking the time derivative of the velocity vector
dr dr dθ
v= = r̂ + r θ̂
dt dt dt
d d
and then using the derivatives of the unit vectors dt θ̂ and dt r̂ derived in this chapter.
22. A point mass m is placed at the top of the frictionless surface of a sphere of radius
R, and slides down the surface of the sphere. At what point does the mass leave the
spherical surface?
23. Consider a mass m moving in the xy-plane under the influence of a force whose
polar components are given by the expression Fθ = mṙθ̇ and Fr = 0, where (r, θ) are
polar coordinates. Show that
r = C θ̇−1
√
ṙ = A ln r + B
where A, B, C are constants. You may want to use a CAS for some of the steps in this
problem.
24. A wheel of radius R is rolling without slipping on a flat frictionless surface.
End-of-chapter problems 125
a. Show that the path of a point on the circumference of the wheel is a cycloid
curve:
x = Rθ + R sin θ y = R + R cos θ
where θ is the angle of rotation of the wheel around its center of mass.
b. Find the velocity and acceleration of this point on the circumference of the rolling
wheel.
c. The curvature k at a point of a curve is defined as
|a × v|
k= 3
|v|
where a and v are the acceleration and velocity vectors of the wheel. Find the
curvature k at a point located at the top of the cycloid.
25. Find the curvature at the top of the parabolic path of a projectile by assuming no air
resistance. The curvature k at a point of a curve is defined as
|a × v|
k= 3
|v|
where a, v are the acceleration and velocity vectors of the object.
26. Find expressions for the velocity and the acceleration vectors in spherical coordinates.
27. Use SymPy and/or Mathematica to show that for any vectors A, B, C, D the
following identities are true:
a. A × [B × (C × D)] = B [A · (C × D)] − (A · B) (C × D)
b. (A × B) · (C × D) = (A · C) (B · D) − (A · D) (B · C)
28. Show symbolically and analytically that for any two vectors A, B:
d dA dB
(A · B) = ·B + A·
dt dt dt
29. Starting from the relationships between the spherical and Cartesian coordinates
x = r sin θ cos ϕ, y = r sin θ sin ϕ and z = r cos θ, show that the arc length in spherical
coordinates is given by:
ds2 = dr2 + r2 dθ2 + r2 sin2 θ dϕ2 (3.6.1)
Do this problem both analytically and with the use of a symbolic algebra system.
30. Use Mathematica and/or SymPy to solve the following system of equations for
the unit vectors r̂, θ̂ in polar coordinates:
r̂ = cos θ î + sin θ ĵ (3.6.2)
θ̂ = − sin θ î + cos θ ĵ (3.6.3)
to obtain the Cartesian unit vectors î, ĵ in terms of r̂, θ̂.
126 Motion in Two and Three Dimensions
31. Use Mathematica and/or SymPy to differentiate the following expressions for the
polar unit vectors r̂ and θ̂ with respect to time t,
r̂ = cos θ î + sin θ ĵ
θ̂ = − sin θ î + cos θ ĵ
and show that
dr̂ dθ dθ̂ dθ
= θ̂ =− r̂ (3.6.4)
dt dt dt dt
32. A particle is located at r = − î + 3ĵ − 4k̂; find the values of r, θ, ϕ for this vector and
the spherical coordinates unit vectors r̂, θ̂, ϕ̂ at the position r. In addition, find its
components Ar , Aθ and Aϕ in spherical coordinates, such that r = Ar r̂ + Aθ θ̂ + Aϕ ϕ̂.
33. Cylindrical and spherical coordinates are examples of orthogonal curvilinear systems.
In such coordinate systems, we can obtain expressions for the gradient, divergence
and curl by using the following general procedure. Let r be some point in space and qi
represent the coordinate system, we can define three vectors ei which are orthogonal
to each other by evaluating the partial derivatives:
∂r
ei = ei · ej = 0 (i = 1, 2, 3 i ̸= j)
∂qi
These ei vectors can be normalized by dividing by their length, and the normalized
basis vectors are then:
ei ei
êi = =
hi |ei |
The lengths hi of the basis vectors êi are very useful functions known as scale factors
of the coordinates. In the case of Cartesian coordinates, qi = x, y, z and
∂r ∂r ∂r
êi = , , = î, ĵ, k̂
∂x ∂y ∂z
and it is easy to verify that hi = [Link] infinitesimal length in this orthogonal coordi-
nate system is found from:
√ q
ds = dr · dr = h21 dq12 + h22 dq22 + h23 dq32
a. Find expressions for the unit vectors êi in cylindrical coordinates, and determine
the corresponding scale factors.
b. Find expressions for the infinitesimal arc length ds2 and infinitesimal volume dV
in cylindrical coordinates.
34. Repeat Problem 33 for spherical coordinates, i.e., find the unit vectors êi , the square
of the element of arc length ds2 , the corresponding scale factors and the infinitesimal
volume dV for spherical coordinates.
End-of-chapter problems 127
35. The gradient of a scalar field f , the divergence and curl of a vector field
F = (F1 , F2 , F3 ), and the Laplacian of a scalar field f can be found using the
following general expressions:
where the hi are the scale factors of the basis vectors, êi , which were defined in
Problem 33.
a. Use the expressions above to obtain the gradient, divergence, and curl in cylin-
drical coordinates.
b. (∇V × ∇V ) · (∇V )
c. ∇ × ∇ × V î where î is the unit vector in the x-direction.
d. ∇2 (∇V )
e. ∇ (∇V · ∇V )
37. Given the function f = y 2 + x3 find the following quantities both analytically and
using Mathematica and/or SymPy:
a. Curl of the gradient of f
b. Laplacian of f
c. Divergence of the gradient of f
39. Graph the vector fields and contours of constant value for the functions:
a. V (x, y) = y î + x ĵ
b. V (x, y) = −x î − y ĵ
c. V (x, y) = y î + x ĵ + z k̂
40. Prove that ∇2 1r = 0 where r is the magnitude of the position vector r.
∇ · (ϕA) = (∇ϕ) · A + ϕ (∇ · A)
44. Find the ∇f if (a) f = ln |r|, (b) f = 1r . Here r is the magnitude of the position
vector r. Solve this problem both analytically and with a symbolic algebra system.
45. Show that ∇rn = nrn−2 r where r is the magnitude of the position vector r.
46. Maxwell’s famous equations concern the magnetic field vector B and the electric field
vector E. If these vectors satisfy the equations:
∂B ∂E
∇·E=0 ∇ · B=0 ∇×E=− ∇×B=
dt dt
then show that E and B satisfy the generalized wave equation:
∂2E ∂2B
∇2 E = ∇2 B =
∂t2 ∂t2
47. Demonstrate using a symbolic algebra system that for any vector field A(x, y, z),
the following is true:
∇ × (∇ × A) = −∇2 A + ∇ (∇ · A)
4 Momentum, Angular
Momentum, and
Multiparticle Systems
In this chapter, we focus on two important physical quantities: linear momentum and an-
gular momentum. Under certain conditions, as explained in this chapter, momentum and
angular momentum are conserved quantities, meaning that their values are constant dur-
ing a physical process. The conservation of momentum or angular momentum can then be
used to solve problems by comparing the state of a system before a physical process to the
state of that same system after this process. In this chapter, we will also study multiparti-
cle systems, continuous mass distributions (i.e., systems that are not point particles), and
the center of mass. We develop relationships between the total momentum of a system of
particles to the momentum of the system’s center of mass. We also develop a relationship
between the angular momentum of a system of particles and the angular momentum of the
system’s center of mass. We show that these relationships also hold for continuous mass
distributions. Finally, we discuss numerical integration techniques which will be useful when
finding a system’s center of mass.
Newton’s third law will lead us to an interesting result. Consider two particles interacting via
a force, which we will refer to as an “internal force.” For example, if our two objects are the
Earth and Moon, their gravitational interaction would be the internal force. Furthermore,
assume that each particle is experiencing an external force due to other bodies outside of
the system. In the case of the Earth and the Moon, that could be the Sun’s gravitational
force, a body outside the Earth-Moon system. The net force F1 on Particle 1 is then:
F1 = F12 + Fext
1 (4.1.2)
where F12 is the force on Particle 1 exerted by Particle 2 (the “internal force”), and Fext
1 is
the net external force acting on Particle 1. Similarly, Particle 2 experiences a net force:
F2 = F21 + Fext
2 (4.1.3)
Let p1 and p2 represent the linear momenta of the two particles, then Newton’s second law
states that
ṗ1 = F1 = F12 + Fext
1 (4.1.4)
and
ṗ2 = F2 = F21 + Fext
2 (4.1.5)
Now, we define the total momentum vector as P = p1 + p2 , to be the sum of the momenta
of each particle. Then,
Ṗ = ṗ1 + ṗ2 = Fext ext
1 + F2 =F
ext
(4.1.6)
129
130 Momentum, Angular Momentum, and Multiparticle Systems
Hence, we see that if there are no total net external forces Fext = Fext ext
1 + F2 then Ṗ = 0,
or to put it another way:
The total momentum of a system is conserved if no external forces act on that system.
This is an important law in physics, one that we will use to solve problems in cases where
the external forces add to zero.
Pinitial = m1 v1 + m2 v2
Pfinal = (m1 + m2 ) v
Note that because the two objects stick together after the collision, both masses have
the same velocity, hence the right-hand side of Pfinal above. Conservation of momentum
tells us that Pinitial = Pfinal and therefore:
m1 v1 + m2 v2
v=
m1 + m2
Notice that the final velocity is the weighted average of the initial velocities, where the
masses of each object serve as the weights for the average. While this problem may seem
to be simple, it is an important application of the conservation of momentum; it is used
to solve problems in nuclear physics, astrophysics, and accident reconstruction–to name
a few.
m1 v1
v0 θ
m1 φ
m2
m2
v2
Figure 4.1: Before and after the collision in Example 4.2.
Solution:
Recall that in an elastic collision both the total momentum mv and total kinetic
energy 1/2mv 2 are conserved. We will discuss kinetic energy more in depth in the next
chapter.
Only mass m1 is moving before the collision, and the problem states that the velocity
is in the x-direction. Therefore,
pinitial = m1 v0 î
The momentum after the collision involves both particles. By analyzing the velocity
vectors v1 and v2 into their x and y components, we can write:
m1 v0 = m1 v1 cos θ + m2 v2 cos ϕ
0 = m1 v1 sin θ − m2 v2 sin ϕ
1 1 1
m1 v02 = m1 v12 + m2 v22
2 2 2
The first two equations represent the total momentum in the x and y directions
respectively, and the third equation represents the conservation of kinetic energy. In
addition, we know that v0 = 10.0 m/s, m1 = 0.10 kg, and m2 = 0.20 kg. As you might
imagine, this problem can involve a lot of algebra. However, a CAS will be able to assist
us with that algebra.
Python Code
We use fsolve from the SciPy library to solve for v1 , v2 and ϕ. The fsolve command
takes a vector function as its input. The components of the vector function f are the
equations to be solved (with the right-hand side set to zero). We need to give fsolve
a guess to begin with. We choose 10 and 0 as the initial guesses for v1 and v2 , because
these were the initial velocities of m1 and m2 . We choose 1 as an initial guess for
ϕ because the nearly equal masses would imply the particle would move in similar
132 Momentum, Angular Momentum, and Multiparticle Systems
directions. However, it should be noted that the answer for ϕ given by fsolve is very
sensitive to the initial guess.
import numpy as np
from [Link] import fsolve
print('-'*28,'CODE OUTPUT','-'*29,'\n')
def f(x):
#let x[0] = v1, x[1] = v2, x[3] = phi
return [m1*v0 - m1*x[0]*[Link](theta) - m2*x[1]*[Link](x[2]),
m1*x[0]*[Link](theta) - m2*x[1]*[Link](x[2]),
0.5*m1*v0**2 - 0.5*m1*x[0]**2 - 0.5*m2*x[1]**2]
roots = fsolve(f,[10,0,1])
Mathematica Code
We begin the program by defining our known variables, the final direction θ of mass
m1 , the initial velocity of m1 (v0), and the values of the masses m1 and m2 . If you run
this code from this book’s website, the Solve command gives a warning (shown here
as a comment line) that some solutions may not be found by Mathematica. This is not
uncommon when using a CAS to solve transcendental equations.
However, four solutions are found. The first three solutions include negative values
for v1 and v2 . These are non-physical results because v1 and v2 are speeds, and speed is
the positive magnitude of the velocity vector. The fourth solution found by Mathematica
contains all positive values, which is in agreement with the problem’s diagram. Finally,
we need to remember that Mathematica, like any calculator, is not respecting significant
figures. Therefore, our final answer is: v1 = 9.3 m/s, v2 = 2.5 m/s, and ϕ = 1.2 rad. As
we have said before, the availability of CAS programs is not a substitute for knowing
how to do algebra. The reader should verify the solution by hand and by checking the
physical meaning of the analytical results.
Conservation of momentum and Newton’s third law 133
m1 ∗ v1 ∗ Sin[θ] == m2 ∗ v2 ∗ Sin[ϕ],
0.5 ∗ m1 ∗ v0∧ 2 == 0.5 ∗ m1 ∗ v1∧ 2 + 0.5 ∗ m2 ∗ v2∧ 2}, {v1, v2, ϕ}];
Next, we study the case where three or more particles are involved. The question arises:
Do we still expect momentum to be conserved when there are many interacting particles?
Let’s begin by examining the net force acting on a collection of N interacting particles. The
net force on the ith particle is: X
Fi = Fext
i + Fij (4.1.7)
j̸=i
X
N X
N X
N X
F= Fi = Fext
i + Fij (4.1.8)
i=1 i=1 i=1 j̸=i
X
N X
N X
F= Fext
i + (Fij + Fji ) (4.1.9)
i=1 i=1 j>i
If this rewriting is not clear to you, set N = 3 and write out the terms in (4.1.8); you
will find that you can rewrite the sum as a collection of two terms, as shown previously.
Newton’s third law tells us that Fji = −Fij , and therefore the second term in the previous
equation is zero leading to:
XN
Ṗ = F = Fext
i (4.1.10)
i=1
134 Momentum, Angular Momentum, and Multiparticle Systems
X
N
If Fext
i =0 then P = constant (4.1.11)
i=1
In other words, the momentum of the system of particles is conserved if there are no
external forces acting on the system, like in the case of two-particle systems.
4.2 ROCKETS
A practical example of conservation of momentum is rocket propulsion. The rocket has a
challenge of moving forward without pushing against something. For example, an automobile
moves forward by turning its wheels so that it pushes against the ground. However, a rocket
in space has nothing to push against. Instead, the rocket solves this problem by ejecting
mass, similar to the recoil of a gun. Before a gun is fired, the bullet and the gun are at rest.
However, once the bullet is fired, it is propelled forward. In order for the total momentum
to be conserved, the gun has to move in the direction opposite to that of the bullet. The
velocities of the gun and the bullet are, of course, very different because the gun has more
mass than the bullet does.
We begin by considering a rocket flying horizontally and assume that the rocket is not
experiencing any external forces. The rocket has momentum p(t) = mv at time t, where m
and v are the mass and velocity of the rocket. The momentum of the rocket is measured
by an observer in a reference frame that is at rest relative to the rocket. A short time later
denoted by t + dt, the rocket has expelled a small amount of mass dm′ , which is moving
at a speed u relative to the rocket, as illustrated in Figure 4.2. The speed u is sometimes
called the exhaust speed. The ejection of mass leads to an increase in the rocket’s speed by
a small amount dv, as measured in the rest frame. Therefore, the momentum of the system
immediately after the mass was ejected is:
p(t + dt) = (m − dm′ )(v + dv) + dm′ (v − u) (4.2.1)
where the second term above is the momentum of the ejected mass relative to the rest
frame.
dm' v+dv
m-dm'
u
Figure 4.2: A rocket after ejecting a small amount of mass dm′ at a speed u relative to the
rocket.
where the last line was obtained by noting that the change in mass of the rocket is
dm = −dm′ . Furthermore, we ignored the term dm′ dv because both dm′ and dv are
small; therefore their product is negligible. Dividing both sides by dt we obtain:
m v̇ = −u ṁ (4.2.6)
The left-hand side of (4.2.6) is Newton’s second law (F = ma), and therefore we see that
the net force acting on the rocket is equal to −u ṁ, which is sometimes called the thrust.
Note that ṁ < 0, so the thrust is positive (and points to the right in Figure 4.2). We can
also write (4.2.6) as:
dm
dv = −u (4.2.7)
m
This equation can be integrated by assuming a constant u. If at t = 0 the rocket’s speed is
v0 and its mass is m0 , we obtain:
m
0
v − v0 = u ln (4.2.8)
m
which gives the velocity of the rocket as a function of its mass m. Equation (4.2.8) tells us
that in order to make a rocket go as fast as possible, engineers need to create rockets with
large exhaust speed u, and with a large initial to final mass ratio m0 /m. The final speed of
the rocket will be obtained once all of the fuel is burned. Rockets with multiple stages that
are ejected can help maximize m0 /m, so that the rocket can achieve even greater speeds.
Next, we study the case of a rocket moving vertically, experiencing the force of gravity.
Our goal is to find an equation which describes the velocity of the rocket. We will use a
coordinate system where the positive y-direction is upward, in the opposite direction of the
force of gravity. In this case, gravity is an external force acting on the rocket, and therefore:
dp
= − mg (4.2.9)
dt
dp = − mgdt (4.2.10)
p(t + dt) − p(t) = − mgdt (4.2.11)
mdv + udm = − mgdt (4.2.12)
dv dm
m +u = − mg (4.2.13)
dt dt
In order to obtain an equation for v, we assume a constant burn rate α:
dm
α=− (4.2.14)
dt
Using our definition of burn rate, (4.2.13) becomes:
dv α
=−g+ u (4.2.15)
dt m
αu
dv = −g + dt (4.2.16)
g m
u
dv = − dm (4.2.17)
α m
Integrating the above equation using v(0) = v0 and m(0) = m0 produces:
g m
0
v − v0 = (m − m0 ) + u ln (4.2.18)
α m
136 Momentum, Angular Momentum, and Multiparticle Systems
This equation gives the velocity of the rocket as a function of mass m when the burn rate α
is constant. Sometimes (4.2.18) is rewritten by integrating the definition of the burn rate:
m − m0 = −αt. In that case, (4.2.18) becomes:
m
0
v − v0 = −gt + u ln (4.2.19)
m
The advantage of using (4.2.19) is that one can see two terms which affect the rocket’s
motion. The first term, −gt, is the standard kinematics term for a particle in free fall, and
represents the effect of gravity on the velocity. The second term, u ln(m0 /m), is the same
term we obtained for the horizontal motion of the rocket and represents the effect of thrust
on the rocket’s velocity.
1 X
N
R= mi ri (4.3.1)
M i=1
1 X 1 X 1 X
N N N
X= m i xi Y = mi yi Z= m i zi (4.3.2)
M i=1 M i=1 M i=1
where riP is the position of the ith particle, which has mass mi . The total mass of the system
is M = mi . Equation (4.3.1) is actually three equations, one for each coordinate of R.
For example, in Cartesian coordinates the position of the ith particle is ri = xi î + yi ĵ + zi k̂
and we can write R = X î + Y ĵ + Z k̂.
The center of mass is the weighted average location of the mass in the system, with the
weights being the masses mi . The location of the center of mass will be closer to the heavier
particles. The next example illustrates this point.
coordinate system, rSun = 0 and rEarth = 1.5 × 1011 m. Inserting these numbers into
(4.3.1) gives:
(mEarth ) (rEarth ) 5.9 × 1024 kg 1.5 × 1011 m
= = 4.6 × 105 m.
mSun + mEarth 5.9 × 1024 kg + 2.0 × 1030 kg
The radius of the Sun is approximately 7.0 × 108 m. Therefore, the center of mass of
the Earth-Sun system is well inside the Sun, and it practically coincides with the center
of the Sun.
If we want to extend (4.3.1) to continuous distributions of mass, i.e., objects that are not
well-described as point particles, then we need to make some changes. One way to approach
a continuous mass distribution is by thinking of it as a collection of infinitesimal masses
dm. Then the sum over discrete particles in (4.3.1) becomes an integral over infinitesimal
mass elements dm. The center of mass equations then become:
R
In the equations above, the total mass is found from M = dm, and like (4.3.1), equation
(4.3.3) actually consists of three equations, one for each coordinate. Typically, one does not
integrate (4.3.3) using the mass. Most often the integration is done over the length, area,
or volume of the object, when the object does not have a uniform density.
The following box summarizes how to calculate the total mass M by using the density
of the object in one-, two-, and three-dimensional situations. In the case of one-dimensional
objects, we use a linear mass density λ (mass per unit length in units of kg/m). In the
case of two-dimensional objects, we use a surface density σ (mass per unit area in units of
kg/m2 ), and for three-dimensional objects, we use the familiar volume density ρ (mass per
unit volume in units of kg/m3 ).
The next two examples demonstrate how to apply (4.3.3) to a continuous mass distri-
bution.
138 Momentum, Angular Momentum, and Multiparticle Systems
a a
dm
dy
dx
x
2a
Solution:
First note that due to the symmetry of the triangle, the center of mass lies along
the y-axis. Computing the center of mass of a mass distribution involves identifying
two components. The first component to identify is the mass element dm, shown in the
diagram of the triangle. Cartesian coordinates are a natural choice of coordinates for
this problem. Therefore, dm = σdxdy will be used for the mass element.
The second component needed to find the center of mass is the limits of the integral
in (4.3.3). The limits of the integral range over the size of the object. We included a
horizontal gray strip near the top of the triangle to illustrate that the width of the
triangle varies with the height, with the strip becoming narrower√ as it moves up the
triangle. The right side of the
√ strip is bound by the line y = a/ 2 − x, and
√ the left side
is bound by the line y = a/ 2 + x, because the triangle has a√height a/ 2. Therefore,
√ the left end of the strip to be at x = y − a/ 2, and the right end to
we can consider
be at x = a/ 2 − y.
TheR y-coordinate of the center of mass can then be found by computing Y =
(1/M ) ydm:
Z √
y=a/ 2 Z √
a/ 2−y
1
Y = √
yσdxdy
M y=0 x=y−a/ 2
√
Z √
a/ 2
a/ 2−y
σ
= yx dy
M 0 √
y−a/ 2
Z √
a/ 2
σ a
= 2y √ −y dy
M 0 2
√
a/ 2
σ ay 2 2y 3
= √ −
M 2 3
0
a3 σ
= √
6 2M
Z Z √
y=a/ 2 Z √
a/ 2−y Z √
a/ 2
a σa2
M= dm = √
σdxdy = σ 2 √ −y dy =
y=0 x=y−a/ 2 0 2 2
By using the value for M found above, we find that:
a
Y = √
3 2
We can use a CAS to evaluate the integrals, even if the limits are not constant.
Python Code
We can use the integrate command from SymPy to perform both integrals. Notice
that in Python unlike Mathematica, the limits of the integral to be done first appears
as the second argument (after the function being integrated).
print('-'*28,'CODE OUTPUT','-'*29,'\n')
Mathematica Code
Note the order of appearance of the coordinates x, y inside the Integrate command.
140 Momentum, Angular Momentum, and Multiparticle Systems
h n o n oi
Y = Integrate σ ∗ y/m, y, 0, √a2 , x, y − √a2 , √a2 − y ;
Print[“The mass M, M = ”, M ]
a2 σ
The mass M, M = 2
Y2 = Y /.m → M ;
x
Solution:
To solve this problem, we first need to identify a coordinate system. A cone can be
naturally described in cylindrical coordinates. Therefore we use dm = ρdV = ρrdrdθdz.
By symmetry, the center of mass is along the z-axis. The θ-coordinate ranges from 0 to
2π, and the z-coordinate ranges from 0 to h.
However, the radius changes with the z-coordinate. The equation of the edge of the
cone in the yz-plane in the figure is r = az/h, so that the radius r ranges from 0 to
az/h. Putting all of this together,
Z h Z 2π Z az/h
1
Z= zρrdrdθdz
M z=0 θ=0 r=0
Z az/h
2πρ h r2
= z dz
M 0 2
0
Z
2πρa2 h 3 πρa2 h2
= 2 z dz =
2h M 0 4M
Center of mass 141
Python Code
The triple integral is done the same way as the double integral which was evaluated in
Example 4.4. Note again the order of integrations, and compare with the Mathematica
code. Note again the order of the limits of integration in the integrate command.
print('-'*28,'CODE OUTPUT','-'*29,'\n')
Mathematica Code
Notice that in order to perform the triple integral in cylindrical coordinates, we
needed to explicitly include the equation for r = az/h in the argument of the Integrate
command.
Z = Integrate ρ∗z∗r
m
, {θ, 0, 2π}, {z, 0, h}, {r, 0, az/h} ;
Print[“The mass M, M = ”, M ]
Z2 = Z/.m → M ;
In the next example, we will use numerical methods to find the center of mass of a
non-uniform isosceles triangle. Recall that in Chapter 2, we discussed numerical integration
techniques.
Python Code
We use [Link] from the SciPy library. Notice that we can include the
bounds as a function; this allows us to use the non-constant limits of integration nec-
essary to describe the sides of the triangle. In addition to finding Y , we also calculated
X to show that X = 0, as expected.
Note the square brackets inside the [Link] command.
print('-'*28,'CODE OUTPUT','-'*29,'\n')
a = 1.0
def sigma(x,y):
return 2.0*y
def fx(x,y):
return x*sigma(x,y)
def fy(x,y):
return y*sigma(x,y)
def y_bounds():
return [0,1/[Link](2.0)]
def x_bounds(y):
return [y-1/[Link](2.0),1/[Link](2.0)-y]
Y = [Link](fy,[x_bounds,y_bounds])[0]
X = [Link](fx,[x_bounds,y_bounds])[0]
mass = [Link](sigma,[x_bounds,y_bounds])[0]
Mathematica Code
We use NIntegrate to numerically evaluate the integrals. We included the result
for X to show that it is zero.
144 Momentum, Angular Momentum, and Multiparticle Systems
a = 1.0;
√ √ √
mass = NIntegrate 2 ∗ y, y, 0, a 2 , x, y − a 2 ,a 2 −y ;
√ √ √
Y = NIntegrate 2 ∗ y ∧ 2, y, 0, a 2 , x, y − a 2 ,a 2 −y mass;
√ √ √
X = NIntegrate 2 ∗ y ∗ x, y, 0, a 2 , x, y − a 2 ,a 2 −y mass;
X
N
d2 X
N
d2
F= mi r̈i = 2
mi ri = 2 M R = M R̈ (4.4.1)
i=1
dt i=1 dt
where we used the definition of the center of mass from (4.3.1). Therefore, the system of
particles moves like a single particle of mass M , acted upon by the external forces. We can
also compute the net momentum of the system of particles:
X
N X
N
d X
N
d
P= pi = mi ṙi = mi ri = M R = M Ṙ (4.4.2)
i=1 i=1
dt i=1
dt
The total momentum of the system is equal to the momentum of the system’s center of
mass. Again, we can think of the system as a single particle of mass M located at the
system’s center of mass. The time derivative of the total momentum gives:
Ṗ = M R̈ = F (4.4.3)
This also tells us that the total linear momentum of the system is conserved if there are no
net external forces acting on the system.
In summary, we can think of the net external forces as acting on the center of mass of
the system. The results of this section also hold for continuous mass distributions, but the
summations would need to be replaced by integrals.
When it comes to translational motion, the above result allows us to think of the object
or system of particles as a point particle located at the object’s center of mass. The mass of
the point particle would equal the total mass of the object, or the total mass of the system
of particles. Since the external forces act on the center of mass, we can simply follow the
motion of the object’s center of mass. For example, an American football is not a point
particle. However, if the football is punted, its center of mass would follow a parabolic
Momentum of a system of multiple particles 145
trajectory because the center of mass is being acted upon by the force of gravity, and obeys
the equations established for projectile motion in Chapter 3.
x
a
Solution:
The chain can be thought of as a system of particles. The force on the center of
mass of the chain is:
Fnet = M g − FN
where M g is the weight of the chain and FN is the force exerted by the table on the
chain. We have chosen a coordinate system where +x is in the downward direction, so
that the speed of the falling chain is ẋ > 0. The mass of the falling part of the chain is
ρ(a − x), because the length of the chain that has yet to fall is (a − x). The momentum
of the falling part of the chain is then:
P = mv = ρ(a − x)ẋ
We know that Ṗ = Fnet ; therefore, the time derivative of the momentum is:
Ṗ = ρg(a − 3x)
Finally substituting Ṗ = Fnet = M g−FN and using the total mass of the chain M = ρa,
we find:
r ℓ
O x
Figure 4.3: A particle of mass m at a location r relative to the origin O is moving with
momentum p, and has an angular momentum ℓ = r × p relative to the origin. In this case,
the angular momentum of the particle is pointing into the page.
Angular Momentum
ℓ=r×p (4.5.1)
Because the position r of the particle is measured relative to the origin, the angular
momentum ℓ is also relative to the origin. The linear momentum p does not depend on the
origin, while by contrast the angular momentum vector ℓ depends on the choice of origin.
The angular momenta of multiple particles can only be compared (and added) if all angular
momenta are measured with respect to the same origin. Further, note that the particle does
not need to be revolving around the point O, in order for the particle to have an angular
momentum relative to O.
The cross product relationship between r and p tells us that the direction of angular
momentum is found using the right-hand rule. In this case, we can imagine taking the
fingers of our right hand and pointing them in the direction of r. Next, we can sweep (or
curl) our fingers in the direction N
of p resulting in the thumb, which points in the direction
of ℓ, pointing into the page. The symbol in Figure 4.3 represents the angular momentum
vector pointing into the page. If ℓ pointed out of the page, we would use a circle with a dot
inside to represent the direction of the vector.
If we compute the time derivative of the angular momentum, we obtain:
ri'=ri-R
mi
R
ri
x
Figure 4.4: A collection of N particles. Each particle mi is at a location ri relative to the
origin and a position r′i relative to the center of mass. The empty circle is the center of mass
of the system.
ℓ̇ = r × F = N (4.5.3)
Therefore, the time rate of change of the angular momentum is the torque, N = r × F.
Like the angular momentum, the torque is also measured relative to the same origin as the
angular momentum. Equation (4.5.3) is sometimes referred to as Newton’s second law for
rotation, even though rotational motion is not needed in order for the particle to experience
a torque, or to have angular momentum.
X
N X
N
L= ri × pi = ri × mi ṙi (4.6.1)
i=1 i=1
X
N
L= (r′i + R) × mi ṙ′i + Ṙ (4.6.2)
i=1
148 Momentum, Angular Momentum, and Multiparticle Systems
X
N
L= mi (r′i × ṙ′i ) + r′i × Ṙ + (R × ṙ′i ) + R × Ṙ (4.6.3)
i=1
!
X
N
X
N
mi r′i × Ṙ = mi r′i × Ṙ (4.6.4)
i=1 i=1
!
X
N
d X
N
mi (R × ṙ′i ) =R× mi r′i (4.6.5)
i=1
dt i=1
P P P P
P In each case, the term mi r′i appears. However, mi r′i = mi (ri − R) = mi ri −
mi R = M R − M R = 0 from the definition of the center of mass. Therefore, only two
terms survive in (4.6.3), and the total angular momentum is:
X
N
L= mi (r′i × ṙ′i ) + R × Ṙ
i=1
(4.6.6)
X
N X
N
= (r′i × mi ṙ′i ) + R × mi Ṙ
i=1 i=1
X
N
L= (r′i × p′i ) + R × P (4.6.7)
i=1
which says that the total angular momentum of the system is the sum of two terms:Pthe first
term is the sum of the angular momenta of the particles about the center of mass ( r′i × p′i
); the second term is the angular momentum of the center of mass about the origin (R × P).
If we compute the time derivative of L we find,
X
N
L̇ = ri × ṗi (4.6.8)
i=1
which is the net torque N acting on the system (recall that ṗ = F). Next, we will examine
the net torque acting on the system in detail:
X
N X
N
N= ri × ṗi = r i × Fi (4.6.9)
i=1 i=1
where ṗi = Fi is the net force acting on mass mi . This net force acting on mi is the sum of
external and internal forces; therefore:
Angular momentum of multiple particles 149
X
N X
N= ri × Fext
i + Fij (4.6.10)
i=1 j̸=i
X
N
XN X
= ri × Fext
i + (ri × Fij ) (4.6.11)
i=1 i=1 j̸=i
X
N
XN X
N= ri × Fext
i + [(ri × Fij ) + (rj × Fji )] (4.6.12)
i=1 i=1 j>i
X
N
X
N X
N= ri × Fext
i + (ri − rj ) × Fij (4.6.13)
i=1 i=1 j>i
Note that if the internal forces Fij are central forces, then the vector Fij lies along the
line joining mi and mj . Therefore, for central forces Fij lies along the vector ri − rj , and
(ri − rj ) × Fij = 0. In this case, the second term in (4.6.13) is zero, and the net torque is:
X
N
XN
N= ri × Fext
i = Next
i = Next (4.6.14)
i=1 i=1
In other words, the net torque on the system is equal to the sum of the external torques.
Similar to the net force, the sum of the internal torques is zero (if the internal forces are
central forces).
In summary, similar to the single-particle case, Newton’s second law for rotation can be
written as,
L̇ = Next (4.6.15)
Hence, the net angular momentum of the system is conserved only if the net external
torques are zero. The conservation of angular momentum can then be written as:
î ĵ k̂
ℓ1 = m1 (r1 × v1 ) = 1.0 3 2 0 = −4k̂
2 0 0
where we dropped the units in the determinant to simplify the equation. Next, we follow
the same steps for Particle 2:
î ĵ k̂
ℓ2 = m2 (r2 × v2 ) = 1.0 −3 2 0 = 6.0k̂
0 −2 0
L = ℓ1 + ℓ2 = 2.0 kg m2 /s k̂
Note that in this case we could add angular momenta, because each of the individual
angular momenta was calculated with respect to the same origin.
Python Code
Here we use NumPy to create the vectors and compute the cross products using the
cross(r1,v1) function.
Angular momentum of multiple particles 151
import numpy as np
print('-'*28,'CODE OUTPUT','-'*29,'\n')
m1, m2 = 1, 1
r1 = [Link]([3,2,0])
r2 = [Link]([-3,2,0])
v1 = [Link]([2,0,0])
v2 = [Link]([0,-2,0])
l1 = m1*[Link](r1,v1)
l2 = m2*[Link](r2,v2)
Mathematica Code
We use the Cross command to calculate the angular momenta. Note the use of curly
brackets to define vectors as lists.
r1 = {3, 2, 0}; v1 = {2, 0, 0}; m1 = 1.0;
l1 = m1 ∗ Cross[r1, v1];
l2 = m2 ∗ Cross[r2, v2];
L = l1 + l2;
1 X
N
R= mi ri
M i=1
Ṗ = M R̈ = F
The angular momentum ℓ of a single particle is the cross product of position vector r
and linear momentum vector p:
ℓ=r×p
and the torque N is the cross product of position vector r and force vector F:
ℓ̇ = r × F = N
The angular momentum L of a system of particles is the sum of two terms, the angular
momenta of the particles about the center of mass, and that of the center of mass about
the origin (R × P):
XN
L= (r′i × p′i ) + R × P
i=1
End-of-chapter problems 153
where R is the location of the center of mass relative to the origin, and P is the total
momentum. If we differentiate L with respect to time, we find Newton’s second law for
Rotation:
L̇ = Next
From Newton’s second law for rotation, we can write the law of conservation of angular
momentum for a system of particles:
7. Consider a rocket moving horizontally such that the only force acting on the rocket
is a linear drag force of the form Fdrag = −bvv̂ where b is a positive constant. Using
Newton’s second law, write the differential equation which describes the velocity of
the rocket as a function of time, with the initial condition v(0) = 0 at time t = 0.
a. Obtain the analytical solution v(t) by hand.
b. Using a CAS, solve the differential equation to find the velocity v(t) of the
rocket as a function of time. If you use Python, you will notice that the solution
in SymPy obtained with dsolve may contain complex numbers, while the Math-
ematica solution contains only real constants. This is an example showing one
of the limitations of CAS systems, and it is therefore important that one should
compare (when possible) the analytical solutions with the CAS results.
8. A rocket needs to hover just above the surface of Mars which has a gravitational
acceleration of a = 3.8 m/s2 . The exhaust velocity of the rocket is u =2000 m/s but
only 10% of its initial fuel can be burned. How long can the rocket hover?
9. A model rocket has a constant burn rate α = −dm/dt. Using (4.2.19) derived in
this chapter, m
0
v − v0 = −gt + u ln
m
calculate the height of the rocket as a function of time t. Find the height analytically
and by using a CAS.
10. Solve these two rocket problems.
a. A rocket has an initial mass m and burn rate α. What is the minimum exhaust
velocity u needed to allow the rocket to lift-off from the Earth’s surface immedi-
ately after its engines fire?
b. The Saturn V rocket had a mass (when fully loaded with fuel) of 2.8 million
kg. It consumed fuel at a rate of 20 tons per second. Find the exhaust velocity
needed for the Saturn V to lift off from the Earth’s surface immediately after its
engines fire. Compare your answer to the escape velocity of the Earth.
11. Consider a two-stage rocket flying horizontally far from any other object. During the
first phase of flight, the rocket with mass m0 has exhaust velocity v. At the end of
phase 1, the rocket has a mass m1 = mp + mf 1 where mp is the mass of the payload
and mf 1 is the mass of the fuel container. At burnout, the rocket ejects the mass mf 1
and begins to burn the fuel stored in the payload. At the end of the second burnout,
the rocket’s mass is m2 . The exhaust velocity during the second burnout is also u.
Find the velocity of the rocket after the second burnout.
Sections 4.3: Center of Mass
13. Consider the cone in Example 4.5. Suppose it has a density of ρ = (3 + z)/2, where
the units of the constants are such that ρ is measured in SI units. Using a CAS, find
the center of mass of the cone.
End-of-chapter problems 155
14. Compute the location of the center of mass of a uniform solid hemisphere of radius
R and density ρ. Perform the calculation using a CAS.
16. Using either Mathematica or Python, calculate the center of mass of a lamina with
a density of σ = 2(1 − x)(1 − y 2 ) formed from the area defined by the curves y = x2
and y = x, between x = 0 and x = 1.
17. A uniform piece of metal is cut into the shape of the function y = sin x from x = 0
to x = π. The metal has a density of σ = 2xy. Compute the location of the center of
mass. Solve this problem with a numerical integration algorithm.
18. Compute the location of the center of mass of a lamina cut in the shape of 1/3 of
the unit circle with a density of σ = 2xy. Place one edge of the lamina on the positive
x-axis and its “center” at the origin. Solve this problem using a CAS.
22. A chain of length L and uniform mass density λ = M/L hangs in a U shape from
the ceiling, with its two ends parallel and close together. At time t = 0, one end of
the chain is released. Find the tension T in the chain at the point of suspension, after
the released end has fallen a distance x. You may assume that the end of the chain
which is released is experiencing
p free fall. Plot the ratio of the tension to weight as a
function of t/tf , where tf = 2L/g is the time it takes for the released end to fall a
distance L.
23. A rope of mass M and length L is stretched out along a table such that a length x0
is hanging over the edge of the table. If the rope is released from rest and neglecting
friction, show that the time it takes
p for the rope to completely slide off of the table is
t = T cosh−1 (L/x0 ), where T = L/g.
156 Momentum, Angular Momentum, and Multiparticle Systems
24. Consider the rope in Problem 23 in the presence of friction. Find the time it takes
for the rope to slide off the table, if µ is the coefficient of friction between the rope
and the table. Solve the problem analytically and using a CAS.
Sections 4.5 and 4.6: Angular Momentum of a Single Particle and of Multiple
Particles
25. Evidence from ancient corals suggest that 350 million years ago, the Earth took 385
days to revolve around the Sun (Hadhazy [2]). The period of a year hasn’t changed,
but the Earth was rotating more quickly. What is the magnitude of the effective
torque slowing the Earth’s rotation over the last 350 million years? Assuming this
torque remains constant, how long will it take for the Earth to stop rotating (i.e., to
have an angular velocity equal to 0)?
26. Suppose you tie a ball of mass m to the end of a long string of length r0 and whirl the
ball around your head with an angular velocity ω0 , so that the ball travels in a circular
path whose plane is parallel to the ground. At time t = 0, the string is shortened at a
constant rate such that ṙ = −α. Find the angular velocity ω of the ball as a function
of time. Without plotting, qualitatively describe how ω changes with time. Find the
time at which the ball’s angular velocity is 16 ω0 .
27. Consider a rigid rotating object. By breaking the object up into many small pieces
of mass mi , show that the components of the object’s angular momentum parallel to
the axis of rotation can be written as L = Iω, such that:
X
I= mi ri2
where ri is the position of the mass element mi relative to the origin. Recall that I is
called the total moment of inertia of the system of particles.
32. Consider two particles each with a mass m = 1 (all physical quantities in SI
units). Particle 1 is located at r1 = 3 tî + 2 t2 ĵ + 6 k̂ and Particle 2 is located
at r2 = −3 t2 î + 2 t3 ĵ − 4 tk̂, where t represents time. Compute the total angular
momentum with respect to the origin of this system of particles. What is the net
torque acting on this system? Solve this problem by hand and by using a CAS.
33. Consider a system of three particles with masses and positions at time t: mass m1 =
1 is at r1 = 3t2 i + 2(t − 1)j − 3 cos (2t) k, mass m2 = 2 is at r2 = ti + 4t3 j − exp(−t)k,
and mass m3 = 1.5 is at r3 = i + t2 j − 3k. All physical quantities are in SI units.
Using a CAS, find:
where primes are used to distinguish between variables of integration and the limits of
integration. The unit of work, the Joule is 1 J = 1 N·m. Note that work is negative if the
object’s displacement is in the opposite direction of the force. For simplicity, we will focus
only on positive work right now.
Recall from Chapter 2 that if F = F (x), then we can write:
dv
F (x) = mv (5.1.2)
dx
which can be written as:
d 1
F (x) = mv 2 (5.1.3)
dx 2
159
160 Energy
Notice that the right-hand side of the above equation is the derivative of the quantity
T = 12 mv 2 , called the kinetic energy:
dT
F (x) = (5.1.4)
dx
Separating variables and integrating:
Z T Z x
dT ′ = F (x′ )dx′ (5.1.5)
T0 x0
Equation (5.1.6) is called the work-kinetic energy theorem, which states that work needs
to be done by the force F (x) in order to change the kinetic energy of a system. For example,
the force of gravity does work on a falling object, and its kinetic energy increases.
Additional insight into the nature of work can be obtained from (5.1.6). If the change
of the particle’s kinetic energy ∆T is positive, then positive work is being done by F and
the system is gaining kinetic energy. If however ∆T < 0, then F (x) is doing negative work
and the particle is losing kinetic energy.
Next, we will add another restriction to F (x). If the work done by F (x) is independent
of the path taken by the particle from x0 to x, then we say that force is conservative.
In a later section, we will study forces in two and three dimensions and develop a deeper
mathematical formalism for conservative forces. However, in one dimension all forces of the
form F = F (x) are conservative. Let’s consider the force of gravity exerted by an object
near the Earth’s surface. In this case, the force is the weight w = −m g ĵ, where the negative
sign is introduced to denote that the weight points downward, in the negative y-direction.
The work done by gravity is,
Z y
W = −mgdy ′ = −mg(y − y0 ) (5.1.7)
y0
where we used y for vertical displacements. Notice that the work done by gravity depends
only on the end points of the particle’s motion.
Consider a falling rock (in a vacuum, of course!). We noted earlier that the rock will
increase its kinetic energy as it falls. Where does that kinetic energy come from? According
to (5.1.6), the force of gravity does work on the rock, and (5.1.7) tells us how much work
is done by gravity. Another way of thinking of the process is to say that during the fall,
the rock’s energy is changing from one form into another. While the kinetic energy is the
energy associated with the motion of the rock, there is an additional energy associated
with the configuration of the rock-Earth system. In this case, the important parameter
is the rock’s height above the ground. In fact, (5.1.7) supports the idea of configuration-
dependent energy. The term y − y0 in (5.1.7) says that the work done by gravity depends
on how the distance between the Earth’s surface and the rock changes during the motion.
That change of distance is a change in the configuration of the rock-Earth system. The
Work and energy in one-dimensional systems 161
energy associated with the configuration of the rock-Earth system, or any system, is called
the potential energy. The potential energy function V (x) in one-dimension is defined by:
dV (x)
F (x) = − (5.1.8)
dx
Notice that (5.1.8) says that forces act so as to decrease the potential energy along x.
Hence, in our rock-Earth example, the force of gravity is decreasing the rock’s potential
energy and increasing the rock’s kinetic energy. Furthermore, this example illustrates that
forces transfer one form of energy into another, in this case, potential energy transferring
into kinetic energy.
To find the potential energy V (x) for a given force F(x), we need to integrate the force:
Z x
V (x) − V (x0 ) = − F (x′ )dx′ (5.1.9)
x0
If we choose y0 = 0 (and V (y0 ) = 0), then we recover the familiar equation, V = mgy.
Equation (5.1.9) can be rewritten as W = −∆V and tells us that potential energy also
measures the ability of the system to do work. By inserting (5.1.8) into (5.1.6) we get:
Zx
1 1 dV (x′ )
T − T0 = mv 2 − mv02 = − dx′ = V (x0 ) − V (x) (5.1.11)
2 2 dx′
x0
This equation is known as the conservation of mechanical energy, stating that the sum
of the kinetic and potential energies, called the total mechanical energy, is always constant
if only conservative forces act on the system. Conservative forces conserve energy!
Conservative forces are very useful in physics as they allow us to work with a scalar
quantity, the mechanical energy E = T + V . Mechanical energy is a useful way of solving
physics problems because instead of needing to keep track of the magnitude and direction
of vectors, as one needs to do with forces, all one needs to do is keep track of how the value
of the different types of energies are changing as the particle moves. Looking at (5.1.12), we
see that solving problems using conservation of energy requires only that we compare one
state of the system to another. For example, suppose we drop a rock starting at rest from
a height of 5 m above the ground and we want to know the kinetic energy of the rock after
it fell 2 m. All we need to know is the initial kinetic energy (which is zero) and the initial
and final potential energies in order to obtain the final kinetic energy (and thus the speed).
We don’t need information about the state of the system during the actual fall!
Equation (5.1.12) also tells us that if the potential energy of the system decreases, its
kinetic energy must increase and vice versa, in order to maintain the equality of both sides
of the equation. The ability to interpret the meanings behind equations such as (5.1.8) and
(5.1.12) is an important skill for physicists.
162 Energy
Therefore, we can write the elastic potential energy as V (x) = 1/2kx2 . When the
mass reaches the amplitude of oscillation, x0 = A, the mass has traveled as far from
equilibrium as it can, and it comes to a stop. Therefore, v0 = 0 and (5.1.12) becomes:
T0 + V (x0 ) =T + V (x)
1 1 1
0 + kA2 = mv 2 + kx2
2 2 2
Therefore, using E = T + V (x):
1 1 1
E= mv 2 + kx2 = kA2 (5.1.14)
2 2 2
we find that the total mechanical energy in terms of A is E = 12 kA2 .
(b) At the turning points xTURN the velocity vTURN = 0 so (5.1.14) gives:
1 2 1
E = 0 + k (xTURN ) = kA2
2 2
Therefore, the expression for the turning points in the motion of a simple harmonic
oscillator is: p
xTURN = ±A = 2E/k (5.1.15)
In the next section, we will discuss turning points in more detail.
where we used Wnc to denote that the work is done by a nonconservative force. Note that
we explicitly included the minus sign in (5.1.16) because the force of friction opposes the
direction of motion, and we consider the displacement to be in the positive direction.
Potential energy and equilibrium points 163
Consider the case of a particle, again constrained to move along a line, experiencing
multiple forces, both conservative and nonconservative. The net work Wnet is the total
work done by all of the forces. The net work can be written as Wnet = Wc + Wnc , where Wc
is the work done by the conservative forces, and Wnc is the work done by nonconservative
forces. In regards to the work in the above example, Wnet = ∆T and Wc = −∆V . Therefore,
∆T =Wnc − ∆V (5.1.17)
Wnc =∆T + ∆V (5.1.18)
Wnc =∆E (5.1.19)
or, in other words, the work done by nonconservative forces is equal to the change of the
system’s mechanical energy. So in cases where conservative forces act on the system, kinetic
energy gets exchanged for potential energy and vice versa. However, when nonconservative
forces act on the system, then mechanical energy can be lost or gained. An object falling
through air loses potential energy to both kinetic energy and work done by friction heating
the object and the surrounding air. However, if we account for the heat, we will find that
the total energy is conserved.
In the next section, we will study how to use potential energy to describe the motion of
an object.
Hence, the local maxima or minima of the potential energy gives the location of the system’s
equilibrium points, x0 . As we will see, the plot of V (x) can be used to describe the motion
of a particle.
Physical systems can be in three types of equilibria: stable, unstable, and neutral. An
example of a stable equilibrium is shown at the position near x = 0.7 mm in Figure 5.1.
This corresponds to values for which the potential energy V (x) is a local minimum. In
other words, d2 V /dx2 > 0 at the equilibrium position. In the case of stable equilibrium,
the forces acting on the particle will tend to restore the equilibrium. The restoring nature
of the force can be seen in the graph of V (x), by looking at the slope of V (x) on either
side of the equilibrium point. Note that the sign of the force is opposite of the sign of the
potential energy’s slope. Hence a displacement to the right of the equilibrium, where V (x)
has a positive slope, is met with a negative (left pointing) force. Similarly, to the left of
the equilibrium, V (x) has a negative slope, and therefore a particle displaced to the left of
equilibrium experiences a positive (right pointing) force.
An unstable equilibrium is shown at x = 0 in Figure 5.1. This corresponds to values for
which the potential energy V (x) is a local maximum, or in other words, d2 V /dx2 < 0 at
the equilibrium position. This means that if the particle is displaced an arbitrarily small
distance from the equilibrium state, the force causes it to move even farther away. By
studying the slope of V (x) on either side of the equilibrium, we can see that the particle
experiences a positive (rightward) force when displaced to the right of equilibrium, and a
164 Energy
1.00
0.95
Potential V
0.90
0.85
0.80
0.75
-1.0 -0.5 0.0 0.5 1.0
position x (mm)
Figure 5.1: Graph of a potential energy function which shows stable equilibrium points near
x = 0.7 and x = −0.7 and an unstable equilibrium at the origin (x = 0).
negative (leftward) force when displaced to the left of the equilibrium position, hence the
force acts to move the particle farther from equilibrium.
A final type of equilibrium not shown in Figure 5.1 is called neutral equilibrium. A neutral
equilibrium corresponds to situations for which the potential energy V (x) is a constant, and
hence its derivative is zero. In the case of neutral equilibrium, the system will tend to remain
in equilibrium if displaced by a small amount.
CM
h-R
h
H
R θ R
The figure on the left shows the object in its equilibrium state (upright). The figure
on the right shows the object tilted an angle θ from the vertical. The vertical line
passing through the center (circle) and center of mass (square) denotes the equilibrium
Potential energy and equilibrium points 165
positions. From the second diagram, we can see that the height of the center of mass is
H = R + (h − R) cos θ. Therefore, the potential energy with respect to the ground is:
V = mg [R + (h − R) cos θ] (5.2.2)
Next, to get the stability of the equilibrium state, we take two derivatives of V :
dV
= − mg(h − R) sin θ (5.2.3)
dθ
d2 V
= − mg(h − R) cos θ (5.2.4)
dθ2
Notice that the first derivative dV /dθ correctly identifies θ = 0 as an equilibrium
condition, since sin θ = 0 at θ = 0. Furthermore, if θ = 0 is inserted into the second
derivative, we find that the second derivative is negative when h > R. Therefore, the
equilibrium at θ = 0 is unstable when h > R. Additionally, the upright position is stable
if h < R, since in that case the second derivative is positive.
70
60
Potential V(x)
50
40 x3 E2
Out[ ]=
30
x1 x2
20
E1
10
0.0 0.5 1.0 1.5 2.0 2.5 3.0
Position x
Figure 5.3: Potential energy function demonstrating turning points.
We can, of course, use mathematics to describe this motion. Using energy conservation,
E = T + V = mv 2 /2 + V (x), we can solve for the velocity as a function of position:
r
2
v=± (E − V (x)) (5.2.5)
m
For a particle with energy E = E1 , we can see from Figure 5.3 that V (x1 ) = E1 and
V (x2 ) = E1 and therefore, using (5.2.5), the velocity is zero at the turning points, x = x1
and x = x2 . Furthermore, for x > x2 and x < x1 , the velocity is a complex number because
V (x) > E in those regions. Complex velocities are not physical, and this means that the
particle does not have enough energy to access those regions. For a particle with E = E1 , the
regions x < x1 and x > x2 are called classically forbidden regions. According to the physics
of classical mechanics, the particle cannot be in classically forbidden regions, because it
doesn’t have enough energy to access those regions. However, such regions are accessible in
quantum mechanical systems.
Using v = dx/dt, we can find the position by integrating (5.2.5):
Z x
dx′
t − t0 = q (5.2.6)
x0 2
(E − V (x ′ ))
m
Equation (5.2.6) can be a difficult way to solve for x(t) in closed form, for all but the most
simple of potential energy functions.
We can repeat our qualitative analysis for the motion of a particle starting at rest at
the unstable equilibrium x3 in Figure 5.3. In that case, if the particle is perturbed to the
right, it increases its velocity as the potential decreases. The graph ends at x = 3, so we
cannot tell what will happen to the particle for x > 3. If the particle is deflected to the left,
then it will increase in speed until it passes through the stable equilibrium, after which it
will slow down until it reaches x ≈ 0.1, before turning around. Mathematically, the particle
will then reach the unstable equilibrium coming to a stop.
Notice that both Figures 5.1 and 5.3 have local minima. The motion around local min-
ima corresponds to an oscillatory motion, if the energy of the particle is low enough. Let
us understand why that is the case using mathematics. Consider a particle near a stable
equilibrium x = x0 , hence, the equilibrium position x0 needs to be a local minimum of
V (x). Next, we ask the question, what is the mathematical form of V (x) near the stable
Potential energy and equilibrium points 167
Solution:
We find the equilibrium point by setting the derivative of V (x) equal to zero and
solving for x:
dV (x)
dx = 12x−13 − 6x−7 = 0
x = 21/6 = 1.122
We can easily verify that this is a stable equilibrium point by examining the second
derivative. We can also use Python and Mathematica to expand the function V (x)
around the equilibrium point:
A plot of (5.2.11) and (5.2.12) appear in Figure 5.4. The dashed line is the series
approximation near the stable equilibrium, and the solid line is the Lennard-Jones
potential. Notice that the approximation fails to provide a reliable estimate of the
potential energy the farther the particle moves from the equilibrium position.
Python Code
We begin the code by defining the Lenard-Jones potential, V. We then solve for the
equilibrium points. Notice the use of the .subs() method to get a numerical answer
from solve. There are many roots, but only one is positive and real. Next, we perform
a Taylor series expansion about the value x0 using the SymPy command series. Note
that we ask Python to compute up to the third order in the expansion. That ensures
we get the quadratic terms.
The method .removeO() removes the order term that Python includes at the end
of the series by default. Finally, we use lambdify to convert the SymPy expressions V
and expansion into functions that can be plotted, and we create the graph.
Potential energy and equilibrium points 169
print('-'*28,'CODE OUTPUT','-'*29,'\n')
x, s, ep = symbols('x, s, ep')
expansion_plot = lambdify(x,[Link]([(s,1),(ep,1/4)]),'numpy')
V_plot = lambdify(x,[Link]([(s,1),(ep,1/4)]),'numpy')
x_values = [Link](0.95,2.0,50)
Mathematica Code
After defining V, we find the equilibrium position x0 using Solve and choose the
only positive real root. Next, we compute the Taylor expansion about x0 using Series.
We apply the function Normal to make the series computable (and to remove the order
term). Chop replaces real numbers in the expression that are close to zero with the exact
value of zero.
170 Energy
σ = 1; ϵ = 1/4;
AxesLabel->{“position,x”, “V(x)”}]
0.4
0.2
V(x)
0.0
-0.2
dV a
F (x) = − = 2 − 2bx + 3cx2
dx x
The next step is to use Newton’s second law in order to create a second-order ODE,
which can be solved for x(t):
a
mẍ = − 2bx + 3cx2 (5.2.13)
x2
We plot the motion using Python and Mathematica. The output of the Mathematica
code is shown in Figure 5.5. Notice that the motion is periodic, oscillating between
points x = 0.21 and x = 0.95, as suggested in Figure 5.3.
Python Code
To solve (5.2.13) using odeint, we must rewrite it as two first-order equations using
the variable, v = dx/dt = ẋ:
ẋ =v
1 a
v̇ = − 2bx + 3cx 2
m x2
This code parallels many of the other codes in which we used odeint to solve an
ODE.
172 Energy
a, b, c, m = 4, 25, 8, 1
[Link](times,soln[:,0])
[Link]('time (s)')
[Link]('position (m)')
[Link]()
Mathematica Code
We use NDSolve to integrate (5.2.13).
SetOptions[Plot, Frame->True, Axes->False, BaseStyle->{FontSize->16}];
a = 4; b = 25; c = 8; m = 1;
0.8
0.4
0.2
0.0 0.5 1.0 1.5 2.0
time (s)
Figure 5.5: Output of the Mathematica code for Example 5.4.
Notice the dot product between the force F and the infinitesimal displacement dr in
(5.3.1). The dot product tells us that work calculations involve only the component of the
force parallel to the displacement, i.e., the component of the force perpendicular to the
displacement does no work. Note that (5.3.1) is also applicable to one-dimensional systems,
and we no longer need the restriction that F is in the same direction as dr.
The right-hand side of (5.3.1) is a line integral. In other words, the integral is evaluated
along a specific path. The value of W can depend on the path taken by the particle. It is
common to rewrite (5.3.1) including the path C followed by the particle:
Z
W = F · dr (5.3.2)
C
In order to calculate integrals of this type, one can break them up into component integrals,
by writing out the dot product of the components of the force vector F = Fx î + Fy ĵ + Fz k̂
and the differential dr =dxî + dy ĵ + dz k̂, as follows:
Z Z Z
W = Fx dx + Fy dy + Fz dz (5.3.3)
C C C
and then evaluate the individual integrals along the path C. The next several examples
demonstrate how to calculate path integrals for the three paths shown in Figure 5.6.
174 Energy
y
(0,1)
(2,1) (2,1)
y y
y=x/2
θ
x
(0,0) (0,0) (2,0) (1,0)
x x
(a) (b) (c)
Example 5.5: Calculating the work done by a force along a straight line path.
Find the work done by the force F = x y î−y 2 ĵ along the straight line path connecting
the origin to the point (2, 1) as indicated in Figure 5.6a. Do this problem analytically
(with and without parameterizing the path) and by using Python and Mathematica.
Solution:
This problem is most easily done in Cartesian coordinates. We write for the work
Z Z Z Z Z
W = Fx dx + Fy dy + Fz dz = x y dx − y 2 dy (5.3.4)
C C C C C
The straight line path shown in the figure can be written as y = x/2, and therefore
the differentials are related by dy = dx/2. The x-coordinate along path AB changes
from x = 0 to x = 2. By substituting these equations for y, dy into the above expression,
we end up with simple integrals over the x-axis only:
Z 2 Z 2 x 2 dx Z 2 3
x
W = x dx − = x2 dx = 1 (5.3.5)
0 2 0 2 2 0 8
We can also evaluate the work by parameterizing the path: we introduce the parameter
x = t such that t varies from t = 0 to t = 2. Along the line connecting the origin to the
point (2, 1) we then have y = t/2, and also dy = dt/2. The work becomes:
Z Z Z Z
2 2
2
W = Fx dx + Fy dy = t2 /2 dt − (t/2) dt/2 = 1 (5.3.6)
C C 0 0
Python Code
In Method #1 we use integrate in SymPy to evaluate the two integrals. In
the Python code we define the line from the origin to the point (2, 1) by using
ParametricRegion((t,t/2),(t,0,2), and we store this as the variable diagonal.
The work using Method #2 is calculated using ParametricIntegral(F,diagonal)
where F represents the force vector F = xy î − y 2 ĵ.
Work and line integrals 175
print('-'*28,'CODE OUTPUT','-'*29,'\n')
intx=integrate(x1*(x1/2), (x1,0,2))
inty=integrate(-y1**2, (y1,0,1))
x = t
y = t/2
W = ParametricIntegral(F, diagonal)
print('The line integral using ParametricIntegral = ',W)
Mathematica Code
After defining the force F as a vector field, we first perform two separate line integrals
using the Integrate command. Next, we use LineIntegrate where the first argument
is the vector field. The second argument is the variables written such that they are
along the line that joins the origin to the point (2, 1) defined in Mathematica using
Line[0,0,2,1].
176 Energy
F = {x ∗ y, −y ∧ 2};
Example 5.6: Calculating the work done by a force along a path consisting
of multiple straight-line segments
Find the work done by the force F = x y î − y 2 ĵ from the previous example along the
line path (0, 0) → (2, 0) → (2, 1), indicated in Figure 5.6b. Do the problem by hand and
by using ParametricIntegral in Python and LineIntegrate in Mathematica. Does
the work done by the force depend on the path taken between points (0, 0) and (2, 1)?
Solution:
The work in this case is calculated as the sum of two segments, (0, 0) → (2, 0) and
(2, 0) → (2, 1).
In the first segment we have y = 0 and therefore dy = 0, while x varies from x = 0
to x = 2.
Z Z
W = Fx dx + Fy dy (5.3.7)
(0,0)→(2,0) (0,0)→(2,0)
Z Z
= xydx − y 2 dy (5.3.8)
(0,0)→(2,0) (0,0)→(2,0)
=0+0=0 (5.3.9)
The first integral above is zero because y = 0 along the path from (0, 0) → (2, 0).
The second integral is zero because dy = 0 along the path.
Along the second segment from (2, 0) → (2, 1), we have x = 2 and dx = 0, while y
varies from y = 0 to y = 1.
Z Z
W = Fx dx + Fy dy (5.3.10)
(2,0)→(2,1) (2,0)→(2,1)
Work and line integrals 177
Z y=1 Z 1
= x y dx − y 2 dy (5.3.11)
y=0 0
1
1 3 1
=0− y =− (5.3.12)
3 0 3
Python Code
In the Python code we use the same method as in the previous example, with
ParametricRegion((t,0),(t,0,2) defining the horizontal line of the integration path
with x = t and y = 0. Similarly, ParametricRegion((2,t),(t,0,1) defines the ver-
tical line of the integration path with x = 2 and y = t. The work is calculated using
ParametricIntegral(F,line1) plus ParametricIntegral(F,line2), where F repre-
sents again the force vector F = x y î − y 2 ĵ.
from sympy import symbols
from [Link] import CoordSys3D, ParametricIntegral,\
ParametricRegion
print('-'*28,'CODE OUTPUT','-'*29,'\n')
t = symbols('t')
# Force vector
F = C.x*C.y*C.i - C.y**2*C.j
Mathematica Code
We break up the path into two steps. The first line integral, stored as line1 is done
along the line joining the origin and the point (2.0). The second line integral, stored as
line2 is done along the line joining (2, 0) to (2, 1). The final result is the sum of the
two integrals.
F = {x ∗ y, −y ∧ 2};
Example 5.7: Calculating the work done by a force along a curved path.
Find the work done by the force F = x y î − y 2 ĵ from Example 5.5 along the unit
quarter circle from the point (1, 0) to the point (0, 1) as indicated in Figure 5.6c. Do the
problem by hand and by using ParametricIntegral in Python and LineIntegrate in
Mathematica.
Solution:
This is a problem that is best done in polar coordinates. Let θ be the angle measured
counterclockwise with respect to the x-axis, denoted in Figure 5.6c. A particle moving
along the quarter circle would have a constant radial coordinate r = 1. Therefore, the
conversion from Cartesian to polar coordinates would be: x = cos θ and y = sin θ. In
order to rewrite the force vector, we need to convert the unit vectors from Cartesian
to polar coordinates. To derive the conversion, we start with the unit vectors for polar
coordinates from Chapter 3:
)
r̂ = cos θ î + sin θ ĵ
(5.3.13)
θ̂ = − sin θ î + cos θ ĵ
Next, we multiply r̂ by cos θ and θ̂ by sin θ and subtract. The result is:
Similarly, by multiplying the r̂-equation by sin θ and the θ̂-equation by cos θ, and
add. The result is:
ĵ = sin θ r̂ + cos θ θ̂ (5.3.15)
By inserting the coordinate transformations for x, y, î, and ĵ into the force we obtain:
dr = r dθ θ̂, because the particle is not moving radially away from the origin (i.e., r = 1
and dr = 0). After inserting F and dr into (5.3.1) and setting r = 1, we obtain:
Z π/2
W = (−2 cos θ sin2 θ) dθ = −2/3 (5.3.16)
0
Python Code
In the Python code we use the same method as in the previous two examples, with
path=ParametricRegion((cos(t),sin(t),(t,0,pi/2) defining the quarter circular
integration path, and the angle varying from t = 0 to t = π/2. The work is calculated
once more using ParametricIntegral(F,path, where F represents again the force
vector F = xy î − y 2 ĵ.
print('-'*28,'CODE OUTPUT','-'*29,'\n')
t = symbols('t')
# Force vector
F = C.x*C.y*C.i - C.y**2*C.j
Mathematica Code
Again we use LineIntegrate. This time, the path is defined using the command
Circle, whose arguments are the location of the circle’s center (0, 0), the circle’s radius
(1), and the parameter θ values of the path’s start and end point (in this case θ = 0 to
π/2).
180 Energy
F = {x ∗ y, −y ∧ 2};
dT 1
= m (v̇ · v + v · v̇) = mv̇ · v = F · v (5.4.2)
dt 2
dT = F · (vdt) (5.4.3)
dT = F · dr (5.4.4)
where T0 is the value of the kinetic energy at position r0 . Equation (5.4.5) is the work-kinetic
energy theorem and is similar to (5.1.6) derived for one-dimensional systems.
where we have set a reference point r0 such that V (r0 ) = 0. The above definition works for
our purposes because we have a conservative force. If the force was not conservative, then
Conservative forces and potential energy 181
the integral in (5.5.1) would also depend on the path taken by the particle and would not
be simply a function of r.
Now suppose that a conservative force, F(r), moves a particle from a point r0 to the
point r2 along two different paths. One path goes directly from the reference point r0 to
r2 , while the other path goes from r0 to r1 and then from r1 to r2 . Because the work is
conservative, the work done along the two paths is the same:
Or, the work done by the conservative force F(r) is related to the potential energy
through the formula:
Combining equation (5.5.5) with (5.5.1), we see that the work done by a conservative force
along a closed-loop path must be equal to zero, since the change of potential energy along
that path is zero.
Combining the Work-Kinetic Energy Theorem (5.4.5) with (5.5.1), produces:
Z r2
∆T = F(r′ ) · dr ′ (5.5.6)
r1
∆T =W (r1 → r2 ) (5.5.7)
∆T = − ∆V (5.5.8)
and therefore:
∆(T + V ) = 0 (5.5.9)
which tells us that the total mechanical energy E = T +V remains constant as the particle’s
position changes from r1 to r2 .
In the case where nonconservative forces work on the system, (5.1.19) still applies for
two- and three-dimensional systems. However, in this case, (5.4.1) is used to compute T ,
(5.5.1) is used to compute V , and the work done by the nonconservative force Fnc (r) is
found using: Z r2
Wnc = Fnc (r′ ) · dr′ (5.5.10)
r1
We have seen that the potential energy V (x) can be found from the conservative force F,
by using (5.5.1). Now suppose we know V and want to find F. We know from our discussion
of one-dimensional systems that F = −dV /dx; however, how does that generalize to higher
dimensions? To derive the relationship between F and V in three dimensions, we begin by
considering an infinitesimal displacement r → r + dr over which a conservative force F(r)
is acting on a particle. The work done by that force is:
dW = F(r) · dr = Fx dx + Fy dy + Fz dz (5.5.11)
where we are working in Cartesian coordinates for simplicity, but any other coordinate
system can be used. Continuing with the same displacement r → r + dr, the work done by
182 Energy
dW = − dV (5.5.12)
= − [V (r + dr) − V (r)] (5.5.13)
∂V ∂V ∂V
= − V (r) + dx + dy + dz + · · · − V (r) (5.5.14)
∂x ∂y ∂z
∂V ∂V ∂V
=− dx + dy + dz (5.5.15)
∂x ∂y ∂z
where r = xî+y ĵ+z k̂ , and in (5.5.15) we kept only linear terms in the multi-variable Taylor
series. Comparing the coefficients of dx, dy, and dz in Equations (5.5.11) and (5.5.15), we
find:
∂V ∂V ∂V
Fx = − Fy = − Fz = − (5.5.16)
∂x ∂y ∂z
In other words, the force is related to the potential energy through the gradient by:
Notice the minus sign in (5.5.17). The gradient points in the direction of the most rapid
increase in a scalar function. In the case of (5.5.17), we see that forces point in the direction
of the most rapidly decreasing potential energy. Consider the gravitational potential energy
as illustrated in Figure 5.7. Points at the same altitude all have the same potential energy.
We can think of the dashed lines in Figure 5.7 as surfaces of constant potential energy. As
the altitude increases, the potential energy increases. Hence, the direction of the most rapid
increase in V is upward ,i.e., perpendicular to the ground (shown as the rectangle). Because
Fg = −∇V, the force vector points along the direction of the most rapid decrease in V ,
which is downward.
A conservative force F can be written as the gradient of the potential energy. From
Chapter 3, we recall that the curl of a gradient of any scalar function V is always zero:
∇ × F = −∇ × ∇V = 0 (5.5.19)
Therefore, one method to identify whether or not a force is conservative is to compute its
curl. A force F will be conservative if and only if its curl is zero:
Conservative Force
∇×F=0 (5.5.20)
Conservative forces and potential energy 183
Figure 5.7: Surfaces of constant gravitational potential energy and the direction of gravita-
tional force, Fg .
∇ × F = (0 − 0) î + (0 − 0) ĵ + (0 − x) k̂ = − xk̂ =
̸ 0
Python Code
We use CoordSys3D to define a coordinate system and use the function curl(F)
from the library [Link]. We find that the curl is nonzero and the force is non-
conservative.
from [Link] import CoordSys3D, curl
print('-'*28,'CODE OUTPUT','-'*29,'\n')
R = CoordSys3D('R')
Mathematica Code
Notice that we defined the force F as a three-dimensional vector to get the correct
curl. Otherwise, Mathematica would assume F is a two-dimensional vector field and not
give the correct curl.
F = {x ∗ y, −y ∧ 2, 0};
î ĵ k̂ h i
∇×F = ∂
∂x
∂
∂y
∂
∂z
(−k) = −k î(0) + 0ĵ + k̂ (1 − 1) = 0 (5.5.21)
y x −z
So F is conservative and there exists a potential energy V associated with the force
F.
(b) Next, we calculate the potential energy V . Recall
Z Z Z Z
V = − F · dr = −k ydx − k xdy + k zdy (5.5.22)
Since the force is conservative, the potential energy V will be independent of the
path we choose for evaluating the integral.
We will integrate (5.5.22) from the origin to the point (x, y, z) along the following
path:
(1) From the origin to the point (x, 0, 0) along the x-axis.
(2) From the point (x, 0, 0) to the point (x, y, 0) along a line parallel to the y-axis.
(3) From the point (x, y, 0) to the point (x, y, z) along a line parallel to the z-axis.
Along path (1), we have y = z = 0, and dr = îdx. Therefore the line integral along
path (1) is
Z x
V1 = − (−ky)|y=0 dx = 0 (5.5.23)
0
Along path (2), x is constant and we have z = 0 and dr = ĵdy. Therefore the line
integral along path (2) is
Z y
V2 = − (−kx)|x=constant dy = kxy (5.5.24)
0
Along path (3), x and y are constant, and we have dr = k̂dz. Therefore the line
integral along path (3) is
Conservative forces and potential energy 185
Z z
k
V3 = − kzdz = − z 2 (5.5.25)
0 2
The total line integral across the entire path is
k 2
V = V1 + V2 + V3 = kxy − z (5.5.26)
2
Finally, we check the answer:
∂V ∂V ∂V
F = −∇V = − ,− ,− = −ky î − kxĵ + kz k̂ ✓ (5.5.27)
∂x ∂y ∂z
We now show an alternative method of calculating the potential energy V in the previous
example. In this method we integrate the general expression for the gradient.
Example 5.10: Consider the force F = −k y î + xĵ − z k̂ from the previous example.
Find the potential energy associated with this force, starting from the expression for
the gradient:
∂V ∂V ∂V
F = −∇V = − ,− ,−
∂x ∂y ∂z
Solution
Since F is conservative, there exists a potential energy V associated with the force
F such that: Z Z Z Z
V = − F · dr = − Fx dx − Fy dy − Fy dy
Z Z Z
V =k ydx + k xdy − zdz
We must have
∂V ∂V ∂V
F = −∇V = − ,− ,−
∂x ∂y ∂z
We consider the x-coordinate first:
∂V
Fx = − = −ky
∂x
Integrating with respect to x while keeping y, z as constants:
k
h(z) = − z 2 + c
2
where c is an arbitrary constant which we set to c = 0. Therefore:
k 2
V (x, y, z) = kxy −
z
2
This is of course the same answer we obtained in the previous example, where we
used a specific integration path to evaluate V .
ri'=ri-R
mi
R
ri
x
Figure 5.8: A collection of discrete particles. The center of mass is located at R and is
denoted by the empty circle.
First, we calculate the kinetic energy of the system relative to the origin, by using a
method similar to our calculation of the total momentum of a system of N particles in
Energy and multiparticle system 187
By using ri = R+r′i and ṙi = Ṙ+ ṙ′i (recall that a dot above a variable means differentiation
of that variable with respect to time), we can write vi2 as:
vi2 = ṙi · ṙi = ṙ′i + Ṙ · ṙ′i + Ṙ = (vi′ ) + 2 ṙ′i · Ṙ + V2
2
(5.6.2)
where vi′ = ṙ′i is the velocity of the ith particle relative to the center of mass, and V = Ṙ is
the velocity of the center of mass relative to the origin. Inserting (5.6.2) into (5.6.1) gives:
N ! N
X 1 d X
N X 1
′ 2 ′
T = mi (vi ) + Ṙ · mi ri + mi V2 (5.6.3)
i=1
2 dt i=1 i=1
2
P
The middle term in the above equation contains mi r′i , which in Chapter 4 was shown to
be zero from the definition of the center of mass. Hence, the total kinetic energy becomes:
XN
1 1
mi (vi′ )
2
T = M V2 + (5.6.4)
2 i=1
2
The first term in (5.6.4) is the kinetic energy of the center of mass, and the second term
corresponds to the kinetic energy of each particle that is moving relative to the center of
mass.
For potential energy, we need to consider both external and internal forces and their
corresponding potential energies. The potential energy of the particle with mass mi is:
X
Vi = Viext + int
Vi,j (5.6.5)
j̸=i
where Viext is the potential energy due to the external force acting on mi , and Vi,j int
is
the potential energy due to the interaction force between mi and mj . Examples of such
interaction forces could be gravitational, electrostatic, or any other central forces. In general
int
for central forces we have Vi,j int
= Vi,j (|ri − rj |), meaning that the potential energy depends
on the relative distance between the two particles. Therefore the total potential energy of
the system is:
X
N XN X
V = Viext + int
Vi,j (|ri − rj |) (5.6.6)
i=1 i=1 j̸=i
In the case of rigid bodies, the particles are at fixed distances, and therefore the internal
potential energy can be ignored, since it will be constant for each particle. Hence, for a rigid
body we will only have to worry about external forces. We will study rigid bodies in more
detail in Chapter 11.
188 Energy
The work W done by the force F (x) on a particle moving along a line from position
x0 to position x is: Z x
W = F (x′ ) dx′
x0
The Work-Kinetic Energy Theorem states that work needs to be done by the force
F (x) in order to change the kinetic energy of a system.
Zx
1 1
mv 2 − mvo2 = F (x′ )dx′
2 2
xo
The potential energy function V (x) associated with the force F (x) in one dimension
is defined by:
Z x
V (x) − V (x0 ) = − F (x′ )dx′
x0
The force F (x) associated with a potential energy V (x) can be found through differen-
tiation:
dV (x)
F (x) = −
dx
A particle is in an equilibrium state at x = x0 if:
dV
=0
dx
x0
Physical systems can exist in three types of equilibria: stable, unstable, and neutral
depending on the sign of d2 V /dx2 at the equilibrium point x = x0 .
The velocity is zero at the turning points of motion, so all of the particle’s energy
is in the form of potential energy.
Hooke’s Law appears any time we are studying small amplitude oscillations about
a stable equilibrium, by doing a Taylor expansion of the potential V (x):
1 1
V (x) ≈ (x − x0 )2 V (2) (x0 ) = k(x − x0 )2
2 2
In two and three dimensions, the work done by the force F moving an object between
points r1 and r2 is: Z r2
W (r1 → r2 ) = F · dr
r1
In order to calculate integrals of this type, one can break them up into component
integrals: Z Z Z
W = Fx dx + Fy dy + Fz dz
C C C
End-of-chapter problems 189
E = T + V (x) = T0 + V (x0 )
The kinetic energy of a system of N particles is the sum of the kinetic energy of the
center of mass and the kinetic energy of each particle that is moving relative to the
center of mass:
XN
1 2 1 ′ 2
T = MV + mi (vi )
2 i=1
2
In a rigid body the particles are at fixed distances, and the internal potential energy
can be ignored, so that we only have to worry about external forces.
5. A particle with mass m experiences a force F , and has velocity v = a/x (a > 0)
along the +x-direction. How much work is done by the force moving the particle from
position x1 to x2 , where x2 > x1 ? Do this problem analytically, and by using a CAS.
6. Consider a spherical planet of mass M and radius R. The gravitational potential
energy of a particle with mass m a distance r from the center of the planet is:
GM m
V =−
r
where G is the gravitational constant.
a. What is the escape speed for the planet? In other words, what velocity does
the particle need to have at the planet’s surface in order to escape the planet’s
gravitational pull at r = ∞?
b. Calculate numerically the escape velocity for a spacecraft on Mars.
where V0 , a > 0 and x > 0. Find the equilibrium points and determine the stability of
each equilibrium point. Plot V (x) and find a Taylor series approximation (to quadratic
in x) of V about each equilibrium point. To create the plot, set all constants equal to
1. Do this problem both analytically and using a CAS.
9. The equation for the potential energy shown in Figure 5.1 is V (x) = ax4 − bx2 + c,
which is known as a double-well potential. In Figure 5.1, a = b = c = 1 was used to
make the graph:.
End-of-chapter problems 191
a. What are the units for each coefficient a, b, c if V is measured in Joules and x in
meters?
b. If a 1.0 kg particle has energy E = 0.90 J and starts in the left well, describe the
motion of the particle. If there are turning points, find them.
10. Consider the double-well potential V (x) = ax4 − bx2 + c, with a = b = c = 1. Find
the force acting on the particle. Using a numerical ODE solver, find the position x(t)
of the particle with mass m = 1 kg as a function of time, when it starts at rest and
has a total energy:
a. E = 0.85 J.
b. E = 1.0 J.
c. E = 2.0 J.
11. The potential energy function used to make Figure 5.3 is V (x) = 1/(ax)+bx2 −cx3 ,
where the magnitudes of the coefficients are: a = 0.25, b = 25, and c = 8, and the
units are such that V is measured in Joules and x in meters:
a. What are the units of a, b, and c?
12. Consider the potential energy V (x) = a/x + bx2 − cx3 , from Example 5.4 and
Figure 5.2.2, where a = 4 Jm, b = 25 J/m2 , c = 8 J/m3 and mass m = 1 kg.
Using a numerical differential equation solver, find x(t) if the particle starts at rest at
x = 0.5 m and has total energy E = 30 J.
b. Plot the potential energy for different values of k and ϵ, to see how the shape of
the potential energy graph depends on those parameters. Try both positive and
negative values for ϵ. Discuss the motion of the particles in each case.
14. The simple plane pendulum consists of a mass m attached at the end of a massless
rod of length ℓ. The other end of the massless rod is fixed to a pivot point such that the
pendulum is allowed to swing freely in the vertical plane. Find the potential energy of
the pendulum as a function of θ, the angle the rod makes with the vertical. Find the
equilibrium points and classify their stability. Using m = 1 and ℓ = 1 (in SI units),
make a graph of the potential energy and discuss the motion of the pendulum for
various values of total energy. Do not assume that the pendulum is limited to small
oscillations.
15. Consider a particle of mass m experiencing the force, F(x) = −(k x + ϵ x2 )î where
k > 0 and ϵ > 0. In the cases where there is a stable equilibrium, find the frequency
of small oscillations.
192 Energy
16. In this chapter we saw Equation (5.2.6) for a particle of mass m and total energy
E, moving in a potential V (x):
Z x
dx
t − t0 = q
m (E − V (x))
x0 2
This equation gives t(x), which can be inverted to obtain the position of the particle
x(t). Use this equation to find x(t) for a particle whose potential energy is V (x) =
1/2kx2 , both analytically and using a CAS.
−c2 (x2 + k 2 )
V (x) =
x4 + 3c4
where c > 0 and k > 0. Find the equilibrium points as a function of x/c. Are the
points stable or unstable? Plot V (x) and discuss the possible types of motion of a
particle for different values of k/c.
18. A particle of mass m is acted upon by a one-dimensional potential V (x) = 3kx4 /4.
The particle oscillates between two turning points, x1 and x2 . Find the period of
oscillation of a particle with mass m = 1 kg, in the case where the total energy is
E = 10 J and k = 3.0 N/m4 . Plot the period of oscillation as a function of total
energy and discuss your results.
Section 5.3: Work and Line Integrals
19. Analytically, and by using a computer algebra system, compute the work done by
the force F = xy î − y ĵ along the path joining the origin to the point (2,4) along the
following paths:
a. Along the x-axis to the point (2,0), then parallel to the y-axis to the point (2,4).
b. Along the straight line path connecting the origin to the point (2,4).
c. Along the path y = x2 .
20. Analytically, and by using a computer algebra system, compute the work for the
force F = y î − xĵ along the following closed-loop paths:
a. The unit square in the first quadrant of the Cartesian plane, with one corner at
the origin.
21. Which of the forces below are conservative? Answer this question analytically and
by using a computer algebra system. For each conservative force, find the correspond-
ing scalar potential.
End-of-chapter problems 193
a. F = y î − xĵ
b. F = −kr
c. F = r sin θ eiϕ r̂ (in spherical coordinates)
d. F = kxyz r̂
k
e. F = r 3 r̂
22. Prove that any central isotropic force F = F (r)r̂, where r2 = x2 + y 2 + z 2 , is conser-
vative.
23. We showed that a conservative force can be written as F(r) = −∇V (r), and that
when conservative forces act on a system, the total mechanical energy is conserved
(∆(T + V ) = 0). Now consider a time-dependent force written as F(r, t) = −∇V (r, t).
Is energy conserved for this system? If so, prove it. If not, how is the conservation of
energy equation ∆(T + V ) = 0, changed?
25. Prove that the electrostatic force F = kq1 q2 /r2 r̂ on a point charge q1 at position r due
to a fixed charge q2 at the origin is conservative. The constant k = 1/4πϵ0 is positive
and depends on the permittivity of free space, ϵ0 . Find the potential energy when the
charges have the same sign. What happens to the potential energy when the charges
have a different sign? Explain your answer.
26. For each potential energy function, compute the associated force both analytically
and using a computer algebra system:
a. V = k x2 + y 2 + z 2 .
b. V = −kr cos ϕ, where k is a positive constant and r and ϕ are cylindrical coor-
dinates.
c. V = −kr cos ϕ + cr2 sin θ, where k and c are positive constants and r, θ, and ϕ
are the typical spherical coordinates.
27. Consider three particles. Particle 1 has a mass of m1 = 3 and is located at r1 = 3t2 î
at time t. Particle 2 has a mass of m2 = 1 and is located at r2 = 3t2 k̂. Particle 3 has
a mass of m3 = 2 and is located at r3 = 4t î − 8t2 ĵ + 3t3 k̂. All physical quantities are
in SI units. Analytically and by using a computer algebra system, find:
a. The location of the center of mass for the system.
28. Consider a planet of mass M which is orbited by a Moon of mass m1 = m. The Moon
is in a circular orbit with an orbital radius a. A dwarf planet, of mass m2 = m and
with kinetic energy of T2 approaches the two objects. The dwarf planet gets trapped
in the same circular orbit as the Moon, and the Moon is kicked free. Write down the
total energy of the three particle system (there will be two kinetic energies and three
potential energies). What is the kinetic energy of the Moon after the collision, after it
is far away? As usual, take the gravitational potential energy of a particle with mass
m at a distance r from a mass M as:
GM m
V =−
r
where G is the gravitational constant.
dn x dn−1 x dx
An + An−1 + .. + A1 + A0 x = f (t) (6.1.1)
dtn dtn−1 dt
where x = x(t) measures the oscillator’s displacement from a stable equilibrium, A0 , . . . , An
are constants, and f (t) is a function of time t. The order of a differential equation is the
highest derivative in the equation, and the equation is called homogeneous when the function
f (t) = 0. Equation (6.1.1) is called a linear differential equation because it consists of
only terms that are linear in x(t) and its derivatives. In general, equations that describe
oscillations are nonlinear in x and its derivatives. However, as we will see later in this
chapter, in the limit of small displacements from equilibrium, the equations of motion
usually take a linear form similar to that of (6.1.1).
In this chapter we will first study homogeneous linear second-order differential equations
of the form:
d2 x dx
A2 + A1 + A0 x = 0 (6.1.2)
dt2 dt
If x1 (t), x2 (t) are two solutions of this equation, then the general solution xc (t) of (6.1.2)
is a linear combination of these two solutions in the form:
195
196 Harmonic Oscillations
d2 x dx
A2 2
+ A1 + A0 x = f (t) (6.1.4)
dt dt
In the general theory of differential equations, the solution of this equation is given by
the sum of the solution of the homogeneous equation xc (t) from (6.1.3), sometimes called
the complementary solution, and a particular solution xp (t) of the full nonhomogeneous
equation. The particular solution xp (t) is any solution to the equation:
d 2 xp dxp
A2 2
+ A1 + A0 xp = f (t) (6.1.5)
dt dt
The general solution x(t) of a nonhomogeneous second-order differential equation then takes
the form:
For small displacements, we can expand F (x) as a Taylor series about the equilibrium
position x = 0:
dF
F (x) ≈F (0) + x + O(x2 ) (6.2.1)
dx
x=0
We know that F (0) = 0, because the restoring force is not exerted when the system is at
equilibrium. Likewise, we know that the first derivative of F (x) with respect to x must be
negative, in order for F (x) to point towards equilibrium. In other words, the sign of F (x)
is opposite that of x. Therefore, we define the spring constant as:
dF
k≡− (6.2.2)
dx
x=0
We can ignore second-order and higher terms in (6.2.1) because x is small. Therefore, the
result is that for small displacements, the restoring force takes on the form of Hooke’s Law:
Hooke’s Law
If x(t) is the location of the mass at a time t and we assume that the restoring force
takes the form of Hooke’s Law (i.e., small displacements from equilibrium), then we can
write Newton’s second law, F = ma = −kx(t), as:
d2 x
+ ω02 x = 0 (6.2.4)
dt2
where ω02 ≡ k/m is a constant. Equation (6.2.4) is the differential equation of motion for
the so-called simple harmonic oscillator (SHO), which is an important equation in physics
because it is the generic equation of motion for an object experiencing small amplitude
oscillations about a stable equilibrium. Simple harmonic motion results when a particle
experiences only a restoring force that is proportional to the particle’s displacement from
equilibrium, i.e., when there are no drag forces or other external forces acting on the particle.
198 Harmonic Oscillations
To find an analytical solution to (6.2.4), we need a function x(t) whose second derivative
gives itself back after differentiation, with a multiplicative constant and a minus sign. In
other words, x(t) must satisfy: ẍ = −ω02 x. Recall that time derivatives can be represented
by dots above a function. While one obvious choice is either a sine or a cosine function, we
will find that an exponential solution will be more useful (and still equivalent). We look for
solutions that have the form x = Ceλt , where C is a constant. By substituting this into
(6.2.4) we find:
λ2 Ceλt + ω02 Ceλt = 0 (6.2.5)
or by simplifying:
λ2 + ω02 = 0 (6.2.6)
or q
λ± = −ω02 = ±i ω0 (6.2.7)
and thus λ must be one of the complex numbers i ω0 or −i ω0 . The general solution, then,
will be a linear combination of the two solutions:
x(t) = C1 [cos ( ω0 t) + i sin (ω0 t)] + C2 [cos (ω0 t) − i sin (ω0 t)] (6.2.9)
Returning to Equations (6.2.10) and (6.2.11), A, B, and C are now real constants which
can be determined by the initial conditions, which specify the state of the system at a given
time (usually at t = 0).
Example 6.1 demonstrates the solution of (6.2.4) for the initial conditions x(0) = x0
and v(0) = x′ (0) = v0 .
Example 6.1: The symbolic solution of the SHO for given initial conditions
Solve (6.2.4) by hand and using Mathematica and SymPy, for the initial conditions
x(0) = x0 and v(0) = x′ (0) = v0 .
Solution:
When solving by hand, we can use (6.2.10) or (6.2.11), where A, B, and C are constants
determined by the initial conditions. Inserting the initial condition x(0) = x0 at t = 0
into (6.2.10) we find:
x(0) = A cos 0 + B sin 0 = A = x0 (6.2.14)
The speed of the mass v(t) is found by taking the derivative of (6.2.10) with respect to
time:
dx
v(t) = = −Aω0 sin ( ω0 t) + B ω0 cos ( ω0 t) (6.2.15)
dt
By using the given initial condition v(0) = v0 at t0 = 0 :
and so B = v0 /ω0 . Therefore, the complete solution for these initial conditions is:
v0
x(t) = x0 cos ( ω0 t) + sin ( ω0 t) (6.2.17)
ω0
Python Code
We can obtain the same result by using dsolve() in SymPy. The output of the symbolic
evaluation is
x(t) = x0*cos(omega*t) + v0*sin(omega*t)/omega
In this code we use SymPy to obtain both the general symbolic solution which contains
the arbitrary constants C1 and C2 , as well to obtain the specific solution with the given
initial conditions.
200 Harmonic Oscillations
print('-'*28,'CODE OUTPUT','-'*29,'\n')
Mathematica Code
We use DSolve twice, to obtain both the general symbolic solution which contains the
arbitrary constants C1 and C2 , as well to obtain the specific solution with the given
initial conditions.
Simple harmonic oscillator 201
Print[“x(t) = ”, x[t]/.soln1[[1]]]
x[t], t];
Print[“x(t) = ”, x[t]/.soln2[[1]]//Simplify]
In conclusion:
1 1 1
<V >=<T >= mA2 ω02 = kA2 = E (6.2.22)
4 4 2
where we used k = mω 2 and E = 12 kA2 . This equation shows that the time averages of both
the kinetic and potential energies within one period of oscillation are equal to one-half the
total energy E.
We can find the equation of motion for the simple plane pendulum by applying Newton’s
second law to the tangential axis only, F = −mg sin θ = ma and a = −g sin θ. The linear
2
acceleration a = ddt2s , where s is the arc length, which is related to the angle θ by the
Simple harmonic oscillator 203
d2 s
formula s = Lθ. The differential equation for the linear acceleration is dt2 = Lθ̈. Therefore
we obtain:
Lθ̈ = −g sin θ (6.2.24)
By substituting ω02 = g/L, we obtain the equation of motion for the simple plane pendulum:
For small displacements from equilibrium, we can approximate sin θ ≈ θ, and the equa-
tion becomes:
θ̈ + ω02 θ = 0 (6.2.26)
Equation (6.2.26) is exactly similar to the equation for a mass-spring system ẍ +pω02 x = 0,
with the angle θ replacing
p the position x, and with the natural frequency ω0 = k/m
being replaced by ω0 = g/L . Because the two equations (SHO and pendulum) are
mathematically similar, we can repurpose the solution of the SHO in order to solve
(6.2.26). The solution to (6.2.26) is therefore given by:
where ϕ is a constant phase angle value dependent on the initial conditions. The period of
oscillation for small displacements is found using τ = 2π/ω0 and is:
Notice that the period of oscillation is independent of the amplitude of oscillation. This
condition holds only for small amplitude oscillations. Once the small angle approximation
sin θ ≈ θ no longer holds, then the period of oscillation will be related to the amplitude of
oscillation. Such a relationship is common in nonlinear oscillators, which we will study in
Chapter 13.
The gravitational potential energy of the pendulum is given by the expression:
Notice that the above expression is chosen such that V = 0 when θ = 0. In other words, the
potential energy is zero at the stable equilibrium point. By using the small angle approxi-
mation cos θ ≃ 1 − θ2 /2, we obtain:
1
V = mgLθ2 (6.2.30)
2
The total energy of the pendulum for small angle oscillations is then:
2 2
1 ds 1 1 dθ 1
E= m + mgLθ2 = mL2 + mgLθ2 (6.2.31)
2 dt 2 2 dt 2
204 Harmonic Oscillations
where s = Lθ was used. Next, we can use (6.2.27) to find the total energy of the pendulum:
1
E= mgLθ02 (6.2.32)
2
This equation is of course completely analogous to the equation E = 12 kA2 for a mass-spring
oscillator. Notice that mgL appears in (6.2.32) instead of k. The restoring torque acting
on the pendulum is N = −mgL sin θ ≈ −mgLθ and is linearly proportional to the angular
displacement θ of the pendulum (for small displacements), with a coefficient of k = mgL.
Therefore (6.2.32) is consistent with the results for the spring-mass oscillating system.
Solution:
To solve (6.2.25), we will use the function odeint() from the [Link] library
which numerically solves first-order ODEs of the form:
dy
= f (y, t) (6.3.1)
dt
where y and t are the dependent and independent variables respectively, and f (y, t) is
a known function of the variables y, t.
To use odeint() on (6.2.25), we need to rewrite (6.2.25) as a system of two first-order
ODEs, a common procedure needed for some ODE solvers. We begin by creating a new
variable ω = θ̇ and (6.2.25) can be rewritten as the system:
dθ
=ω
dt (6.3.2)
dω g
= − sin θ
dt L
Python Code
In the code we define a function deriv(y,time) whose arguments are a vector y and the
time variable time. In our example, the first component y[0] of the vector y represents
the angle variable θ, and the second component y[1] represents the angular velocity ω =
dθ/dt. The function deriv uses (6.3.2) to evaluate and return a vector with components
(ω, dω/dt).
The function odeint(deriv, yinit, t) is called with three arguments. The first ar-
gument is the function deriv which contains the information on the first-order ODE
Numerical solutions of the simple pendulum 205
to be solved, the second argument is the initial conditions vector yinit, and the third
argument is the time variable t.
The result of calling odeint is an array which is assigned to the variable y. The line
t = [Link](0, 10, 100) defines the time interval over which the ODE will be
integrated, in this case between t = 0 and t = 10 s. The variable yinit = (3,0) defines
the initial conditions θ(0) = 3 rad, and ω(0) = θ′ (0) = 0 rad/s. The last 6 lines in the
code are the graphics commands which plot the two functions θ(t) and ω(t) = θ′ (t), as
shown in Figure 6.3.
The plot shows clearly that θ(t) is not a sinusoidal oscillation.
import numpy as np
import [Link] as plt
# define times t
t = [Link](0, 10, 100)
[Link](loc='best')
[Link]('Time [s]')
[Link](r"$\theta$(t), $\theta$'(t)")
[Link]('Numerical solutions for the plane pendulum')
[Link]()
findfont: Font family ['DejaVu Sans Display'] not found. Falling back to
DejaVu Sans.
206 Harmonic Oscillations
Mathematica Code
As in previous codes, we use NDSolve to obtain the numerical solution of the differ-
ential equation with the given initial conditions.
BaseStyle->FontSize->20, PlotRange->All];
L = 0.5; g = 9.8;
θ, {t, 0, 10}];
5
[t], '[t]
-5
0 2 4 6 8 10
t
Figure 6.3: Mathematica code output in Example 6.2 for large amplitude oscillations of a
simple pendulum, for the angle θ(t) (solid line) and the angular velocity θ′ (t) (dashed line).
We now define a constant γ called the damping parameter, in order to express the amount
of damping present in the system:
γ = b/2m (6.4.2)
and the differential equation becomes:
This implies a pair of solutions eλt , corresponding to the two roots of the quadratic. The
general solution is a linear combination of these two solutions:
√ √ √ 2 2 √ 2 2
−γ+ γ 2 −ω02 t −γ− γ 2 −ω02 t
x(t) = C1 e + C2 e = e−γt C1 e γ −ω0 t + C2 e− γ −ω0 t
p (6.4.6)
or by introducing the parameter ω ≡ γ 2 − ω02 :
q q
2
ω= γ 2 − ω02 = (b/2m) − (k/m) (6.4.8)
The exact mathematical form of this equation x(t) depends p on the numerical values
of γ and ω0 , which determine whether the parameter ω = γ 2 − ω02 is real, imaginary,
or zero. Therefore there are three physically different behaviors of the damped harmonic
oscillator as follows: overdamped oscillations (γ > ω0 ), underdamped oscillations (γ < ω0 ),
and critically damped oscillations (γ = ω0 ). p
In the special case of critically damped oscillations, we have γ = ω0 , and ω = γ 2 − ω02 = 0.
A critically damped system returns to equilibrium as quickly as possible without oscillating.
This is often desired for the damping of systems such as doors and car suspensions. In this
case, there is only one root of the quadratic equation λ = −ω0 . In addition to the solution
x(t) = eλt , a second solution is given by the function x(t) = teλt (see Problem 26 from the
End-of-Chapter problems for this section). The complete solution for a critically damped
oscillator is a linear combination of these two solutions:
Example 6.3 shows how to obtain the general symbolic solutions (6.4.7) and (6.4.9) using
Python and Mathematica.
Python Code
We use dsolve() in SymPy. Note that for the critically damped oscillator we use γ = ω0
explicitly in the code.
import textwrap
print('-'*28,'CODE OUTPUT','-'*29,'\n')
Mathematica Code
We use DSolve twice to obtain the general solutions for the three cases. The solutions
contain the arbitrary constants C1 and C2 .
Print[
motion is:"]
The general
solution
√
forunderdamped
and
√
overdamped
motion is:
b2 −4km b2 −4km
1
−m
b
− t 1
−m
b
+ t
x[t] → e
2 m 2 m
c1 + e c2
The solution of the underdamped case oscillates repeatedly through the equilibrium
point as the amplitude of oscillation decays to zero. This is unlike the overdamped case,
where the oscillator may not pass through equilibrium at all as its amplitude decays to zero.
This is an important difference in the behaviors p of the twop oscillators. Also notice from
(6.4.13) and (6.4.14) that the parameter ωd = ω02 − γ 2 = k/m − γ 2 is the frequencyp of
the underdamped oscillator, which is smaller than the natural frequency ω0 = k/m .
The expression Ae−γt in (6.4.13) and (6.4.14) represents the decrease of the amplitude
as a function of time t for underdamped motion. Notice that the amplitude of oscillation
decays exponentially with time. The quantity τA = 1/γ has dimensions of time, in order
for the argument of the exponential e−γt to be dimensionless, and it characterizes how fast
the amplitude of oscillation reaches zero. As a general guideline for exponential decaying
functions, the amplitude of oscillation is considered to have reached a value of effectively
zero after five characteristic times, i.e., after t ∼
= 5/γ.
For small damping, i.e., when γ << ω0 , we can use the binomial approximation (1−x)a ∼ =
1 − ax to obtain:
q q
2 ∼ γ2
ωd = ω0 − γ = ω0 1 − (γ/ω0 ) = ω0 1 −
2 2 γ << ω0 (6.4.16)
2ω02
Example 6.4 illustrates the solution for the equations of motion in a mass-spring system
exhibiting various degrees of damping.
Python Code
We use dsolve() in SymPy without specifying the initial conditions. The results from
the code agree with the above discussion for the different b values.
print('-'*28,'CODE OUTPUT','-'*29,'\n')
m, k, b = 1, 1, 3
# overdamped oscillation
soln = dsolve(m*D(x(t), t, t)+b*D(x(t), t) +k*x(t), x(t), \
simplify=True).rhs
m, k, b = 1, 1, 1
soln = dsolve(m*D(x(t), t, t)+b*D(x(t), t) +k*x(t), x(t), \
simplify=True).rhs
m, k = 1, 1
b = 2*sqrt(k*m) # condition for critical SHO
soln = dsolve(m*D(x(t), t, t)+ b*D(x(t), t) + k*x(t), x(t), \
simplify=True).rhs
Mathematica Code
Again the analytical solutions from Mathematica are in agreement with the general
form of the analytical solution given in this section.
m = 1; b = 1; k = 1;
m = 1; b = 3; k = 1;
m = 1; k = 1; b = 2 ∗ Sqrt[k ∗ m];
A comparison of x(t) for the underdamped, overdamped, and critically damped oscilla-
tions is shown in Figure 6.4, where we can easily see that the critically damped oscillator
(solid curve) returns to equilibrium in a shorter time than other cases. Note that the same
parameter values are used for m, k, x(0), and v(0) to produce all three curves in Figure 6.4,
while the value of b is variable.
Energy in damped harmonic motion 213
1.0
Underdamped
Overdamped
0.5 Critical
Position x(t)
0.0
Out[ ]=
-0.5
0 2 4 6 8 10 12 14
Time t,s
Figure 6.4: Dependence of the harmonic oscillator behavior on the amount of damping,
showing underdamped (oscillatory curve), overdamped (solid line) and critically damped
(dashed curve) cases.
these approximations the term γ sin (ωd t) is much smaller that the term ωd cos (ωd t) and
can be dropped in (6.5.3), to obtain:
dx
= A0 e−γt [ωd cos (ωd t) ] (6.5.4)
dt
Substituting x(t) and dx/dt into (6.5.1) we obtain:
1 2 1 2
E= m A0 e−γt ωd cos (ωd t) + k A0 sin (ωd t) e−γt (6.5.5)
2 2
By collecting terms:
1 2 −2γt
E= A0 e mωd2 cos2 (ωd t) + k sin2 (ωd t) (6.5.6)
2
214 Harmonic Oscillations
p
Substituting ωd ≃ ω0 = k/m we obtain:
1 2 −2γt 1
E= A0 e k cos2 (ωd t) + k sin2 (ωd t) = kA20 e−2γt (6.5.7)
2 2
The above equation shows that in a situation of weak damping, the total energy decays
exponentially with time. The characteristic decay time is τE = 1/(2γ).We previously saw
in (6.4.13) that the corresponding characteristic decay time for the amplitude is τA = 1/γ.
In summary, the total energy E and the rate of decrease of the total energy dE/dt for
the cases of weak damping γ << ωd (or ωd ≃ ω0 ) are given by:
The total energy lost within a small time interval ∆t can be estimated from:
∼ dE ∆t = −2γE∆t
∆E = (6.5.10)
dt
where we used (6.5.9). It is customary to define the dimensionless Quality factor or Q-factor
Q as the ratio Q = 2π|E/∆E|, for a time interval ∆t equal to the period τ = 2π/ωd . By
substituting this value of ∆t = τ = 2π/ωd in this definition of Q:
E 1 ωd
Q = 2π = 2π = (6.5.11)
∆E 2γτ 2γ
In a later section, we will provide a more in-depth discussion of the quality factor, in
connection with the concept of energy resonance of a forced harmonic oscillator.
where γ = b/2m, ω02 = k/m, and D = F0 /m. You might be wondering why we limit ourselves
to studying driving forces in the form of cosine functions. Clearly not all driving forces in
nature are in the form of cosine or sine functions. As we will show later in this chapter,
any periodic force (under certain conditions, which are often met in physical problems) can
be approximated using a series of sines and cosines. Therefore, the case of cosine or sine
driving forces is applicable widely and for many physical systems.
Note that (6.6.2) is a nonhomogeneous ordinary differential equation. As we discussed in
the introduction of this chapter on the general theory of differential equations, the solution
of nonhomogeneous equations is given by the sum of two parts, the homogeneous solution
xc (t), plus the particular solution xp (t) of the full nonhomogeneous equation:
We already saw in the previous section that the general solution xc (t) of the homogeneous
equations is given by (6.4.7):
q
−γt −ωt 2
xc (t) = e ωt
A0 e + A1 e ω = (b/2m) − (k/m) (6.6.4)
The solution xc (t) is commonly referred to as the transient solution, because the exponential
decay term e−γt causes xc (t) to decay to zero. After the transient solution has decayed to
zero, the only solution left is xp (t) (assuming that xp = ̸ 0) and is therefore known as
the steady state solution. Many physical systems exhibit both a transient and steady state
behavior. Physicists and engineers are often (but not always!) more interested in the steady
state behavior of the system, because that is the system’s long-term behavior.
Before we study the solution x(t) for the full equation (6.6.2), it is instructive to study
the case in which damping is absent. When no friction is present, the driven oscillator is
described by b = 0, so we obtain:
We try a solution of the form x = A cos (ωt − ϕ), and after we substitute and collect terms
we obtain:
−Aω 2 cos (ωt − ϕ) + ω02 A cos (ωt − ϕ) =D cos(ωt)
(6.6.6)
A ω02 − ω 2 cos (ωt − ϕ) =D cos(ωt)
This equation will have two possible solutions, when ϕ = 0 and cos (ωt − ϕ) = cos (ωt), and
when ϕ = π where cos (ωt − ϕ) = − cos (ωt). The amplitude A must be always positive, so
we can write the two possible solutions in the form:
D
A= ϕ = 0 and ω < ω0 (6.6.7)
ω02 − ω 2
D
A= ϕ = π and ω > ω0 (6.6.8)
ω 2 − ω02
and the solution of this driven oscillator with no damping is:
D
x = A cos (ωt) = cos (ωt) ϕ = 0 and ω < ω0 (6.6.9)
ω02 − ω 2
D
x = A cos (ωt) = cos (ωt) ϕ = π and ω > ω0 (6.6.10)
ω2 − ω02
A plot of the amplitude A and of the phase difference ϕ as a function of the external
frequency ω is shown in Figure 6.5. We see that the amplitude of the oscillation is maximum
216 Harmonic Oscillations
when the external frequency ω = ω0 , and that there is a sharp change in the amplitude and
in the phase at this frequency. This is our first demonstration of amplitude resonance, where
there is a large response from the oscillator when it is driven at a frequency that matches
the natural frequency of the oscillator. We will comment on resonance in more detail later
in this section.
20 5
Phase difference
15
Amplitude A
3
10
2
5
1
0 0
0.0 0.5 1.0 1.5 2.0 0.0 0.5 1.0 1.5 2.0
External frequency ω/ωo External frequency ω ωo
Figure 6.5: Amplitude A and phase difference ϕ as a function of the external frequency ω,
in the special case of driven simple harmonic motion with no damping.
A more realistic physical situation is of course the case where damping is not zero. For
this case, the standard method is to try substituting a solution x = A cos(ωt − ϕ) in (6.6.2).
The choice of a cosine solution is motivated by the fact that the right-hand side of (6.6.2)
contains a cosine term with a frequency ω. We need a function x(t) whose derivatives will
ultimately give a cosine with the same frequency. We know that the first derivative of the
cosine is sine. Therefore we introduce a phase term ϕ, which if chosen properly will allow all
of the terms on the left-hand side of (6.6.2) to add up to a cosine, and match the right-hand
side. To simplify the mathematics, we write our trial solution as a complex exponential,
x = A ei(ωt−ϕ) , and also replace the term D cos(ωt) in this equation with D eiωt . We will
carry out the algebra,
and then at the end, we will take the real part of the solution, because
cos(ωt) = Re eiωt . By substituting and taking the derivatives, we obtain:
By canceling out the eiωt from all terms and multiplying by eiϕ = cos ϕ + i sin ϕ on both
sides, we obtain:
By equating the real parts on the two sides of this equation, and also equating the imaginary
parts on the two sides to each other, we obtain:
A ω02 − ω 2 = D cos ϕ (6.6.13)
dx dxp
v= = − Aω sin (ωt − ϕ) (6.6.16)
dt dt
F0 /m
A= q (6.6.17)
2
(ω02 − ω 2 ) + 4γ 2 ω 2
2γω
tan ϕ = (6.6.18)
ω02− ω2
The codes in Example 6.5 numerically solve (6.6.2) using the odeint numerical integra-
tion method in SciPy, and the NDSolve command in Mathematica.
Python Code
In the code, the first component y[0] of the vector y represents the position variable
x, and the second component y[1] represents the derivative dx/dt. The function odeint
evaluates and returns a vector with components (x, dx/dt).The Python code shows
clearly the change of behavior of the solutions x(t) and v(t) as time progresses. The
initial part of the functions contains an exponentially decaying transient component.
At longer times, the solutions approach the steady state solutions, which oscillate with
time with a constant amplitude.
218 Harmonic Oscillations
[Link](1,2,1)
[Link](t, soln[:, 0], '-')
[Link]('x(t)')
[Link]('Time [s]')
[Link](1,2,2)
[Link](t, soln[:, 1], '-')
[Link]('v(t)')
[Link]('Time [s]')
plt.tight_layout()
[Link]()
Mathematica Code
SetOptions[Plot, Frame->True, Axes->True, BaseStyle->FontSize->20];
m = 1; k = 1; b = .2;
d = 5; ω = 3;
x, {t, 0, 80}];
GraphicsGrid[{{gr1, gr2}}]
Forced harmonic oscillator 219
2
2
1
x'[t]
x[t]
0
0
-1 -2
-2 -4
0 20 40 60 80 0 20 40 60 80
t t
Figure 6.6: The result of running the Mathematica code in Example 6.5 for the externally
driven harmonic oscillator. The effect of the transient part of the solution is clearly seen for
times t < 40 s, while the steady state solution is dominant for t > 40 s.
In addition, we can plot the amplitude A and phase angle ϕ as a function of frequency
using (6.6.17) and (6.6.18). The plots of the amplitude A and of the phase angle ϕ as a
function of the external frequency ω are shown in Figure 6.7. When ω << ω0 , we find that
the phase difference ϕ goes to zero, while for ω >> ω0 we find that the phase goes to π (180
degrees), i.e., completely out of phase with the driving force.
20 4
γ 0.01 γ 0.01
Phase Difference
15 3
Amplitude A
γ 0.05 γ 0.05
10 γ 0.1 2 γ 0.1
5 1
0 0
0.0 0.5 1.0 1.5 2.0 0.0 0.5 1.0 1.5 2.0
External frequency ω/ωo External frequency ω ωo
Figure 6.7: Plots of the amplitude A (ω), and of the phase angle ϕ (ω), in the case of
externally driven damped harmonic motion.
One of the most striking results shown in Figure 6.7 is the amplitude A (ω) as a function
of frequency. Notice that similar to the undamped case, amplitude resonance can occur. The
damping prevents the amplitude from blowing up to infinity at resonance. Although the
small value of γ = 0.01 results in a large amplitude at resonance, it is not infinite; it simply
is beyond the scale of the graph here. Notice that the amplitude resonance occurs when
ω ≈ ω0 , because of the small values of γ used to make Figure 6.7. Next, we will compute
the exact frequency at which resonance occurs.
220 Harmonic Oscillations
The resonance frequency ωr is the value of the drive frequency ω which causes amplitude
resonance and is found by computing:
dA
=0 (6.6.19)
dω
ω=ωr
p
From this equation we find that A is a maximum when ω = ωr = ω02 − 2γ 2 , where ωr is
the resonant frequency. The corresponding maximum value of A defined as Amax is then:
F /m
Amax = p0 (6.6.21)
2γ ω02 − γ 2
Python Code
In the Python code we create a function findmax(w) which finds the maximum value
of the steady state solution. This function solves the ODE using the dsolve function
in SymPy, and we select the steady state part of the solution soln by using the .subs
method to set the arbitrary constants to C1 = C2 = 0 .
Forced harmonic oscillator 221
print('-'*28,'CODE OUTPUT','-'*29,'\n')
x = Function('x')
t = symbols('t')
F, wo, gm = 1, 1, .1
def findmax(w):
# solve the ode to find the full analytical solution soln
soln = dsolve(D(x(t), t, t)+2*gm*D(x(t), t) +wo**2*x(t)-F*cos(w*t),
x(t),simplify=True).rhs
tvals = [Link](0,70,.02)
return max(steadyf(tvals))
Mathematica Code
By using the DSolve command as shown in the code, Mathematica produces the ana-
lytical solution which clearly contains the sum of xc (t) and xp (t). The variable x in the
code represents the full solution, while the variable steady represents xp (t). By using
the replacement rule /.Exp[t_]->0, the two exponential terms in xc (t) are set to zero,
and we are left with the expression steady which represents xp (t). By subtracting the
variable steady from x, we obtain the variable trans which represents the transient
solution xh (t). The parameter u is a list (created by Mathematica’s Table command)
of external frequencies ω and of the corresponding maximum amplitude A(ω). These
maximum values are obtained by using the command NMaxValue . Finally the list u is
plotted using the ListPlot command, and we obtain the desired graph of the maximum
amplitude A(ω) as a function of the external driving frequency ω.
sol = DSolve[{x”[t] + ωo∧ 2 ∗ x[t] + 2 ∗ γ ∗ x′ [t] == Fo/m ∗ Cos[ω ∗ t]}, x[t], t];
x = x[t]/.sol[[1]]//Simplify
√ √
−t γ+ γ 2 −ωo2 t −γ+ γ 2 −ωo2 Fo((−ω 2 +ωo2 )Cos[tω]+2γωSin[tω])
e c1 + e c2 + m(4γ 2 ω 2 +(ω 2 −ωo2 )2 )
steady = x/.Exp[t_] → 0
trans = x − steady
√ √
−t γ+ γ 2 −ωo2 t −γ+ γ 2 −ωo2
e c1 + e c2
m = 1; γ = 0.1; Fo = 1; ωo = 1;
1.00969Cos[0.1t] + 0.0203978Sin[0.1t]
Energy resonance and the quality factor for driven oscillations 223
4
Amplitude A(ω)
0
0.0 0.5 1.0 1.5 2.0 2.5 3.0
Driving frequency ω, Hz
Figure 6.8: The amplitude resonance A(ω) for a forced harmonic oscillator as a function of
the external driving frequency ω, from Example 6.6.
1 (F0 /m)
2
<E>= mω 2 + mω02 2 (6.7.3)
4 (ω0 − ω 2 ) + 4γ 2 ω 2
2
224 Harmonic Oscillations
and finally:
F02 ω 2 + ω02
<E>= (6.7.4)
4m (ω02 − ω 2 )2 + 4γ 2 ω 2
A plot of < E > as a function of the external driving frequency ω is shown in Figure
6.9. Notice that there is a peak similar to the peak we saw for the amplitude graph A(ω)
in Figure 6.8.
Figure 6.9 is illustrating energy resonance, and the energy resonance frequency is the
drive frequency which maximizes the average energy of the oscillator.
In the context of energy resonance and driven oscillations, the Q factor is defined as the
“frequency-to-bandwidth ratio” of the resonator, thus:
ωr
Q≡ (6.7.5)
∆ω
where ωr is the resonant angular frequency of the peaked graph in Figure 6.9. ∆ω in this
definition is the full width at half maximum (FWHM) of the energy resonance peak. In
order to find ∆ω, we need to find the two points ω1 and ω2 on this graph, which correspond
to half of the maximum of the peak.
500 γ 0.03
Average energy <E>
400 γ 0.05
γ 0.1
300
200
100
0
0.8 0.9 1.0 1.1 1.2
External frequency ω/ωo
Figure 6.9: Plot of the time averaged energy < E > from (6.7.4), as a function of the ratio
ω/ω0 . The value of γ = 0.03 results in a lightly damped harmonic motion, corresponding to
a large Q-factor.
To calculate Q, we assume a system with small damping (i.e., a sharp resonance), and
2
we substitute ω ≃ ω0 in (6.7.4), except for the term ω02 − ω 2 , to obtain:
F02 ω02 1
<E>= (6.7.6)
2m (ω0 − ω 2 )2 + 4γ 2 ω02
2
By approximating ω0 ≃ ω, the term ω02 − ω 2 = (ω0 + ω) (ω0 − ω) ≃ 2ω0 (ω0 − ω), and the
previous equation becomes:
F02 1
<E>= (6.7.7)
8m (ω0 − ω)2 + γ 2
Energy resonance and the quality factor for driven oscillations 225
Next, taking the derivative of < E > with respect to the driving frequency ω and setting
it equal to zero, we find that the maximum of this function occurs at ω = ω0 . By substituting
this value in (6.7.4), the maximum time average of the total energy is given by:
F02
< E >max = (6.7.8)
8mγ 2
Next, we need to find the frequency at which the average energy < E > drops to half its
maximum value. We substitute (6.7.8) in (6.7.7) to obtain:
1 1 F02 F02 1
< E >max = = (6.7.9)
2 2 8mγ 2 8m (ω0 − ω)2 + γ 2
ω1 = γ − ω0 ω2 = ω0 − γ (6.7.11)
∆ω = ω1 − ω2 = 2γ (6.7.12)
Therefore, from the definition of the Q-factor in (6.7.5), we find the ratio of the resonance
frequency ω0 over the FWHM ∆ω:
This is the same simple equation we derived for underdamped motion and involves only
the coefficients of the second-order differential equation describing most resonant systems,
electrical or mechanical. In electrical systems, the stored energy is the sum of energies stored
in lossless inductors and capacitors; the lost energy is the sum of the energies dissipated
in resistors per cycle. In mechanical systems, the stored energy is the maximum possible
stored total energy, i.e., the sum of the potential and kinetic energies at some point in time,
while the lost energy is that lost to damping forces such as friction.
ω and of the corresponding maximum energy E(ω). We plot the maximum average
energy E(ω) as a function of the external driving frequency ω.
It is notable that the energy resonance E(ω) shown in this example is much narrower
than the corresponding amplitude resonance A(ω) studied in the previous Example 6.6.
Mathematica Code
sol = DSolve[{x”[t] + ωo∧ 2x[t] + 2γx′ [t] == Fo/mCos[ωt]}, x[t], t];
x = x[t]/.sol[[1]]//Simplify
√ √
−t γ+ γ 2 −ωo2 t −γ+ γ 2 −ωo2 Fo((−ω 2 +ωo2 )Cos[tω]+2γωSin[tω])
e c1 + e c2 + m(4γ 2 ω 2 +(ω 2 −ωo2 )2 )
steady = x/.Exp[t_] → 0
en = 1/2msteady∧ 2
2
Fo2 ((−ω 2 +ωo2 )Cos[tω]+2γωSin[tω])
2
2m( 4γ 2 ω 2 +(ω 2 −ωo2 )2 )
m = 1; γ = 0.1; Fo = 1; ωo = 1;
12
10
Energy E(ω)
8
6
4
2
0
0.0 0.5 1.0 1.5 2.0 2.5 3.0
Driving frequency ω, Hz
Figure 6.10: The energy resonance E(ω) for a forced harmonic oscillator as a function of
the external driving frequency ω, from Example 6.7.
Figure 6.11: RLC series circuit with external voltage V (t), resistance R, inductance L, and
capacitance C.
The governing differential equation can be found by substituting into Kirchhoff’s voltage
law (KVL), the voltage equation for each of the three elements. From the KVL,
V (t) + VR + VL + VC = 0 (6.8.1)
where VR = −IR is the voltage drop across the resistor, VL = −L dI dt is the voltage drop
across the inductor, VC = − Q C is the voltage drop across the capacitor, and V (t) is the
time varying voltage from the source. Note that we are using the normal conventions that
I is the current in the circuit and Q is the charge on the capacitor. Furthermore, L is the
inductance of the inductor, R is the resistance of the resistor, C is the capacitance of the
228 Harmonic Oscillations
capacitor, and the current is I = Q̇. For simplicity, we will assume that V (t) = V0 cos(ωt).
Substituting these expressions in the KVL equation:
dI Q
L + IR + = V0 cos(ωt) (6.8.2)
dt C
Dividing by L leads to the second-order differential equation:
d2 Q(t) R dQ(t) 1 V0
+ + Q(t) = cos(ωt) (6.8.3)
dt2 L dt LC L
This equation has the exact same mathematical form as equation (6.6.2) for a driven
damped harmonic oscillator:
d2 x b dx k F0
+ + x= cos(ωt) (6.8.4)
dt2 m dt m m
where (6.6.2) is written without the substitution γ = b/2m.
Because (6.8.3) and (6.8.4) have the same mathematical form, we can reuse the solution
of the mechanical system, in order to get the solution of the electrical system. The math-
ematical similarities imply that the physical behaviors of the two systems are similar. The
forced damped harmonic oscillator has two solutions: a transient solution which decays as
t → ∞ and a steady state solution consisting of a sinusoidal oscillation with a frequency
equal to the drive frequency. Physically, these solutions are describing the displacement of
the mass m. Because of the mathematical similarities, we know that the RLC circuit will
also have two solutions, a transient which will also decay, and a steady state sinusoidal
solution which has the same frequency as the voltage source in the circuit. In the case of
the RLC circuit, it is the value of the charge on the capacitor that is oscillating.
Furthermore, we can then draw exact analogies between mechanical systems and elec-
trical systems. These analogies are shown in Table 6.1, and are found by comparing the
locations of the variables in (6.8.3) to those in (6.8.4). The simplest analogy is between the
displacement x of the mass and the charge Q on the capacitor. A more interesting analogy
exists between L and m. The inductance L in (6.8.3) appears in the same location as m in
(6.4.3). This implies that L is taking on a role similar to that of mass. This analogy makes
physical sense if we recall that the inductance L measures the inductor’s ability to resist
changes in current (Q̇), while the mass m is a measure of inertia, an object’s ability to resist
changes in velocity (ẋ).
It is also possible to use the analogies to identify qualitative characteristics of the RLC
circuit’s behavior. For example, we know that the coefficient of x in the mechanical system
is the angular frequency ω02 of oscillation for an undamped oscillator. We can conclude from
(6.8.3) that the oscillation frequency of a LC circuit (where R = 0) will be given by:
Table 6.1
Analogy between electrical RLC circuit in series and driven harmonic oscillator.
Position x Charge Q
dx dQ
Velocity dt
Current dt
Mass m Inductance L
Spring Constant k Inverse Capacitance 1/C
Damping γ Resistance R
pk p 1
Natural Frequency m LC
Finally, we can derive an expression about the energy of the RLC circuit. We begin by
multiplying (6.8.3) by Q̇ and L:
1
LQ̇Q̈ + RQ̇2 + QQ̇ = V0 cos(ωt)Q̇ (6.8.6)
C
Notice that:
1 d 1 d
Q̇Q̈ = Q̇2 and QQ̇ = Q2 (6.8.7)
2 dt 2 dt
Substitution of the previous equations into (6.8.6) gives:
d 1 11 2
2
LQ̇ + Q = −RQ̇2 + V0 cos(ωt)Q̇ (6.8.8)
dt 2 2C
The 12 LQ̇2 and 12 C1 Q2 terms in (6.8.8) are the energy stored in the inductor and capacitor,
respectively. We can see that if R = 0 and if there is no voltage source in the circuit (V0 = 0),
then the right-hand side of (6.8.8) is zero, so the total energy of the circuit is conserved.
The terms on the right-hand side describe how energy is either lost or gained in the
system. Recall that the power dissipated by a resistor is P = −I 2 R, which is the first
term on the right-hand side of (6.8.8). The second term on the right-hand side of (6.8.8) is
describing the rate at which energy is supplied by the variable voltage source. Notice that
V0 cos(ωt)Q̇ is in the form of V I, which is the formula for electric power.
Analogies can be a powerful tool in physics, which can be used to take an understanding
of one system, and apply it to another mathematically similar system. As with any analogy
(physics-related or not), be careful not to take the analogy too far. Doing so can lead to
confusion at best, and to a complete misunderstanding of the system at worst.
her child on a swing. The force applied by the mother is not continuous, but it is periodic
with a period τ . How can we mathematically model such forces? We could describe a force
that is “off” for a time τ /2 and then constant for a time τ /2 by using a piecewise definition:
(
0 0 ≤ t < τ /2
F (t) = (6.9.1)
F0 τ /2 ≤ t ≤ τ
however, such a definition could be difficult to work with analytically. We should note
that modern CAS can handle such equations in a variety of applications; however, there is
much value in learning how to work with such cases analytically. So, the question remains:
how do we represent such periodic discontinuous functions in a way that lends itself to
analytical solutions? The answer, which we will demonstrate in this section, is that we can
represent periodic discontinuous functions as a sum of sines and cosines called a Fourier
series. This interesting and important result is known as Fourier’s Theorem and applies to
periodic functions that are continuous, or have a finite number of discontinuities over the
period τ . Since most functions describing physical processes have only a finite number of
discontinuities over an interval t ∈ [0, τ ], we can consider Fourier’s Theorem to be widely
applicable.
Fourier’s Theorem is only one part of the solution of handling discontinuous periodic
drive functions. By representing drive functions as a series of sines and cosines, we need to
be able to solve equations of the form:
In other words, we need to know how to solve linear ordinary differential equations that
have multiple terms on the right-hand side. Because the differential equation is linear in x
and its derivatives, we can use the powerful concept of the Principle of Superposition, which
will allow us to break up the differential equation into pieces and then sum the solutions of
the individual pieces.
which is very similar to the equations describing oscillations that we have worked with so
far. We can rewrite such an equation as L̂(x) = F (t), where the differential operator L̂ is
defined as:
d2 d
L̂ ≡ a 2 + b + c (6.9.4)
dt dt
An operator L̂ is linear if it satisfies:
where c1 and c2 are arbitrary constants, and x1 and x2 are two solutions of the differential
equation (6.9.3). It is straightforward to show that L̂ defined in (6.9.4) is a linear operator.
Next, we consider a differential equation of the form:
where L̂ is defined as in (6.9.4). Suppose we know two functions x1 and x2 , such that
L̂ (x1 ) = F1 (t) and L̂ (x2 ) = F2 (t). In other words, x1 is the solution to (6.9.6) without
F2 (t) on the right-hand side, and x2 is the solution without F1 (t) present. Then:
Therefore, the sum of the individual solutions x1 and x2 is the solution to the full differential
equation (6.9.6). We can, of course, extend this to an arbitrary number of terms on the
right-hand side:
XN
L̂ (x) = ci Fi (t) (6.9.8)
i=1
where xi satisfied L̂ (xi ) = Fi (t) and xc is the complementary solution of the ODE. The
ability to add solutions in the above manner is called the Principle of Superposition and
applies only to linear differential equations. In Chapter 13 we will study nonlinear systems,
and the Principle of Superposition will not apply to those systems.
The Principle of Superposition will be critical in dealing with Fourier series representa-
tions of discontinuous drive forces. When we represent the discontinuous drive force as a
Fourier series, the resulting differential equation will be of the form:
We now know that in order to solve this type of equation, all we need to do is solve the
system of equations:
for i = 0, . . . , N . Note that for i = 0, cos(0) = 1 and we obtain the solution for the constant
term on the right-hand side of the differential equation. Similarly sin(0) = 0 gives the
homogeneous solution. While there may be a large number of equations to solve, there are
ways that the process can be generalized. For example, notice that in the above case, by
changing the value of i, we are simply changing the drive frequency for i > 0. Next, we need
to learn how to represent a discontinuous periodic function as a Fourier series.
a0 X
N
f (t) = + an cos(nωt) + bn sin(nωt) (6.9.12)
2 n=1
232 Harmonic Oscillations
1.0
0.5
f(x)
0.0
-0.5
-1.0
-5 0 5
Position x
where the lowest angular frequency is ω = 2π/τ , and the higher frequencies are integer
multiples n ω of the fundamental angular frequency ω. The coefficients an and bn represent
the amplitudes of the various waves, and are known as Fourier coefficients. The Fourier
coefficients an and bn are computed by using the following general integral relationships:
Z τ /2 (
0 m= ̸ n
cos (nωt) cos (mωt) dt =
−τ /2 τ /2 m = n ̸= 0
Z τ /2 (
0 m= ̸ n
sin (nωt) sin (mωt) dt = (6.9.13)
−τ /2 τ /2 m = n ̸= 0
Z τ /2
cos (nωt) sin (mωt) dt =0 for all integers n and m
−τ /2
The calculation of an and bn involves multiplying both sides of (6.9.12) with either
cos(2πmt/τ ) or sin(2πmt/τ ), and integrating over the whole period. The results of this
calculation are known as Fourier’s trick to many generations of physicists:
Z τ /2
2
bn = f (t) sin(nωt)dt (6.9.15)
τ −τ /2
It is not always possible to compute coefficients of all values of n, so a finite Fourier series
approximates the original function f (t), and the approximation improves as N increases.
The Fourier series is generally presumed to converge everywhere except at discontinuities,
where it converges to the mean of the values of f (t) before and after the discontinuity.
Example 6.8 demonstrates how to evaluate and plot the Fourier series of a periodic
function f (x), both analytically and using a CAS. Note that in this example the independent
variable is x and not the time t.
Principle of superposition and Fourier series 233
Solution:
Although in this case the independent variable is x, the function f (x) is periodic in
x, so all of the formulas for Fourier series still apply. Next, it is important to identify the
period. As can be seen from the graph (and the definition of f ), the period is τ = 2π.
Using the formulas (6.9.14) and (6.9.15), we can compute the Fourier coefficients, with
ω = 2π/τ = 1. First we find the an coefficients:
Z
1 π x
an = cos( 2πnx
2π ) dx
π −π π
2 Z π
1
= x cos(nx) dx
π −π
2 π
1 x sin(nx)
=
π n
−π
therefore, we see that an = 0 for all values of n, because sin(nπ) = 0 for all integers n.
Next, we compute the bn coefficients:
Z
1 π x
bn = sin( 2πnx
2π ) dx
π −π π
2 Z π
1
= x sin(nx) dx
π −π
2 2
=− cos(nπ) + 2 2 sin(nπ)
πn π n
Again, we use sin(nπ) = 0 for integer values of n. However, note that cos(nπ) = (−1)n .
Therefore, we find that:
2 (−1)n+1
bn =
πn
The resulting Fourier series is therefore:
∞
2 X (−1)n+1
f (x) = sin(nx)
π n=1 n
When x = ±π, the Fourier series converges to 0, which is the mean of the left and right
limits at x = ±π.
Python Code
In the code we evaluate the definite integrals for an and bn and specify that n is an
integer, by using the option integer = True in the symbols command. For the plots in
Figure 6.13, we define a function T(numTerms) which represents the finite summation
234 Harmonic Oscillations
of the number of Fourier terms, numTerms. A for loop is used to evaluate the sum,
with the two subplots representing the summation for N = 10, 30 terms. As can be
expected, as N increases, the sum represents more accurately the sawtooth function.
print("Coefficients an = ",(1/pi**2)*integrate(x*cos(n*x),(x,-pi,pi)))
print("Coefficients bn = ",(1/pi**2)*integrate(x*sin(n*x),(x,-pi,pi)))
[Link](1,2,2)
numTerms = 30
[Link](x, T(numTerms))
[Link](x1,x1/[Link]) # plot the two parts of f(x)
[Link](x2,-1+([Link])/[Link])
[Link](5,1,'N = '+str(numTerms))
plt.tight_layout()
[Link]()
Mathematica Code
We use the PieceWise command to define the function f (x), and we use the Table
command to create appropriate lists for the plots of the series approximations and of
f (x).
f = Piecewise[{{x/Pi, x > −Pi&&x < Pi}, {(x − 2 ∗ Pi)/Pi, x > Pi&&x < 3 ∗ Pi}}];
T = 2 ∗ Pi;
numTerms = 30;
ao=0
an-Fourier coefficients= −1+Cos[2nπ]+2nπSin[nπ]
n2 π 2
bn-Fourier coefficients= −2nπCos[nπ]+Sin[2nπ]
n2 π 2
Figure 6.13: Results from the Python code in Example 6.8, showing a comparison of the
original function (solid line) and the approximation using the Fourier series for N = 10, 30
terms (wavy line).
The driving force in (6.9.16) acts on a damped harmonic oscillator with damping pa-
rameter γ and natural frequency ω0 , whose equation of motion is then:
F (t)
ẍ + 2γ ẋ + ω02 x = (6.9.17)
m
In order to solve for x(t) using the analytical methods described in this chapter, we need
to use the Fourier series for F (t). From Example 6.8, we know that:
∞
2mA X (−1)n+1
F (t) = sin(nωt) (6.9.18)
π n=1 n
where we changed the independent variable from x to t, included the multiplicative constant
A, and explicitly included ω into the Fourier series. Note that ω = 1 because τ = 2π. So
the resulting differential equation to solve is:
∞
2A X (−1)n+1
ẍ + 2γ ẋ + ω02 x = sin(nωt) (6.9.19)
π n=1 n
However, the work done in this chapter had cosine terms on the right-hand side of the
differential equation. In order to use the solutions developed in this chapter, we will need
to use the identity: sin(a) = cos(a − π/2). Doing so results in (6.9.19) becoming:
∞
2A X (−1)n+1
ẍ + 2γ ẋ + ω02 x = cos(nωt − π/2) (6.9.20)
π n=1 n
Phase space 237
2A (−1)n+1
ẍn + 2γ ẋn + ω02 xn = cos(nωt − π/2) (6.9.21)
π n
We use trial solutions of the form xn (t) = An cos(nωt − π/2 − ϕn ) and follow the procedure
outlined for the solution of the driven damped harmonic oscillator. The result is:
2A(−1)n+1
An = q (6.9.22)
2
nπ (ω02 − (nω)2 ) + 4γ 2 (nω)2
2γnω
tan ϕn = (6.9.23)
ω02 − (nω)2
Notice that the above solution is the same as (6.6.17) and (6.6.18), however the constant
coefficient is now 2A(−1)n+1 /nπ, and the drive frequency is nω instead of ω. Finally, we
can use the Principle of Superposition to find the solution to (6.9.20):
∞
2A X (−1)n+1
x(t) = q cos(nωt − π/2 − ϕn ) (6.9.24)
nπ n=1 2
(ω02 − (nω)2 ) + 4γ 2 (nω)2
where the phase angles ϕn are defined in (6.9.23).
x2 v2
+ =1 (6.10.4)
2E/k 2E/m
p
This is an ellipse with semi-major axis equal
p to the amplitude of oscillation a = 2E/m
and the semi-major y-axis equal to b = 2E/k. Examples of harmonic oscillators with
238 Harmonic Oscillations
different energies E are shown in Figure 6.14. In this case, we see that ellipses with larger
area correspond to the trajectories with larger energies.
1.0
E=1
0.5 E=0.25
0.0
p
-0.5
-1.0
-2 -1 0 1 2
x 1
Figure 6.14: Phase space of simple harmonic oscillator
Phase space diagrams can tell us something about the motion of the system. The curve
in a phase diagram is sometimes referred to as a trajectory in phase space. An image of all
possible trajectories in a phase space is usually called a phase portrait or phase diagram.
Each point along a trajectory gives the system’s position and momentum. The presence of
closed-loop trajectories in a phase space diagram is evidence of oscillatory motion. A closed-
loop trajectory tells us that after some time τ , the system returns to its initial position and
momentum. The elliptical trajectories in Figure 6.14 tell us that the SHO displays oscillatory
motion (which we already knew!).
Next, we will look at the phase space diagram of an underdamped harmonic oscillator.
In this case, we write:
x(t) = Ae−γt cos(ωd t − ϕ) (6.10.5)
v(t) = dx/dt = −Aωd e−γt sin(ωd t − ϕ) − Aγe−γt cos(ωd t − ϕ) (6.10.6)
where ωd is the driving frequency. It can be difficult to visualize the trajectories directly
from the above equations. Therefore, we can make the following change of coordinates, in
order to simplify the algebra:
u = ωd x, w = γx + v (6.10.7)
we know that underdamped motion consists of oscillatory motion whose amplitude decays
exponentially in time.
Suppose we did not have the insight to use polar coordinates. How would we have created
the phase space diagram? We can use a parametric plot of x and v. The codes for creating
the underdamped oscillator’s phase space diagram are demonstrated in Example 6.9.
Python Code
In the code we define the time parameter t and define x(t) and v(t) as NumPy expres-
sions, which are plotted in MatPlotLib using [Link]. The graph is shown in Figure
6.15.
x = A*[Link](-gamma*t)*[Link](omega*t-phi)
# v = dx/dt
v = -A*(gamma*[Link](omega*t - phi) +\
omega*[Link](omega*t - phi))*[Link](-gamma*t)
[Link](x,v)
[Link]('v')
[Link]('x')
[Link]()
Mathematica Code
In Mathematica we find the speed v(t) using v=D[x,t], and we can use directly the
ParametricPlot[x,v] command to create the phase space plot in Figure 6.15.
240 Harmonic Oscillations
A = 1; ωd = 1; ϕ = 0; γ = 0.1;
v = D[x, t];
0.5
0.0
v
-0.5
The above algorithm can be used to generate the phase diagram for any system whose
position x(t) is known. While the phase space diagram does not provide new information
about the behavior of the harmonic oscillator, we will find in Chapter 13 that phase space
diagrams will become a critical tool for understanding the possible behaviors of a nonlinear
system. In Chapter 13, we will develop a method of finding a system’s phase space diagram
without solving analytically the system’s equations of motion. It is often the case in nonlinear
systems that the equations of motion cannot be solved analytically. Therefore the phase
space diagram may be the only tool available in getting information about the behavior of
the system.
Chapter summary 241
q
x(t) = A0 eωt + A1 e−ωt e−γt ω= γ 2 − ω02 γ > ω0 Overdamped
q
x(t) = Ae−γt cos (ωd t − ϕ) ωd = ω02 − γ 2 γ < ω0 Underdamped
−ω0 t
x(t) = (A + Bt) e γ = ω0 Critically Damped
The energy and energy loss for weakly damped oscillator are:
1 2 −2γt dE
E= kA e γ << ωd = −2γE (6.11.1)
2 0 dt
The dimensionless Q-factor expresses the degree of damping present in an oscillator,
with higher Q indicating a lower rate of energy loss:
ω0
Q=
2γ
The forced damped oscillator is described by the amplitude A (ω) and phase angle
ϕ (ω), both are functions of the external driving frequency ω:
ẍ + 2γ ẋ + ω02 x = F0 cos(ωt) x(t) = xc (t) + A cos (ωt − ϕ)
F0 /m 2γω
A= q tan ϕ =
2 ω02 − ω 2
(ω02 − ω2 ) + 4γ 2 ω 2
242 Harmonic Oscillations
where xc (t) is one of the three possible solutions of the homogeneous equation. This
oscillator exhibits the phenomenon of resonance with resonance frequency and
resonance amplitude given by:
q q
F /m
ωr = ωd2 − γ 2 = ω02 − 2γ 2 Amax = p0
2γ ω02 − γ 2
There is an analogy between the charge Q(t) in electrical RLC circuits and the
position x(t) in mechanical oscillators:
d2 Q(t) R dQ(t) 1 d2 x b dx k
+ + Q(t) = 0 + + x=0
dt2 L dt LC dt2 m dt m
The general mathematical form of a Fourier series for any periodic function with
period τ = 2π/ω is:
a0 X
N
f (t) = + an cos(nωt) + bn sin(nωt)
2 n=1
Phase space diagrams are important in analyzing nonlinear systems. They are plots of
the position x(t) of a particle on the x-axis and its corresponding speed v(t) (or
momentum) on the y-axis.
1. A mass m kg moves with simple harmonic motion along the x-axis with a frequency
ω0 . At time t = 0 the mass is stationary, and at time t =1 second it is moving with a
speed V . Solve this problem both analytically and using a CAS.
a. Find the position, velocity, and acceleration as a function of time t.
b. Find the amplitude and period of the motion.
2. Starting from the general expression x(t) = A cos ( ω0 t) + B sin ( ω0 t) for a harmonic
oscillation, show that an equivalent form √
of this equation is given by the expressions:
x(t) = C cos ( ω0 t + ϕ) where C = A2 + B 2 tan ϕ = B/A.
3. A mass m is attached to a spring of spring constant k and moves with underdamped
harmonic motion along the x-axis, with the air resistance given by F = −bv.
a. Show that the difference in times between two successive maxima is given by:
2π
∆t = p
ωo2 − γ 2
End-of-chapter problems 243
p
where γ = b/2m and ω0 = k/m.
b. Show that the ratio of the amplitudes of two successive maxima of the position
is given by:
R = eγ∆t
d2 z
+ 16z − 160 cos (6t) = 0
dt2
with the initial conditions z(0) = 0 and dz
dt (0) = 0. Find and plot the solution z(t) for
several periods and interpret the results.
7. A cylinder of mass m and radius R floats with its axis vertically and partially sub-
merged in a liquid of density ρ. The cylinder is given a small vertical displacement
downwards and is released. Find the period of oscillation.
8. A mass m moves in a region of the xy-plane where the force is given by F = −k x î −
k y ĵ.
a. Show that depending on the initial conditions of the problem, the motion will be
an ellipse, a parabola or a hyperbola.
b. Find the potential energy of this oscillator.
9. Consider a mass m moving on a vertical wire inside a gravitational
field. The shape of the wire is a cycloid, described by the equations:
x = a θ − a sin θ and y = −a + a cos θ.
a. Find the speed of the mass at the bottom of the cycloid wire, if it is released
from rest at the origin (0, 0) at time t = 0.
b. Find the period of oscillation.
10. A mass m is on a frictionless table and is connected to two fixed points on opposing
walls, by two springs of equal natural length, of negligible mass and spring constants
k1 and k2 , respectively. The mass is displaced
p horizontally and then released. Prove
that the period of oscillation is τ = 2π m/(k1 + k2 ).
244 Harmonic Oscillations
11. A spring having a spring constant k and negligible mass, has one end fixed on an
inclined plane of angle θ and a mass m at the other end, as shown in Figure 6.16. If
the mass m is pulled down a distance x below the equilibrium position in a direction
parallel to the inclined plane and released, find the displacement from the equilibrium
position at any time if (a) the incline is frictionless, (b) the incline has coefficient of
friction µ.
Figure 6.16: A mass attached to a spring on an inclined plane, from Problem 6.11.
12. A particle moves with simple harmonic motion along the x-axis. At times t0 , 2t0 , 3t0
it is located
at x
= a, b, c, respectively. Prove that the period of oscillation is T =
2πt0 / cos−1 a+c2b .
13. Two equal masses m are connected by springs having equal spring constant k, as
shown in Figure 6.17, so that the masses are free to slide on a frictionless table. The
walls to which the ends of the springs are attached are fixed.
a. Set up the differential equations of motion of the masses, and find the possible
frequencies of oscillation, also called the normal frequencies.
b. Suppose that the first mass is held at its equilibrium position while the second
mass is given a displacement of magnitude a > 0 to the right of its equilibrium
position. The masses are then released. Find the position of each mass at any
later time.
c. Plot the positions of the two masses as a function of time on the same graph,
and discuss the motion. Use the numerical values k = m = a = 1 in SI units.
Figure 6.17: Two coupled masses connected to fixed ends, from Problem 6.13.
14. Two equal masses m are on a horizontal frictionless table as shown in the Figure
6.18, are connected by springs of equal spring constants k. The end of one spring is
attached to a wall, and the masses are set into motion.
a. Set up the equations of motion of the system.
End-of-chapter problems 245
b. Find the possible frequencies of oscillation, also called the normal frequencies,
and plot
p the motion of the two masses. Use a numerical value of the frequency
ω = k/m=1 rad/s.
Figure 6.18: Two masses joined by a horizontal spring from Problem 6.14.
15. Two masses m1 and m2 are attached to the ends of a spring of constant k , which
is on a horizontal frictionless table as shown in Figure 6.19. If the masses are pulled
apart and thenpreleased, prove that they will vibrate with respect to each other with
period T = 2π µ/k where µ = M1 M2 /(M1 + M2 ) is the reduced mass of the system.
Figure 6.19: Two masses attached to a spring on a frictionless table, from Problem 6.15.
16. Find the frequencies of vibration for the system of particles of equal masses m
connected by springs with the same spring constant k, as indicated in Figure 6.20.
Figure 6.20: Two coupled masses hanging from vertical springs, from Problem 6.16.
17. A pendulum has length L = 1 m, mass m = 0.1 kg and the gravitational accelera-
tion is g = 9.8m/s2 . Let θ(t) represent the angle of the pendulum from the equilibrium
position.
a. Plot the angle θ(t), the angular velocity ω = dθ/dt, the kinetic energy T , the
potential energy V and the total kinetic energy E = T + V as functions of time
t, when the pendulum is released from rest at a small angle of 3 degrees from
equilibrium.
246 Harmonic Oscillations
b. Plot the motion of the pendulum when it is released from rest at a small angle
of 3 degrees, and at a very large angle of 170 degrees from equilibrium. How is
the oscillation different in the two cases?
c. Find the time averages < T > and < V > over a complete period of oscillation for
the two angles of release in part (b), and compare them with the total mechanical
energy E. Discuss your result.
18. A pendulum has length L = 1m, mass m = 0.1kg, and it is released from rest at an
angle of 3 degrees from equilibrium. Use a value of g = 9.8 m/s2 for the gravitational
acceleration.
a. Find the tension T of the string as a function of time t.
b. At what value of time t is the tension a maximum, and at what value is it a
minimum? Do these results make sense?
19. In this chapter,
p we saw that for small amplitude oscillations, the period of a pendulum
is τ = 2π L/g.
a. Show that in the more general case of oscillations with any amplitude θ0 , the
period is given by the expression:
p Z θ0
dθ
τ= 8L/g √
0 cos θ − cos θ0
b. By expanding the integrand in a series of the angle θ, show that the integration
can be performed term-by-term to obtain the following expression:
p θ02
τ = 2π L/g 1 +
16
20. We have studied the ODE for the damped oscillator ẍ + 2γ ẋ + ω02 x = 0. The
corresponding ODE for a damped pendulum oscillating at small angle θ is θ̈ + 2bθ̇ +
ω02 θ = 0. A pendulum has length L = 1 m, mass m = 0.1 kg, and is released from rest
at a small angle of 3 degrees from equilibrium.
a. If the damping force is such that the motion of the pendulum is critically damped,
find the maximum angular speed of the pendulum.
b. Plot the angle θ(t) and the angular speed ω = dθ/dt for the motion.
21. A spring system is underdamped, and the frequency of oscillation when there is no
damping is three times the frequency of oscillation with damping. Find the ratio of
successive maxima in the oscillations.
22. A spring system is critically damped, and the frequency of oscillation when there is
no damping is 100 Hz. If the initial conditions of the spring are x = x0 and v = 0 at
time t = 0, find the displacement at t = 10 s.
End-of-chapter problems 247
23. Show that the two expressions x(t) = [A0 eωt + A1 e−ωt ] e−γt and x(t) =
−γt
[B0 sinh (ωt) + B1 cosh
p (ωt)] e are equivalent for the case of overdamped mo-
tion, where ω = γ − ω0 and γ > ω0 . What is the mathematical relationship
2 2
25. Using the approximation γ << ω0 , compute the general position x(t) for the case of
underdamped motion. What is the resulting equation in the limit of γ → 0?
26. Show that x(t) = teλt is a solution of the equation ẍ + 2γ ẋ + ω02 x = 0, in the case of
critically damped oscillations.
27. A pendulum has length L = 1 m, mass m = 0.1 kg and the gravitational acceler-
ation is g = 9.8 m/s2 . The air resistance on the pendulum is given by F = −bv where
v = v(t) is the speed of the mass m, and b = 0.1 N s/m is the damping coefficient.
The pendulum is released from rest at an angle of 3 degrees from equilibrium.
Find the kinetic energy T and potential energy V as a function of time t, when the
pendulum is released from rest at an angle of 3 degrees from equilibrium. Plot T, V
and the sum T + V on the same graph .
28. The position x(t) of a forced harmonic oscillator satisfies the equation
d2 x dx
+6 + 8x = 10 cos(2t)
dt2 dt
At time t = 0 the particle is at the origin and at rest.
a. Find the transient and steady state solutions for the position and velocity of the
oscillator as functions of time t. Do this by hand, and also by using a CAS.
b. Plot the potential energy, the kinetic energy and the total energy on the same
graph.
c. Find the rate of change of the kinetic energy dT/dt as a function of time, and plot
this quantity over many periods of oscillation. Discuss the shape of the resulting
graph at different intervals of time t.
29. The position x(t), y(t) of a particle on the xy-plane is given by x(t) = A cos(ω1 t + ϕ1 )
and y(t) = B cos(ω2 t + ϕ2 ). Prove that if the ratio ω1 /ω2 is a rational number, then
the particle moves in a closed curve.
248 Harmonic Oscillations
30. The position x(t), y(t) of a particle on the xy-plane satisfies the equations
d2 x
= −8y
dt2
d2 y
= −2x
dt2
At time t = 0, the particle is at the position (1, 0) and at rest. Find the position and
velocity as a function of time t. Do this problem by hand, and also by using a CAS.
31. A particle with mass m = 1 kg moves on the xy-plane where the potential energy
function is V (x, y) = x2 + y 2 + xy + 3. The particle is initially at the point (1, 1) and
moves with a speed of 2 m/s along the positive x-axis.
Sections 6.7-6.8: Energy Resonance and the Quality Factor for Driven Os-
cillations and Electrical Circuits
3.0
2.5
2.0
f(x)
1.5
1.0
0.5
0.0
-5 0 5
Position x
Figure 6.21: Piecewise continuous function f (x) , from Problem 6.35.
251
252 Calculus of Variations
r2
y2
r1
y1 y=y(x)
x1 x2
Figure 7.1: A function y(x) which describes a path between two points, r1 = (x1 , y1 ) and
r2 = (x2 , y2 ).
this case, the calculus of variations can be used to find the function that corresponds to the
shape of the chain that minimizes the chain’s gravitational potential energy. This will be
analogous to finding the value that minimizes a function using the methods of elementary
calculus.
In this chapter, we will present the calculus of variations and use it to demonstrate the
solution to a few mathematical problems, all of which are relevant to physics. In the next
chapter, we will present a method which allows us to formulate a system’s equations of
motion using variational principles and the calculus of variations.
where r1 and r2 denote the location of the first and second point, respectively. It is common
to factor out the dx2 term from ds in order to obtain:
Z x2 p
L= 1 + y ′ (x)2 dx (7.2.2)
x1
where we used:
dy
dy = dx = y ′ (x)dx (7.2.3)
dx
In the introductory paragraphs of this chapter we said, “[the] calculus of variations provides
a means of finding the function which extremizes the quantity of interest.” In this case,
the “quantity of interest” is the length L of the curve y(x) joining the points r1 and r2 .
Notice that the length of the curve depends on the function y(x) (or more specifically, its
First form of the euler equation 253
derivative), hence our “quantity of interest” is a function of the function y(x) and, therefore,
we can write the length of the curve as L = L(y). The problem specifically states that we
want to find the path which minimizes the distance between the points r1 and r2 . In other
words, we want to find the function y ∗ (x) such that L(y ∗ ) is the minimum value of L. As
we will see, the calculus of variations will provide us with a means of how to find y ∗ (x).
Before showing how to solve the above problem, it will be useful to establish some
notation. Notice that (7.2.2) takes the form:
p
In the case of (7.2.2), the integrand f [y(x), y ′ (x); x] = 1 + y ′ (x)2 is a function of
′
only y (x). The use of square brackets denotes the functional nature of f , i.e., that, loosely
speaking, its arguments are functions. The semicolon is used to separate out the independent
variable in the argument of f from the functions. In other words, f depends on functions
y(x) and y ′ (x) but can also contain terms of those functions’ independent variable, x. It
should be noted that there are no hard rules for these two notations, square brackets and
semicolons, parentheses and a comma could have been used instead. Many of the problems
from the calculus of variations that we will study will involve integrands that are functions
of y(x), y ′ (x), and x. Later on in this chapter, we will explore cases where the integrand
depends on multiple functions y1 (x), y2 (x), . . . , yn (x), their derivatives, and an independent
variable x.
The quantity J is sometimes referred to as a functional. A functional is a mathematical
object that takes a function as an input and returns a scalar as an output. In the case of
(7.2.2), the functional L can be rewritten as L(y), and takes the equation of the curve y(x)
as an input and returns as the length of the curve (a scalar) as the output.
Next, we will develop a method for finding the function y(x) that is an extremum of the
functional J(y). Or, continuing with our example, we will learn how to find the curve y ∗ (x)
that minimizes the path length between two points on a plane.
df
=0 (7.3.1)
dx
x=x∗
∗
In other words, the condition for the value x to be an extremum of f is that the first
derivative of f must be zero at x∗ . Equivalently, the rate of change in the function f is zero
at the extremum. It may not surprise you that in order to find the function y(x) that is
an extremum of the functional J, we will also perform a derivative and identify a condition
for that derivative to be equal to zero. The condition that leads to a zero derivative will
also give us the means of finding the extremum, y(x). Note that for clarity of notation,
we will drop the asterisk representing the extremum function. Furthermore, the point x∗
is sometimes called a stationary point because infinitesimal displacements from x∗ do not
254 Calculus of Variations
Y(x)=y(x)+aη(x)
y2
y1
y(x)
x1 x2
Figure 7.2: The function η(x) perturbs y(x), the extremum of (7.3.2), resulting in the
functional J not being stationary. The parameter a describes the size of the perturbation
from the extremum y(x).
change the value of f (x) since the slope of f (x) is zero at x∗ . Likewise, in the case of the
functional J, the extremum function y(x) makes J stationary. In other words, infinitesimal
changes in the function y(x) do not change the value of J.
Continuing with the introductory calculus problem, recall that one can easily distinguish
between a local maximum and a local minimum by calculating the second derivative of f (x)
and evaluating it at the stationary point. As it turns out, determining if y(x) maximizes or
minimizes J can be very difficult. Fortunately for applications in mechanics, it is only nec-
essary to know that y(x) makes a certain functional stationary and whether y(x) maximizes
or minimizes the functional will not matter.
Let us now consider the problem of finding the function y(x) that makes the functional
Z x2
J(Y ) = f [Y (x), Y ′ (x); x] dx (7.3.2)
x1
stationary. It will be helpful to think of the “shortest distance between two points on a plane”
example from the previous section as we work through the following derivation. However,
keep in mind that J is not necessarily a path length. Let us return to Figure 7.1 for a
visualization; however, this time we will start with the true stationary function y(x) and
vary it by adding a small perturbation η(x) such that η(x1 ) = η(x2 ) = 0. A perturbation
is a small additive deviation from a quantity. Hence, the perturbation results in a function
Y (x) = y(x)+aη(x), shown in Figure 7.2, which no longer makes the functional J stationary
because of the perturbation. The parameter a provides a measure of the amount that y(x)
is perturbed.
The functional J becomes:
Z x2
J = f [Y, Y ′ ; x]dx (7.3.3)
x
Z x1 2
= f [y + aη, y ′ + aη ′ ; x]dx (7.3.4)
x1
In other words, J = J(a) because the integration will “remove” J’s dependence on x.
In effect, we have reduced our problem to a function of a single variable a, for which we
know how to find its extrema by using introductory calculus. Because we know that the
extremum exists when a = 0, we need to show that ∂J/∂a equals zero when a = 0. As we
will see, the result of this work will be a condition for which y(x) makes J stationary.
First form of the euler equation 255
Z x2
∂J ∂
= f [Y, Y ′ ; x]dx (7.3.5)
∂a ∂a x1
Z x2
∂f ∂Y ∂f ∂Y ′
= + dx (7.3.6)
x1 ∂Y ∂a ∂Y ′ ∂a
Using Y = y + aη,
∂Y ∂Y ′ dη
=η and =
∂a ∂a dx
Therefore,
Z x2
∂J ∂f ∂f dη
= η+ dx (7.3.7)
∂a x1 ∂Y ∂Y ′ dx
Next, we integrate the second term in (7.3.7) by parts using:
∂f dη
u= dv = dx
∂Y ′ dx
d ∂f
du = dx v =η
dx ∂Y ′
such that,
Z x2
x2 Z xx
∂f dη ∂f d ∂f
dx = η(x) − η(x)dx (7.3.8)
x1 ∂Y ′ dx ∂Y ′ x1 dx ∂Y ′
x1
The first term on the right-hand side of (7.3.8) is zero because η (x1 ) = η (x2 ) = 0 as can be
seen in Figure 7.2. This leaves the second term remaining in (7.3.8), which will be inserted
into (7.3.7) to obtain
Z x2
∂J ∂f d ∂f
= − η(x)dx (7.3.9)
∂a x1 ∂Y dx ∂Y ′
Next, we need to evaluate (7.3.9) at a = 0 so that Y = y + aη = y, resulting in
Z x2
∂J ∂f d ∂f
= − η(x)dx = 0 (7.3.10)
∂a x1 ∂y dx ∂y ′
where we have set the derivative equal
R to zero to ensure that J is stationary.
Equation (7.3.10) is of the form, h(x)η(x)dx
R = 0, and must be true for any continuous
function η(x). It can be shown that if h(x)η(x)dx = 0 for any η(x), then h(x) = 0 for all
x. The end result is the Euler equation:
which provides an ODE for the function y(x) that makes J stationary. Equation (7.3.11)
is also sometimes referred to as the first form of the Euler equation, and it provides the
promised condition for finding the extremum y because, as we will see, (7.3.11) will produce
a differential equation for y(x).
Next, we use the Euler equation to find the path of the shortest distance between two
points on the Cartesian plane.
Example 7.1: The shortest path between two points on the Cartesian plane
Find the path that has the shortest length between two points (x1 , y1 ) and (x2 , y2 )
on the Cartesian plane, both analytically and using a CAS.
Solution:
We start with (7.2.2),
Z x2 p
L= 1 + y ′ (x)2 dx
x1
p
where we see that f = 1 + y ′ (x)2 . Next, we compute the derivatives needed for the
Euler equation:
∂f ∂f y′
=0 and = q .
∂y ∂y ′ 2
1 + (y ′ )
Because the first term of the Euler equation is zero, we have
d y′ =0
q
dx ′ 2
1 + (y )
or, in other words, the term within the parentheses must be constant in x. Setting that
constant equal to c produces
y′
q =c
2
1 + (y ′ )
which leads to:
c
y′ = √
1 − c2
The term on the right-hand side of the above equation is also a constant which we
define to be m. As promised, the Euler equation leads to a differential equation from
which y can be found. It is easy to check that the differential equation y ′ = m results
in:
y(x) = mx + b
where b is the constant of integration. Hence, the path with the shortest distance be-
tween two points in the Cartesian plane is a straight line. No surprise. Computer algebra
systems sometimes have algorithms for handling problems involving the calculus of vari-
ations. The following codes create the Euler equation for this example.
First form of the euler equation 257
Python Code
We use the command euler_equations from the SymPy library to produce the
Euler equation for the problem. The arguments of euler_equations consist of the
functional f , the dependent function y(x) (the function we ultimately want to find),
and the independent variable x. The command euler_equations outputs a list of
ODEs, which is why we need the index in the variable euler. The command dsolve
can then be used to solve the resulting Euler equation for y(x), with the expected result
of y(x) = c1 + c2 x.
print('-'*28,'CODE OUTPUT','-'*29,'\n')
x = symbols('x')
y = Function('y')(x)
f = sqrt(1 + diff(y,x)**2)
soln = dsolve(euler,y).rhs
Mathematica Code
Similar to Python, Mathematica also has libraries which are called packages. The
command << tells Mathematica to import the VariationalMethods package, which con-
tains various functions that can be used to solve problems involving the calculus of
variations. The EulerEquations command creates the Euler equation for f . Finally,
we use DSolve to solve the differential equation that results from the Euler equation.
The result is the equation of a line.
258 Calculus of Variations
<< VariationalMethods`
′′
− (1+yy′ [x]
[x]
2 )3/2
== 0
h ′′
i
soln = DSolve − (1+yy′ [x]
[x]
2) 3/2 == 0, y[x], x ;
y[x]/.soln
{c1 + xc2 }
df ∂f dy ∂f dy ′
= + ′ (7.4.1)
dx ∂y dx ∂y dx
df ∂f ∂f
= y′ + y ′′ ′ (7.4.2)
dx ∂y ∂y
∂f df ∂f
y ′′ = − y′ (7.4.3)
∂y ′ dx ∂y
In addition, we can compute:
d ′∂f ∂f d ∂f
y = y ′′ + y′ (7.4.4)
dx ∂y ′ ∂y ′ dx ∂y ′
Finally, we insert (7.4.3) into (7.4.4),
d ∂f df ∂f d ∂f
y′ ′ = − y′ + y′ (7.4.5)
dx ∂y dx ∂y dx ∂y ′
d ∂f ∂f df
= y′ − + (7.4.6)
dx ∂y ′ ∂y dx
The term in the square brackets in (7.4.6) is Euler’s first equation, and if y(x) makes J
stationary, then that term must be zero. Therefore we have:
d ∂f
f − y′ ′ = 0 (7.4.7)
dx ∂y
Using the same kind of argument as we did in Example 7.1, we can set the term inside
the parentheses equal to a constant and therefore we obtain the second form of the Euler
equation:
Some examples of problems solved using the calculus of variations 259
(x1,y1)
x
F
(x2,y2)
Figure 7.3: The solution of the brachistochrone problem will provide the formula for the
dotted path which minimizes the time of travel for a particle moving between the two points
(x1 , y1 ) and (x2 , y2 ) in a constant conservative force field, F = mg ĵ.
The second form of the Euler equation is often useful when the dependent variable, x
does not explicitly appear in f , i.e., ∂f /∂x = 0. An example of such a case is finding the
mathematical form of a geodesic on a sphere, as described later in this chapter.
we see that f is independent of x, and and therefore ∂f /∂x √ = 0. We can then equate the
partial derivative ∂f /∂x′ to a constant that we will call 1/ 2a,
∂f x′ 1
′
=p =√ (7.5.6)
∂x y (1 + x′2 ) 2a
√
where a is a constant. The choice of using 1/ 2a as our constant will simplify the mathe-
matics later on in the calculation. Next, we will square (7.5.6) and solve for x′ to obtain,
r
dx y
x′ = = (7.5.7)
dy 2a − y
which is a differential equation whose solution will give us the function x(y) that makes
(7.5.3) stationary. To solve for x(y), we need to solve the integral:
Z r
y
x= dy (7.5.8)
2a − y
which can be done using the substitution:
y = a (1 − cos θ) (7.5.9)
The result of the integration is that,
(x1,y1)
x
a
θ
(x2,y2)
y
Figure 7.4: The cycloid is the path that makes (7.5.3) stationary. The path is parameterized
by the variable θ.
where we set the integration constant to zero by choosing the point (x1 , y1 ) to be the origin.
In other words, x = 0 when θ = 0. The equations (7.5.9) and (7.5.10) use the parameter θ
in order to describe the path that makes (7.5.3) stationary. The path described by (7.5.10)
and (7.5.9) is called a cycloid. A cycloid is the curve traced out by the point on the rim of
a circular wheel of radius a, as it rolls along a horizontal path without slipping as shown in
Figure 7.4.
The cycloid is the path that extremizes (7.5.3), and although we will not prove it, it is
the path that minimizes the time of travel between the two points (x1 , y1 ) and (x2 , y2 ).
The next example shows how we can arrive at the equations for the cycloid using a CAS
and how to plot it. The example also shows some of the limitations of a CAS when dealing
with complex integrals, especially when using SymPy.
Python Code
We perform the integration using the integrate command in SymPy. However,
note that the answer produced by SymPy contains complex numbers; this is is because
SymPy does not have a fully developed method for including detailed assumptions for
the variables in the code.
No special command is needed to create a parametric plot in Python. We simply
define the x and y coordinates and the parameter, theta.
262 Calculus of Variations
print('-'*28,'CODE OUTPUT','-'*29,'\n')
x = integrate(sqrt(y1/(2*a-y1)),(y1,0,y))
# Parametric plot
theta = [Link](0,3*[Link],100)
a = 2
x = a*(theta - [Link](theta))
y = -a*(1 - [Link](theta))
[Link](x,y)
[Link]('x')
[Link]('y')
[Link]()
Mathematica Code
The Mathematica code performs better than the SymPy code above, since we can
specify in detail the conditions that must be satisfied by the variables a,y using the
Assumptions command.
The code obtains the analytical equation for x(y), which does not contain complex
numbers. Furthermore, by substituting the parametric form
y = a (1 − cos θ)
into the analytical equation x(y), we obtain the parametric equation for x as
x = a(θ − sin θ)
a > 0 && y1 > 0 && y > 0 && 2 ∗ a − y > 0 && 2 ∗ a − y1 > 0}]//
Simplify;
Print[“x(y) = ”, x]
√y
p
x(y) = − (2a − y)y + 2aArcSin √a
2
yparametric = a ∗ (1 − Cos[θ]);
x/.{y->yparametric}//Simplify];
BaseStyle->{FontSize->16}];
a = 2;
Frame->True, BaseStyle->{FontSize->16},
FrameLabel->{x, y}]
264 Calculus of Variations
0
-1
-2
y -3
-4
0 5 10 15
x
Figure 7.5: Cycloid plot for the Mathematica code in Example 7.2.
7.5.2 GEODESICS
A geodesic is the shortest possible line between two points on a curved surface. In this
example, we will find the geodesic on a sphere of radius R. We begin by noting that the
infinitesimal displacement along the surface of the sphere (dr = 0) is:
q p
ds = R dθ2 + sin2 θ dϕ2 = R θ′2 + sin2 θ dϕ
where we used θ′ = dθ/dϕ. In this case, we are going to find the geodesic as a curve θ(ϕ).
If we use the Earth as our sphere, then finding θ(ϕ) is similar to describing the latitude of
the points along the geodesic as a function of their longitude.
The length integral we are attempting to make stationary is,
Z Z ϕ p
L= ds = R θ′2 + sin2 θ dϕ (7.5.11)
ϕ0
dϕ a csc2 θ
=√
dθ 1 − a2 csc2 θ
which when integrated by separation of variables yields
−1 cot θ
ϕ = sin +α (7.5.15)
β
where β 2 = (1 − a2 )/a2 and α is a constant of integration. Finally, we can rewrite (7.5.15)
as:
Some examples of problems solved using the calculus of variations 265
Figure 7.6: The geodesic (black line) on the sphere is the intersection of the plane and the
surface of the sphere. The code used to create this figure can be found on this book’s website
and in the book by Pagonis and Kulp [3].
z = Ay − Bx (7.5.19)
which is the equation of a plane passing through the center of the sphere as shown in Figure
7.6.
Because we are restricted to the surface of a sphere of radius R, the geodesic is the
path made by the intersection of the plane with the sphere’s surface. Hence, the geodesic is
the great circle that lies at the intersection of the plane and the surface of the sphere. The
great circle between two points is the path often used for air and sea navigation, because it
266 Calculus of Variations
z
(y2,z2)
ds
(y1,z1)
x
Figure 7.7: The surface of revolution formed by a line joining the points (y1 , z1 ) and (y2 , z2 ).
provides the path with the shortest distance between those points. The code used to create
Figure 7.6 can be found on this book’s website.
We want to find z(y) that minimizes the area of the surface of revolution. Therefore,
√ we
factored dy out of ds to produce (7.5.20), where z ′ = dz/dy. Next, we insert f = y 1 + z ′2
into the first form of the Euler equation (7.3.11) and ∂f /∂z = 0; therefore
Some examples of problems solved using the calculus of variations 267
d y z′
√ =0 (7.5.21)
dy 1 + z ′2
yz ′
√ =a (7.5.22)
1 + z ′2
where a is a constant. Solving (7.5.22) for z ′ we obtain,
dz a
=p (7.5.23)
dy y − a2
2
Python Code
We use the command newton from the SciPy library to perform Newton’s method of
finding roots. The plot is created by revolving the curve a cosh(z/a) around the z-axis
between the values of z = −1 and z = 1. Notice the use of trig functions to create the
effect of the revolution when defining the variables X and Y.
print('-'*28,'CODE OUTPUT','-'*29,'\n')
def f(a):
return a*[Link](1/a) - 3
u = [Link](-1,1,100)
v = [Link](0, 2*[Link], 100)
U,V = [Link](u,v)
Y = root2*[Link](U/root2)*[Link](V)
X = root2*[Link](U/root2)*[Link](V)
Z = U
fig = [Link]()
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(X, Y, Z)
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
[Link]()
Mathematica Code
The option Reals in NSolve instructs Mathematica to produce only real solutions
for a. Notice that there are two solutions that were stored in the variable params. There
Some examples of problems solved using the calculus of variations 269
are two curves that extremize the functional (7.5.20) from which (7.5.26) was derived.
The two curves are plotted in the yz−plane as shown in Figure 7.8.
We can plot the surface using Mathematica’s RevolutionPlot3D command, as
shown in the code below. Although we will not prove stability, we will use a = 2.82089
because that is the value of a associated with the minimal surface of the soap film.
When a = 0.35363, the soap film is not minimal and is unstable.
The default for RevolutionPlot3D is to plot a function fz (t) which describes the
height of the curve above the xy-plane, where t is the radius from the z-axis. The
command then rotates the curve of fz about the z-axis. However, our function describes
the height of the curve above the xz-plane. In order to get the shape we expect, we
need to tell Mathematica to revolve about what it believes to be the x-axis by using the
option, RevolutionAxis → {1, 0, 0}. This is the type of technical issue one occasionally
encounters when working with software. If you had plotted (7.5.25) using the defaults,
you would have obtained a plot that was clearly incorrect. This is another reminder
that one can’t simply use computer algorithms as black boxes. You need to make sure
that you understand the algorithm and check to see that the output makes sense.
SetOptions[RevolutionPlot3D, BaseStyle->{Black, Bold, FontSize->18}];
a = 0.353638 a = 2.82089
3.0
2.5
2.0
1.5
y
1.0
0.5
0.0
-1.0 -0.5 0.0 0.5 1.0
z
Figure 7.8: The soap film profile for a = 0.353638 (solid curve) and a = 2.82089 (dashed
curve), from Example 7.3.
(a) (b)
Figure 7.9: The surface of the soap film as produced by (a) Mathematica and (b) Python,
from Example 7.3.
f [y1 (x), y1′ (x), y2 (x), y2′ (x), . . . , yn (x), yn′ (x); x] (7.6.1)
Multiple dependent variables 271
where there are n dependent variables yi . In this case, it is often convenient to write f =
f [yi , yi′ ; x], where i = 1, 2, . . . , n.
We want to find a set of functions {yi (x)} (i = 1, 2, . . . , n) that makes the functional
Z
J = f [yi (x), yi′ (x); x] dx (7.6.2)
stationary. To find {yi (x)}, we follow the work done in Section 7.2. We write Yi (α, x) =
yi (x) + αηi (x), insert Yi into (7.6.2), differentiate the resulting J with respect to α, and
then set that derivative equal to zero. The result is,
Z x2 n
X
∂J ∂f d ∂f
= − ηi (x)dx (7.6.3)
∂α x1 i=1
∂Yi dx ∂Yi′
Each perturbation ηi (x) is independent of one another. Therefore, in order for the derivative
in (7.6.3) to be zero at a = 0, we must have,
In other words, we will have an Euler equation for each dependent function yi . As before,
each Euler equation will produce an ordinary differential equation. However, these ODEs
are often coupled and can be difficult to solve in closed form.
For an example of f depending on multiple dependent variables, we can reconsider the
first problem we studied, the shortest path between two points on the Cartesian plane. When
we first solved that problem, we assumed y = y(x). However, if we wanted to consider all
possible paths, then we would need to consider curves which are parameterized using a
variable t,
x′ y′
p =a and p =c (7.6.6)
x′2 + y ′2 x′2 + y ′2
272 Calculus of Variations
where a and c are constants. Note that we used the fact that ∂f /∂x = ∂f /∂y = 0, in order
to set ∂f /∂x′ and ∂f /∂y ′ equal to the constants a and c, respectively. By dividing the two
equations in (7.6.6), we get,
y′ dy c
= = =m (7.6.7)
x′ dx a
Integrating (7.6.7), we find y = mx + b, where b is the constant of integration. In other
words, we again get the equation for a line.
The calculus of variations provides us a means of finding a function y(x) that ex-
tremizes the functional:
Z x2
J= f [y(x), y ′ (x); x]dx
x1
Common problems in the calculus of variations involve finding the path of the short-
est distance between two points, finding the path that minimizes the time of travel
between two points, and finding the minimum surface area for a surface of revolution.
The function y(x) can be found using Euler’s equation:
d ∂f ∂f
′
− =0
dx ∂y ∂y
Euler’s equation will produce a differential equation, which can be solved for y(x).
An alternative form of the Euler’s equation is,
∂f
f − y′ = constant
∂y ′
which can be used when ∂f /∂x = 0.
Problems involving finding the extrema of a functional which depends on several
dependent variables {yi (x)}, for i = 1, 2, . . . , n, of the form,
Z x2
J= f [yi (x), yi′ (x); x]dx
x1
Z 1 p
J(y) = x2 1 − y ′ dx,
0
stationary with y ′ = dy/dx. The path must connect the points (0, 0) and (1, 1). Solve
this problem analytically and by using Python or Mathematica.
4. Find the shortest path between two points on the surface of a cylinder with radius
R. As in Problem 2, set up the necessary functional by using cylindrical coordinates
(ρ, θ, z) and assume that the curve can be written as θ(z).
5. Consider the light ray (solid line) reflecting off of the surface of a plane mirror at the
point (xr , yr ) as shown in Figure 7.10. The surface of the mirror is in the xz-plane,
and the light ray is in the xy-plane. Using Fermat’s principle from Problem 1, prove
the law of reflection. In other words, show that the angle of incidence θ1 is equal to
the angle of reflection θ2 in Figure 7.10. Although not necessary, you may find it
helpful to set x1 = 0 and yr = 0 as suggested in Figure 7.10. To solve the problem,
compute the time it takes to travel along the path in Figure 7.10, then show that the
time is a minimum when θ1 = θ2 . You may start by assuming that the point (xr , yr )
is in the same vertical plane as (x1 , y1 ) and (x2 , y2 ). If you were not to make that
assumption, then explain how you would need to change your solution in order to
prove the law of reflection.
274 Calculus of Variations
(x1,y1) (x2,y2)
θ1 θ2
(xr,yr)
x
Figure 7.10: The path of a light ray in the xy-plane reflecting off a mirror in the xz-plane,
in Problem 7.5.
6. Consider the light ray shown in Figure 7.11. The light ray starts in a medium with a
spatially uniform index of refraction n1 and, at the point (xr , yr ) enters a new medium
with a spatially uniform index of refraction n2 . Using Fermat’s principle from Problem
1 to minimize the time of travel between the two points (x1 , y1 ) and (x2 , y2 ), prove
Snell’s law, n1 sin θ1 = n2 sin θ2 and that the point of refraction (xr , yr ) is coplanar
with the points (x1 , y1 ) and (x2 , y2 ). As before, the index of refraction is defined as
the ratio n = vc , where c is the speed of light in vacuum and v is the speed of light
inside the medium.
(x1,y1) y
θ1
(xr,yr) n1
n2
x
θ2
(x2,y2)
Figure 7.11: The path of a light ray in the xy-plane leaving a medium with an index of
refraction n1 ,and entering a medium with an index of refraction n2 , in Problem 7.6.
Z 1
J= y ′2 − y 2 + x dx
0
subject to the two boundary conditions: y(0) = 1, y ′ (0) = −1 and where y ′ (x) =
dy/dx. Solve this problem analytically and by using Python or Mathematica.
Z p p
x2 + y 2 1 + y ′2 dx
are
x2 cos α − 2xy sin α − y 2 cos α = β
where y ′ = dy/dx and α, β are constants.
Hint: Rewrite the functional in polar coordinates and use a CAS to find Euler’s
equations and solve the resulting ODE.
9. Find the geodesics on the surface of the cone whose equation in cylindrical coor-
dinates is z = c ρ.
10. Imagine a ball rolling down the first half of the first loop of a cycloid (from x = 0 to
x = πa), defined by the equations:
y = a (1 − cos θ) x = a (θ − sin θ)
p
Show that the time of travel from x = 0 to x = a is equal to π a/g.
11. For a little bit of foreshadowing of upcoming chapters, consider the functional,
Z t
1 1 2
J(x) = mx − kx dt′
′2
t0 2 2
where m and k are positive constants, x′ = dx/dt′ and t′ is the independent variable
(the prime after the t does not denote a derivative). Find the function x(t) that makes
the functional stationary. Does this look familiar?
Z π
J(y, z) = y ′2 + z ′2 + yz dx
0
277
278 Lagrangian and Hamiltonian Dynamics
∂V
F =− = −kx (8.1.2)
∂x
is the force acting on the mass. Therefore, using Newton’s second law, F = mẍ, we can
write the equation of motion for the SHO as,
mẍ + kx = 0 (8.1.3)
Recall that normally we define ω02
= k/m for the SHO, but for now we will leave the
equation of motion as it appears above.
There is another method of finding (8.1.3) that doesn’t directly involve Newton’s second
law. Notice that,
d ∂T d
= (mẋ) = ṗ = mẍ (8.1.4)
dt ∂ ẋ dt
Therefore, we can obtain (8.1.3) by writing,
d ∂T ∂V
+ =0 (8.1.5)
dt ∂ ẋ ∂x
Equation (8.1.5) is similar to the Euler equation in appearance, except that the functions
appearing in each derivative are different. We can make (8.1.5) look like the Euler equation
by defining a new function, the Lagrangian:
L≡T −V (8.1.6)
Notice that V does not depend on ẋ , and T does not depend on x; therefore ∂T /∂x = 0
and ∂V /∂ ẋ = 0, and we can write:
d ∂T d ∂L
= (8.1.7)
dt ∂ ẋ dt ∂ ẋ
and
∂V ∂L
=− (8.1.8)
∂x ∂x
And therefore we obtain from (8.1.5) the Euler-Lagrange equation:
y
θ ℓ
x
m
Figure 8.1: A simple plane pendulum composed of a mass m attached to a massless rigid
rod of length ℓ which makes an angle θ with the vertical (dashed line).
x, y, and z. However, because we are working with a plane pendulum, we have our first
equation of constraint, z = 0. Next, we know that the mass is constrained to move along a
circle of radius ℓ. Therefore, the next equation of constraint is x2 + y 2 = ℓ2 . We see that we
have two equations of constraint; therefore, we have s = 3 (1) − 2 = 1 degree of freedom.
To describe the system, we would like to work with a generalized coordinate system. The
most obvious one to choose is polar coordinates. In this case, we will choose q = θ, where
θ is the angle between the pendulum and the dashed line in Figure 8.1. We can write the
Cartesian coordinates in terms of the generalized coordinate θ using:
d ∂L ∂L
− =0 (8.2.6)
dt ∂ q̇ ∂q
will produce the equation of motion. Inserting (8.2.5) into (8.2.6) gives the simple plane
pendulum equation,
g
q̈ + sin q = 0 (8.2.7)
ℓ
Hamilton’s Principle
The path taken by a particle from the point r1 to the point r2 during the time
interval t1 to t2 is the one that makes the action integral stationary:
Z t2
S= Ldt (8.3.1)
t1
Hamilton’s principle is a cornerstone not just of classical physics, but also of quantum
physics. From Chapter 7, we know that the condition for S to be stationary is
The result is an ODE for the path q(t). The right-hand side of (8.3.4) is the q component
of the force acting on the particle. Likewise, the left-hand side of (8.3.4) is the time derivative
of the momentum. Therefore, we see that the path q(t) that makes the action integral S
stationary is the one that also solves Newton’s second law. Therefore, Hamilton’s principle
does provide a means of finding a system’s equation of motion. Note that the above work
is not a proof of Hamilton’s principle, but rather a demonstration of how it is capable of
producing a system’s equation of motion.
Before we move on to some examples of using the Lagrangian to find the equation of
motion for a system, it is important that we point out some additional terminology that
will become useful later. First, notice V = V (qj ) and T = T (q̇i ). Hence, in our example
∂L ∂L ∂V
= mq˙j and =− (8.3.5)
∂ q̇j ∂qj ∂qj
The term ∂L/∂ q˙j is sometimes called the j th component of the generalized momentum
although it is not always a linear momentum. Likewise, ∂L/∂qj is sometimes called the j th
component of the generalized force; again it is not always a force, but rather it acts like one.
With these terms in mind, (8.3.4) can be reworded as: “the generalized force is equal to the
time rate of change of the generalized momentum.” It is a “generalized” Newton’s second
law!
Therefore, we are attempting to find functions x(t), y(t), and z(t) that make the
action integral
Z
S = L(x, y, z, ẋ, ẏ, ż)dt
stationary.
Because there are three degrees of freedom, i.e., three functions that need to be
found in order to make S stationary, there will be three Euler-Lagrange equations.
Before finding the Euler-Lagrange equations for this problem, first note that:
= (mẋ) = mẍ
d ∂L d
dt ∂ ẋ dt
d ∂L d
= (mẏ) = mÿ (8.4.3)
dt ∂ ẏ dt
d ∂L d
= (mż) = mz̈
dt ∂ ż dt
By equating the terms in parentheses in each line above, we see that ∂L/∂ ẋ is the
x-component of the particle’s momentum (similar for the ẏ and ż derivatives). In this
case, the generalized momentum is the same as the linear momentum. Likewise,
= Fx
∂L ∂V
=−
∂x ∂x
∂L ∂V
=− = Fy (8.4.4)
∂y ∂y
= Fz
∂L ∂V
=−
∂z ∂z
We can see that ∂L/∂x is the x-component of the force acting on the particle (similar
for the y and z derivatives). In this case, the generalized force is equal to the force acting
on the particles. Inserting the derivatives into the Euler-Lagrange equation gives:
d ∂L ∂L
− =0 ⇒ mẍ = Fx
dt ∂ ẋ ∂x
d ∂L ∂L
− =0 ⇒ mÿ = Fy
dt ∂ ẏ ∂y
d ∂L ∂L
− =0 ⇒ mz̈ = Fz
dt ∂ ż ∂z
The result of the Euler-Lagrange equations is simply Newton’s second law.
While Example 8.1 may seem elementary, it points out a few important things. First,
the number of Euler-Lagrange equations will equal the number of degrees of freedom in
the system. Second, Example 8.1 demonstrates the connections between the generalized
momentum and generalized force and the physical quantities momentum and force with
which you are already familiar. Of course, to progress further in this problem and find x(t),
y(t), and z(t), you would need to know V (x, y, z).
284 Lagrangian and Hamiltonian Dynamics
R
x1
x2
m1
m2
We use the horizontal dashed lined passing through the center of the Atwood ma-
chine as the origin for our coordinate system. The coordinates x1 and x2 measure the
distance from the center of the Atwood machine to masses m1 and m2 , respectively.
Because the string is inextensible, the two coordinates x1 and x2 are not independent.
For example, as m1 falls down, m2 rises and vice versa. Therefore, there is one equation
of constraint among the coordinates:
ℓ = x1 + x2 + πR (8.4.5)
The last term in the constraint is the length of the string that wraps around the
pulley. Of course an additional constraint is that the masses are each constrained to
move only up or down along a line; therefore, y1 = y2 = z1 = z2 = 0, which are actually
four constraints (one on each coordinate) for a total of five constraints on the system
(m = 5). Therefore, with two particles in the system N = 2, we have s = 3(2) − 5 = 1
degree of freedom for the problem. We will rewrite the coordinates x1 and x2 in terms
of the generalized coordinate x using:
x1 = x (8.4.6)
x2 = ℓ − x − πR (8.4.7)
Examples of lagrangian dynamics 285
Notice that the velocities have the relationship, ẋ2 = −ẋ1 , and the accelerations
have the relationship, ẍ2 = −ẍ1 , which is what we would expect in this situation.
Next, we will find the kinetic and potential energies of the system. Notice that the
pulley has mass, but the string does not. Therefore, the total kinetic energy includes
the kinetic energy of m1 , m2 , and the rotational kinetic energy of the pulley. Recall
that rotational kinetic energy takes the form Trot = 12 Iω 2 , where I = 12 M R2 is the
rotational inertia for the pulley, and ω = ẋ/R is the angular velocity of the pulley.
Therefore, the total kinetic energy for the system is:
1 1 1 2
T = m1 ẋ21 + m2 ẋ22 + Iω (8.4.8)
2 2 2
2
1 1 1 ẋ
= m1 ẋ2 + m2 ẋ2 + I (8.4.9)
2 2 2 R
The potential energy takes the form of the gravitational potential energy. Measuring
upward as the positive direction, we have:
(m1 − m2 )g
ẍ = (8.4.16)
m1 + m2 + M 2
where we used I = 12 M R2 . From the generalized acceleration, we can get the accelera-
tion of each mass because ẍ1 = ẍ and ẍ2 = −ẍ.
Example 8.2 demonstrates several ideas. First, drawing a picture of the system can help
identify constraints on the coordinates. Second, this example reminds us to carefully identify
all kinetic and potential energies in the system. It would be easy to overlook the rotational
kinetic energy of the pulley if you thought the pulley was massless, a common assumption
in introductory physics. Finally, Example 8.2 shows us that although it might be useful to
describe the motion in generalized coordinates (in this case x), the solution of the problem
needs to address what is being asked by the problem. In this case, we needed to make sure
that we showed how to express the acceleration of each mass in terms of the generalized
coordinate.
286 Lagrangian and Hamiltonian Dynamics
y
ω
R x
ℓ
θ
m
Figure 8.3: The rotating pendulum for Example 8.3.
Solution:
The coordinate system is defined in the figure where the coordinate axes are the
dashed lines. The mass is constrained to move in the xy-plane, hence z = 0 is our first
equation of constraint. There is an additional constraint which may not be immediately
obvious. However, if we write the location of the mass in terms of polar coordinates, then
it will become clear that this problem has only one degree of freedom. The coordinates
of the mass can be written as:
ẋ = −Rω sin (ωt) + ℓθ̇ cos θ and ẏ = Rω cos (ωt) + ℓθ̇ sin θ (8.4.18)
Next, we find the kinetic and potential energies. The kinetic energy T = 21 mv 2 can
be written using the velocity of the mass in the Cartesian plane, v = ẋî + ẏ ĵ,
1 1 1
T = mv 2 = mv · v = m ẋ2 + ẏ 2
2 2 2
Examples of lagrangian dynamics 287
The pendulum is in the Earth’s gravitational field; therefore, the potential energy
is V = mgy. Inserting (8.4.17) and (8.4.18) into our equations for the kinetic and
potential energies results in the Lagrangian (after some algebra, see Problem 9 in the
End-of-Chapter Problems),
1
L= m R2 ω 2 + ℓ2 θ̇2 + 2Rℓω θ̇ sin (θ − ωt) − mg (R sin (ωt) − ℓ cos θ) (8.4.19)
2
Inserting (8.4.19) into
d ∂L ∂L
− =0
dt ∂ θ̇ ∂θ
produces the equation of motion:
g Rω 2
θ̈ + sin θ = cos (θ − ωt) (8.4.20)
ℓ ℓ
Notice that (8.4.20) is the simple pendulum equation with an additional cosine term.
The cosine term is the drive term associated with the rotating disk.
The codes below show how to find (8.4.20) and plot its solution θ(t). A graph of
θ(t) is shown in Figure 8.4.
Python Code
This code follows the same procedure as the examples in Chapter 7. Note that we
use the variable q instead of θ. Notice also that we needed to redefine the ODE as the
function deriv so that it can be solved using odeint. The Python result agrees with
the analytical solution.
288 Lagrangian and Hamiltonian Dynamics
print('-'*28,'CODE OUTPUT','-'*29,'\n')
wrapper = [Link](width=60)
D, t, m, g, w, R, l = symbols('D,t,m,g,w,R,l',positive=True)
q = Function('q')(t) # we use q instead of theta
L = 1/2*m*(R**2*w**2 + l**2*diff(q,t)**2 + \
2*R*l*w*diff(q,t)*sin(q-w*t)) - \
m*g*(R*sin(w*t) - l*cos(q))
euler = nsimplify(euler_equations(L,q,t)[0].expand().lhs)
euler_string = [Link](str(euler))
ics = [1,0]
t = [Link](0,20,100)
soln = odeint(deriv, ics, t)
[Link](t,soln[:,0])
[Link]('time')
[Link]('theta')
[Link]()
Mathematica Code
This code follows the same procedure as in Chapter 7. Notice that by using a re-
placement in the variable ode, we can directly use the output of EulerEquations in
NDSolve.
SetOptions[Plot, Axes->False, Frame->True, BaseStyle->{FontSize->16}];
<< VariationalMethods`
m ∗ g ∗ (R ∗ Sin[ω ∗ t] − l ∗ Cos[θ[t]]);
1.00
0.75
0.50
0.25
theta
0.00
−0.25
−0.50
−0.75
−1.00
0.0 2.5 5.0 7.5 10.0 12.5 15.0 17.5 20.0
time
Figure 8.4: The solution θ(t) from Example 8.3 as produced by the Python code. Notice
that θ(t) behaves similar to a beat wave as the pendulum interacts with the rotating disk.
290 Lagrangian and Hamiltonian Dynamics
Example 8.3 is an example of a problem which appears to have two degrees of freedom,
but it can actually be described using only one. Another important point demonstrated in
Example 8.3 is that it is necessary to be careful with kinetic energies. While often we focus
more on potential energies, this is a case where the kinetic energy is a bit more difficult.
It was important to include all of the components of the velocity in order to correctly
obtain the kinetic energy. Finally, if you solve Problem 9, you will see the value in using
trigonometric identities to cast the final solution in terms of something that is easier to
interpret.
m
R
y
r
θ
x
Figure 8.5: A bead of mass m free to move on a rotating parabolic wire from Example
8.3.
Solution:
The system consists of one particle N = 1, and in order to find the number of degrees
of freedom s, we will need to find the number of constraints. Cylindrical coordinates
are a natural choice for this problem. In those coordinates, we have two constraints.
The first constraint is that z = ar2 because the bead is constrained to move along the
wire. The second constraint is due to the rotation of the wire. We know that the wire
is rotating about the z-axis at a constant angular velocity; therefore, θ = ωt. Hence, we
are left with one degree of freedom, r.
Next we find the kinetic and potential energies. Using the velocity in cylindrical
coordinates, v = ṙr̂ + rθ̇θ̂ + żẑ, we find
Examples of lagrangian dynamics 291
1 1
T = mv · v = m ṙ2 + r2 θ̇2 + ż 2 (8.4.21)
2 2
The potential energy is found using V = mgz. By applying the constraints z = ar2
and θ = ωt, we find:
L =T − V
1
= m ṙ2 + r2 θ̇2 + ż 2 − mgz
2
1
= m ṙ2 + r2 ω 2 + 4r2 a2 ṙ2 − mgar2
2
Note that L = L (r, ṙ). To get the equation of motion for the bead, we can insert
the Lagrangian into the Euler-Lagrange equation,
d ∂L d m 2 2
= 2ṙ + 8r a ṙ = 1 + 4a r mr̈ + 8ma rṙ
2 2 2 2
dt ∂ ṙ dt 2
(8.4.23)
∂L
=mr rω + 4a2 ṙ2 − 2ga
∂r
Equating the two terms above gives:
1 + 4a2 r2 r̈ + 4a2 rṙ2 + r ω 2 − 2ga = 0 (8.4.24)
We are interested in the case when the bead is traveling in a circle of radius R.
Therefore, inserting r̈ = ṙ = 0 and r = R into (8.4.24), we obtain
ω2
a=
2g
Python Code
This code follows similar examples from Chapter 7. However, note the order of sub-
stitutions when defining the variable find_a. The highest derivatives must be defined
first in the subs method.
292 Lagrangian and Hamiltonian Dynamics
print('-'*28,'CODE OUTPUT','-'*29,'\n')
wrapper = [Link](width=70)
t, m, g, a, w, R = symbols('t,m,g,a,w,R',positive=True)
r = Function('r')
L = 1/2*m*(diff(r(t),t)**2 + r(t)**2*w**2 + \
4*r(t)**2*a**2*diff(r(t),t)**2) - \
m*g*a*r(t)**2
euler = simplify(euler_equations(L,r(t),t)[0]).lhs
# substitute derivatives = 0
find_a = solve([Link]([(diff(r(t),t,t),0),\
(diff(r(t),t),0),(r(t),R)]),a)[0]
print('\na = ', find_a)
a = w**2/(2*g)
Mathematica Code
Finding the Euler-Lagrange equation is done the same way as finding the Euler
equation from Chapter 7. Note to be careful to include the dependency of r on t as
r[t] when defining the Lagrangian.
Examples of lagrangian dynamics 293
<< VariationalMethods`
Example 8.4 demonstrates several important points. First, it demonstrates the need to
use the velocity in cylindrical coordinates. The velocity of a particle in polar, cylindrical,
and spherical coordinates was discussed in Chapter 3. It is important when computing the
kinetic energy that the velocity vector be expressed in the same coordinate system that you
are using to solve the problem. Second, although this problem didn’t specifically ask for the
equation of motion, we found it easier to answer the problem by finding it. Once we had the
general equation of motion for the bead (8.4.24), we inserted the specific conditions for the
motion of interest. Finally, Example 8.4 shows how the Lagrange formulation does not need
to know all of the forces acting on the system. We do not know the mathematical form of
the force that keeps the bead on the wire. The aforementioned ignorance is not a problem,
all we needed for the Lagrange formulation was to know how the value of the z coordinate
was constrained.
The next example demonstrates the importance of calculating the Lagrangian in an
appropriate coordinate system.
x2 ℓ
x1 m
M
Figure 8.6: A mass m sliding down an incline plane with mass M for Example 8.5.
The figure above shows that we have created two coordinates, x1 and x2 . The coor-
dinate x1 is measured from the vertical axis and describes the location of the inclined
plane M . The coordinate x2 measures the position of the particle m from the top of
the inclined plane. Note that the two coordinates are not orthogonal to each other.
To calculate the Lagrangian, we need to find the kinetic energy of each object,
1 1
T = M v12 + mv22
2 2
̸ ẋ22 . The particle’s velocity v2 relative to the vertical axis will
where v12 = ẋ1 , but v22 =
depend on the velocity of the inclined plane and therefore, v2 = ẋ1 + ẋ2 , where ẋ1 and
ẋ2 are vectors that point along the directions of x1 and x2 in the figure, respectively.
We can find v22 = v2 · v2 by noting that the angle between ẋ1 and ẋ2 is θ,
1 1
T = M ẋ21 + m ẋ21 + ẋ22 + 2ẋ1 ẋ2 cos θ (8.4.28)
2 2
V = mg (ℓ − x2 ) sin θ (8.4.29)
1 1
L = M ẋ21 + m ẋ21 + ẋ22 + 2ẋ1 ẋ2 cos θ − mg (ℓ − x2 ) sin θ (8.4.30)
2 2
Note that we used ℓ as the length of the inclined plane and the height of the particle
above the horizontal axis is (ℓ − x2 ) sin θ. Further note that the Lagrangian is of the
form L = L (x1 , x2 , ẋ1 , ẋ2 ). There are two degrees of freedom for this problem; therefore,
we will have two Euler-Lagrange equations:
d ∂L ∂L
− =0
dt ∂ ẋ1 ∂x1
(8.4.31)
=0
d ∂L ∂L
−
dt ∂ ẋ2 ∂x2
Examples of lagrangian dynamics 295
Python Code
Notice how we needed to explicitly state the Derivative command in the results
found in x_solns, where we solve for ẍ1 and ẍ2 .
296 Lagrangian and Hamiltonian Dynamics
print('-'*28,'CODE OUTPUT','-'*29,'\n')
wrapper = [Link](width=74)
M, m, g, l, q,t = symbols('M,m,g,l,q,t',positive=True)
# we use q symbol for the angle theta
x1 = Function('x1')
x2 = Function('x2')
L = 1/2*M*diff(x1(t),t)**2 + 1/2*m*(diff(x1(t),t)**2 + \
diff(x2(t),t)**2 + \
2*diff(x1(t),t)*diff(x2(t),t)*cos(q)) - \
m*g*(l-x2(t))*sin(q)
euler = euler_equations(L,(x1(t),x2(t)),t)
print('The Euler equations are:\n\n')
print([Link](str(euler[0])))
print('\n' + [Link](str(euler[1])))
x_solns = simplify(\
solve(euler,(diff(x1(t),t,t),diff(x2(t),t,t))))
Mathematica Code
Having two degrees of freedom changes little about the code compared to earlier
problems. Note that the second element of the command EulerEquations is a list of
dependent functions {x1,x2}.
<< VariationalMethods`
(m + M )x1′′ [t] + mCos[θ]x2′′ [t] == 0, gmSin[θ] == m Cos[θ]x1′′ [t] + x2′′ [t]
One of the important issues demonstrated in Example 8.5 is about choosing the right ve-
locity. We needed to make sure that the velocity of each particle was measured with respect
to the same reference frame, in order to have a consistent kinetic energy. Also notice that
∂L/∂x1 = 0. This tells us that the x1 -component of the generalized force is zero. This will
have consequences which we will discuss in Section 8.7. Finally, Example 8.5 is a demon-
stration of a problem that has two degrees of freedom. In this case, we only needed to find
the acceleration of each object. If instead we needed to find x1 (t) and x2 (t), we might have
a difficult time solving the coupled second-order differential equations. Coupled differential
equations are typically difficult to solve, and we often must rely on numerical methods.
In the next section, we will return to the Lagrange formalism and study more closely
systems with constraints.
x2 + y 2 = ℓ2 (8.5.1)
Notice that (8.5.1) takes the form,
see that by using the constraint equation, we can also find the force causing the constraint.
In the case of the pendulum, the constraint force is the tension in the pendulum’s string.
Before developing the method of Lagrange multipliers, it is important to discuss types of
constraints. In this chapter, we will focus on holonomic constraints. Holonomic constraints
are constraint equations which can be written as an algebraic relationship between the
coordinates. Equation (8.5.2) is an example of such a constraint. Sometimes, holonomic
constraints are written in the form,
f (qi ; t) = 0 (8.5.3)
where the abbreviation qi says that f is a function of several coordinates (for example, x,
y, and z in Cartesian coordinates), and the semicolon shows f ’s indirect dependence on
time (through the coordinates qi ). For example, we can rewrite (8.5.1) in the form of (8.5.2)
by writing f (qi ; t) = f (x, y) = x2 + y 2 − ℓ2 = 0. Constraints that must be written as
relationships involving velocities are called nonholonomic constraints, unless the constraint
equation can be integrated to produce a relationship between coordinates. Although we will
not discuss nonholonomic constraints further, the interested reader can consult the classic
text by Thornton and Marion [6].
Now we will derive Lagrange’s equations with undetermined multipliers. We derive the
equations for a system with two degrees of freedom, x and y, and then discuss a general-
ization for systems with higher degrees of freedom. The system will have one holonomic
constraint of the form, f (x, y) = constant. We know that finding the equations of motion
involves finding functions x(t) and y(t) that make the action integral,
Z t2
S= L X, Ẋ, Y, Ẏ dt (8.5.4)
t1
The left-hand side of (8.5.9) depends on derivatives with respect to x and ẋ, while the
right-hand side depends on derivatives with respect to y and ẏ. Note that x and y are both
functions of t. In order for the two sides of (8.5.9) to be equal, they must both be equal
to a function of only t. We will define that function to be −λ(t), and we call λ Lagrange’s
undetermined multiplier. We do not know λ, hence the name “undetermined multiplier.”
Setting each side of (8.5.9) equal to −λ we obtain,
∂L d ∂L ∂f
− = − λ(t)
∂x dt ∂ ẋ ∂x
(8.5.10)
∂L d ∂L ∂f
− = − λ(t)
∂y dt ∂ ẏ ∂x
Equations (8.5.10) along with f (x, y) = constant will produce the equations of motion for
the system.
Of course, not all systems are limited to only two degrees of freedom and one constraint
equation. In general, systems will have n degrees of freedom and m equations of constraint.
We have already seen how to generalize the Lagrange formulation for s degrees of freedom,
in which case we have s Euler-Lagrange equations to solve. However, multiple constraint
equations means that there will be multiple derivatives dfj /da (j = 1, . . . , m, with m equal
to the number of constraints) that we will have to include in the derivation above. The
result is:
We will focus on the equation involving x, which can be written in the form:
∂V ∂f
mẍ = − +λ (8.5.13)
∂x ∂x
The left-hand side mẍ is the x-component of the net force acting on the system. In
this case, there are two forces acting on the system: an external force, associated with the
potential energy V (x, y), and the constraint force. The first term in the right-hand side of
(8.5.13) is the x-component of the external force acting on the system, gravity for example.
The remaining term λ∂f /∂x must therefore be the x-component of the constraint force.
We can repeat a similar argument for the y-equation (8.5.12) to see that λ∂f /∂y is the
y-component of the constraint force. In general we have,
c ∂fj
Fj,q = λj (8.5.14)
i
∂qi
c
where Fj,q i
is the qi -component of the constraint force associated with the constraint equa-
tion fj (qi ; t) = constant. The following example illustrates the use of the Euler-Lagrange
equation to derive a constraint force.
θ R
To begin the problem, we start by selecting polar coordinates to solve the problem.
Because the particle is moving on the surface of the sphere, our constraint equation is,
f (r; t) = r − R = 0 (8.5.15)
The force of constraint is the force that keeps the particle on the sphere and ṙ =
0. When the particle leaves the sphere’s surface, ṙ = ̸ 0; therefore, there will be an
acceleration in the radial direction. We can find the relevant constraint force by finding:
Constraint forces and lagrange’s equation with undetermined multipliers 301
∂f
Frc = λ
.
∂r
We know ∂f /∂r, so we need to find λ. We will find λ by setting up the Euler-
Lagrange equations for the system.
Using polar coordinates, we can write down the kinetic and potential energies for
the system:
1
T = m ṙ2 + r2 θ̇2
2
V =mgr cos θ
1
L = m ṙ2 + r2 θ̇2 − mgr cos θ
2
where we used the horizontal line in Figure 8.7 as y = 0, and therefore the potential
energy can be written as mgy with y = r cos θ. The Euler-Lagrange equations are:
∂L d ∂L ∂f
− =−λ (8.5.16)
∂r dt ∂ ṙ ∂r
∂L d ∂L ∂f
− =−λ . (8.5.17)
∂θ dt ∂ θ̇ ∂θ
By substituting the Lagrangian L and the constraint equation, we obtain:
mRθ̇2 − mg cos θ = − λ
(8.5.20)
−mgR sin θ − mR2 θ̈ =0
In the first equation above, we have found that λ = λ(θ, θ̇). The second equation
will give us a way of finding θ(t),
g
θ̈ = sin θ (8.5.21)
R
While we could attempt to integrate (8.5.21) and solve for θ, we actually don’t need
to do that. What we really need is θ̇, which can be found from (8.5.21) using,
Notice that this angle does not depend on the mass of the particle or the radius of the
sphere!
The translation does affect the position of the particle. The careful reader might then
think that dV ̸= 0, because potential energies are often position dependent. Wouldn’t the
gravitational potential energy change with translation? Yes! However, recall that this is an
isolated system, meaning that there are no external forces acting on the system. Further-
more, inter-particle forces are usually dependent on the distances between particles. Because
all of the particles experience the same displacement, the distances between particles will
not change. Hence, dV = 0, and therefore dL = 0.
Now that we have demonstrated the translational invariance of the Lagrangian, we
can make the connection between the symmetry and the conservation of momentum. For
simplicity, we will set N = 1, but the following holds for any number of particles. In addition,
we will use generalized
P coordinates
P with generalized unit vectors êi , again for simplicity of
notation, r = qi êi and dr = êi dqi . Hence, for a single particle under the translation,
Xs
∂L Xs
∂L
dL = dqi + dq̇i = 0 (8.6.2)
i=1
∂qi i=1
∂ q̇i
where s is equal to the particle’s number of degrees of freedom. Because dr is not a function
of time,
dqi d
dq̇i = d = (dqi ) = 0
dt dt
Therefore (8.6.2) becomes:
Xs
∂L
dL = dqi = 0 (8.6.3)
i=1
∂qi
Because dqi ̸= 0, we must have
∂L
=0 (8.6.4)
∂qi
for all i, and therefore according to the Euler-Lagrange equation,
d ∂L
=0 (8.6.5)
dt ∂ q˙i
Equation (8.6.5) then tells us that:
∂L
pi = = constant (8.6.6)
∂ q̇i
We have already seen that pi is the ith component of the particle’s generalized momen-
tum. The quantity pi is sometimes also referred to as the canonical momentum conjugate to
qi . From (8.6.4), we see that when L does not explicitly depend on the coordinate qi , then
the canonical momentum conjugate to qi is conserved. In other words, if qi does not appear
in L, then pi is constant. Visual inspection of the Lagrangian can tell you what momenta are
conserved in the system! If qi does not appear in L, then changing qi will not change L and
L is said to be “invariant” under changes of qi . Note that we can extend the work above to
N -particle systems by including an additional sum over α = 1, . . . , N . The procedure would
then follow as done above. Finally, when the Lagrangian is independent of the coordinate
qi , then qi is called a cyclic coordinate. Next, we will see that time-translational symmetry
in the Lagrangian will lead to conservation of energy.
304 Lagrangian and Hamiltonian Dynamics
If the Lagrangian is invariant to time translations, then ∂L/∂t = 0 and therefore (8.6.10)
becomes, " #
d Xs
L− pi q̇i = 0 (8.6.11)
dt i=1
where we used pi = ∂L/∂ q̇i . We see that we have a new conserved quantity in the square
brackets of (8.6.11). The conserved quantity is called the Hamiltonian function, or simply
the Hamiltonian. The Hamiltonian is defined as:
The Hamiltonian
X
s
H= pi q̇i − L (8.6.12)
i=1
where s is the number of degrees of freedom. As stated above, the Hamiltonian is an im-
portant quantity in both classical and quantum physics.
When the Lagrangian is invariant to time translations, then the Hamiltonian is constant
in time. The question remains, how does any of this connect to conservation of energy? To
answer that question, let us look at the simple harmonic oscillator (SHO). The Lagrangian
for the SHO is
1 1
L = mẋ2 − kx2 (8.6.13)
2 2
Conservation theorems and the lagrangian 305
where we will consider the standard model of the SHO, a mass m connected to a massless
spring with spring constant k displaced a distance x from its equilibrium position located at
x = 0, allowed to slide along a horizontal frictionless surface. In this case, we have one degree
of freedom and one generalized coordinate q1 = x. We can find the canonical momentum
conjugate to x,
∂L
p= = mẋ (8.6.14)
∂ ẋ
Inserting p = mẋ and q̇ = ẋ into (8.6.12), we find
H = mẋ2 − L = 2T − (T − V ) = T + V = E (8.6.15)
We see, at least for the SHO, that the Hamiltonian is equal to the total mechanical energy.
Next, we will prove that H = T + V for a wider class of systems.
Under the right conditions, the Hamiltonian is the total energy of the system. Consider
a system of N particles, each denoted by the index α = 1, 2, . . . , N described by the
generalized coordinates q1 , . . . , qn . We will now prove that if
rα = rα (q1 , . . . , qn ) (8.6.16)
Therefore !
X ∂rα X ∂rα
ṙ2α = ṙα · ṙα = q̇j · q̇k (8.6.18)
j
∂q j ∂qk
k
where
X ∂rα ∂rα
ajk = mα · (8.6.20)
α
∂qj ∂qk
and ajk = ajk (q1 , . . . , qn ). Next, we will compute the canonical momentum conjugate to qi ,
∂L ∂T X
pi = = = aij q̇j (8.6.21)
∂ q̇i ∂ q̇i j
where we used,
d d ∂L ∂L
ṗ =
(p) = =
dt dt ∂ q̇ ∂q
from the Euler-Lagrange equation. Collecting terms, (8.7.7) becomes,
∂L
dH = q̇dp − ṗdq −dt (8.7.8)
∂t
Finally, we equate the coefficients of dq and dp in (8.7.4) and (8.7.8) to get Hamilton’s
equations for a system with one degree of freedom,
∂H ∂H
q̇ = ṗ = − (8.7.9)
∂p ∂q
Hamilton’s equations for a system of s degrees of freedom are:
Hamilton’s equations of motion are also sometimes referred to as the canonical equations
of motion, and the description of a particle’s motion by these equations is referred to as
Hamiltonian dynamics. Regardless of the number of degrees of freedom, we also have the
relationship:
∂H ∂L
=− (8.7.11)
∂t ∂t
found by equating the coefficients of dt in (8.7.4) and (8.7.8).
Finally, if we divide (8.7.4) by dt, we find that,
dH ∂H
= (8.7.12)
dt ∂t
While both the Lagrangian and the Hamiltonian can be used to find a system’s equa-
tions of motion, there are some differences between the two formulations. First, notice that
for a system of s degrees of freedom, Hamilton’s equations result in 2s first-order ODEs.
The Lagrange formulation for the same system results in s second-order ODEs. Hamilton’s
formulation uses generalized coordinates and generalized momenta, while the Lagrange for-
mulation uses generalized coordinates and generalized velocities. These different properties
are summarized in Table 8.1.
Table 8.1
Summary of the Hamilton and Lagrange formulations of a system’s equations of motion
for a system with s degrees of freedom and no constraints.
Formulation Number of Equations Order of Equations Coordinates Used
You now have three different methods of formulating a system’s equations of motion:
Newton’s second law, the Lagrangian, and the Hamiltonian. In addition, you can use con-
servation laws to set up and solve problems. The method you choose will depend on what
information you are given, and what information you want to learn about the problem at
hand. In fact, you may learn different things by solving the same problem using multiple
techniques. Once students learn about Lagrangians, they sometimes ignore Newton’s second
law, but Newton’s second law can be the easiest one to use when dealing with drag forces
and (as we will see later) noninertial reference frames. Use the right tool for the job!
To end this section, we present a few examples of using the Hamilton formulation in
order to find equations of motion. Notice that all of these examples will have a common
theme: in order to find H, one needs to first find L and compute the generalized momenta.
H =pθ θ̇ − L
pθ 1 2 p θ 2
=pθ − mℓ + mgℓ cos θ (8.7.14)
mℓ2 2 mℓ2
p2
= θ 2 − mgℓ cos θ
2mℓ
Notice that we needed to substitute for θ̇ in order to get H in terms of θ and
pθ . Further, notice that the Hamiltonian is equal to the total mechanical energy of the
system because the transformation between Cartesian coordinates and polar coordinates
is not time-dependent.
Finally, we compute Hamilton’s equations,
∂H pθ
θ̇ = → θ̇ = 2
∂pθ mℓ
(8.7.15)
→ ṗθ = −mgℓ sin θ
∂H
ṗθ = −
∂θ
There are a few things to notice with our solution. First, Hamilton’s equation for θ̇
simply reproduces what was obtained by computing the canonical momentum. Second,
the canonical momentum in this case is actually the angular momentum, not the linear
momentum. Finally, notice that ṗθ is the torque acting on the system.
Hamiltonian dynamics 309
Python Code
We use diff to evaluate the partial derivatives of the Hamiltonian, and odeint is
used to integrate numerically the system of equations (8.7.15). The symbolic results are
the same as the analytical ones obtained above.
print('-'*28,'CODE OUTPUT','-'*29,'\n')
H = ptheta**2/(2*m*l**2)-m*g*l*cos(theta)
m, l, g = 1, 1, 9.8
ics = [3,0]
t = [Link](0,20,100)
[Link](t,soln[:,0])
[Link]('time')
[Link]('theta')
[Link]()
ptheta-dot = -g*l*m*sin(theta)
310 Lagrangian and Hamiltonian Dynamics
Mathematica Code
We use NDSolve to solve the system of equations (8.7.15).
SetOptions[Plot, Axes->False, Frame->True, BaseStyle->{FontSize->16}];
θ-dot = lpθ
2m
pθ-dot = − glmSin[θ]
l = 1.0;
m = 1.0;
g = 9.8;
soln = NDSolve[{θ′ [t] == pθ[t]/(ml∧ 2), pθ′ [t] == −mglSin[θ[t]], θ[0] == 3.0,
0
θ
-1
-2
-3
0 5 10 15 20
time
Figure 8.8: Mathematica output for Example 8.7. Notice that with the large initial ampli-
tude, θ(t) is not sinusoidal.
Hamiltonian dynamics 311
ρ=R
m
r
z
Figure 8.9: A particle of mass m moving along a cylinder of radius R, in Example 8.8.
x2 + y 2 = R 2 (8.7.16)
which can also be written as ρ2 = R2 . Therefore, there are two degrees of freedom in
this problem.
Next, we compute the kinetic energy. In cylindrical coordinates, v 2 = ρ̇2 + ρ2 θ̇2 + ż 2 .
However, using our constraint ρ̇ = 0, the kinetic energy of the particle becomes,
1
T =m R2 θ̇2 + ż 2 (8.7.17)
2
The potential energy is best found in Cartesian coordinates first. We are given that
F = −kr = −krr̂ = −k xî + y ĵ + z k̂ (8.7.18)
1
V = kr2
2 (8.7.19)
1
= k x2 + y 2 + z 2
2
If we apply the constraint (8.7.16), then the potential energy becomes
312 Lagrangian and Hamiltonian Dynamics
1
k R2 + z 2
V =
2
We next compute the Lagrangian L = T − V ,
1 1
L=m R2 θ̇2 + ż 2 − k R2 + z 2 (8.7.20)
2 2
From the Lagrangian we see that the canonical momentum conjugate to θ is con-
served because θ is a cyclic coordinate. In order to find the Hamiltonian, we need to
compute pθ and pz ,
∂L ∂L
pθ == mR2 θ̇ and pz = = mż (8.7.21)
∂ θ̇ ∂ ż
Note that pθ again is an angular momentum, whereas pz is the translational mo-
mentum. Next, we use (8.7.3) to find the Hamiltonian,
H =pθ θ̇ + pz ż − L (8.7.22)
p 2 p 2 1
pθ pz 1 θ z
=pθ + pz − m R 2
+ − k R +z
2 2
(8.7.23)
mR2 m 2 mR2 m 2
p2θ p2z 1
= + + k R2 + z 2 (8.7.24)
2mR2 2m 2
Finally, we use the Hamiltonian to compute Hamilton’s equations,
∂H pz
→ ż =
m
ż =
∂pz
∂H pθ
θ̇ = → θ̇ =
∂pθ mR2 (8.7.25)
∂H
ṗz = − → ṗz = − kz
∂z
∂H
ṗθ = − → ṗθ =0
∂θ
Notice that ṗz is equal to the z-component of the external force acting on the system.
When the canonical momentum is constant, the equation of motion can be reduced to
quadrature (as above). If a coordinate system can be found such that all coordinates are
cyclic, then the equations of motion are trivial. In fact, it is possible to find such coordinate
systems. Those transformations were developed by Carl Gustav Jacob Jacobi (1804–1851)
and the work is referred to as the Hamilton-Jacobi theory. Hamilton-Jacobi theory is beyond
the scope of this book, but the motivated reader should consult Goldstein et al. [8].
Furthermore, simply knowing the Hamiltonian alone can give us insight into all possible
behaviors of the system. This can be done by using the Hamiltonian to plot the system’s
phase space. Unlike in Chapter 6 where we plotted x versus v, we will plot p versus q
to create the phase space. In particular, we will plot the canonical momentum versus its
conjugate generalized coordinate. In general, the dimension of the phase space is 2s, where
s is the system’s number of degrees of freedom. Notice that H = H (qk , pk ) and will define
surfaces in the phase space. To understand the value of such plots, we will revisit the simple
pendulum, yet again.
Consider the simple plane pendulum. Using the Hamiltonian found in Example 8.7,
plot the phase space of the simple plane pendulum using the values m = 1.0 kg,
ℓ = 1.0 m, and g = 9.8 m/s2 . Specifically, plot the contours corresponding to the
initial conditions: (q, p) = (0.5 rad, 0 kg m2 /s), (2.0 rad, 0 kg m2 /s), (π rad, 0 kg m2 /s),
(π rad, ±4.43 kg m2 /s) and (π rad, ±6.26 kg m2 /s), and interpret the results.
Solution:
The Hamiltonian for the simple plane pendulum was found in Example 8.7,
p2
H(q, p) = − mgℓ cos q (8.8.1)
2mℓ2
where we have defined p = pθ and q = θ for simplicity of notation.
The initial conditions correspond to the following values of H:
Note the negative value of the first initial condition is due to the choice of y-coordinate
to describe the pendulum’s location. The codes to create a contour plot are shown
below. The result of the Python code is shown in Figure 8.10.
Notice that we plotted q only for its possible range of −π ≤ q ≤ π. Some of the
contours (contours with H ≤ 9.8) form closed loops. Closed contours correspond to
oscillatory motion, which is what we would expect for q ≤ π and an initial angular
velocity of zero. The contour for H = −8.60, is nearly elliptical and if we were to
further decrease the initial value of q, we would get a contour corresponding to a simple
harmonic motion. The contour H = 4.07 corresponds to a larger amplitude of oscillation
where the pendulum is no longer oscillating sinusoidally. The dashed line (red in the
314 Lagrangian and Hamiltonian Dynamics
Python Code
In Python we use the command contour from the Matplotlib library. Unlike in
Mathematica, we must define a grid using [Link] for which we will calculate the
values of H. The value of each contour plotted is defined using the levels option in
the contour command.
import numpy as np
import [Link] as plt
m, l, g = 1, 1, 9.8
q_range = [Link](-[Link],[Link],100)
p_range = [Link](-10,10,100)
q, p = [Link](q_range,p_range)
H = p**2/(m*l**2) - m*g*l*[Link](q)
contour_plot = [Link](q,p,H, \
levels=[-8.6,4.07,9.8,19.61,29.39],colors=['k','k','r','k','k'],\
linestyles=['solid','solid', 'dashed','solid','solid'])
[Link](contour_plot)
[Link]('theta')
[Link]('p')
#[Link]('[Link]')
[Link]()
Additional explorations into the hamiltonian 315
Mathematica Code
We use the command ContourPlot to create the phase portrait for specific values
of H. The option Contours specifies the value of the contours plotted.
SetOptions[ContourPlot, BaseStyle->{FontSize->16}];
l = 1.0;
m = 1.0;
g = 9.8;
2
p
H[q_, p_]:= 2ml2 − mglCos[q];
ContourPlot[H[q, p], {q, −π, π}, {p, −10, 10}, ContourShading → None,
10.0
7.5
2.5
−8.60
0.0
p
9.8
0
−2.5 4.07
19.61
−5.0 29.39
−7.5
−10.0
−3 −2 −1 0 1 2 3
theta
Figure 8.10: Contour plot of the simple pendulum’s Hamiltonian produced by Python in
Example 8.9.
The Hamilton formulation is a powerful one, especially for theoretical mechanics. Ex-
tensions of the Hamilton formulation like the Hamilton-Jacobi theory laid the groundwork
for the theoretical structure of quantum mechanics. Beyond Goldstein et al. [8], the very
motivated student will find Arnold [9] to be both a highly challenging and highly rewarding
presentation of theoretical mechanics that goes well beyond the undergraduate-level, tying
classical mechanics to advanced mathematics such as Lie algebra and symplectic geometry.
The Lagrange formulation uses Hamilton’s principle, which says that the path a
particle will follow makes the action integral
Z t2
S= L (qi q̇i ; t) dt
t1
stationary. The functions qj (t) that make the action integral stationary can be found
using the Euler-Lagrange equation,
d ∂L ∂L
− =0
dt ∂ q̇i ∂qi
The Euler-Lagrange equation produces s second-order ODEs, where s is the number
of degrees of freedom in the system, which can be solved for qi (t).
In the case where there are m holonomic constraints on the system, we can express
the constraints as m constraint equations fj and the Euler-Lagrange equation becomes
End-of-chapter problems 317
∂L d ∂L Xm
∂fj
− =− λj (t)
∂qi dt ∂ q˙i j=1
∂qi
X
s
H= pi q̇i − L.
i=1
2. Consider a particle of mass m moving in three dimensions near the surface of the
Earth. Find the Lagrangian and the equations of motion for the particle. Identify any
conserved quantities. Solve this problem analytically and by using Mathematica or
Python.
5. Consider a disk of radius R rolling without sliding down an inclined plane. What
coordinates are needed to describe the state of the system? Are there constraints
among those quantities?
6. A very small ball of mass m and radius a is constrained to roll along the surface of a
sphere of R ≫ a. The ball is constrained to move along geodesics on the sphere. How
many degrees of freedom does the ball have?
318 Lagrangian and Hamiltonian Dynamics
11. A simple plane pendulum made of a mass m and massless rod of length ℓ is
attached to a support that accelerates upward with an acceleration a. Write down the
pendulum’s x and y coordinates as a function of time t and parameter θ (defined as the
angular displacement from the pendulum’s stable equilibrium). Find the Lagrangian
and the pendulum’s equation of motion, both analytically and using a CAS. Find also
the period of small oscillations around the equilibrium position.
12. Consider the pendulum described in Problem 11. Plot the path of the pendulum
bob as a function of time in the xy-plane using ℓ = 1.0 m and a = g/10, g/2, g, and
2g. Use θ(0) = 0.25 rad and θ̇(0) = 0 as initial conditions.
13. Find the equation of motion for a simple plane pendulum made of a mass m and a
massless rod of length ℓ which is attached to a support that oscillates horizontally, such
that xs = a cos (ωt), where xs is the location of the support on the horizontal axis.
The support has no vertical motion. Write down the pendulum’s x and y coordinates
as a function of time t and parameter θ (defined as the angular displacement from
the pendulum’s stable equilibrium, as in Figure 8.1). Find the Lagrangian and the
pendulum’s Euler-Lagrange equation of motion, both analytically and using a CAS.
14. Consider the driven pendulum described in Problem 13. Plot the path of the
pendulum bob in the xy-plane using a = 0.25 m, ω02 = g/ℓ = 1 rad/s and ω =
ω0 /10, ω = ω0 /2, ω0 , and 2ω0 . Use θ(0) = 0.25 rad and θ̇(0) = 0 as initial conditions.
15. A simple plane pendulum made of a mass m and massless rod of length ℓ is
attached to a support that oscillates vertically, such that ys = a cos (ωt) , where ys is
the location of the support on the vertical axis. The support has no horizontal motion.
Write down the pendulum’s x and y coordinates as a function of time and parameter
θ (defined as the angular displacement from the pendulum’s stable equilibrium, as
in Figure 8.1). Find the Lagrangian and the pendulum’s Euler-Lagrange equation of
motion, both analytically and using a CAS.
End-of-chapter problems 319
ℓ1
θ1
m1
ℓ2
θ
m2
16. Consider the driven pendulum described in Problem 15. Plot the path of the
pendulum bob in the xy-plane using a = 0.25 m, ω02 = g/ℓ = 1 rad/s and ω =
ω0 /10, ω0 /2, ω0 , and 2ω0 . Use θ(0) = 0.25 rad and θ̇(0) = 0 as initial conditions.
17. A double pendulum consists of two pendulums attached in series by massless rods as
shown in Figure 8.11. Find the equation of motion for the double pendulum. Note
that the motion of the pendulum is constrained to the plane like a simple plane
pendulum.
18. Consider a simple pendulum of mass m and initial length ℓ. After the pendulum
begins to swing, its length is shortened at a rate ℓ̇ = −α, where α is a constant.
Use the Lagrangian to compute the equations of motion of the system. Is the energy
conserved in this system? Solve this problem analytically and by using Mathematica
or Python.
19. A small particle with mass m slides down a smooth circular wedge with mass M and
radius of curvature R as shown in Figure 8.12. The wedge is free to move horizontally
along a frictionless surface. Find the equation of motion for each object.
20. Find the equations of motion for a single particle in three dimensions experiencing
a central force F (r) = F (r) r̂, where r is the magnitude of the position vector, and
F (r) is a scalar function. Use spherical coordinates.
320 Lagrangian and Hamiltonian Dynamics
21. A particle of mass m is constrained to move along a frictionless massless circular hoop
of radius a. The hoop rotates about its vertical diameter with a constant angular
speed ω. Find the equilibrium positions of the particle.
22. Consider a mass attached to a massless spring with a spring constant k and
equilibrium length ℓ that is allowed to swing on a frictionless plane. This is the so-
called elastic pendulum. Find the equation of motion for an elastic pendulum of mass
m and equilibrium length ℓ. Initially, the pendulum is stretched 0.25 meters from its
equilibrium length and displaced an angle of 0.5 radians from its stable equilibrium.
The pendulum is then released from rest. Plot the path of the pendulum bob in the
xy-plane using ℓ = 1, m = 1, k = 1 (in SI units) for t = 0 to 4.4 seconds.
23. A smooth horizontal circular wire of radius R rotates with constant angular speed ω
about a point on its perimeter. A particle of mass m is constrained to move along
the wire as shown in Figure 8.13. Find the equation of motion for the particle. About
what point does the particle oscillate?
ω
x
Figure 8.13: A bead restricted to move on a rotating circular wire in Problem 8.23.
24. A rope of mass M and length L is stretched out along a frictionless table such that
a length z0 is hanging over the edge of the table. Find the equation of motion of the
rope if it is released from rest. Use the Lagrangian to show that the rope requires a
time s
L
t= cosh−1 (L/z0 )
g
to completely slide off the table. You may remember this problem from Chapter 4,
where we solved it using Newton’s laws.
25. A particle of mass m moves in a plane under the force F = −αr2 where F points
towards the origin, and r is the magnitude of the position vector. Find the equations
of motion for the particle. Are there any conserved quantities? Is so, what are they?
26. A sphere of radius a and mass m is constrained to roll without slipping on the inside
of a cylinder with a radius R. Find the equations of motion of the sphere and calculate
the period of small oscillations.
27. A particle of mass m is constrained to move on a frictionless wire which is bent into
the shape of a helix with r = R and z = αθ, where R and α are positive constants. The
particle is under the influence of gravity, which points in the −z direction. Find the
equation of motion for the particle. What is the particle’s acceleration when R → 0?
End-of-chapter problems 321
29. A particle of mass m moves within a force field that has an associated potential energy
V = −k/r where k is a positive constant. What are the conserved quantities for this
particle?
30. Consider a system with s degrees of freedom and Lagrangian L(qk , q̇k ), where k =
1, . . . , s. Now, let F = F(qk ) be any function of the generalized coordinates, qk . We
can construct an additional Lagrangian,
L′ = L + dF/dt
Show that L and L′ give the same equations of motion.
Section 8.7: Hamiltonian Dynamics
31. Derive Hamilton’s equations of motion for a system with s degrees of freedom.
35. Find Hamilton’s equations for the elastic pendulum described in Problem 22.
Plot the path of the elastic pendulum using the same parameter values and initial
conditions as in Problem 22. However, this time, plot the path of the pendulum from
t = 0 to t = 10 seconds.
36. Find Hamilton’s equations for a particle of mass m confined to the surface of a cone,
which in cylindrical coordinates is described by r = az, inside a uniform gravitational
field. Show that for a given energy, there are maximum and minimum values of z for
which the particle is confined.
37. Consider the force
k
F = − e−λt (8.10.3)
x
acting on a particle of mass m moving in one dimension. Assume that the constants
k and λ are bothR positive. We can create a “pseudo-potential energy,” using the rela-
tionship, V = − F dx. Using the pseudo-potential energy, find Hamilton’s equations
of motion for the particle. Compute ∂H/∂t and ∂L/∂t and show that they satisfy
(8.7.11):
∂H ∂L
=−
∂t ∂t
322 Lagrangian and Hamiltonian Dynamics
y =a (1 − cos θ)
x =a (θ − sin θ)
39. Poisson brackets are an interesting method of representing the time evolution of
a quantity using the Hamiltonian. Consider two functions g(qk , pk ) and h(qk , pk ).
The functions g and h are functions of the generalized coordinates and generalized
momenta, similar to the Hamiltonian. The Poisson bracket is defined as:
X ∂g ∂h ∂g ∂h
[g, h] = −
∂qk ∂pk ∂pk ∂qk
k
41. Both in Chapter 5 and in Problem 33 of this chapter, we studied the double-well
potential, V = − 21 kx2 + 14 ϵx4 .
a. Find the Hamiltonian for this potential.
b. Using the Hamiltonian, plot the phase space for ϵ = 1 and various values of k.
Use m = 1 for the particle’s mass.
c. How does the phase space change with k? For each value of k that you try,
describe the possible motions of the particle.
d. Draw the phase space plots and identify the types of motion associated with each
region of the phase space.
9 Central Forces and Planetary
Motion
In this chapter we will first look at the concept of central forces and their importance in
describing physical phenomena. Next we examine the problem of two objects interacting
via a central force, this is the so called two-body problem. Our analysis of the two-body
problem will lead to Kepler’s Laws of Planetary Motion. We will obtain the solution of the
two-body problem both analytically and by numerically integrating Newton’s law. Finally,
we study the three-body problem where three objects interact via central forces. Solving
for the motion of one of the objects in the three-body problem will require us to use the
computational skills developed so far in this book.
m1 r
F21
r
F12
m2
Figure 9.1: Two masses m1 and m2 interacting via a central force F.
323
324 Central Forces and Planetary Motion
where f (r) is a scalar function of the magnitude r of the position vector r, and r̂ is a unit
vector along the position vector as shown in Figure 9.1.
The best known examples of central forces in physics are Newton’s Law of Universal
Gravitation FG (r) between two masses m1 and m2 , and the electrostatic Coulomb force
FC (r) between two electric changes q1 and q2 . The mathematical description of these two
forces is very similar:
Gm1 m2
FG (r) = − r̂ (9.1.2)
r2
1 q1 q2
FC (r) = r̂ (9.1.3)
4πϵ0 r2
where G = 6.67×10−11 N m2 kg2 is the universal gravitational constant and ϵ0 = 8.85 ×
10−12 F/m is the corresponding constant for electrical forces, called the permittivity of free
space.
1 ∂ ∂Fθ 1 1 ∂Fr ∂
∇×F= (Fϕ sin θ) − r̂ + − (rFϕ ) θ̂
r sin θ ∂θ ∂ϕ r sin θ ∂ϕ ∂r
1 ∂ (rFθ ) ∂Fr
+ − ϕ̂ (9.1.4)
r ∂r ∂θ
∂Fr ∂Fr
In the case of central forces we have Fθ = Fϕ = 0 , ∂ϕ =0, ∂θ = 0 so that (9.1.4) gives:
∇×F=0 (9.1.5)
and therefore, F is a conservative force.
As we saw in Chapter
R 5, conservative forces can be associated with potential energy
functions V (r) = − F · dr. The corresponding scalar gravitational potential energy VG
and electrostatic potential energy VC are:
Gm1 m2
VG (r) = − (9.1.6)
r
1 q1 q2
VC (r) = (9.1.7)
4πϵ0 r
Another well-known example of a central force is the intermolecular long-range Van der
Waals force, which is of importance in several branches of science. In one of its simplest
forms, the Van der Waals force between a pair of neutral atoms or molecules can be approx-
imated by the Lennard-Jones potential (also termed the L-J potential or 6-12 potential).
The mathematical form of the 6-12 potential VLJ (r) is:
hc c2 i
1
VLJ (r) = 12 − 6 (9.1.8)
r r
where c1 and c2 are constants with the appropriate SI units.
In the field of particle and atomic physics, the Yukawa short range nuclear force is of great
importance, and the corresponding Yukawa potential VY (r) is represented mathematically
by:
e−c5 r
VY (r) = c4 (9.1.9)
r
where c4 , and c5 are constants with the appropriate SI units.
The two-body problem 325
X
N X
N
N= ri × ṗi = ri × Fi (9.1.10)
i=1 i=1
where Fi is the force acting on the particle with mass mi . In Chapter 4, we further simplified
this equation to show that
X
N
XN X
N= ri × Fext
i + (ri − rj ) × Fij (9.1.11)
i=1 i=1 j>i
where Fext is the sum of the external forces acting on mi , and Fij is the force of interaction
between mi and mj . If we assume an isolated system, then Fext = 0, and the first term
in (9.1.11) is equal to zero. Using a coordinate system similar to that in Figure 9.1, we
can write ri − rj = rij r̂ij , where r̂ij is a unit vector that lies along a line joining mi and
mj . Furthermore, if the force of interaction between the particles is a central force, then
Fij = Fij (r)r̂ij and the second term in (9.1.11) is: (rij r̂ij ) × (Fij r̂ij ) = 0. Therefore, the
net torque acting on the system is zero, and angular momentum is conserved.
In the next section, we will examine the so-called two-body problem in detail. This
discussion will lead us to Kepler’s famous laws of planetary motion.
r1 r=r1-r2
R
m2
r2
O
Figure 9.2: Position vectors r1 and r2 and relative distance r = r1 − r2 of the two masses
interacting with a central force F (r)r̂. The white circle at the location R shows the location
of the system’s center of mass, and O is the origin of the coordinate system.
326 Central Forces and Planetary Motion
If r1 and r2 are the position vectors of the two masses m1 and m2 respectively, then the
vector distance between the two masses is
r = r1 − r2 (9.2.1)
This equation tells us that the two-body system behaves just like a single mass µ with
a position vector r, moving under the influence of the central force F = F (r)r̂. This single
mass µ is called the reduced mass of the two-body system, and it represents an effective
inertial mass appearing in the two-body problem. Using the reduced mass µ allows us to
study the two-body problem as if it were a one-body problem. Note that the minus sign
appears in (9.2.6) because we assumed an attractive force. A repulsive force would give
similar results but without the minus sign in (9.2.6).
What is the reduced mass? The definition in (9.2.7) can be difficult to interpret. Consider
the Earth-Sun system. In this case the mass of the Sun mS is much greater than the mass
of the Earth, mE . If we use m1 = mS and m2 = mE in (9.2.7), we find that µ ≈ mE . Hence,
when we study the motion of the Earth-Sun system, we are essentially studying the motion
of the Earth. As the masses become more comparable, we cannot associate the reduced
mass with either one of the masses, as we will demonstrate later in Example 9.1.
When working with a system of multiple particles, we know that the system’s center of
mass can be useful in describing the behavior of the system. As we discussed in Chapter 4,
the position of the center of mass of the two-body system is defined by:
m1 r1 + m2 r2
R= (9.2.8)
m1 + m2
Because the translational motion of the system as a whole is not of interest (we are
focused on the particles’ orbits with respect to each other), we can set R = 0, as shown
in Figure 9.3a. In other words, we can place the center of mass at the origin. This new
The two-body problem 327
coordinate system is different from that shown in Figure 9.2. As we will see, this new
coordinate system with the center of mass at the origin, will be very useful in describing
the orbits.
Figure 9.3: (a) The two-body system can be best described using a system of coordinates
axes with the origin located at the center of mass of the system. (b) The motion can also
be described by Newton’s law (9.2.6), as the motion of the reduced mass µ, with position
vector r = r1 − r2 , moving with the relative velocity of the two masses v = ṙ1 − ṙ2 .
Using R = 0, we have
m1 r1 + m2 r2 = 0 (9.2.9)
By combining (9.2.9) with the definition r = r1 − r2 for the position vectors r1 and r2 , we
obtain:
m2
r1 = r (9.2.10)
m1 + m2
m1
r2 = − r (9.2.11)
m1 + m2
Note that in the center of mass coordinate system of Figure 9.3a, the three vectors
r, r1 , r2 are collinear. Equations (9.2.10) and (9.2.11) allow us to relate the particles’ posi-
tions to the separation vector r. In addition, we can write the Lagrangian for the system
as:
1 1
L= m1 ṙ21 + m2 ṙ22 − V (r) (9.2.12)
R 2 2
where V (r) = − F (r)dr is the potential energy associated with the central force F. Sub-
stituting the values of (9.2.10) and (9.2.11) in the Lagrangian (9.2.12), we find after some
simple algebra that the Lagrangian of the two-body system is:
Similar to Newton’s second law, the Lagrangian shows that we are reducing the two-
body problem to the motion of a single object with a mass equal to the reduced mass µ,
moving with the relative velocity of the two masses v = ṙ1 − ṙ2 .
Similarly, the total angular momentum of the two-body problem is found from:
dr1 dr2
L = m1 r1 × + m2 r2 × (9.2.14)
dt dt
Substituting (9.2.10) and (9.2.11) into (9.2.14) we can obtain the total angular momentum
(see Problem 10 in the End-of-Chapter Problems):
ℓ = µ (r × ṙ) (9.2.15)
where we have replaced L (for two bodies) with ℓ (for one body). This equation tells us that
the total angular momentum of the two-body problem is equal to the angular momentum of
the reduced mass µ, located at the point r = r1 −r2 and moving with velocity v = ṙ = ṙ1 −ṙ2 .
Again, the result is that we can reduce the two-body problem to studying the motion of a
single particle of mass µ.
Furthermore, taking the time derivative of (9.2.15) results in ℓ̇ = 0; hence just as before,
the angular momentum is conserved. One of the physical consequences of the conservation
of the angular momentum vector ℓ is that the motion of the mass µ has to remain on the
same plane (which also contains the force center), in order to keep the direction of ℓ constant
at all times. This is shown for the special case of a circular orbit in Figure 9.4. Because
the motion of the particle is restricted to a plane, polar coordinates are a useful coordinate
system when dealing with central force problems. The constant nature of ℓ helps explain
why all of the orbits of the planets in our solar system are essentially coplanar and continue
to stay that way.
=r×p
θ r
p
μ
Figure 9.4: Relationship of the angular momentum vector ℓ, position vector r and linear
momentum vector p = µv.
Since the motion is restricted in to a plane, we can compute the magnitude of the
angular momentum in polar coordinates. Recall that in polar coordinates ṙ = ṙr̂ + rθ̇θ̂, and
substituting in (9.2.15) we obtain:
Equations of motion for the two-body problem 329
ℓ = µr2 θ̇ (9.2.16)
We can also compute the total energy of the two-body system using E = T + V ,
1
E= µ ṙ2 + r2 θ̇2 + V (r) (9.2.17)
2
2
1 1 ℓ
= µṙ2 + µr2 + V (r) (9.2.18)
2 2 µr2
Again, the physical interpretation of this equation, and the others before it, is that the
two-body system can be replaced by a single reduced mass µ at a distance r =| r1 − r2 |from
the origin (i.e., the force center and the system’s center of mass), and moving with the
velocity v = ṙ = ṙ1 − ṙ2 . This is shown schematically in Figure 9.3b.
While the reduced mass is a useful tool for performing the calculations above, what we
really want is to be able to calculate the motions of m1 and m2 . In the next section, we will
derive the equations of motion for the two-body problem.
dr dr dθ dr ℓ2
= = (9.3.2)
dt dθ dt dθ 2µr2
into (9.3.1) and integrate to obtain
Z
ℓdr
θ(r) = ± q (9.3.3)
r2 2µ E − V (r) − ℓ2
r2
330 Central Forces and Planetary Motion
In principle, after specifying V (r), we could perform the integral to get a mathematical
form for θ(r), and then invert it to get r(θ). However, in general, the integral in (9.3.3) is
difficult to do and the inversion is also not easy.
Before we present the analytical solution, we demonstrate the numerical solution for
the two-body problem. Computers can provide a means of obtaining numerical solutions,
in which case it is often easier working directly with Newton’s second law. In the next
example, we show how numerical solutions for an object’s orbit in the two-body system can
be obtained by numerically solving Newton’s second law.
r xî + y ĵ
r̂ = =p
r x2 + y 2
Python Code
In this example, the first component Y[:,0] of the vector Y represents the variable
x(t), and the second component Y[:,1] represents the corresponding velocity ẋ(t) =
dx1 /dt. Similarly, the third component Y[:,2] of Y represents the variable y(t), and
the fourth component Y[:,3] represents the corresponding velocity dy/dt. In Figure
9.5a we see that the reduced mass µ follows an elliptical orbit.
We also plotted the positions of the two masses in Figure 9.5b. The positions can
be calculated by multiplying r with the factors m1 /(m1 + m2 ) and −m2 /(m1 + m2 ) to
get r1 and r2 , respectively. Notice that each mass follows an elliptical path around the
center of mass, which is located at one of the foci of each ellipse.
Since the vectors r1 , r2 and r are collinear, the line connecting the locations of the
two masses at any moment passes through the origin. We also draw the line connecting
the two masses m1 and m2 at time t=1 s.
Mathematica Code
The command NDSolve is used to solve the system of differential equations (9.3.4),
and the Table command is used to construct a list of the pairs of position coordinates
r = (x, y) from t = 0 to t = 10, in time steps of dt = 0.01. The coordinate pairs
are stored in the variable xyList. Finally a graph of the orbits of the two masses is
produced by using the ListPlot command.
The positions r1 and r2 can be calculated from r easily by multiplying the list xyList
with the factors m1 /(m1 + m2 ) and −m2 /(m1 + m2 ) to get r1 and r2 , respectively.
m1 = 1; m2 = 2; x0 = 1; y0 = 0; vx0 = 0; vy0 = 1;
y”[t] == −(m1 + m2) ∗ y[t]/((x[t]∧ 2 + y[t]∧ 2)∧ (3/2)), x[0] == x0, y[0] == y0,
x1 = x/.sol[[1]];
y1 = y/.sol[[1]];
GraphicsGrid[{{gr1, gr2}}]
Equations of motion for the two-body problem 333
Figure 9.5: The two-body system in Example 9.1 can be described in two equivalent ways.
In (a) the system is described as the motion of the reduced mass µ in an ellipse with the
center of mass at the origin. In (b) the system is described by the motion of the two masses
in ellipses around the center of mass which is located at the origin, and it represents one of
the foci of the ellipse.
Although numerical solutions are very useful, it is very important to obtain an analytical
solution, when possible. Next, we derive a general equation which provides another means
of computing the orbit of the reduced mass for the two-body problem. This equation can
also be used to find the mathematical form of the central force acting on the reduced mass,
if the mathematical form of the orbit is known to us. In order to obtain the central force, we
need to use Newton’s second law in polar coordinates. Here r and θ are the usual position
and angle polar coordinates. The acceleration in polar coordinates is given by:
dv
= r̈ − rθ̇2 r̂ + rθ̈ + 2ṙθ̇ θ̂ (9.3.7)
dt
Newton’s second law for the reduced mass µ becomes:
µ r̈ − rθ̇2 r̂ + µ rθ̈ + 2ṙθ̇ θ̂ = −f (r)r̂ (9.3.8)
where we used the reduced mass of the two-body system.
By setting the radial components on both sides of this equation equal to each other and
the angular components equal to each other, we obtain:
µ r̈ − rθ̇2 = f (r) (9.3.9)
rθ̈ + 2ṙθ̇ = 0 (9.3.10)
334 Central Forces and Planetary Motion
This equation is useful when we know the orbit in the form r(θ), and we want to evaluate
the central force f (r) which creates this orbit. In the following two examples, we use (9.3.17)
to evaluate the central force f (r) and the total energy E for a given orbit r(θ) for a two-body
system.
Example 9.2: Finding the central force when we know the orbit
The orbit r(θ) of a mass m moving inside a central force field, is given by the expression:
r(θ) = kθ
(a) Find the central force f (r) creating this orbit, both analytically and using a CAS.
(b) Find the orbit θ(t) with the initial condition θ(0) = 0.
Solution:
(a) We use (9.3.17) to evaluate the force:
2
ℓ2 d 1 1
f (r) = − 2 +
µr dθ2 r r
Equations of motion for the two-body problem 335
We now have
d2 1 d2 1 2 2k 2
= 2 = 3 = 3
dθ2 r dθ kθ kθ r
and the f (r) equation above gives:
ℓ2 2k 2 1 ℓ2 2k 2 1
f (r) = − + = − +
µr2 r3 r µ r5 r3
So the central force in this system is a linear combination of the two terms 1/r5 and
1/r3. .
(b) We can find the orbit θ(t) by using the conservation of angular momentum:
dθ
µr2 θ̇ = µr2 =ℓ
dt
and substituting r = kθ:
µk 2 d θ3
2 2 dθ
µk θ = =ℓ
dt 3 dt
This can be integrated to yield:
3tℓ
θ3 (t) = + θ3 (0)
µk 2
and using the initial condition θ(0) = 0 yields the orbit θ(t), or equivalently the orbit
r(t) = k θ(t): s s
3 3tℓ 3tℓ
θ(t) = r(t) = k 3
µk 2 µk 2
336 Central Forces and Planetary Motion
Python Code
We use diff to obtain the second derivative of u = 1/r, and dsolve in SymPy to
solve the differential equation symbolically for θ(t). The output of the code agrees with
the analytical solution obtained above.
print('-'*28,'CODE OUTPUT','-'*29,'\n')
r, k, theta, L, mu, t =symbols('r,k,theta,L,mu,t',real=True)
force = -L**2/(mu*rr**2)*(diff(1/rr,theta,theta)+1/rr)
theta2 = Function('theta2')
ic = {theta2(0):0}
soln = dsolve(mu*k**2*theta2(t)**2*diff(theta2(t),t)-L,\
theta2(t),ics=ic)[0]
Mathematica Code
We use D to obtain the second derivative of u = 1/r, and DSolve to solve the
differential equation symbolically for θ(t). Note that we have to select the positive
solution of the ODE.
Equations of motion for the two-body problem 337
rr = k ∗ θ;
Print[“or”];
Print[“θ[t]∧ 3 = ”, (θ[t]/.soln)∧ 3]
Example 9.3: Finding the total energy when we know the orbit
Find the total energy E for the orbit r(θ) of the mass µ in Example 9..2.
Solution: R
We find the potential energy V (r) = − f (r) dr by using the expression for the
force f (r) from the previous example:
Z Z 2
ℓ 2k 2 1 ℓ2 k 2 1
V (r) = − f (r) dr = − − 5 + 3 dr = − +
µ r r 2µ r4 r2
The kinetic energy T is given by:
2
ℓ2 1 dr
T= 2
+ µ
2µr 2 dt
We can evaluate dr/dt using the chain rule, the orbit equation r = kθ and the conser-
vation of angular momentum ℓ = µr2 θ̇:
dr dr dθ d (kθ) dθ ℓ
= = = k θ̇ = k 2
dt dθ dt dθ dt µr
Finally the total energy will be:
2
ℓ2 1 dr
E =T +V = 2
+ µ + V (r)
2µr 2 dt
2
ℓ2 1 ℓ ℓ2 k 2 1
E= + µ k 2 − + 2 =0
2µr2 2 µr 2µ r4 r
As discussed later in this chapter, the value of E = 0 corresponds to a parabolic
motion of the reduced mass µ in the two-body system.
338 Central Forces and Planetary Motion
w′′ = −w (9.4.3)
Notice that the result is a simple harmonic oscillator equation for w with a natural frequency
ω0 = 1. The solution is
w = A cos θ + B sin θ (9.4.4)
With a careful choice of coordinates, we can set B = 0. Let’s choose θ = 0 as the angular
position of µ when it makes its closest approach rmin to the force center (i.e., to the center of
mass). At this point, ṙ = 0 (because this is a turning point in the orbit) and due to (9.3.13),
u′ = 0. Hence, we are setting an initial condition for u to be u′ (θ = 0) = 0. Because w′ = u′ ,
we also have w′ (θ = 0) = 0, and this condition leads to B = 0. Hence we have,
µk
u = A cos θ + (9.4.5)
ℓ2
We now introduce a new constant e = ℓ2 A/ (µk) and we set α = ℓ2 / (µk), to obtain:
1 1
= (1 + e cos θ) (9.4.6)
r α
α
r= (9.4.7)
1 + e cos θ
which, as we showed in Chapter 4, is the equation of a conic section in polar coordinates
with one focus at the origin. The dimensionless variable e is the eccentricity of the conic
section, and the distance α is the semi-latus rectum. Later in this chapter we will discuss
the equation for conic sections in polar coordinates in more detail.
When studying planetary motion, Johannes Kepler (1571-1630) developed three laws of
planetary motion. Kepler’s first law stated that planets orbit in an ellipse and that the Sun
is at one of the foci of the ellipse. An ellipse, of course, is one example of a conic section.
However, starting from Newton’s second law, we have found a much more general result.
We have found that the motion of the reduced mass is of the form of a conic section: circle,
ellipse, parabola, or hyperbola. What conditions dictate which conic section the reduced
mass follows? In the next section, we will begin to answer this question.
However, before we move on, there is one piece of (9.4.6) that is still unsatisfactory,
the eccentricity e is in terms of the constant of integration A. It would be better if we
could rewrite the eccentricity e in terms of physical parameters, similar to the equation
α = ℓ2 / (µk). We begin by using our choice of coordinates where ṙ = 0 at r = rmin and rmin
occurs at θ = 0, hence (9.4.6) gives
Orbits in a central force field 339
α
rmin = (9.4.8)
1+e
and the total energy at rmin is
ℓ2 k
E= 2 − (9.4.9)
2µrmin rmin
Substituting (9.4.8) into (9.4.9), and solving the resulting quadratic equation for the eccen-
tricity e, we obtain
s
2Eℓ2
e= 1+ (9.4.10)
µk 2
In summary, the motion of the reduced mass in the two-body system is a conic section,
with one focus at the origin. In terms of the eccentricity e and the semi-latus rectum α, the
equation of the conic section r (θ) in polar coordinates is:
Note that the conic section in (9.4.11) is completely described by the two parameters e, α.
These two geometrical parameters can be evaluated using (9.4.12) and (9.4.13), when we
know the two conserved physical quantities in the system, i.e. when we know the total energy
E and the conserved angular momentum ℓ. Alternatively, the conic section is completely
described by the physical quantities E, ℓ.
1 2 l2
E =T +V= µṙ + + V (r) (9.5.1)
2 2µr2
where we have returned to the generic potential energy V (r). Note that for an inverse
square law, V = −k/r. The first term in (9.5.1) can be interpreted as a kinetic energy term,
because it is of the form of one half times a mass and the square of the radial velocity. It is
convenient to think of the second two terms as representing potential energy.
We notice that the term
340 Central Forces and Planetary Motion
l2 1
VC ≡ = µr2 θ̇2 (9.5.2)
2µr2 2
can be interpreted as a form of energy called the centrifugal potential energy VC , and the
corresponding force will be the centrifugal force FC :
∂VC l2
FC = − = 3 (9.5.3)
∂r µr
note that FC = FC r̂ points radially outward from the center of mass (the force center for
the two-body problem). We can then write the effective potential energy Veff (r) as the sum
of two terms, the centrifugal potential VC and the potential energy V (r) corresponding to
the central force.
l2
Veff (r) = + V (r) = VC + V (r) (9.5.4)
2µr2
Figure 9.6 shows a plot of the effective potential Veff (r) as a function of the distance
r, and for an attractive potential V = −k1 /r where k1 = 2.5 in SI-units. The dashed
lines in this graph indicate a repulsive positive centrifugal potential VC = 1/r2 , and the
attractive potential V = −k1 /r. The thick solid line in this figure shows the sum of these
two potentials, which represents the effective potential Veff (r). When the distance r → 0
the effective potential goes to infinity, while as r → ∞ the effective potential goes to
zero. The horizontal lines in this figure indicate two possible energies of the reduced mass,
E0 = −1.55 J and E1 = 1.3 J. Note that the value of these energies are arbitrarily chosen
for illustrative purposes only.
We can use the methods of Chapter 5 in order to qualitatively describe the motion of
the reduced mass µ as a function of its total energy E. Recall, that we can think of the
reduced mass as a particle that is rolling along the track made by the shape of the Veff
graph. When E = E0 , the particle is fixed at the minimum of Veff . This means that the
value of r does not change. The result is that the reduced mass has a circular orbit with
r = r0 . When E = E1 < 0 (or more generally for E0 < E < 0), the particle rolls back and
forth between r = r1 and r = r2 . We know from Chapter 5 that such a “rolling back and
forth” means oscillatory motion. The reduced mass gets no closer to the force center than
r = r1 , and no farther than r = r2 . Hence the resulting motion is an ellipse with rmin = r1
and rmax = r2 . Note that we are using rmin and rmax as the closest and farthest distance
between the reduced mass and the force center, respectively. In general, we can see from
Figure 9.6 that when E < 0, the motion of the reduced mass is bound to periodic orbits.
Furthermore, from Figure 9.6 we can see that when E ≥ 0, the motion is unbound. The
reduced mass comes in from infinity and gets as close to the force center as the distance
r3 , which is not shown in Figure 9.6. However, one can find r3 by solving E = Veff (r3 )
where E is the energy of the reduced mass. The solution can be found either analytically or
numerically. The unbound orbits are parabolic or hyperbolic, depending on the value of E.
Orbits in a central force field 341
Figure 9.6: A plot of the effective potential Veff (r) = VC + V (r) as a function of the distance
r (thick solid line). The dashed lines indicate the repulsive positive centrifugal potential
VC and the attractive potential V (r) = −2.5/r. When E = E0 the motion is a circle and
r = r0 . When E = E1 < 0, the motion is bound between the two circles with radii r = r1
and r = r2 . When E > 0, the motion is unbound.
So far in this section, we have learned that the energy of the reduced mass determines
the nature of its orbit. Now that we have a qualitative understanding of the orbit of µ, we
can use our knowledge of conic sections in order to determine the conditions under which
each orbit occurs. We know that conic sections have specific eccentricities, for example,
e = 0 for a circle. Using the equation for the eccentricity (9.4.10) we can now determine the
energies of each type of orbit. They are summarized in Table 9.1, and examples are shown
in Figure 9.7.
Table 9.1
The energies and eccentricities associated with each type of orbit.
Eccentricity e Energy E Orbit shape
4
Hyperbola, e>1
2
0
y
2 Ellipse, e<1
4 Parabola, e=1
8 6 4 2 0 2 4 6 8
x
Figure 9.7: Possible conic section orbits of the reduced mass for different eccentricities e:
ellipse (e < 1), parabola (e = 1) and hyperbola (e > 1). The orbits in this example are
centered at the origin of the coordinate system.
Figure 9.8: The motion of the planets around the Sun can be described by an ellipse which
has the Sun at one focus, F . The second focus F ′ is an (empty) point in space. The ellipse
can be described mathematically using (9.6.1) in polar coordinates (r, θ).
At θ = 90◦ and at θ = 270◦ the distance is equal to the semi-latus rectum distance r = α
shown in Figure 9.9, and depends on both the semi-major axis a of the elliptical motion,
and on the eccentricity e:
α = a 1 − e2 (9.6.4)
The minor axis 2b is perpendicular to the major axis 2a, and both (a, b) are related to
the energy of the orbit:
α k
a= = (9.6.5)
1−e 2 2 |E|
α ℓ
b= √ =p (9.6.6)
1−e 2 2µ |E|
Here again note the presence of the two conserved quantities E, ℓ. Furthermore, we can
rewrite the perihelion and aphelion distances as:
Figure 9.9: Kepler’s first law places the Sun at the focus of an elliptical orbit.
The next two examples shows how to plot the orbits of planets. The first example uses
(9.4.6) and data for the planets Mercury and Earth, while the second uses a numerical
solution to Newton’s second law.
Example 9.4: Plotting the orbits of Earth and Mercury around the sun
The Earth’s distance from the Sun ranges from 147.5 million km (at perihelion),
to about 152.6 million km (at aphelion), while for Mercury these distances are from
46,000,000 to 70,000,000 km. Plot the orbits of Mercury and Earth around the Sun.
Solution:
The semi-major axis a can be found directly from the distances rmin and rmax for the
perihelion and aphelion by using (9.6.3), and the eccentricity e can be found by using
(9.6.7). Once the geometrical properties a, e are known, we know everything about the
orbits and we can plot them using the general equation (9.4.6) for the elliptical orbits.
Python Code
We evaluate α and e, and use
α
r= (9.6.8)
1 + e cos θ
with x = r cos θ, y = r sin θ to create the plots.
Kepler’s laws of planetary motion 345
import numpy as np
import [Link] as plt
print('-'*28,'CODE OUTPUT','-'*29,'\n')
a = (rminE + rmaxE)/2
eEarth = (rmaxE - rminE)/(rminE + rmaxE)
print('The eccentricity of Earth is e = ', round(eEarth,4))
theta = [Link](0,2*[Link],100)
rE = alpha/(1 + eEarth*[Link](theta))
[Link](rE*[Link](theta),rE*[Link](theta))
aM = (rminM + rmaxM)/2
eMercury = (rmaxM - rminM)/(rminM + rmaxM)
print('The eccentricity of Mercury is e = ', round(eMercury,4))
[Link](rM*[Link](theta),rM*[Link](theta))
[Link]('Orbits of Earth and Mecrury around the Sun')
[Link]('x [m]')
[Link]('y [m]')
[Link]()
Mathematica Code
We use the PolarPlot command to plot the two orbits, and we also print out the
values of e for the two planets.
Notice the almost completely circular orbit of the Earth (because the eccentricity
e = 0.0167 is close to zero), and the clearly elliptical orbit for Mercury (because of the
larger value of e = 0.21).
346 Central Forces and Planetary Motion
a = (rminE + rmaxE)/2;
PlotRange → {{−2 ∗ 10∧ 11, 2 ∗ 10∧ 11}, {−2 ∗ 10∧ 11, 2 ∗ 10∧ 11}}];
a = (rminM + rmaxM)/2;
Frame → True, PlotRange → {{−2 ∗ 10∧ 11, 2 ∗ 10∧ 11}, {−2 ∗ 10∧ 11, 2 ∗ 10∧ 11}}];
2 × 1011
1 × 1011
y, m
-1 × 1011
-2 × 1011 11
-2 × 10 -1 × 1011 0 1 × 1011 2 × 1011
x, m
Figure 9.10: Plots of the orbits of Mercury and Earth around the Sun, from Example 9.4.
a = (perigee + apogee)/2
(b) The period of revolution of the Moon is found from Kepler’s third law:
4π 2 a3
P2 = (9.6.10)
G (m1 + m2 )
s
4π 2 a3
P = = 27.29 days (9.6.11)
G (mmoon + mearth )
348 Central Forces and Planetary Motion
Python Code
After evaluating a and the eccentricity e, we plot the orbit using the polar coordi-
nates expression r = α/ (1 + e cos θ) and the coordinates x = r cos θ, y = r sin θ, where
the angle θ ranges from 0 to 2π.
import numpy as np
import [Link] as plt
print('-'*28,'CODE OUTPUT','-'*29,'\n')
theta = [Link](0,2*[Link],100)
alpha = a*(1 - e**2)
r = alpha/(1 + e*[Link](theta))
[Link](r*[Link](theta),r*[Link](theta))
[Link]("Orbit of Moon around the Earth")
[Link]('x')
[Link]('y')
[Link](-4.2*10**8, 4.2*10**8);
[Link](-4.2*10**8, 4.2*10**8);
# draw x-y-axes
[Link]([Link](-4.2*10**8,4.2*10**8,100),[0]*100)
[Link]([0]*100,[Link](-4.2*10**8,4.2*10**8,100))
[Link]()
Mathematica Code
The code is very similar to the Python code, and we use the command PolarPlot
to plot the Moon’s orbit.
a = (perigee + apogee)/2;
“ days”];
α = a ∗ (1 − e∧2);
r = α/(1 + e ∗ Cos[θ]);
Frame->True, BaseStyle->{FontSize->16},
PlotLabel->“Moon’s orbit”,
PlotRange->{{−4.2 ∗ 10∧ 8, 4.2 ∗ 10∧ 8}, {−4.2 ∗ 10∧ 8, 4.2 ∗ 10∧ 8}}]
350 Central Forces and Planetary Motion
Figure 9.11: The slightly elliptical orbit of the Moon, evaluated in Example 9.5.
ℓ = µr2 θ̇ (9.6.12)
From this magnitude we can now derive Kepler’s second law. We begin by considering a
small wedge of the planet’s orbit traced out in a time dt, as shown in Figure 9.12.
rdθ
dθ
r
Figure 9.12: A small wedge of the planet’s orbit traced out in a time dt.
The wedge shown in Figure 9.12 forms an infinitesimal triangular area element dA, which
in polar coordinates can be written as:
r2
dA = dθ (9.6.13)
2
By dividing with dt and using (9.6.12), we obtain Kepler’s second law:
Kepler’s laws of planetary motion 351
dA r2 dθ ℓ
= = = constant (9.6.14)
dt 2 dt 2µ
Note that Kepler’s second law holds for any central force. Equation (9.6.14) is the
mathematical form of Kepler’s second law which says that a line joining a planet to the
Sun sweeps out equal areas in equal time intervals. This is illustrated in Figure 9.13. The
result of Kepler’s second law is that the planet’s speed increases as it reaches perihelion and
decreases as it approaches aphelion.
Figure 9.13: Kepler’s second law: A line connecting a planet to the Sun (S) sweeps out equal
areas in equal times. If the time TAB required to travel distance AB is equal to the time
TCD required to travel distance CD, then the swept out area AREAABS must be equal to
the corresponding area AREACDS .
Example 9.6 shows how to evaluate the angular momentum of the Earth as it orbits
around the Sun, and also how to estimate the Earth’s orbital velocity.
Example 9.6: The orbital angular momentum of the Earth around the
Sun
The speed of the Earth at perihelion is 30,300 m/s, and its distance from the Sun
ranges from 147.3 million km (at perihelion), to about 152.6 million km (at aphelion).
Evaluate:
(a) The orbital angular momentum of the Earth around the Sun.
(b) The orbital velocity of the Earth at aphelion.
(c) The speed of the Earth at the latus rectum point α of its elliptical orbit.
Solution:
(a) When the Earth is at the aphelion (or at the perihelion) of its orbit, the velocity
vector v = dr/dt is perpendicular to the position vector r, so that the radial component
of the velocity is zero (dr/dt = 0); therefore, the magnitude of the angular momentum
is found from:
dr dr
| ℓ |= m r × =m|r|| | sin 90◦ = mrv
dt dt
where v represents the magnitude of the orbital velocity at these two points and m =
5.97 × 1024 kg is the mass of the Earth. By using the given value of the speed at
352 Central Forces and Planetary Motion
perihelion and the given distance from the Sun, we can find the magnitude of the
angular momentum in SI units:
ℓ = | ℓ |= mrperi vperi = 5.97 × 1024 kg 3.03 × 104 m/s 147.3 × 109 m
= 2.66 × 1040 kgm2 /s
vaphe = ℓ/ (m raphe )
which gives the value of vlatus = 29, 800 m/s. Note that the velocity vector at the latus
rectum is not perpendicular to the position vector.
Z Z
2µ
dt = dA (9.6.15)
ℓ
2µ
P = πab (9.6.16)
ℓ
where we used the area of an ellipse A = πab. P is the period, the time needed for a line
joining the reduced mass and the force center to sweep out the entire area of the ellipse.
Next, we use (9.6.5) and (9.6.6) to express the period P and as a function of energy E.
r
µ −3/2
P = πk |E| (9.6.17)
2
By substituting now |E| = k/(2a) from (9.6.5), we obtain Kepler’s third law:
Kepler’s laws of planetary motion 353
4π 2 µ 3
P2 = a (9.6.18)
k
Kepler’s original statement was that the planet’s period squared was proportional to the
cube of its semi-major axis. Kepler did not know the proportionality constant. However,
using Newton’s second law, we have found it! If we consider the central force to be Newton’s
Law of Universal Gravitation, the constant k = Gm1 m2 and the definition of the reduced
mass µ = m1 m2 / (m1 + m2 ), then Kepler’s third law becomes
4π 2 a3
P2 = (9.6.19)
G (m1 + m2 )
However, for a planet of mass m1 orbiting the Sun of mass m2 = M ≫ m1 , we have
4π 2 a3
P2 = (9.6.20)
GM
Example 9.7 illustrates Kepler’s Third Law with the moons of Jupiter.
Solution:
The data can be analyzed by plotting Kepler’s law
4π 2 a3
P2 = (9.6.21)
G (m1 + m2 )
By plotting P 2 as a function of a3 using the given table, we should obtain a a linear
graph P 2 = m a3 + b, with a slope
4π 2
slope =
G (m1 + m2 )
For Jupiter m1 = mJupiter >> m2 , so this becomes
4π 2
slope =
G MJupiter
354 Central Forces and Planetary Motion
By fitting a straight line to the plot of the data, we can obtain an estimate of the mass
of Jupiter:
MJupiter = 4π 2 / (G slope) . Note that in this problem it is important to use SI units
throughout the solution, by converting the units of kilometers into meters, and the
periods P into SI units by converting days into seconds.
Python Code
We use list comprehensions to obtain the variables x = a3 , y = P 3 . We use SI
units by converting the units of kilometers into meters, and the days into seconds. The
aValues list is converted in SI units by converting the units of kilometers into meters,
and the periods P are converted into SI units by converting days into seconds. We use
the command polyfit from the NumPy library, to find the best straight line fit to
this plot. The command solve from SymPy is used to obtain the value of the mass of
Jupiter.
import numpy as np
import [Link] as plt
from sympy import solve, symbols
print('-'*28,'CODE OUTPUT','-'*29,'\n')
M = symbols('M')
G = 6.67408*10**-11
Mathematica Code
We set up two lists called aValues and periods, which contain the semi-major axes
a and the periods P of the four moons. The aValues list is converted in SI units by
converting the units of kilometers into meters, and the periods P are converted into
SI units by converting days into seconds. The command Transpose is used to create a
new list called list, containing the pairs (a3 , P 2 ) for the four moons. This is plotted
using the ListPlot command, and the graph is stored in the variable gr1. By using the
FindFit command, we fit a best line to the graph, and we obtain the best slope of this
line to have a slope of 3.11 × 10−16 (SI-units).
By setting the best slope 3.11×10−16 = 4π 2 /(GM ) and using the NSolve command,
we obtain the mass of Jupiter as M = 1.89 × 1027 kg. This value is very close to the
accepted value of the mass of Jupiter MJ = 1.90 × 1027 kg.
Show[gr1, gr2]
356 Central Forces and Planetary Motion
2.0 × 1012
1.5 × 1012
P^2 (s^2)
1.0 × 1012
5.0 × 1011
0
0 2 × 1027 4 × 1027 6 × 1027 8 × 1027
a^3 (m^3)
Figure 9.14: Kepler’s third law applied to four of the many Moons of Jupiter, from Example
9.7.
• The period of the orbits of m1 and m2 about their shared center of mass is 2π.
These scalings will simplify the resulting equations of motion. Using Kepler’s third law and
the scalings above, we find that G = 1. In addition, we can choose m2 = m and then
m1 = 1 − m, where 0 ≤ m ≤ 1/2. The end result is that the equations of motion will
depend on only one parameter, m.
Before deriving the equations of motion, we need to establish a coordinate system as
shown in Figure 9.15.
Planar circular restricted three-body problem 357
y
m3
R m2
r2
t
m 1-m x
r1
m1
Figure 9.15: The coordinate system for the planar restricted circular three-body problem.
The center of mass for m1 and m2 is at the origin. Mass m1 follows a circular orbit with
radius m about the center of mass, and m2 follows a circular orbit of radius 1 − m. The
third body m3 is located at the position R. Not shown in this figure is a vector r which
points from m1 to m2 and passes through the origin.
In order to understand Figure 9.15, we begin with the assumption that m1 and m2
follow circular orbits. Using (9.2.10) and (9.2.11), we can compute the radius of each orbit:
m2
r1 = r=m (9.7.1)
m1 + m2
−m1
r2 = r =1−m (9.7.2)
m1 + m2
Noting that ω = 1 (because the period of m1 and m2 is 2π), we can write,
Although not shown in Figure 9.15, the separation vector r = r2 − r1 points from m1 to
m2 and passes through the origin. Noting that r = 1, we can write,
R = X î + Y ĵ (9.7.5)
358 Central Forces and Planetary Motion
We will use the Lagrangian to derive the equations of motion for the particle m3 . The
kinetic energy of the mass m3 is,
1
T3 = m3 Ẋ 2 + Ẏ 2 (9.7.6)
2
We find the potential energy using the general formula, V = −Gmm2 /r where m and m2
are the masses of the interacting particles and r is the distance between m and m2 . There
are two gravitational interactions that involve m3 , V13 is the potential energy between m1
and m3 , and V23 is the potential energy between m2 and m3 . They can be written as:
G(1 − m)m3
V13 = − (9.7.7)
r13
Gmm3
V23 = − (9.7.8)
r23
where
2 2 2
r13 = (X + m cos t) + (Y + m sin t) (9.7.9)
2 2
2
r23 = (X − (1 − m) cos t) + (Y − (1 − m) sin t) (9.7.10)
1 (1 − m)m3 mm3
L= m3 Ẋ 2 + Ẏ 2 + + (9.7.11)
2 r13 r23
Note that (9.7.11) is time-dependent. We can eliminate the time-dependence by trans-
forming our coordinate system into a frame that is rotating with the masses m1 and m2 .
In this rotating frame, m1 and m2 are at rest, with m1 located at the point (m, 0) and m2
located at the point (1 − m, 0). Let us use the notation (x, y) to describe the position of m3
in the rotating frame. The transformation that connects the coordinates (X, Y ) and (x, y)
is the rotation matrix
X cos t − sin t x
= (9.7.12)
Y sin t cos t y
where the angle of rotation is θ = ωt = t, since ω = 1 due to our assumption about the
period of revolution for masses m1 and m2 . We can write out the matrix multiplication in
(9.7.12) to find,
The equations of motion (9.7.22) and (9.7.23) are two coupled second-order ordinary
differential equations that must be solved numerically.
Example 9.8 shows the numerical solution of this system of ODEs using Python. The
corresponding code using Mathematica for this example is left for Problem 9.38.
ẋ =u (9.7.24)
(1 − m) (x + m) m [x − (1 − m)]
u̇ =2v + x − 3/2 − 3/2 (9.7.25)
2 2
(x + m) + y 2 (x − (1 − m)) + y 2
ẏ =v (9.7.26)
(1 − m) y my
v̇ = − 2u + y − 3/2 − 3/2 (9.7.27)
2 2
(x + m) + y 2 [x − (1 − m)] + y 2
360 Central Forces and Planetary Motion
The four first-order equations of motion are then solved using odeint for the con-
dition m = 0.01. The local variables peXterm and peYterm are the right-hand side of
(9.7.22) and (9.7.23), respectively. These additional variables were included to improve
the clarity of the algorithm. In addition, we included the basic information needed to
create a four-panel plot. The results of the code are shown in Figure 9.16.
In Figure 9.16 we see the trajectory of m3 in the rotating coordinate frame (x, y)
for four different initial conditions. In each plot, the red (in the e-book) dot near the
origin is m1 and the other dot (which is green in the e-book) is m2 . The blue (in the
e-book) curve is the trajectory of m3 . Notice in the upper-left plot of Figure 9.16, m3
is in a precessing orbit about m1 , which is obscured by the trajectory. The upper-right
plot has m3 spiraling out towards an orbit that encompasses both m1 and m2 . The
lower-right plot shows a case where m3 orbits about m2 .
Arguably the most interesting plot in Figure 9.16 is the lower-left plot which shows
an example where m3 orbits around a so-called Lagrange point of the m1 -m2 system.
A Lagrange point is a point in space where the centrifugal force is balanced by the
gravitational attraction. Because we transformed the coordinates of the original problem
into a rotating system, we introduced a noninertial frame. We will discuss noninertial
frames in the next chapter. However, for now all you need to know is that in non-inertial
frames, an apparent force called the centrifugal force appears which is directed outward.
Near two orbiting masses, such as m1 and m2 , there are five points called Lagrange
points where the centrifugal (outward) force is equal to the gravitational attraction
(inward). The Lagrange points are equilibrium points, and the one represented in the
lower-left panel of Figure 9.16 is called L4, which is a stable equilibrium.
For example, the Trojan asteroids orbit Jupiter’s L4 point. In addition, Lagrange
points in the Earth-Sun and Earth-Moon systems have been used by many probes and
satellites. For example, the James Webb Space Telescope orbits L2, which lies along a
line joining the Earth and the Sun, and would be to the right of the green dot (in the
e-book) in Figure 9.16.
Planar circular restricted three-body problem 361
Python Code
import numpy as np
from [Link] import odeint
import [Link] as plt
mu = 0.01
def threeBody(vec,t):
x, y, u, v = vec
peXterm = -(1.0-mu)*(x+mu)/((x+mu)**2+y**2)**(1.5)-mu*\
(x-1.0+mu)/((x-1.0+mu)**2+y**2)**(1.5)
peYterm = -y*(1.0-mu)/((x+mu)**2+y**2)**(1.5)-mu*y/((x-1.0+\
mu)**2+y**2)**(1.5)
derivative = [u, v, 2*v + x + peXterm, -2*u + y + peYterm ]
return derivative
initialCondition1 = [-0.75, 0, 0, 1]
t=[Link](0,20,2001)
sol1 = odeint(threeBody, initialCondition1, t)
Figure 9.16: Results of the Python code for the planar restricted three-body problem, from
Example 9.8. The red (in the e-book) dot near the origin is m1 , and the green (in the
e-book) dot is m2 . The curve represents the path followed by m3 . The complete code for
this plot can be found in this book’s website.
A central force is directed along a line that joins the particle and the force center.
Central forces can be expressed in spherical coordinates as:
F = f (r)r̂
where the vector r is the location of the particle relative to the force center. Central
forces conserve energy and angular momentum.
In a two-body system, where two masses m1 and m2 interact via a central force, we
can reduce the problem to that of the motion of a single particle of mass µ called the
reduced mass:
m1 m2
µ=
m1 + m2
The reduced mass is located at r = r1 − r2 relative to the system’s center of mass.
The center of mass serves as the force center.
One approach of finding the equations of motion for the reduced mass in the two-
body problem, is by solving the differential equation,
d2 1 1 µ r2
+ = − f (r)
dθ2 r r ℓ2
From the equation of motion, which is derived from Newton’s second law in polar
coordinates, we can derive general forms of Kepler’s Three Laws of Planetary Motion.
The first law is that the orbit of the reduced mass is of the form of a conic section
with the force center at one focus,
End-of-chapter problems 363
s
1 1 ℓ2 2Eℓ2
= (1 + e cos θ) α= e= 1+
r α µk µk 2
For planets orbiting the Sun, their motion is an ellipse with the Sun at one focus.
The shape of the ellipse can be described by
rmin = a (1 − e) rmax = a (1 + e)
where e is the eccentricity of the ellipse, r is the distance from the Sun to the planet,
a and b are the semi-major and semi-minor axes of the ellipse. The perihelion is the
point where the distance is minimum rmin , and the aphelion is the point where the
distance is maximum rmax . In general, the motion of the reduced mass can be any
conic section, and is determined by the energy E and angular momentum ℓ which
determine the eccentricity e of the orbit. If 0 < e < 1 the motion is an ellipse, if e = 0
the orbit is a circle, if e > 1 the motion is a hyperbola, and for e = 1 it is a parabola.
The conservation of angular momentum leads to Kepler’s second law: a line joining
the reduced mass to the force center sweeps out equal areas in equal time periods.
Kepler’s third law relates the period of the planet’s orbit P to the semi-major axis
of its orbit a.
4π 2 a3
P2 =
G (m1 + m2 )
The three-body problem involves interactions between three objects. We examined
the circular restricted three-body problem which is a relatively simple formulation of
the three-body problem. However, even the circular restricted three-body problem must
be analyzed numerically. The motion of the third mass m3 ≪ m1 , m2 can be rather
complicated.
b. Prove that if E is the total energy supplied to the particle, then its speed is given
by
364 Central Forces and Planetary Motion
p
v= K/(mr2 ) + 2E/m
5. A particle of mass m moves in a central force field F = −K/rn where K and n are
constants and K > 0. The particle starts from rest at r = a and arrives at r = 0 with
finite speed V0 .
a. Prove that for this physical situation, the condition n < 1 must be true.
b. Prove that s
2Ka1−n
V0 =
m (n − 1)
6. Let L, M, and T represent the dimensions of length, mass and time, respectively.
Find the dimensions of the universal gravitational constant G.
b. Show that if ω1 = ω2 , then the force acing on the mass is a central force.
c. Evaluate the total energy when ω1 = ω2 , and show that it is conserved.
momentum at t = 0.
Sections 9.2 - 9.3: The Two-Body Problem and Equations of Motion for the
Two-Body Problem
9. Two point masses m1 ,m2 are separated by a distance r. Starting from rest, they
both begin to accelerate towards each other. Show that the elapsed time t until they
collide is: s
r3
t=π
8G(m1 + m2 )
You may want to evaluate the integrals with a CAS.
10. Show that the total angular momentum L =L1 + L2 of the two-body system is equal
to
L =µ (r × v)
where µ is the reduced mass, r = r2 − r1 is the relative position vector of the two
masses, and the velocity vector v = ṙ. Here µ = reduced mass = mm11+m
m2
2
.
End-of-chapter problems 365
11. Show that the kinetic energy of the two-body system with a reduced mass µ and
relative position vector of the two masses r = r2 − r1 is equal to:
1 2
T = µ | ṙ |
2
m1 m2
where µ = reduced mass = m1 +m2 . Solve this problem both analytically and using a
CAS.
12. In Example 9.1 we evaluated numerically and plotted the orbits in a two-body
gravitational system. Use the command ListAnimate in Mathematica, to produce an
animation of the two bodies moving around each other.
14. What central force is required to produce an orbit r2 = a2 cos (2θ), where a is a
positive constant? It may be useful to use a CAS to evaluate and simplify the necessary
derivatives.
15. Show that both r = e−θ and r = 1/θ are possible orbits for a central force proportional
to 1/r3 . How is this possible?
16. A particle with mass m moves around the origin O with a speed v = a/r, inversely
proportional to the distance from O.
a. Show that the motion of the particle requires an inverse cube central force.
17. The orbit of a mass m inside a central force field is such that r = a/θ, where a is a
positive constant. Show that the potential must be proportional to 1/r2 .
18. Obtain the orbit for a mass m moving in a central force field defined by F = −K/r3 ,
and describe it physically.
19. A particle of mass m moves in a central force field given in magnitude by F = −Kr
where K is a positive constant and r is the position vector. If the particle starts at
r = a, θ = 0 with a speed v0 in a direction perpendicular to the x-axis, determine and
describe its orbit.
20. A particle of mass m moves in a central force field given in magnitude by F = −k/r3
where k is a positive constant, and r is the distance from the force center. The particle
starts at r = a, θ = 0 with a speed v0 in a direction making an angle α with the positive
x-axis.
a. Show that the differential equation for the orbit is given in terms of u = 1/r by
d2 u
+ (1 − γ)u = 0
dθ2
where
k
γ=
ma2 v 20 sin2 α
b. Solve the differential equation in (a) and interpret it physically.
366 Central Forces and Planetary Motion
21. The orbit of a mass m and angular momentum L in a central field is given by
1
r (θ) =
A cos (ωo θ)
where ωo is a positive constant, and the constants A, ϕ depend on the initial condi-
tions. This type of orbit is obtained in Problems 9.16, 9.18 and 9.20 under certain
assumptions.
a. Assuming that θ(0) = 0, obtain analytical expressions for the radius r(t) as a
function of time.
b. Plot r(t) as a function of time t, and a polar plot r(θ) by using the numerical
values A = 1, L = 1, m = 1, ω = 0.3 (all in SI units). What is the physical
meaning of these plots?
Solve this problem both analytically and also using a CAS.
24. A planet revolves around a massive Sun in an elliptical orbit, with one focus F at
the origin, the center of the ellipse located at (−4, 0) and semi-major axis a = 10.
a. Find the equation of the orbit in Cartesian and polar coordinates.
b. Find the central force for this orbit, in terms of the angular momentum L and
the mass m of the planet.
Solve this problem both analytically and also using a CAS.
25. The orbit of a mass m and angular momentum L in a central field is given by
1
r (θ) =
A cosh (ω0 θ)
where ω0 is a positive constant, and the constants A, ϕ depend on the initial condi-
tions. This type of orbit is obtained in Problems 9.16, 9.18 and 9.20 under certain
assumptions.
End-of-chapter problems 367
a. Assuming that θ(0) = 0, obtain analytical expressions for the radius r(t) as a
function of time.
b. Plot r(t) as a function of time t, and a polar plot r(θ) by using the numerical
values A = 1, L = 1, m = 1, ω = 0.3 (all in SI units). What is the physical
meaning of these plots?
Solve this problem both analytically and also using a CAS.
26. The distance of closest approach of Halley’s Comet to the Sun is 0.57 astronomical
units AU (1 AU is the mean Earth-Sun distance). The greatest distance of the comet
from the Sun is 35 AU. Create a polar plot of the orbit of Halley’s comet around the
Sun in the vicinity of our solar system, which extends about 40 AU in diameter. Plot
together the orbits of Mercury, the earth and Halley’s Comet.
Section 9.5: Orbits in Central Force Fields
27. Evaluate and discuss the motion of a particle in the central force field F = α/r2 +β/r3
for β > 0 and α, β are constants.
28. Integrate numerically Newton’s second law when the interaction force between two
masses m1 and m2 is of the form
Gm1 m2 Gm1 m2
F(r) = − r̂ or F(r) = − r̂
r1.9 r2.1
Evaluate numerically and discuss the orbits of a particle in these central force poten-
tials. Use the numerical values m1 = 1, m2 = 2, G = 1 and initial conditions x(0) = 1,
x′ (0) = 0, y(0) = 0, y ′ (0) = 0.5 (all quantities in SI units). Show that the resulting
orbits of the reduced mass are precessing ellipses, and discuss the differences between
the two cases. Use a CAS to carry out numerical integration of Newton’s law.
29. Planet A has a velocity vA at aphelion and a velocity of vP at perihelion during its
motion around a star. A second planet B moves around the same star as planet A, in
a circular orbit with a radius R and with a speed v. Show that the aphelion distance
for planet A is
2Rv 2
RA =
vA (vA + vP )
30. A comet of energy E and angular momentum L enters a region with an attractive
central potential V (r). Show that the distance of closest approach of the comet to
the star is
L
rmin = p
2m (E − V (rmin ))
31. A comet of mass m approaches our sun with a velocity v0 from a very large distance
as shown in Figure 9.17. If there was no deflection of the comet due to the Sun, it
would have passed a distance b from the Sun as shown. Show that the distance of
closest approach for the comet is given by:
s 2
k k
rmin = + + b2
mv02 mv02
Figure 9.17: The comet of mass m approaching the Sun, from Problem 9.31.
32. A spacecraft travels from planet A to planet B in an elliptical orbit, so that the
perihelion is at planet A and the aphelion is at planet B. Planets A and B move in
circular orbits around a star of mass M , with radii RA and RB as shown in Figure
9.18. Assume that the masses of the planets have no effect on the spacecraft. Show
that the spacecraft must be given a speed
s r
2GM RA GM
v= −
RB (RA + RB ) RA
with respect to planet A, in order to move in the dashed elliptical orbit shown below.
Figure 9.18: A spacecraft transiting from planet A to planet B along the dotted elliptical
path, from Problem 9.32.
b. Calculate the mass of the Sun using the fact that the Earth is 150 million km from
it, and the Earth makes one complete revolution about the Sun in approximately
1 year.
34. Suppose that a small spherical planet has a radius of 10 km and a mean density of 5
g/cm3 .
a. What would be the acceleration due to gravity at its surface?
b. Evaluate the orbiting period of the space shuttle around the Earth, by assuming
that its orbit is very close to the Earth’s surface.
36. Create three lists of the perihelion, aphelion and orbital periods of the planets,
and use Kepler’s third law to estimate the mass of the Sun, by fitting a least squares
linear function. Follow a procedure similar to Example 9.7.
37. Using the code provided in Section 9.7, try different initial conditions for the mass
m3 and discuss the result.
38. Write the Mathematica code for Example 9.8, and discuss the plots for various
initial conditions of the circular restricted three-body problem.
39. In this problem, we evaluate and plot the Lagrange points for the circular restricted
three-body problem with m = 0.01. We continue with the situation where m1 ≫ m2
such as the Earth-Sun-satellite system. Note that the value of m in the Earth-Sun
satellite is close to 10−6 but we will continue with m = 0.01 for visualization purposes.
The Lagrange points are points where ẍ = ÿ = 0 and ẋ = ẏ = 0 in the rotating frame
discussed in Section 9.7. Using a computer, solve numerically (9.7.22) and (9.7.23)
when ẍ = ÿ = ẋ = ẏ = 0. Plot the resulting points on the same graph as a circle with
radius 1 − m, which represents the orbit of m2 . You should find that there are a total
of five Lagrange points and that two of the Lagrange points lie along the orbit of m2
and three of them lie along the same line (one of those is also located on the orbit).
10 Motion in Noninertial
Reference Frames
As we saw in Chapter 1, Newton’s second law is valid only for inertial reference frames.
However, it is sometimes the case where we need to describe the motion in a noninertial
reference frame. For example, long-range missile trajectories need to be described using
a noninertial reference frame, a frame fixed to the surface of the rotating (and therefore
noninertial) Earth. In Chapter 1 we found that using Newton’s second law in a noninertial
reference frame, resulted in the appearance of inertial forces. In this chapter, we will expand
on the idea of inertial forces; specifically, those arising in rotating reference frames. We will
discuss how a vector in a rotating reference frame can be described in a nonrotating frame,
and from that description, we will show how applying Newton’s second law in a rotating
frame results in inertial forces such as the Coriolis force and the centrifugal force. We will
then study how the Coriolis and centrifugal forces affect the motion of a particle near the
surface of the Earth. Finally, we will explore the famous problems of the Foucault pendulum
and projectile motion in a noninertial frame.
y m
r
y' r'
S x
R
S' x'
Figure 10.1: A particle of mass m located at a position r′ relative to the origin of an inertial
frame S ′ and at a location r relative to the origin of a noninertial frame S. The vector R
measures the position of the noninertial frame’s origin relative to the origin of the inertial
frame.
371
372 Motion in Noninertial Reference Frames
The position of the particle measured in S ′ can be written as r′ = R + r and the velocity
of the particle, as measured in the frame S ′ is therefore,
ṙ′ = ṙ + V (10.1.1)
where F = mr̈ are the forces acting on the particle as measured in the noninertial frame,
and F′ = mr̈′ are the forces acting on the system as measured in the inertial frame. The
forces acting on the particle such as gravity, air resistance, friction, etc. These forces are
measured in both frames. However, there is an additional force measured in the noninertial
frame, −mA. This additional force is sometimes called an inertial force, a fictitious force,
or a pseudo-force. In order to use Newton’s second law to describe motion in a noninertial
frame, we need to include the additional inertial force, which is not due to the particle’s
interaction with another body, but rather arises from the acceleration of the noninertial
frame.
Although the inertial force is sometimes called the fictitious force, inertial forces are real
to those moving in a noninertial reference frame. You have experienced noninertial forces
in an accelerating car as you are being pushed back on the seat, or on a rotating carnival
ride, where you are pushed against the side of a carriage as the ride spins. In each case,
the force is due to your inertia as opposed to the interaction with another body, hence the
name inertial force, since it is introduced in order to account for all of the accelerations you
are experiencing. By including inertial forces, we are able to use Newton’s second law to
describe motion in noninertial reference frames.
θ ℓ
Figure 10.2: An upward accelerating pendulum with mass m and length ℓ from Example
10.1.
Solution:
According to (10.1.3), the force in the frame S which is accelerating with the pen-
dulum is,
F = (T + mg) − ma (10.1.5)
where T is the tension in the pendulum, g is the acceleration due to gravity, and a is a
vector that has a magnitude of a and points in the direction opposite of g. The term in
the parentheses of (10.1.5) is F′ , the sum of the forces acting on the system according
to Newton’s second law in the inertial frame. We can rewrite (10.1.5) as
F = T + mgeff (10.1.6)
where geff = g − a is the effective gravitational field which includes the gravitational
attraction and the acceleration of the pendulum’s support. It then follows that in the
frame S, the equation of motion of the pendulum for small oscillations is,
geff
θ̈ + θ=0 (10.1.7)
ℓ
where θ is the angle that the pendulum makes with the vertical (as usual). From Chapter
6 we know that the coefficient in front of θ in (10.1.7) is the square of ω0 , the frequency
of small oscillations. Therefore, we find
r
|g − a|
ω0 = (10.1.8)
ℓ
We see that the upward acceleration effectively reduces the gravitational field. The
result is that the accelerated frame is the same as having an additional gravitational
field (in this case, whose acceleration is in the opposite direction of g). The fact that ac-
celerating frames are indistinguishable from gravitational fields is an important element
in the general theory of relativity.
consider a wheel rolling along a road. Euler’s theorem says that an infinitesimal displacement
of the wheel can be described as a rotation about the contact point between the wheel and
the road.
Euler’s theorem tells us that in order to specify the rotation about a point, we need
only the direction of the axis and the amount rotated about the axis. Of course, if we are
interested in the rate of rotation, the angular velocity, then we would need the direction
of the axis of rotation and the rate of the rotation. This means we can write the angular
velocity as a vector ω that lies along the axis of rotation and whose magnitude is the rate
of rotation. A stationary spinning top may have an angular velocity of 2π rad/sec with an
axis that is vertically oriented. However, does ω point up or down? The answer to that is
determined by the right-hand rule,
Curl the fingers of your right hand in the direction of the rotation. Your thumb points
in the direction of ω.
The right-hand rule is illustrated in Figure 10.3. The circle with arrows in Figure 10.3
represents a wheel rotating in a counterclockwise direction. As you curl the fingers of your
right hand in the direction of the arrows on the wheel, your thumb should point up, away
from the page. Your thumb is pointing in the direction of the wheel’s angular velocity.
Figure 10.3: The right-hand rule. The large circle represents a wheel and the arrows on
the circle represent a counter clockwise rotation of the wheel. Curl the fingers of your right
hand in the direction of the arrows on the circle. Your thumb should point in the direction
of the vector ω.
If an object’s angular velocity is changing with time, then both the rate of rotation
and/or the orientation of the rotation axis is changing in time. Situations that involve
changes in the orientation of the rotation axis can be difficult to describe mathematically.
In this chapter, we will focus primarily on systems with fixed angular velocities, i.e., both
the rate of rotation and the direction of the rotation axis will remain constant.
In addition to a formal definition of angular velocity, we will also need a relationship
between the velocity of a particle and its angular velocity. Recall that the tangential velocity
v of a particle moving along a circle of radius r with angular velocity ω is v = ωr. In
this particular case, the axis of rotation went through the center of the circle and was
Angular velocity as a vector 375
perpendicular to the plane of the circle. This simple relationship between v and ω results
from the fact that all of the motion is restricted to a plane. That is not generally true.
Consider a particle, represented by the black dot in Figure 10.4 fixed to a location on the
Earth’s surface in the Northern Hemisphere. The angular velocity of the Earth is essentially
constant and points from the South Pole to the North Pole. While every point on the Earth
has the same angular velocity, the particle’s latitude will affect the particle’s tangential
velocity, v.
ρ v
θ r
Figure 10.4: The Northern Hemisphere of the Earth showing the location of a point particle
(black dot) and its velocity, v, which is tangent to the dashed circle.
In Figure 10.4, the particle travels in a circle of radius ρ = |ρ| as the Earth rotates.
The latitude of the particle is π/2 − θ. As θ increases, the particle needs to travel a greater
distance in the same amount of time, while the angular velocity is the same at all latitudes.
Therefore, v = |v| must increase with an increasing θ. We recall that the tangential velocity
of the particle is v = ρ ω where ρ = r sin θ. Therefore, v = rω sin θ and we can write the
tangential velocity as,
v=ω×r (10.2.1)
Notice that (10.2.1) is the general form for the familiar equation v = rω, where θ = π/2.
We need to use (10.2.1) in this case because the origin of the inertial frame is the center
of the Earth, and the center of the Earth is not the center of the circle along which the
particle travels. Furthermore, the center of the Earth will serve as the origin of the inertial
frame that we will use in future problems.
Equation (10.2.1) is not unique to the velocity vector. Note that we can rewrite (10.2.1)
as,
dr
=ω×r (10.2.2)
dt
which is not a formula unique to the vector r. In fact, for any vector Q that is constant in
the rotating reference frame, its time derivative as measured in the nonrotating frame is,
dQ
=ω×Q (10.2.3)
dt
In the next section, we will provide a derivation of a more general form of (10.2.3), which
will include vectors that are not constant in the rotating reference frame.
376 Motion in Noninertial Reference Frames
ê3
ω P
ê'3
r ê2
r'
R ê1
ê'2
ê'1
Figure 10.5: The inertial frame S ′ (primed unit vectors) and the noninertial rotating frame
S (unprimed unit vectors, red in the e-book). The vector R represents the location of the
origin of the noninertial frame as measured in the inertial system. The vector ω represents
the angular velocity of the noninertial frame.
inertial (fixed) frame and the noninertial (rotating) frame using the following notation,
dQ
= the time derivative of Q relative to the inertial (fixed) frame S’
dt f
dQ
= the time derivative of Q relative to the noninertial (rotating)
dt r
frame S.
We begin by writing Q in terms of the unit vectors that are fixed in the noninertial
frame,
X3
Q= Qi êi (10.3.1)
i=1
The coefficients Qi are the same in each frame. Observers in the inertial frame, would
see êi vary with time, but that would be the only difference between what is observed in
the two frames. If we calculate the time derivative of Q relative to the noninertial frame we
find,
X 3
dQ
= Q̇i êi (10.3.2)
dt r i=1
Because the scalar coefficients Qi are the same in each frame, we do not need to distin-
guish whether Q̇i is relative to the inertial or noninertial frame. Note that the derivative
does not affect the unit vectors because they are constant relative to the noninertial frame.
Next, we compute the time derivative of Q relative to the fixed frame,
X
3 X
3
dQ dêi
= Q̇i êi + Qi (10.3.3)
dt f i=1 i=1
dt f
The first term on the right-hand side of (10.3.3) is what we found when computing the
time derivative relative to the noninertial frame. Notice that the second term in the right-
hand side of (10.3.3) is the time derivative of the vector êi , which is constant in the rotating
frame. We can use the general equation (10.2.3) to write,
dêi
= ω × êi (10.3.4)
dt f
or using (10.3.2):
Notice that (10.3.6) is what we would expect from our studies of translationally moving
reference frames. To better understand this, let Q = r, the position of a particle as measured
in the noninertial (rotating) frame. The first term in the right-hand side of (10.3.6) is the
velocity measured in the rotating frame. The second term is the translational velocity of
the particle at r due to the rotation of the noninertial frame. Hence, the velocity measured
by an observer in the fixed frame is the velocity of the particle in the moving frame plus the
velocity of the frame itself. Note that one result of (10.3.6) is that the angular acceleration
ω̇ is the same in each frame because ω × ω = 0.
Equation (10.3.6) tells us that a vector’s rate of change can be related between inertial
and noninertial frames. Newton’s second law provides a particle’s equations of motion by
stating that the net force acting on a particle is proportional to the particle’s change in
velocity as measured in an inertial frame. Thus, (10.3.6) allows us to relate the acceleration
of a particle in an inertial frame, found from Newton’s second law, to situations where the
observer is in a noninertial frame. In the next section, we will use (10.3.6) to find Newton’s
second law in a rotating frame.
where v′ is the velocity of the particle relative to the inertial frame S ′ , and F′ is the net
force acting on the particle. The net force F′ includes the interaction forces between the
mass m and other bodies such as gravity, air resistance, friction, etc. In order to find the
form of Newton’s second law for a noninertial frame, we will need to rewrite the acceleration
as measured in the inertial frame (dv′ /dt)f in terms of the acceleration as measured in the
noninertial frame.
We begin by finding v′ . Figure 10.5 shows that,
r′ = R + r (10.4.2)
The velocity v′ is found by taking the time derivative of r′ relative to the inertial frame.
′
dr dR dr
v′ = = + (10.4.3)
dt f dt f dt f
We use (10.3.6) on the second term in the right-hand side of (10.4.3) in order to find
how an observer in the inertial frame S ′ measures the velocity of the particle moving in the
noninertial frame S,
dr dr
= +ω×r (10.4.4)
dt f dt r
Newton’s second law in a rotating frame 379
where ω is the angular velocity of S. By using (10.4.4) and defining the following:
′
dr
v′ ≡ (10.4.5)
dt f
dR
V≡ (10.4.6)
dt f
dr
v≡ (10.4.7)
dt r
we can write:
v′ = V + v + (ω × r) (10.4.8)
where:
Now, we will go through the right-hand side of (10.4.9) term by term. The first term in
the right-hand side of (10.4.9) is the linear acceleration of the noninertial frame,
dV
A= (10.4.10)
dt f
The second term in the right-hand side of (10.4.9) is rewritten using (10.3.6):
dv dv
= + (ω × v) (10.4.11)
dt f dt r
= a + (ω × v) (10.4.12)
where a = (dv/dt)r is the acceleration of the particle as measured in the noninertial frame.
The third term in the right-hand side of (10.4.9) does not need simplification because ω̇ is
the same in each reference frame. Finally, the fourth term in the right-hand side of (10.4.9)
is rewritten using (10.3.6),
dr dr
ω× =ω × + ω × (ω × r) (10.4.13)
dt f dt r
= (ω × v) + [ω × (ω × r)] (10.4.14)
If we define
as the force experienced by the particle in the noninertial frame, then for noninertial frames,
Newton’s second law takes the form
F =ma (10.4.17)
Recall that a is the acceleration of the particle as measured in the noninertial frame. Al-
though the above equation looks like how we have written Newton’s second law from Chapter
1 and onwards, it is important to remember all of the terms that are packed into F as de-
fined in (10.4.16). The force F is sometimes called the effective force acting on the particle
because it includes both interaction forces and inertial forces.
Notice that there are four inertial forces introduced in (10.4.16). The inertial force −mA
is the same one we found in Section 10.1, and it is due to the linear acceleration of S. The
second term in (10.4.16), −2m (ω × v), is the so-called Coriolis force which we will discuss
in detail later. The term, −m (ω̇ × r), is the inertial force associated with the angular
acceleration of S ′ . For most of the problems in this chapter, the frame S will be attached
to the surface of the Earth, and to a good approximation, ω̇ = 0. This force will not be
present in our discussion. The final term, −m [ω × (ω × r)], is the centrifugal force which
we will also discuss later in detail.
We have learned that Newton’s second law can be used, with modification, for problems
involving noninertial frames. The trick is that we have to include additional inertial forces
and not just the forces of interactions between bodies in the system. Just like in Section
10.1, these inertial forces are real to the observer in the noninertial frames.
Next, we will discuss further the Coriolis and centrifugal forces. These two inertial forces
play an important role when describing the motion of an object near the Earth’s surface.
For the remainder of this chapter, the inertial frame S ′ has its origin at the center of the
Earth and ê′3 points along the Earth’s rotation axis from the Earth’s center to its North
Pole. Hence ω = ω ê′3 where ω = 2π rad/day. Furthermore, the noninertial frame S has its
origin fixed at one point on the Earth’s surface, the ê1 ê2 -plane is tangent to the Earth’s
surface at the origin of S, and ê3 is pointing locally up (away from the center of the Earth).
in (10.4.16) is called the centrifugal force and is present due to the rotation of the noninertial
frame. We can understand the direction of the centrifugal force as follows.
In Figure 10.6, a particle of mass m (not shown) is located at r in a reference frame
that is rotating relative to an inertial frame. In the inertial frame, an observer would see
the particle moving in a circle of radius ρ = r sin θ. In order to find the direction of the
centrifugal force −m [ω × (ω × r)], we first need to find the direction of the vector ω × r.
The vector ω × r is perpendicular to both ω and r and therefore lies in the plane of the
circle as shown most clearly in the bird’s-eye view in Figure 10.6(b). Next, the direction of
ω × (ω × r) is perpendicular to both ω and ω × r, and therefore points radially in towards
the center of the circle. Finally, the centrifugal force is −m [ω × (ω × r)], which points in
the opposite direction of ω × (ω × r) and therefore points radially outward from the center
of the circle.
We can compute the magnitude of the centrifugal force from (10.4.18). Let us focus on
describing the motion along the circle in cylindrical coordinates ρ, ϕ, and z. Note that in
this case, we want an azimuthal angle to describe the motion around the circle of radius ρ,
as shown in Figure 10.6a. Hence we will use ϕ to denote that angle consistent with spherical
coordinates. Using cylindrical polar coordinates, we find ω × r = ω r sin θϕ̂. Furthermore,
Newton’s second law in a rotating frame 381
ω ω×r
ω×r
ω ω×(ω×r) -ω×(ω×r)
ω×(ω×
ρ r)
-ω×(ω
ρ
× r)
r
θ
(a) The perspective from a distant observer. (b) A bird’s-eye view of (a) looking down on the
vector ω.
ω
-ω×(ω×r)
g0
ρ g
θ R
E
Figure 10.7: A particle located at RE on the Earth’s surface (solid circle) moves in a circle
(dotted circle) as the Earth rotates with an angular velocity ω, in Example 10.2. Vectors
for the effective gravitational acceleration g, the centrifugal acceleration ω × (ω × r), and
the acceleration due to gravity g0 are also shown.
Solution:
It is helpful to include a diagram of the particle’s location before we perform any
calculations. Figure 10.7 shows a particle’s position RE on the Earth’s surface. The
position vector RE has a magnitude of 6.371 km and points in a direction from the
center of the Earth to the location of the particle on the Earth’s surface. The angle
θ is the same angle from Figure 10.6a and is related to the particle’s latitude λ by
λ = π/2 − θ. To a stationary observer above the Earth, the particle appears to move in
a circle of radius ρ = RE sin θ.
According to (10.4.16), the effective force acting on the particle is,
F = F′ + mg0 − m [ω × (ω × RE )] (10.4.20)
where
GME
g0 = − 2 R̂E
RE
is the acceleration due to the gravitational attraction, found from Newton’s universal
law of gravitation, the Earth’s mass is ME = 5.972 × 1024 kg and F′ is the sum of all
of the forces other than gravity acting on the particle. The only inertial force acting
on the particle is the centrifugal force. The Coriolis force is zero because the particle is
not moving relative to the Earth’s surface and, to good approximation, ω is a constant
and therefore ω̇ = 0.
We can collect the second and third terms in (10.4.20) and define a new acceleration
due to gravity called an effective acceleration due to gravity g where,
g = g0 − ω × (ω × r) (10.4.21)
Newton’s second law in a rotating frame 383
and it is this effective acceleration g that determines the acceleration due to free fall and
the period of a pendulum at a point on Earth. Note that the centrifugal acceleration
effectively reduces the acceleration due to gravity. In addition, a plumb line will lie along
the direction of g and will slightly deviate from true vertical because of the outward-
directed centrifugal force shown in the diagram above. Furthermore, the surfaces of the
Earth’s oceans are perpendicular to g, not g0 .
We can compute the effective acceleration due to gravity at the North Pole and
equator by first finding the magnitude of g0 ,
GME 6.674 × 10−11 Nm2 /kg 2 5.972 × 1024 kg
g0 = 2 = 2 = 9.820 m/s2
RE (6.371 × 106 m)
Next, we compute the magnitude of the centripetal acceleration at the North Pole
and equator. We will use acent = RE ω 2 sin θ ρ̂ which comes from dividing (10.4.19) by
the mass m. Note that we want the component acent sin θ of acent which is parallel to
RE . Note that for the North Pole, θ = 0 and for the equator θ = π/2. In each case
ω = 2π rad/day = 7.272 × 10−5 rad/s,
A result of Example 10.2 is that in general, we can rewrite the effective force (10.4.16)
acting on a particle near the surface of the Earth as,
F = F′ + mg − 2m (ω × v) (10.4.22)
where F′ is the sum of all of the interaction forces experienced by the particle excluding
its gravitational attraction to the Earth. We then combined mg0 with the centrifugal force
into a new force mg. The final term in (10.4.22) is the Coriolis force, which will be the topic
of the next section.
It is clear from (10.4.23) that the Coriolis force depends on the velocity of a particle.
Particles that are not moving will not experience a Coriolis force. We can estimate the size
of the Coriolis force using (10.4.23). Using ω ≈ 7.3 × 10−5 rad/sec as in Example 10.2, we
find that a golf ball at a latitude of 45 degrees North traveling at 70 m/s will experience a
Coriolis force of 0.007 N, a very small effect considering its time of flight. An intercontinental
384 Motion in Noninertial Reference Frames
ballistic missile traveling at 7 km/s will experience a Coriolis force of 0.7 N which could
have a more considerable effect on the missile. However, missiles are also affected by the
weather and their courses are corrected by computer guidance systems.
The direction of the Coriolis acceleration (and therefore of the Coriolis force) is deter-
mined by the −ω × v term. As shown in Figure 10.8, the Coriolis acceleration is to the
right of the velocity when the particle is moving in the Earth’s Northern Hemisphere. In the
Southern Hemisphere, the Coriolis acceleration will be to the left of the particle’s velocity.
-ω×v
Figure 10.8: The direction of the Coriolis acceleration acor = −2 (ω × v) of a particle moving
with a velocity v relative to the angular velocity ω of a rotating reference frame. The
acceleration deflects the particle towards its right in the Northern Hemisphere, and towards
its left in the Southern Hemisphere.
Besides missile trajectories, the Coriolis force has an important impact on Earth’s
weather, deflecting air currents in the atmosphere. In the Northern Hemisphere, air is de-
flected toward the right, which leads to high pressure to the right of the airflow, and low
pressure to the left (opposite in Southern Hemisphere), resulting in the counterclockwise
circulation of air in the Northern Hemisphere and the clockwise circulation in the Southern.
ω
ez
RE
θ
λ ex
Figure 10.9: Rotating coordinate system (ex , ey , ez ) is attached to the Earth’s surface (cir-
cle), in Example 10.3. Note that ey is not shown, but points into the page.
Newton’s second law in a rotating frame 385
Solution:
A diagram showing the coordinate system appears in Figure 10.9, which depicts the
Earth as the circle. The origin of the rotating frame S is located at a latitude λ, and is
fixed on the Earth’s surface. We have chosen our coordinates in the following way. The
êz -direction is locally upward, opposing the direction of the effective acceleration due to
gravity. The direction, êx , points towards the South. Not shown is the direction êy that
points towards the East in order to preserve a right-handed coordinate system. Note
that the angular velocity vector ω = ωẑ′ , where ẑ′ is a unit vector in the inertial frame
(fixed to the center of the Earth), and points from the Earth’s center to the North Pole.
In order to find the horizontal displacement of the falling particle, we need to solve
Newton’s second law for rotation using our established coordinate system. Newton’s
second law is,
F = mr̈ = mg − 2m (ω × v) (10.4.24)
Hence, we will need to integrate Newton’s second law two times in order to get the
displacement we are seeking. Note that the vectors g and v are already in the unprimed
noninertial coordinate system. However, ω is in the primed or inertial coordinate system.
We can transform ω to the noninertial coordinate system, by thinking of the unprimed
coordinates as a rotation of the primed coordinates through an angle θ about the êy
direction. In order to obtain the form of ω in the noninertial coordinates, we can apply
the rotation matrix about the y-axis to the vector ω in the inertial coordinates,
ωx cos θ 0 − sin θ 0 −ω sin θ −ω cos λ
ωy = 0 1 0 0 = 0 = 0 (10.4.25)
ωz sin θ 0 cos θ ω ω cos θ ω sin λ
where we used λ = π/2−θ. If we assume that the x and y components of the falling par-
ticle’s velocity are negligible and use vz = −gt, we can compute the Coriolis acceleration
ω × v using (10.4.25),
Using g = −gêz and (10.4.26) we find that (10.4.24) becomes three equations,
ẍ =0 (10.4.27)
ÿ =2 ω g t cos λ (10.4.28)
z̈ = − g (10.4.29)
which shows us that there is no deflection to the South (x-direction) and also shows
that the vertical motion is a free fall. The deflection is towards the East (y-direction)
386 Motion in Noninertial Reference Frames
and is found by integrating (10.4.28) twice, once with with initial condition ẏ(0) = 0
and then a second time with initial condition y(0) = 0. The result is,
1
y(t) = ω g t3 cos λ (10.4.30)
3
We can find the time of flight t by integrating (10.4.29) twice to get z(t) = z(0)− 12 gt2
p
(note ż(0) = 0) with z(0) = H. Solving for t, we find t = 2H/g and therefore the
displacement from the plumb line of the falling particle is:
s
1 8H 3
y= ω cos λ (10.4.31)
3 g
How large is this? An object dropped from a height of 100 m at a latitude of 45◦
North is deflected by 1.55 cm, if we neglect the effects of air resistance.
Python Code
We convert the latitude from radians to degrees to create the plot. Notice that we
multiply the variable deflection by 100 to get the deflection in centimeters.
import numpy as np
import [Link] as plt
deflection = 1/3*w*[Link](8*H**3/g)*[Link](l)
[Link](l*180/[Link],deflection*100)
[Link]("deflection (cm)")
[Link]("latitude")
[Link]()
Mathematica Code
Note that we plotted latitude in degrees and needed to adjust the argument of
Cos accordingly. We multiplied the function Deflection by 100 in Plot to obtain
centimeters.
Foucault pendulum 387
H = 100;
g = 9.8;
2.0
deflection (cm)
1.5
1.0
0.5
0.0
0 20 40 60 80
latitude (degrees)
Figure 10.10: Output of the code for Example 10.3. The deflection is highest (2.2 cm) at
the equator (λ = 0) and falls to zero at the North Pole.
T
ey
Tx
Ty
ex
mg
Figure 10.11: A Foucault pendulum of mass m and length ℓ suspended from a large vertical
height at a point on the z-axis.
We begin with a schematic diagram of the pendulum. Figure 10.11 shows a Foucault
pendulum of mass m connected to a long light wire of length ℓ. The coordinate frame
illustrated is a noninertial frame whose xy-plane is tangent to the Earth’s surface and
whose z-axis is oriented along the local vertical direction. The angle α is small. There are
two forces acting on the Foucault pendulum, gravity, and tension. The force of gravity
mg uses the effective gravitational acceleration g which includes the centrifugal force as
previously discussed. The tension in the wire T is illustrated in Figure 10.11, which also
includes the x- and y-components of T. Note that the z-component of T will be discussed
later in the problem. Finally, we assume that the Foucault pendulum’s motion is largely
confined to the xy-plane. In other words, ż ≪ ẋ and ż ≪ ẏ.
Assuming that the Earth’s angular acceleration is constant, which over the period of
the pendulum is an excellent approximation, we can use (10.4.22) to find the acceleration
of the mass m by dividing (10.4.22) by m and using F′ = T,
T
a= + g − 2 (ω × v) (10.5.1)
m
To get x(t) and y(t) (note that with our assumptions z(t) = 0), we need to find the
components of the vector equation (10.5.1), and integrate and solve the resulting second-
order ODE.
To get the ODE, we write the components of each of the vectors on the right-hand side of
(10.5.1), noting that a = ẍêx + ÿêy + z̈êz . We can see in Figure 10.11, that g = −gêz where
g is the magnitude of the local effective acceleration due to gravity. Next, the components
of the tension can be found using the fact that α is a small angle and ℓ is large,
x y
Tx ≈ − T Ty ≈ − T Tz ≈T (10.5.2)
ℓ ℓ
where we used sin α ≈ x/ℓ and y/ℓ for Tx and Ty , respectively. The Coriolis acceleration
ω × v can be found using the method outlined in Example 10.3,
where we used ż ≃ 0, since the pendulum’s motion is confined to the xy-plane. Therefore,
inserting the vector components into (10.5.1) we obtain,
T x
ẍ = − + 2ẏ ω sin λ
m ℓ
T y
ÿ = − − 2ẋ ω sin λ (10.5.5)
m ℓ
T
z̈ = − g + 2ẏ ω cos λ
m
The pendulum stays in the xy-plane; therefore, z̈ ≈ 0. Furthermore, ẏω is small compared
to the acceleration due to the gravity and the tension. Therefore, we can write T = mg
using the equation for z̈ in (10.5.5) and we can rewrite (10.5.5) as,
)
ẍ + β 2 x =2ωz ẏ
(10.5.6)
ÿ + β 2 y = − 2ωz ẋ
where β 2 = T /(m ℓ) ≃ g/ℓ, and ωz = ω sin λ is the êz component of the angular velocity.
Notice that (10.5.6) consists of a pair of coupled second-order differential equations. The
equations are called coupled because the equation for ẍ contains a term with ẏ and vice-
versa. A common√means of solving coupled ODEs analytically is by multiplying one of the
equations by i = −1 and adding the two equations together. The result of multiplying the
ÿ equation by i and adding it to the ẍ equation is,
(ẍ + iÿ) + β 2 (x + iy) = −2ωz i (ẋ + iẏ) (10.5.7)
We see that (10.5.7) is a second-order ODE in the variable q = x + iy,
q̈ + 2iωz q̇ + β 2 q = 0 (10.5.8)
The form of (10.5.8) should be familiar; it is similar to a damped harmonic oscillator.
The solution to (10.5.8) is,
h p p i
q(t) = e−iωz t A exp it ωz2 + β 2 + B exp −it ωz2 + β 2 (10.5.9)
Notice that if the Earth were not rotating, ωz = 0 and (10.5.8) would become,
q̈ ′ + β 2 q ′ = 0 (10.5.10)
which is the equation for simple harmonic motion, where we used the notation of q ′ = x′ +iy ′
for the value of q in a nonrotating frame. From our work in Chapter 6, we know that
q ′ (t) = Aeiβt + Be−iβt (10.5.11)
p
Furthermore, from (10.5.10) we see that β = g/ℓ is the Foucault pendulum’s frequency
of small oscillation when the Earth is not rotating. Because β ≫ ωz , we can rewrite (10.5.9)
as
q(t) = e−iωz t Aeiβt + Be−iβt (10.5.12)
or
q(t) = e−iωz t q ′ (t) (10.5.13)
We can get a better physical insight to the motion of the pendulum if we write (10.5.13)
as
x + iy =(x′ + iy ′ )e−iωz t
= (x′ + iy ′ ) (cos (ωz t) − i sin (ωz t)) (10.5.14)
= (x′ cos (ωz t) + y ′ sin (ωz t)) + i (−x′ sin (ωz t) + y ′ cos (ωz t))
390 Motion in Noninertial Reference Frames
Next, we equate the real and imaginary parts to get the solution we are after, x(t) and
y(t), )
x(t) =x′ cos (ωz t) + y ′ sin (ωz t)
(10.5.15)
y(t) = − x′ sin (ωz t) + y ′ cos (ωz t)
It is easier to get some physical insight into these equations if we rewrite (10.5.15) as a
matrix equation,
′
x(t) cos (ωz t) sin (ωz t) x (t)
= (10.5.16)
y(t) − sin (ωz t) cos (ωz t) y ′ (t)
The appearance of the rotation matrix in (10.5.16) tells us that the Foucault pendulum’s
plane of oscillation is rotating through an angle ωz t with a rotation frequency of ωz = ω sin λ.
Therefore, the precession rate ωz of the pendulum depends on the latitude of the pendulum.
We also see how the Foucault pendulum gives a demonstration of the Earth’s rotation, as
its rotation rate is dependent on the Earth’s angular velocity.
Python Code
To solve the problem in Python, we need to first rewrite (10.5.6) as a system of
first-order equations:
ẋ = r
ẏ = s
(10.5.18)
ṙ = −β 2 x + 2ωz s
ṡ = −β 2 y − 2ωz r
We then use odeint to solve (10.5.18). The solutions x, y are stored in x_coord and
y_coord, respectively.
Foucault pendulum 391
def deriv(u,t):
x, y, r, s = u
dydt = [r, s, -b**2*x + 2*wz*s, -b**2*y - 2*wz*r ]
return dydt
t = [Link](0,27000,10000)
ics = [0.1,0,0,0]
x_coord = soln[:,0]
y_coord = soln[:,1]
[Link](x_coord,y_coord)
[Link]('y')
[Link]('x')
[Link]()
Mathematica code
We use NDSolve to integrate (10.5.6) and plotted the solution using ParametricPlot
for one quarter of the period of the pendulum’s plane of oscillation.
l = 67;
λ = 48.8 ∗ Pi/180;
g = 9.8;
wz = w ∗ Sin[λ];
β = g/l;
0.10
0.05
0.00
y
- 0.05
- 0.10
- 0.10 - 0.05 0.00 0.05 0.10
x
Figure 10.12: Mathematica output for Example 10.4. The pendulum sweeps out a quarter
of a period over the integration time.
ez (vertical)
v0
ey
(East)
ex
(South)
Figure 10.13: Coordinate system for a projectile launched in the yz-plane towards the East,
at an angle α and with a speed v0 .
Python Code
To solve the problem in Python, we need to first rewrite (10.6.4) as a system of
first-order equations:
ẋ = q
ẏ = r
ż = s
(10.6.5)
q̇ = 2rω sin λ
ṙ = −2ω (s cos λ + q sin λ)
ṡ = −g + 2rω cos λ
We then use odeint and the solutions x, y, z are stored in x_coord, y_coord, and
z_coord, respectively. To get the time of flight, we need to know when the z(t) crosses
zero (for the numerical model, the projectile can fall through the Earth’s surface). Using
[Link] we can find the index values where z_coord changes sign. Using [Link], we
get the index before the sign change (hence the addition of 1 in tof_index). Finally, we
can find the time of flight, range, and Coriolis deflection by inserting tof_index into
the respective arrays.
394 Motion in Noninertial Reference Frames
z0_dot = v0*[Link](a)
y0_dot = v0*[Link](a)
def deriv(u,t):
x, y, z, q, r, s = u
dydt = [q, r, s, 2*r*w*[Link](l), \
-2*w*(s*[Link](l) + q*[Link](l)),\
-g + 2*r*w*[Link](l)]
return dydt
t = [Link](0,1000,10000)
ics = [0, 0, 0, 0, y0_dot, z0_dot]
soln = odeint(deriv, ics, t)
x_coord = soln[:,0]
y_coord = soln[:,1]
z_coord = soln[:,2]
z_zero_crossings = [Link]([Link]([Link](z_coord)))[0]
print('The indices of the zero crossing are:',z_zero_crossings)
time_of_flight = t[tof_index]
print('\nThe time of flight is: ', round(time_of_flight,2),' s')
Mathematica code
The code begins by defining the necessary parameters, including the components
of the initial velocity which are stored as z0Dot and y0Dot. We solve (10.6.4) using
NDSolve, as usual. The time of flight T is obtained by finding when the altitude of the
projectile z equals zero, by using FindRoot. The index [[1,2]] is used to remove the
replacement rule that Mathematica outputs for the FindRoot command. Finally, we
insert the time of flight into x[t] to get the Coriolis deflection and y[t] to get the
projectile’s range.
ω = 7.27210∧ (−5);
α = 45 ∗ Pi/180;
λ = 50 ∗ Pi/180;
v0 = 200;
g = 9.8;
z0Dot = v0Sin[α];
y0Dot = v0Cos[α];
{t, 0, 2000}];
“ s”]
ma = F′ − mA − 2m (ω × v) − m (ω̇ × r) − m [ω × (ω × r)]
where:
a = the acceleration relative to the noninertial frame
F′ = the sum of the “interaction” forces acting on the
particle (gravity, friction)
A = the linear acceleration of the noninertial frame relative
to an inertial frame
−2 (ω × v) =the Coriolis acceleration
−ω̇ × r = an acceleration due to the
angular acceleration of the noninertial frame
−ω × (ω × r) = the centrifugal acceleration.
The last four terms in the equation above are referred to as “inertial forces” or
fictitious forces, because they arise from the acceleration of the noninertial frame and
are not due to the interaction between the particle and another body.
Show that the angular velocity of the body relative to S ′ is ω ′ = Ω + ω. Assume that
the reference frames S and S ′ have the same origin.
Section 10.4: Newton’s Second Law in a Rotating Frame
3. Consider a bullet fired horizontally towards the South with a velocity v0 = 500 m/s
at a latitude λ = 50◦ North. How does the Coriolis force acting on the bullet compare
to is weight? Solve this problem analytically and by using either Python or Mathe-
matica.
4. A bucket of water is rotating about its vertical symmetry axis with an angular velocity
ω. What is the shape of the water’s surface in the bucket?
5. Atomic clocks show that a modern day is longer by about 1.7 milliseconds than a
century ago. Hence although small, the angular acceleration of the Earth is not zero
̸ 0, where ω is the angular velocity of the Earth. Compute the acceleration ω̇ × r
ω̇ =
due to the changing angular velocity of the Earth, on a particle fixed to the Earth’s
surface located in Williamsburg, Virginia, USA (latitude 37.3° N and a longitude of
76.6° W ). Solve this problem analytically and using Python or Mathematica.
6. Let S be a frame rotating with a constant angular velocity ω relative to an inertial
frame S ′ , with the origins of both frames being the same. The particle has a potential
energy V . Find the Lagrangian in terms of the position and velocity coordinates r and
ṙ in S. Show that the Euler-Lagrange equations yield
F′ = ma + 2m (ω × v) + mω × (ω × r)
7. Using the effective gravitational acceleration, plot the time it takes for a particle
of mass m to fall a distance of 100 meters, as a function of latitude. Where is this
time the greatest? Ignore air resistance and assume the particle is released from rest.
8. A baseball of mass m is launched vertically upward from the ground with an initial
velocity v0 at a latitude λ. Find the Coriolis deflection of the ball when it returns to
the ground.
9. Find the deflection from the plumb line for a 1.0 kg particle falling from a height
H = 100 m under the Earth’s gravity, experiencing linear air resistance. Assume that
the horizontal component of the particle’s velocity is small, so that the drag force acts
only in the vertical direction. Thus the drag force is Fd = −bż ẑ, where b = 0.1 Ns/m.
Compare the answer to the result if the particle fell from the same height in vacuum
at a latitude of 45 degrees.
10. Consider a particle of mass m confined to move in a vertical plane rotating with
a constant angular velocity ω about the vertical. Let x be the horizontal coordinate
on the plane and z be the vertical coordinate. Using analytical methods, solve the
equations of motion for the particle and describe the particle’s motion. Using Python
or Mathematica, solve the equations of motion using initial conditions r0 = 1î − 1ĵ
and v0 = 1î + 1ĵ (in SI units). Plot the motion of the particle on the plane using ω = 1
rad/s.
11. Let us consider again Problem 10, but now assume the plane’s angular velocity is
increasing in time, such that its angular acceleration is α = αêz where α is a positive
398 Motion in Noninertial Reference Frames
constant. However, now solve the problem using only Python or Mathematica. Plot
the motion of the particle for α = 0.5, and α =1.0 rad/s2 . Assume that the initial
angular velocity of the plane is zero.
12. A baseball is dropped from a height of 30 m at a latitude of 32◦ South. Ignoring air
resistance, in what direction and how far did the ball land from the vertical? How
does the direction compare to the result of Example 10.3? Explain any similarities or
differences.
Section 10.5 Foucault Pendulum
13. Show that (10.5.9)
h p p i
q(t) = e−i ωz t A exp i t ωz2 + β 2 + B exp −i t ωz2 + β 2
q̈ + 2i ωz q̇ + β 2 q = 0
14. What is the rate of rotation of a Foucault pendulum’s plane of oscillation if the
pendulum is located in Paris, France? How about Paris, Kentucky, USA. Plot the
Foucault pendulum’s rotation rate as a function of latitude. Where is its maximum?
What is the minimum value, and where does this minimum value occur?
15. Consider a Foucault pendulum experiencing a damping force F′ = −b v v̂. Is the
precession frequency changed?
16. Is the Foucault pendulum’s precession frequency significantly changed if ω̇ = ̸ 0, where
ω is the angular velocity of the Earth about its rotation axis? To answer this question,
assume that the magnitude of the Earth’s angular velocity changes at a constant rate,
but its direction does not change (this is not true over long time periods). Furthermore,
assume that the change in the angular velocity is very small. For example, consider
the situation described in Problem 26 from Chapter 4 which states that the Earth’s
angular velocity changed from 7.6 × 10−5 rad/s to 7.3 × 10−5 rad/s during a time
period of 350 million years. Let the pendulum have a mass m and a length ℓ (assumed
to be very long) and to be located at a latitude λ in the Northern Hemisphere.
Section 10.6: Projectile Motion in a Noninertial Frame
17. In our study of the projectile motion in a noninertial frame, we derived the equa-
tions
ẍ =2ẏω sin λ
ÿ = − 2ω (ż cos λ + ẋ sin λ) (1)
z̈ = − g + 2ẏω cos λ
Assuming that the approximation 2ẏω cos λ << g holds, solve the resulting system
of two coupled ODEs in closed form. You will want to use a symbolic ODE solver.
After finding the solutions, perform a Taylor series expansion for x(t) and y(t), and
interpret your results.
18. Use a CAS to find the range and Coriolis deflection of a 1.0 kg projectile experi-
encing linear air resistance of the form F′ = −bvv̂ where b = 0.3 SI units. The initial
velocity v0 = 200 m/s, the latitude λ = 50◦ N and the angle of launching is α = 45°.
End-of-chapter problems 399
19. Repeat Problem 18, but this time, the projectile experiences quadratic air resis-
tance of the form F′ = −bv 2 v̂ where b = 0.01 SI units.
20. A projectile of mass m is fired due East from a point on the Earth’s surface with a
latitude of λ (in the Northern Hemisphere). The projectile’s initial speed is v0 and is
launched at an angle α with respect to the horizontal. Calculate the lateral deflection
of the projectile as it hits the ground. Do this problem without the aid of a computer.
21. There is a legend that during World War I, the British navy consistently missed
German ships when fighting near the Falkland Islands because their ships did not
properly account for the Coriolis force. We will not discuss the validity of this legend
here, but for a moment, let’s suppose that it is true and that the Coriolis force was
known, but the ship’s guns were set up to hit their targets for battles in the Northern
Hemisphere. The Falkland Islands are near 50◦ South latitude. Suppose the guns were
set to accurately hit targets at 50◦ North latitude, by how much did the British ships
miss their target during the Falkland Islands engagement? Assume that the German
ships were due East of the British ships, that the British ships’ guns had a muzzle
velocity of 500 m/s and the shells were shot at an angle of 20◦ with respect to the
horizontal.
11 Rigid Body Motion
We begin this chapter by reviewing the rotational motion of a single particle around an
arbitrary axis and the concepts of the moment of inertia and the center of mass. In par-
ticular we focus on how the center of mass simplifies the description of the translational
and rotational motion of a system of particles. After the review, we explore generalized
definitions of the moment of inertia, including products of inertia and the inertia tensor,
and we demonstrate how to calculate these quantities for a variety of solids. We will see
that the moment of inertia tensor of a solid depends on the choice of the coordinate system
and discuss the parallel axis theorem for rigid bodies. This is followed by a discussion of
eigenvalues and eigenvectors of matrices, and how they can be used to describe the principal
axes of a rigid body. The chapter will conclude with a discussion of the Euler equations and
a description of the precessional motion of spinning tops and gyroscopes.
I = mr2 (11.1.4)
where r is the distance of the mass m from the rotational axis.
1
The kinetic energy of the rotating mass m is found from T = mv 2 , and by substituting
2
v = ωr, we obtain:
1
T = Iω 2 (11.1.5)
2
401
402 Rigid Body Motion
Figure 11.1: Rotational motion of a particle in the xy-plane, showing the position, velocity,
angular momentum, and angular velocity vectors.
Recall from Chapter 4 that the torque acting on the particle is N = r × F. We can rewrite
the torque as the time derivative of the angular momentum, by using Newton’s second law
for rotational motion. Using (11.1.3) we can write ℓ = Iω , and Newton’s second law of
rotation becomes:
d
N= (Iω) = I ω̇ = Iα (11.1.6)
dt
where α = ω̇ is the angular acceleration.
Let’s reconsider (11.1.3) as a vector relationship:
ℓ = Iω (11.1.7)
Since the moment of inertia is defined as a scalar quantity in (11.1.4), this vector equation
states that in the example of Figure 11.1, the angular momentum vector ℓ and the angular
velocity vector ω point in the same direction along the rotational axis. In addition, we can
rewrite (11.1.6) as,
N = Iα (11.1.8)
Note that the torque vector N and the angular acceleration vector α point in this same
direction in this case.
Example 11.1 shows an evaluation of the angular momentum vector using Python and
Mathematica.
Example 11.1: Use Python and Mathematica to evaluate the angular momentum
and torque N acting on the mass m in the situation shown in Figure 11.1. Assume that
the mass m moves with a constant angular velocity ω around the z-axis in a circle of
radius R.
Rotational motion of particles around a fixed axis 403
Solution:
We use cylindrical coordinates with the angle increasing with time according to
θ = ω t.
The position vector
r = R cos (ωt) î + R sin (ωt) ĵ
The codes calculate the cross product ω × r and verify that this is indeed equal to
the velocity vector (dx/dt, dy/dt).
In this example, the angular momentum vector points always along the z-axis and
its magnitude is equal to ℓz = mR2 ω.
The torque N = I ẇ = 0, since the mass moves with a constant angular velocity ω
around the z-axis.
Python Code
We define the position vector as a list, and use the cross function in NumPy to
evaluate the cross products.
r_vector = [R*cos(omega*t),R*sin(omega*t),0]
omega_vector = [0,0,omega]
L_vector = m* cross(r_vector,v_vector )
print('\nL = ',simplify(L_vector))
L = [0, 0, R**2*m*omega]
404 Rigid Body Motion
Mathematica Code
The code uses the Cross command to evaluate the cross products.
L = m ∗ Cross[rvector, vvector];
Let us now consider a particle of mass m which rotates around the z-axis at a constant
angle θ and with an instantaneous angular velocity ω, as shown in Figure 11.2. In this
situation the angular momentum vector is perpendicular to the shaded plane in the figure,
which is defined by the position and velocity vectors. As a result, in the example of Figure
11.2 the angular momentum vector ℓ and the angular velocity vector ω do not point in the
same direction, and the direction of ℓ changes continuously in space during the rotational
motion.
Figure 11.2: A particle of mass m revolves around the z-axis on a plane parallel to the
xy-plane with angular velocity vector ω. In this example the angular momentum vector ℓ
and angular velocity vectors ω are not pointing in the same direction. Compare this figure
with the situation in Figure 11.1.
Rotational motion of particles around a fixed axis 405
In this situation the equation ℓ = Iω does not apply because ℓ and ω do not point in
the same direction as in Figure 11.1. We must redefine the moment of inertia concept for
the mass m. As we will see later in this chapter, we need to replace the scalar quantity I in
this equation with a more general physical quantity, the moment of inertia tensor I.
Example 11.2: Use Python and Mathematica to evaluate the angular momentum
and torque for the rotating mass m shown in Figure 11.2, assuming that ω = |ω| is
constant.
Solution:
We follow the same method as in the previous example, using cylindrical coordinates.
The position vector
The length R sin θ appearing in the expressions for the coordinates x, y represents the
radius of rotation of the particle around the z-axis.
The components of the angular momentum are:
ℓz = −mR2 ω sin2 θ
Clearly in this situation the angular momentum vector ℓ has nonzero components
along the x, y, and z axes. By inspection of the calculated components ℓx and ℓy , we
see that the vector ℓ rotates around the z-axis with a constant angular speed ω, and
that the z-component ℓz = m R2 ω sin2 θ stays constant with time. The codes for Figure
11.2 follow.
406 Rigid Body Motion
Python Code
The code is very similar to the previous example, using a different position vector.
r_vector = [R*sin(theta)*cos(omega*t),R*sin(theta)*sin(omega*t),\
R*cos(theta)]
omega_vector = [0,0,omega]
v_vector = simplify(cross(omega_vector, r_vector) )
L_vector = m* cross(r_vector,v_vector )
print('Lx_component = ',L_vector[0])
print('Ly_component = ',L_vector[1])
print('Lz_component = ',simplify(L_vector[2]))
Mathematica Code
L = m ∗ Cross[rvector, vvector];
Print[“L = ”, L//Simplify]
The angular
momentum L is:
L = −mR2 ωCos[θ]Cos[tω]Sin[θ], −mR2 ωCos[θ]Sin[θ]Sin[tω], mR2 ωSin[θ]2
Before we discuss the rotational properties of solid bodies, let us review the center of
mass and how it is used to describe the rotation of a system of particles.
Review of rotational properties for a system of particles 407
ri'=ri-R
mi
R
ri
x
Figure 11.3: Collection of discrete particles (filled circles), with the empty circle representing
their center of mass located at R.
Let R represent the location of the center of mass relative to the origin, shown as a
white circle in Figure 11.3, and r′i denote the positions of the particles relative to the center
of mass. Then ri = r′i + R and the position of the center of mass can be found from:
1 X X X
N N N
R= mi ri M= mi mi r′i = 0 (11.2.1)
M i=1 i=1 i=1
Ṗ = M R̈ = Fext (11.2.4)
As a consequence, if the total external force acting on a system of particles is zero, then
the center of mass is either at rest, or it moves with constant velocity and the total linear
momentum of the system is conserved.
X
N
L= (r′i × p′i ) + R × P (11.2.5)
i=1
L̇ = N (11.2.6)
P ′
The first term (ri × p′i ) represents the angular momentum of the particles about the
center of mass, and the second term (R × P), is the angular momentum of the center of
mass about the origin. In this situation Newton’s second law can be stated as follows: if
the internal forces between the particles in a system of particles are central forces, then
the total external torque N on this system is equal to the time rate of change of the total
angular momentum L̇ of the system. As a consequence, if the total external torque acting on
a system of particles is zero, then the total angular momentum of the system is conserved.
XN
1 2 1 ′ 2
T = M Ṙ + mi (ṙi ) (11.2.7)
2 i=1
2
W12 = T2 − T1 (11.2.8)
The first term is the translational kinetic energy of the center of mass 12 M Ṙ2 , and
P1 ′ 2
the second term 2 mi (ṙi ) , represents the kinetic energy of each particle relative to the
center of mass. We also saw that the total work W12 done in moving a system of particles
from a state of kinetic energy T1 to a state of kinetic energy T2 is equal to the change in
kinetic energy. Furthermore, for a rigid body, the only motion relative to the center of mass
is rotation. Hence, the second term in (11.2.7) is the kinetic energy of rotation about the
center of mass. We can then think of equation (11.2.7) as stating that the total kinetic
energy of a rigid body is equal to the translational kinetic energy of the center of mass plus
the kinetic energy of rotation about the rigid body’s center of mass.
For the potential energy, we need to consider both external and internal forces, and
their corresponding potential energies. The potential energy of the ith mass is:
X
Vi = Viext + int
Vi,j (11.2.9)
j̸=i
where Viext is the potential energy due to the external forces acting on mi , and Vi,j int
is the
potential energy due to the internal interaction force between mi and mj . An example of
such an interaction force could be gravitational, electrostatic, or any other central force. In
int
general for central forces, Vi,j int
= Vi,j (|ri − rj |), i.e., the potential energy depends only on
the distance between the two particles. Therefore, the total potential energy of the system
is:
XN XN X
V = Viext + int
Vi,j (|ri − rj |) (11.2.10)
i=1 i=1 j̸=i
Rigid bodies are defined as solids in which the particles that make up the solid are at
fixed distances from each other. Therefore, the internal potential energy can be ignored
since it will be constant for each particle. Hence, for a rigid body we will only have to
worry about external forces; the internal central forces are irrelevant. When all internal and
external forces acting on a system of particles are conservative, the total mechanical energy
E = T + V is conserved.
In Chapters 4 and 5 we saw that the above results for linear momentum, angular momen-
tum, and kinetic energy holds also for continuous mass distributions, with the summations
replaced by appropriate integrals.
instantaneous velocity vi of mass mi is given by the cross product of the angular velocity
vector ω = ωx î + ωy ĵ + ωz k̂ and the positions ri = xi î + yi ĵ + zi k̂:
vi = ω × ri (11.3.1)
Figure 11.4: Rigid body with a fixed axis of rotation AB. The coordinate system shown is
fixed on the rotating body.
The total angular momentum vector L relative to the center of the coordinate system
is given by the vector sum of the angular momenta of the masses mi :
X X
L= mi (ri × vi ) = mi [ri × (ω × ri )] (11.3.2)
where the summation i = 1 . . . n runs over the masses mi which make up the rigid body.
We now use the identity of the triple cross product A × (B × A) = A2 B − (A · B) A to
evaluate ri × (ω × ri ):
ri × (ω × ri ) = ri2 ω − ri (ri · ω) (11.3.3)
ri × (ω × ri ) = x2i + yi2 + zi2 ωx î + ωy ĵ + ωz k̂ − xi î + yi ĵ + zi k̂ (xi ωx + yi ωy + zi ωz )
(11.3.4)
Substituting (11.3.4) into (11.3.2) and collecting the terms with î, ĵ, and k̂:
L = Lx î + Ly ĵ + Lz k̂ (11.3.5)
X
N X
N X
N
Ixy = Iyx = − mi xi yi Ixz = Izx = − mi xi zi Iyz = Izx = − mi yi zi
i=1 i=1 i=1
(11.3.8)
From these equations it is clear that the moment of inertia matrix I is symmetric, i.e.
Ixy = Iyx , Ixz = Izx , and Iyz = Izy .
Equations (11.3.6) and (11.3.8) can be written as the product of two matrices I and ω:
The terms Ixx , Iyy , and Izz are referred to as moments of inertia. These are the moments
of inertia of the rigid body about each axis. The terms Ixy , Iyz , Ixz , . . . are called products of
inertia. As we will see later, the products of inertia are zero if the x, y, and z axes correspond
to the rigid body’s axes of symmetry. The products of inertia measure the symmetry of the
rigid body’s mass distribution about the x, y and z axes.
To understand the importance of the product of inertia, consider the following. Suppose
you are interested in balancing an automobile tire. In the case of the tire, the axis of
symmetry is the axle passing through the center of the tire and perpendicular to the plane
of the tire. A proper tire rotates about the axle, or in other words, its angular momentum
vector points along the direction of the axle. Suppose the axle points in the z-direction.
We want L = Izz ω k̂ to be the angular momentum of the wheel. However, suppose the
mass of the wheel is not evenly distributed about the axle, then the axle is no longer an
axis of symmetry, and there will be at least two nonzero products of inertia. For simplicity,
suppose that Izy ̸= 0 and all other products of inertia are equal to zero. Then in this case,
the wheel will precess (wobble), because L is no longer parallel to the axle (which points in
the z-direction). Hence automotive technicians will add small weights to a tire to balance
it, such that the wheel’s angular momentum will be parallel to its axis of rotation.
Equations (11.3.7) can also be written as a single equation, as follows:
!
XN X3
Ikl = mi δkl uis − uik uil
2
(11.3.11)
i=1 s=1
412 Rigid Body Motion
where we use the compact notation uis (s = 1, 2, 3) to denote the three components of the
position vector ri = (xi , yi , zi ) of the mass mi . For example, u32 is the y-coordinate of
m3 . The symbol δkl in (11.3.11) is the Kronecker delta which equals 1 when k = l, and 0
otherwise.
It is important to remember that the elements of the inertia tensor depend on the choice
of origin for the coordinate system. Example 11.3 shows how to calculate the elements of
the moment of inertia tensor for a single particle.
For a constant angular velocity, the angle θ = ωt. Substituting these values for x, y, z
in the expressions for inertia tensor. we obtain:
Ixx = m y 2 + z 2 = m R2 sin2 ϕ sin2 θ + cos2 ϕ
Similarly
Iyy = m x2 + z 2 = mR2 sin2 ϕ cos2 θ + cos2 ϕ
Izz = m x2 + y 2 = mR2 sin2 ϕ cos2 θ + sin2 ϕ sin2 θ = mR2 sin2 ϕ
Ixy = −mxy = −mR2 sin2 ϕ sin θ cos θ Ixz = −mxz = −mR2 sin ϕ cos ϕ cos θ
Iyz = −myz = −mR2 sin ϕ cos ϕ sin θ
Moment of inertia tensor 413
The angular momentum vector can now be found by multiplying this matrix I with
the angular momentum matrix ω = (0, 0, ω).
ℓ = Iω
Since ω = (0, 0, ω), the matrix multiplication yields the third column of the matrix
I multiplied by ω, i.e.,
Python Code
We use the Matrix command from SymPy to define the matrices I, ω and the dot
command from NumPy to evaluate the product ℓ = Iω of the two matrices.
x = R*sin(phi)*cos(theta)
y = R*sin(phi)*sin(theta)
z = R*cos(phi)
rsq = x**2+y**2+z**2
I = Matrix([[Ixx,Ixy,Ixz],[Ixy,Iyy,Iyz],[Ixz,Iyz,Izz]])
omega_matrix=Matrix([0,0,omega])
Ly-component = -R**2*m*omega*sin(phi)*sin(theta)*cos(phi)
Lz-component = R**2*m*omega*sin(phi)**2
Moment of inertia tensor 415
Mathematica Code
We define the matrices I, ω as lists, and use the Dot command in Mathematica to
evaluate the product ℓ = Iω of the two matrices.
x = R ∗ Sin[ϕ] ∗ Cos[θ];
y = R ∗ Sin[ϕ] ∗ Sin[θ];
z = R ∗ Cos[ϕ];
Ixx = m ∗ (y ∧ 2 + z ∧ 2);
Ixy = Iyx = −m ∗ x ∗ y;
Iyz = Izy = −m ∗ y ∗ z;
Ixz = Izx = −m ∗ x ∗ z;
Inertia = {{Ixx, Ixy, Ixz}, {Iyx, Iyy, Iyz}, {Izx, Izy, Izz}};
L = Dot[Inertia, ωvector];
Example 11.4 shows how to evaluate the elements of the inertia tensor for a uniform
cube by using symbolic integration.
Example 11.4: The moment of inertia of a cube around its center of mass
Consider a uniform cube of side a, evaluate the moment of inertia tensor with respect
to the Cartesian coordinate system with the origin (0, 0, 0) located at the center of mass,
and the x, y, and z axes parallel to the edges of the cube.
Solution:
We use Cartesian coordinates for the calculation, with the limits of (x, y, z) varying
from −a/2 to a/2. The mass element is dm = (M/a3 ) dV = (M/a3 ) dx dy dz and the
moments of inertia elements are:
ZZZ Z Z a/2 Z a/2
M a/2
Ixx = y 2 + z 2 dm = 3 y 2 + z 2 dx dy dz
a −a/2 −a/2 −a/2
V
Python Code
The integrate command in SymPy is used to carry out the triple integrals, and
the Matrix command is used to create the 3×3 inertia tensor.
Mathematica Code
The Integrate command is used to carry out the symbolic triple integrals, and the
MatrixForm command is used to print the 3×3 inertia tensor as a matrix.
Ixx =
Iyy = Izz = Integrate[y ∧ 2 + z ∧ 2, {x, −a/2, a/2}, {y, −a/2, a/2}, {z, −a/2, a/2}];
Ixy = Iyx = Integrate[x ∗ y, {x, −a/2, a/2}, {y, −a/2, a/2}, {z, −a/2, a/2}];
Iyz = Izy = Integrate[y ∗ z, {x, −a/2, a/2}, {y, −a/2, a/2}, {z, −a/2, a/2}];
Ixz = Izx = Integrate[x ∗ z, {x, −a/2, a/2}, {y, −a/2, a/2}, {z, −a/2, a/2}];
Inertia = m/a∧ 3 ∗ {{Ixx, Ixy, Ixz}, {Iyx, Iyy, Iyz}, {Izx, Izy, Izz}};
Figure 11.6: Evaluating the moment of inertia tensor of a uniform triangular pyramid in
Example 1.5.
Example 11.5 shows how to evaluate the elements of the inertia tensor for a triangular
pyramid with a uniform density by using numerical integration.
Z Z " #
3
1 1−y
(1 − x − y)
Ixx = dy dx y (1 − x − y) +
2
0 0 3
The integrals are rather tedious to evaluate by hand, so we use the alternative numerical
integration routines available in a CAS.
Python Code
The Python code uses the [Link]() function to evaluate the triple
integrals. In order to simplify the code, we define a function f which evaluates the
command [Link]() for the triple integrals, and is called for each
of the components of the inertia tensor Ixx , Ixy , etc.
The important feature of the double integration here is the implementation of the
integration limits in the line of code tplquad(i, 0, 1, 0, yupper). Here yupper is
the function 1−x representing the upper limit in the y-integration, and i is the function
to be integrated.
In this example we use a NumPy array to represent the moment of inertia matrix.
Note that the order of the integrations tplquad(i, 0, 1, 0, x2, 0, z2) is again
important, and we define the upper limits of integration as two functions: x2 and z2.
def f(i):
return tplquad(i, 0, 1, 0, x2, 0, z2)[0]
I = [Link]([[f(Ixx),f(Ixy),f(Ixz)],[f(Ixy),f(Iyy),f(Iyz)],\
[f(Ixz),f(Iyz),f(Izz)]])
print('Moment of inertia tensor I=')
I
Mathematica Code
We evaluate the triple integrals in Mathematica using the NIntegrate command.
Notice that the limits of the integral that we would do last by hand are the first limits
in NIntegrate.
Inertia = {{Ixx, Ixy, Ixz}, {Iyx, Iyy, Iyz}, {Izx, Izy, Izz}};
1 1 1 1
T = ω · L= Ixx ωx2 + Iyy ωy2 + Izz ωz2 +Ixy ω x ω y +Iyz ω y ω z +Izx ω z ω x (11.4.3)
2 2 2 2
By using (11.3.9), this equation can be written in a compact form as a matrix equation:
Kinetic energy and the inertia tensor 421
T
Here the dot product indicates the multiplication of the three matrices, and (ω) indi-
cates the transpose of the column matrix representing the angular velocity vector ω (i.e., a
row vector).
If the angular velocity vector ω points in the direction of the unit vector n̂, we can write
ω = ωn̂, where ω is the magnitude of the angular frequency. Therefore, the above matrix
equation becomes:
1 T
T = ω 2 (n̂) · I · n̂ (11.4.5)
2
From introductory physics we recall that the kinetic energy for rotation around a fixed axis
is: 1
T = In ω 2 (11.4.6)
2
where In is the scalar moment of inertia around this axis. By comparing the last two
equations, we obtain the general expression:
The products of inertia can also be found using an expression similar to (11.4.7). For
example, Ixy is obtained by calculating the quantity:
T
Ixy = bi · I · bj (11.4.8)
Example 11.6:
Use SymPy and Mathematica to find the scalar moments of inertia In of a cube
when it is rotated around
(a) the main diagonal,
(b) a face diagonal on the xy-plane,
(c) the edge that runs along the x-axis.
Solution
We first evaluate the inertia tensor with respect to a coordinate system centered at
one of the vertices, as in Example 11.4. Once the tensor is evaluated, the scalar moment
of inertia I is obtained using (11.4.7) and the appropriate unit vector n̂ pointing along
the direction of rotation.
For the main diagonal we have n̂ = √13 î + ĵ + k̂ , for the face diagonal on the
xy-plane n̂ = √12 î + ĵ , and for the edge that runs along the x-axis, n̂ = î.
The codes below give I = ma2 /6, I = 2ma2 /3 and I = 5ma2 /12, correspondingly.
As we may have expected from geometrical considerations, the largest value of I is
obtained for the face diagonal of the cube.
422 Rigid Body Motion
Python Code
The tensor is evaluated using SymPy as in previous examples. We use the command
transpose from Numpy to find the transpose of the matrix ω = ωn̂, and the command
@ to multiply the three matrices.
I = [Link]([[Ixx,Ixy,Ixz],[Ixy,Iyy,Iyz],[Ixz,Iyz,Izz]])*m/a**3
omega = [Link]([1/sqrt(3),1/sqrt(3),1/sqrt(3)])
omega_trnsp = [Link](omega)
omega = [Link]([1/sqrt(2),1/sqrt(2),0])
omega_trnsp = [Link](omega)
omega = [Link]([1,0,0])
omega_trnsp = [Link](omega)
Mathematica Code
The tensor is evaluated using Integrate as in previous examples. We use the period
command to multiply the three matrices.
ρ = m/a∧ 3;
Ixx = Iyy = Izz = Integrate[ρ(y ∧ 2 + z ∧ 2), {x, 0, a}, {y, 0, a}, {z, 0, a}];
Print[“(a) When the rotational axis is along cube diagonal, I=”, ω.iCube.ω];
2
(a) When the rotational axis is along cube diagonal, I= a 6m
ω.iCube.ω//Simplify];
2
(b) When the rotational axis is along face diagonal, I= 5a12m
ω = {1, 0, 0};
Print[“(c) When the rotational axis is along edge of cube, I=”, ω.iCube.ω];
2
(c) When the rotational axis is along edge of cube, I= 2a3 m
Figure 11.7: Two coordinate systems with their axes parallel to each other, are shifted in
space relative to each other by a vector a.
Iz = Ix + Iy (11.5.2)
More generally, it is convenient and useful to know the relationship between inertia
tensors expressed in different coordinate systems.
We now prove the parallel axis theorem. Figure 11.7 shows two Cartesian coordinate
systems with origins O and OCM and with their axes parallel to each other. Note that OCM
is located at the object’s center of mass. If a is the vector connecting the two origins, the
relationship of any position vectors ri and r′i in the two coordinate system is:
ri = r′i + a (11.5.3)
Let I be the inertia tensor defined in the coordinate system (x, y, z) with the origin fixed
at point O, and I′ be the inertia tensor for the center of mass coordinate system (x′ , y ′ , z ′ )
with its origin at OCM . We wish to find the relation between I and I′ . As we saw previously
in (11.3.11), the components of the inertia tensor I with respect to O can be written in
compact form as:
!
XN X3
Ikl = mi δkl uis − uik uil
2
(11.5.4)
i=1 s=1
where we again use the compact notation uis (s = 1, 2, 3) to denote the three components
of the mass mi ’s position vector ri = (xi , yi , zi ), and δkl is the Kronecker delta.
Inertia tensor in different coordinate systems − the parallel axis theorem 425
Similarly, the components for the tensor with respect to the second coordinate system
OCM are: !
XN X3
′ ′ 2 ′ ′
Ikl = mi δkl (uis ) − uik uil (11.5.5)
i=1 s=1
X
N h i XN X
N
mi δkl (u′is ) as − mi u′ik al − mi u′il ak
2
+2 (11.5.7)
i=1 i=1 i=1
The last three terms are zero because of the definition of the center of mass:
X
N X
N
mi r′i = 0 =⇒ mi u′is = 0 (11.5.8)
i=1 i=1
The coefficients ak and al factor out of the sums, and (11.5.7) becomes:
" # " #
XN X3 X
N X 3
′ 2 ′ ′
Ikl = mi δkl (uis ) − uik uil + mi δkl as − ak al
2
(11.5.9)
i=1 s=1 i=1 s=1
" #
X
N X
3
′
Ikl = Ikl + mi δkl a2s − ak al (11.5.10)
i=1 s=1
P
The total mass is M = mi , so (11.5.10) gives the generalized parallel axes theorem,
also known as the Steiner theorem, for the elements of the inertia tensor in any coordinate
system:
Note that I′ is the object’s moment of inertia for a coordinate system whose origin is
located at the object’s center of mass.
By applying the parallel axis theorem for the diagonal elements of the tensor so that
δkl = 1, we recover (11.5.1), the simple form of the parallel axis theorem:
′
′
Ikk = Ikk + M a2 − a2k = Ikk + M d2k (11.5.12)
where dk is the shortest distance from the axis of rotation to the center of mass.
426 Rigid Body Motion
where I is the square identity matrix, consisting of ones along the diagonal and zeros
everywhere else. Equation (11.6.4) is called the characteristic equation of our eigenvalue
problem. In Chapter 13, we will revisit the eigenvalue problem in more detail.
There are two steps in finding the eigenvalues and eigenvectors of a given moment of
inertia matrix:
1. Solve the characteristic equation (11.6.4), in order to find the three eigenvalues
λ1 , λ2 , and λ3 . These eigenvalues will depend of course on the physical parameters
of the rigid body.
2. Substitute the first eigenvalue λ1 into I a1 = λ1 a1 , in order to find the corresponding
eigenvector a1 . Next, we repeat this step for each of the remaining eigenvalues in order
to obtain their eigenvector.
At the end of this process, we will have found three eigenvectors a1 , a2 , and a3 and the
corresponding eigenvalues λ1 , λ2 , and λ3 , respectively. The resulting eigenvalues are the
principal moments of inertia and the resulting eigenvectors are the principal axes. The
principal moment of inertia λi is the rigid body’s moment of inertia for a rotation about
the principal axis ai .
The Mathematica and Python codes in Examples 11.7 and 11.8 shows how to evaluate
the principal moments of inertia and principal axes of a cube, with respect to two different
coordinate systems.
Example 11.7:
Find the inertia tensor, principal moments of inertia and principal axes for a cube
with uniform density, mass m, and side a, with respect to a coordinate system defined
by its edges and the origin located at one of the corners.
Solution:
The codes below calculate the elements of the symmetric inertia tensor, by carrying
out the triple integrals from x = 0 to x = a, and similarly for the y and z axes. Note
that we use a = 1 for plotting purposes.
Both codes yield the eigenvalues I1 = I2 = 11 m a2 /12 and I3 = m a2 /6, and the
eigenvectors (−1, 0, 1), (−1, 1, 0) and (1, 1, 1). It is easily verified that these three vectors
are perpendicular to each other.
Python Code
The commands Eigenvects and Eigenvalues from SymPy are used to find the three
eigenvectors and eigenvalues of the inertia tensor. These two commands return a Python
dictionary, together with the multiplicity of each eigenvalue. The eigenvectors are stored
in the parameters vec1, vec2, and vec3 and the commands Poly3DCollection and
quiver produce a 3D plot of the cube and of the three eigenvectors (1, 1, 1), (−1, 1, 0)
and (−1, 0, 1).
428 Rigid Body Motion
fig = [Link]()
ax = fig.add_subplot(projection='3d') # set up 3D plot
[Link](0,0,0,vec1[0],vec1[1],vec1[2],color='r',\
length=1,arrow_length_ratio=.3)
[Link](0,0,0,vec2[0],vec2[1],vec2[2],color='b',\
length=1,arrow_length_ratio=.3)
[Link](0,0,0,vec3[0],vec3[1],vec3[2],color='g',\
length=1,arrow_length_ratio=.3)
shape=[((0,0,0),(1,0,0),(1,1,0),(0,1,0),\
(0,0,0),(0,0,1),(0,1,1),(0,1,0),\
(0,0,0),(0,0,1),(1,0,1),(1,1,1),(0,1,1),\
(0,1,0),(1,1,0),(1,1,1),(1,1,0),(1,0,0),(1,0,1),(0,0,1) )]
cube =Poly3DCollection(shape,color='k',alpha=0.1) # draw the cube
ax.add_collection3d(cube)
[Link]()
Figure 11.8: Eigenvectors of a uniform cube, with respect to a coordinate system defined
by its edges and the origin located at one of the corners, from Example 11.7.
430 Rigid Body Motion
Mathematica Code
The commands Eigenvectors and Eigenvalues are used to find the three eigenvec-
tors and eigenvalues of the inertia tensor. The eigenvectors are stored in the parameters
vec1, vec2, and vec3 and the commands Graphics3D and Arrow are then combined to
produce a 3D plot of the cube and of the 3 eigenvectors in Figure 11.8.
ρ = m/a∧ 3;
{z, 0, a}];
vec1 = Eigenvectors[iCube][[1]];
vec2 = Eigenvectors[iCube][[2]];
vec3 = Eigenvectors[iCube][[3]];
n 2 2 2
o
The Eigenvalues of I are: 11a12 m , 11a12 m , a 6m
The Eigenvectors of I are: {{−1, 0, 1}, {−1, 1, 0}, {1, 1, 1}}
Example 11.8:
Find the inertia tensor, principal moments and principal axes for a cube with uniform
density, mass m, and side a, with respect to a coordinate system with origin at the center
of mass of the cube, and axes parallel to the edges of the cube.
Solution
The codes are very similar to Example 11.7, with the difference being that the
integrations are carried out from x = −a/2 to x = a/2, instead of from x = 0 to x = a
used in Example 11.7.
The codes yield I1 = I2 = I3 = ma2 /6 and the three eigenvectors are the unit
vectors (1, 0, 0), (0, 1, 0) and (0, 0, 1). The principal moments of inertia with respect to
the center of the cube are equal to each other, and the corresponding moment of inertia
matrix is diagonal. This means that if the cube is rotated around any axis through its
center, the scalar moment of inertia will always be the same and equal to I = ma2 /6.
The results are shown in Figure 11.9.
Python Code
print('-'*28,'CODE OUTPUT','-'*29,'\n')
fig = [Link]()
ax = fig.add_subplot(projection='3d') # set up 3D plot
[Link](0,0,0,vec1[0],vec1[1],vec1[2],color='r',\
length=1,arrow_length_ratio=.3)
[Link](0,0,0,vec2[0],vec2[1],vec2[2],color='b',\
length=1,arrow_length_ratio=.3)
[Link](0,0,0,vec3[0],vec3[1],vec3[2],color='g',\
length=1,arrow_length_ratio=.3)
shape=[((-0.5,-0.5,-0.5),(0.5,-.5,-.5),(.5,.5,-.5),(-.5,0.5,-.5),\
(-0.5,-0.5,-0.5),(-.5,-.5,.5),(-.5,.5,.5),(-.5,.5,-.5),\
(-0.5,-0.5,-0.5),(-.5,-.5,.5),(.5,-.5,.5),(.5,.5,.5),(-.5,.5,.5),\
(-.5,.5,-.5),(.5,.5,-.5),(.5,.5,.5),(.5,.5,-.5),(.5,-.5,-.5),\
(.5,-.5,.5),(-.5,-.5,.5) )]
Mathematica Code
ρ = m/a∧ 3;
Ixx = Integrate[(y ∧ 2 + z ∧ 2), {x, −a/2, a/2}, {y, −a/2, a/2}, {z, −a/2, a/2}];
Ixy = Iyz = Ixz = −Integrate[(x ∗ y), {x, −a/2, a/2}, {y, −a/2, a/2}, {z, −a/2, a/2}];
Ixx Ixy Ixz
iCube = ρ ∗ Ixy Iyy Iyz
;
Ixz Iyz Izz
Print[“The tensor I = ”, iCube//MatrixForm];
2
a m
0 0
6
a2 m
The tensor I = 0 6 0
2
a m
0 0 6
vec1 = Eigenvectors[iCube][[1]];
vec2 = Eigenvectors[iCube][[2]];
vec3 = Eigenvectors[iCube][[3]];
n 2 2 2
o
The Eigenvalues of I are: a 6m , a 6m , a 6m
The Eigenvectors of I are: {{0, 0, 1}, {0, 1, 0}, {1, 0, 0}}
{.5, .5, .5}], Dashed, Line[{{−1, 0, 0}, {1, 0, 0}}], Line[{{0, −1, 0}, {0, 1, 0}}],
Figure 11.9: Eigenvectors of a uniform cube, with respect to a coordinate system located at
the center of mass and with coordinate axes parallel to the edges of the cube, from Example
11.8.
dL⟂
r CM
mg
x
y
Figure 11.10: Spinning top precesses at a fixed angle θ due to the gravitational torque. The
top is rotating about its symmetry axis which points in the same direction as L.
Let us take the contact point to be the origin O of the coordinate axes. The total
angular momentum of the spinning top with respect to this origin is the sum of the angular
momentum Lspin (due to the spinning motion) and the angular momentum LCM (due to
the motion of the center of mass about the pivot point):
N = r × mg (11.7.2)
where r is the location of the center of mass relative to the origin. The magnitude of this
torque is equal to:
|N| = |r × mg| = rmg sin θ (11.7.3)
where θ is also the angle between the two vectors r and mg.
The important point about the motion of the spinning top is that this torque will cause
a change in the direction of the angular momentum vector L, while the magnitude of the
vector L will remain constant and equal to:
L = |L| = Iω (11.7.4)
where I is the principal moment of inertia associated with the top’s principal axis that
points in the direction of L, and ω is the magnitude of the angular velocity about the top’s
436 Rigid Body Motion
axis of rotation. The torque N with respect to the pivot point is found from Newton’s
second law of rotation:
dL
N= (11.7.5)
dt
Since the magnitude of L remains constant, this equation can be written as |N| = d|L|/dt
and by combining (11.7.5) and (11.7.3) we obtain:
dL
rmg sin θ = (11.7.6)
dt
During the precession, the component of L perpendicular to the z-axis, labeled L⊥ in Figure
11.10, changes direction. Figure 11.10 shows the location of L⊥ at a time t and a later time
t + dt, with dϕ representing the angle between the initial and final angular momentum
vectors. Since the magnitude L remains constant and the angle dϕ is infinitesimally small,
we can write:
dL dL rmgdt
sin (dϕ) ≃ dϕ = = = (11.7.7)
L⊥ L sin θ Iω
where we used (11.7.6) and (11.7.4).
The angular frequency ΩP of the precession motion is given by the time rate of change
of the angle ϕ:
dϕ
ΩP = (11.7.8)
dt
Finally by combining (11.7.8) and (11.7.7), we obtain:
rmg
ΩP = (11.7.9)
Iω
According to this expression, the precessional frequency for a fast spinning top precessing
at a constant angle θ will depend on these factors: the weight of the top mg, the distance
of the center of mass r from the contact point, the spinning angular frequency ω and the
moment of inertia I around the symmetry axis.
As discussed in Chapter 10, the Earth has an equatorial bulge; therefore, it experiences
a gravitational torque due to the Sun and the Moon. These torques cause the Earth’s axis of
rotation to precess slowly, completing one revolution every 26,000 years. The phenomenon
is called the precession of the equinoxes. One of the results is that Polaris is not always the
North Star, and the star that the Earth’s North Pole points towards changes as the Earth
precesses.
the motion, we are by necessity dealing with noninertial rotating reference frames, and we
can use the techniques from Chapter 10 to describe the motion of the rotating body.
The specific non-inertial frame defined by the principal axes of the rotating body is
called the body coordinate frame, which is the XY Z coordinate system in Figure 11.11, and
it is usually taken to be the principal axes of the object. The inertial X ′ Y ′ Z ′ -frame is called
the space coordinate frame.
Figure 11.11: Motion of a rigid body rotating about the axis AB can be described in two
coordinate systems. The space coordinate frame X ′ Y ′ Z ′ is an inertial coordinate system.
The body coordinate frame XY Z is fixed on, and rotates with the rigid body, and is
therefore a noninertial frame. The body coordinate frame is usually taken to correspond to
the principal axes of the rotating rigid body.
Newton’s second law in an inertial frame of reference says that the time derivative of
the angular momentum L in the inertial frame equals the applied torque N:
dL d
= (Ispace ω) = N (11.8.1)
dt space dt
where Ispace is the moment of inertia tensor calculated in the space (inertial) frame, and ω =
(ω1 , ω2 , ω3 ) is the angular velocity. This equation does not lend itself easily to calculations,
because both Ispace and ω change during the motion. However, the calculation can be
simplified using the body coordinate frame.
Let ê1 , ê2 , and ê3 be the unit vectors of the body frame pointing along the principal
axes of the rotating body, the axes X,Y, and Z in Figure 11.11. In the body coordinate
frame, the moment of inertia tensor is constant and diagonal:
I1 0 0
I = 0 I2 0 (11.8.2)
0 0 I3
where I1 , I2 and I3 are the object’s principal moments of inertia. The angular momentum
in the body frame L can be written as:
where Nk (k = 1, 2, 3) are the components of the applied torque. This system of three cou-
pled differential equations for (ω1 , ω2 , ω3 ) is known as Euler’s equations for a rigid body. In
special cases they can be solved analytically; however, in most cases they must be integrated
numerically, in order to obtain the time dependent functions (ω1 (t) , ω2 (t) , ω3 (t)).
Note that according to (11.9.1), ω3 is constant (ω̇3 = 0). The remaining two equations
can then be written as
I3 − I
ω̇1 = − ω3 ω2
I
(11.9.2)
I3 − I
ω̇2 = ω3 ω1
I
We can define a constant angular frequency Ω such that:
I3 − I
Ω= ω3 (11.9.3)
I
which is constant. Equations (11.9.2) then become
)
ω̇1 = − Ωω2
(11.9.4)
ω̇2 =Ωω1
which are a pair of coupled second-order differential equations. In other words, there are
ω2 terms in the equation for ω̇1 , and vice-versa. The result is that the value of ω1 depends
on ω2 , and the value of ω2 depends on ω1 . To solve this system in closed form, we need
to decouple the equations (i.e., write each of the two equations as an equation of a single
variable) or we need to rewrite the equations as one single differential equation of a single
variable. We will take the latter approach by extending
√ the problem to the complex plane.
If we multiply the ω̇2 equation in (11.9.2) by i = −1 and add the two equations, we obtain
η̇ − iΩη = 0 (11.9.5)
where η = ω1 + iω2 . The solution to (11.9.5) is
η = AeiΩt (11.9.6)
Note that once we introduce complex numbers, the constant in the solution can also be
complex. In that case, we write, A = αeiβ and (11.9.6) becomes
η = αei(Ωt+β) (11.9.7)
where α and β are real constants. The term β is a phase term, and it can be set equal to
zero by choosing an appropriate initial time for the problem. This is similar to observing
a sinusoidal wave as it passes by. By setting the initial time t0 = 0 to be the time when
a crest passes your position, the resulting wave motion can then be described as a cosine
function with the phase equal to zero. In what follows, we continue to use (11.9.6) as the
solution to (11.9.5) with A as a real constant.
Using the Euler relationship for exponentials, we can rewrite (11.9.6) as
Equation (11.9.9) tell us that the projection of ω onto the x1 x2 -plane in the body
frame describes a circle. Hence, ω precesses about the symmetry axis x3 with a precession
frequency Ω. An observer in the body frame will therefore observe ω as tracing out a cone
as shown in Figure 11.12(a). The resulting cone is sometimes called a body cone.
Figure 11.12: Precession of ω about the symmetry axis of the force-free symmetric top as
observed in the (a) body frame and (b) space frame.
Because we are examining the force-free case, the angular momentum L of the top is
constant. Hence an observer in the space frame will see the plane containing ω and e3 (the
top’s symmetry axis) precess about L with a precession frequency Ω′ . It can be shown that
Ω′ = L/I. The cone swept out by the plane containing ω and e3 is sometimes called the
space cone. The space cone is shown in Figure 11.12(b).
In addition to the precession due to the gravitational torques provided by the Sun and
the Moon, the Earth experiences another precession due to the Earth’s oblateness. The
Earth is slightly flattened at the poles due to its rotation (see Chapter 10). The result of
the flattening is that the Earth’s principal moments of inertia are not all identical. The
Earth’s principal moment of inertia about its polar axis is slightly larger than its other two
moments (by about 1 part in 300). Hence (11.9.9) tells us that there should be a precession
with a frequency of ω3 /300 where ω3 is equal to one rotation per day. The result is a small
precession (or wobble) of the Earth’s polar axis with a period of 300 days. The wobble was
discovered by an amateur astronomer Seth Chandler (1846-1913). However, the period is
closer to 400 days because the Earth is not a perfectly rigid rotator.
Chapter summary 441
The tangential velocity v and angular momentum vector ℓ of a mass m are given
by the cross products:
v=ω×r ℓ = r × p = m (r × v)
where r is the position vector and p = mv is the momentum vector.
When the position and velocity vectors are at right angles to each other, we can
write these equations as:
v = ωr ℓ = mrv = mr2 ω = Iω
where I = mr2 is the scalar moment of inertia around the rotational axis. The kinetic
energy of the rotating mass m is found from:
1 2
T = Iω
2
A rigid body is a collection of finite masses mi located at positions ri , with respect
to a coordinate system xyz which is fixed in the body, rotating around a fixed axis AB
with an angular velocity vector ω = (ωx , ωy , ωz ). The tangential velocity vi of mass
mi is given by the cross product:
vi = ω × ri
The angular momentum vector L of a system of particles with masses mi relative
to the center of the mass coordinate system is given by the vector sum of the angular
momenta of the masses:
X X
L= mi (ri × vi ) = mi [ri × (ω × ri )]
In cases where the vectors L and ω do not point in the same direction, the equation
L = Iω does not apply, and we replace the scalar quantity I with the moment of the
symmetric inertia tensor I defined by:
L=I·ω
Ixx Ixy Ixz ωx
I = Iyx Iyy Iyz and ω = ω y
Izx Izy Izz ωz
where the scalars Ikl (k, l = 1, 2, 3) are the components of the inertia tensor I, defined
by: X X
Ixx = mi yi2 + zi2 Ixy = Iyx = − mi xi yi , etc.
The elements of the inertia tensor depend on the choice of origin for the system. For
a mass m with density ρ these elements are given by:
ZZZ ZZZ
Ixx = 2 2
ρ y + z dxdydz Ixy = Iyx = − ρxydxdydz etc.
V V
The kinetic energy and moment of inertia tensor are related by the matrix multiplication
equation:
1 1 T
T = ω · L = (ω) ·I · ω
2 2
442 Rigid Body Motion
T
where (ω) indicates the transpose of the column matrix ω.
The scalar moment of inertia I for rotation around an axis in the direction n̂ of any
unit vector, is found from the inertia tensor using the matrix multiplication equation:
T
In = (n̂) · I · n̂
The parallel axis theorem for scalar moments of inertia states: if I is the scalar moment
of inertia of a body around an axis AB, and ICM is the corresponding moment of inertia
about a second axis parallel to AB and passing through the center of mass at a distance
d, then I and ICM are related by:
I = ICM + md2
The generalized parallel axis theorem between moment of inertia tensors is as follows:
If I is the inertia tensor defined in a coordinate system with the origin fixed at point
O, and I′ is the inertia tensor defined in a center-of mass coordinate system with its
origin at the center-of-mass OCM and whose axes are parallel to the previous coordinate
system, then the elements of the tensors I and I′ are related by:
′
Ikl = Ikl + M a2 δkl − ak al
L = I · ω = λω
1. Human walking can be modeled as a swinging simple pendulum pivoting at the hip
joint. Estimate the period of this simple pendulum. Make reasonable numerical esti-
mates for the model, and neglect the effect of knee joints.
2. Find the principal axes and principal moments of inertia for a system of two masses
m1 , m2 connected by a massless rigid rod of length l.
3. A cylinder has mass m and radius R, and is attached to a hanging mass m. The
cylinder rolls without slipping upwards on an inclined plane, as shown in Figure 11.13.
A massless string is wrapped around the cylinder.
a. Find the magnitude and direction of the acceleration of the hanging mass.
b. What are the magnitude and direction of the force of static friction at the contact
point between the cylinder and the inclined plane?
Use a CAS to solve the system of equations.
Figure 11.13: Cylinder on an inclined plane attached to a hanging mass, in Problem 11.3.
4. A uniform hoop of mass m and radius R hangs in a vertical plane and is supported
by a nail at a point on the circumference, as shown in Figure 11.14. Calculate the
natural frequency of small oscillations.
Figure 11.14: Uniform hoop supported by a nail, located at the blue circle (in the e-book),
in Problem 11.4.
5. Baseball players always try to hit what is known as the sweet spot on the baseball
bat. The sweet spot is where the hit delivers the most energy to the ball, and at the
same time minimizes the force on the hands of the player. To describe the physics
of the sweet spot, the baseball bat can be assumed to be rotating in space around a
pivot point at its end without linear displacement, as shown in Figure 11.15. At what
distance D along the baseball bat is the sweet spot located?
444 Rigid Body Motion
Figure 11.15: Baseball bat hitting a baseball at the sweet spot D away from the pivot point,
in Problem 11.5.
6. A torsion pendulum consists in general of a mass m hanging from a wire that can
be twisted, producing a torque N = Iα proportional to the angle θ describing the
twisting. A torsion pendulum satisfies an equation similar to Hooke’s Law:
I1 θ̈ + Aθ = 0
where I1 is the moment of inertia of the attached object around the rotational axis,
and A is the torsion coefficient describing the stiffness of the wire. Consider the torsion
pendulum shown in Figure 11.16, which consists of a thin disk of radius R and mass
M , with a cylindrical mass M of radius R/4 placed on top of the disk. Find the ratio of
the periods of this torsion pendulum, with and without the presence of the cylindrical
mass on top of the thin disk.
7. A bowling ball of uniform density is thrown along a horizontal alley with initial velocity
v0 in such a way that it initially slides without rolling. The ball has mass m, the
coefficient of static friction with the floor is µs , and the coefficient of sliding friction
with the floor is µk . Compute how far the ball will slide before it starts rolling. You
can ignore the effect of air resistance.
8. A coin with radius R and mass m is spinning about its axis of symmetry through its
center with angular frequency ω0 as shown in Figure 11.17a. The coin is placed down
on a horizontal surface as shown in Figure 11.17b. The coin stops slipping and starts
rolling away. What is the velocity of the coin when it rolls away?
End-of-chapter problems 445
(a) (b)
9. A wheel of mass M and radius R is projected along a horizontal surface with an initial
linear velocity v0 and an initial angular velocity ω0 , as shown in Figure 11.18. The
wheel starts sliding along the surface. Let the coefficient of friction between the wheel
and the surface be µ.
a. How long does it take for the wheel to stop sliding?
b. What is the velocity of the center of mass of the wheel when the sliding stops?
10. A solid uniform cylinder of mass m and radius R is placed on a plane inclined at angle
θ with respect to the horizontal, as shown in Figure 11.19. Let a be the acceleration
of the axis of the cylinder along the incline. The coefficient of friction between the
cylinder and plane is µ. For θ less than some critical angle θc , the cylinder will roll
down the incline without slipping.
a. What is the critical angle θc ?
b. What is the acceleration a for angles less than the critical angle?
11. A wheel of radius R and moment of inertia I is mounted on a frictionless axle through
its center. A flexible, weightless cord is wrapped around the rim of the wheel and
carries a body of mass M which begins descending as shown in Figure 11.20. What is
the tension in the cord?
12. A thin uniform stick of mass m is resting with its bottom end on a frictionless table.
The stick is released from rest at an angle θ0 with respect to the vertical, as shown in
Figure 11.21. Find the force exerted by the table upon the stick at an infinitesimally
small time after its release.
Figure 11.21: Thin uniform stick in the process of falling over, in Problem 11.12.
Figure 11.22: Billiard ball being struck by a horizontal cue, in Problem 11.14.
15. A square plate with mass m and side a, has a uniform mass density and lies on
the xy-plane of a xyz coordinate system, with the origin located at one of its corners.
The square plate has a thickness b.
a. Find the moment of inertia tensor of the square plate with respect to this coor-
dinate system.
b. Find the principal moments of inertia and principal axes for this plate, when the
thickness b << a , i.e., when the plate is very thin.
16. Two equal point masses M are connected by a massless rigid rod of length 2b,
to form a dumbbell. Choose a coordinate system in which the dumbbell is on the
xy-plane at an angle ϕ with respect to the x-axis, and with the origin located at the
center of mass of the dumbbell, as shown in Figure 11.23. The angular velocity ω of
rotation around the z-axis is a constant in time.
a. Calculate the elements of the inertia tensor for this coordinate system.
b. Find and discuss the principal axes and principal moments of inertia.
Figure 11.23: Two point masses connected by a massless rod, in Problem 11.16.
17. Find the principal moments of inertia and principal axes for a uniform cylinder of
height H and radius R, with respect to a coordinate system located at the center of
mass of the cylinder.
448 Rigid Body Motion
18. Four masses all with mass m, lie in the xy-plane at positions (x, y) =
(a, 0), (−a, 0), (0, +2a), and (0, −2a). These are joined by massless rods to form
a rigid body.
a. Find the moment of inertia tensor using the xyz-axes as a reference system.
b. Consider a direction given by a unit vector n̂ that makes equal angles with the
positive xyz-axes. Find the moment of inertia for rotation about this axis.
c. Find the angular momentum with respect to the unit vector n̂.
19. A compound pendulum has mass m and principal moments of inertia I1 , I2 , and I3 .
The pendulum oscillates about a horizontal axis which makes angles α, β, and γ with
respect to the principal axes of inertia. Show that the period of small oscillations is
r
mgd
T = 2π
I
where d is the distance from the center of mass to the axis of rotation, and
20. A spherical ball of mass m and radius r rolls without slipping on a track as shown in
Figure 11.24. Find the minimum height h above the top position in the loop that will
permit the ball to maintain constant contact with the rail of the loop.
21. A uniform plank of length 2a is held temporarily so that one end leans against a
frictionless vertical wall, and the other end rests on a frictionless floor making an
angle θ0 with the floor, as shown in Figure 11.25. When the plank is released, it will
slide down under the influence of gravity. Show that the time t that it will take the
plank to reach a new angle θ is:
Z t
dθ
t= q
2a (sin θ0 − sin θ)
0 3g
End-of-chapter problems 449
Figure 11.25: Uniform plank temporarily leaning against a frictionless vertical wall, in Prob-
lem 11.21.
22. A uniform solid ball of radius a rolls with velocity v on a level surface, and it collides
inelastically with a step of height h < a, as shown in Figure 11.26. Find the minimum
velocity for which the ball will “trip” up over the step. Assume that no slipping occurs
at the impact point.
23. A particle of mass m and speed v collides elastically with the end of a uniform thin
rod of mass M and length L as shown in Figure 11.27. The collision takes place on a
horizontal surface, so gravity can be ignored. Show that if mass m is stationary after
the collision, then M = 4m.
Figure 11.27: Particle colliding with the end of a uniform thin rod, in Problem 11.23.
24. Solve the following problems involving different physical pendulums. A physical pen-
dulum is a rigid body that swings freely about some pivot point.
450 Rigid Body Motion
26. A thin disk of radius R and mass M lying in the xy-plane has a point mass
m = 5M/4 attached on its edge as shown in Figure 11.28. We ignore gravity.
a. Show that the moment of inertia tensor of the disk about its center of mass is:
2 1 0 0
MR
I= 0 1 0
4
0 0 2
b. Find the moment of inertia tensor of the combination of disk and point mass
when the system rotates around the pivot point A at the origin, in the coordinate
system shown in Figure 11.28.
c. Find the principal moments and the principal axes.
Figure 11.28: Thin disk with a point mass (solid dot) attached at the edge, in Problem
11.26.
27. A torsion pendulum consists of a vertical wire attached to a cube which may rotate
about the vertical. The cube is hung from a corner, then it is hung from midway
along an edge, and finally it is hung from the middle of a face. In each case, the
cube is allowed to oscillate around the pivot point. Which one of the three periods of
oscillation of the cube is largest?
End-of-chapter problems 451
28. Consider a rotating object which is not experiencing any external torques. Using
Euler’s equations, show that the magnitude of the angular momentum is constant.
Show also that the rotational kinetic energy is constant. Use a CAS to carry out the
algebra.
29. A thin rectangular plate has dimensions a and b. Find the torque required to rotate
this plate with constant angular velocity ω around one of its diagonals.
30. A uniform rigid wheel is located on the xy-plane, and has principal moments of
inertia I1 = I2 ̸= I3 about its body-fixed principal axes x̂1 , x̂2 and x̂3 as shown in
Figure 11.29. The wheel is attached at its center of mass to a bearing which allows
frictionless rotation about one space-fixed axis. The wheel is “dynamically balanced”,
i.e., it can rotate at constant ω, so that it can exert no torque on its bearing.
a. Examine and integrate the Euler equations, first without any given initial con-
ditions, and secondly by using the initial conditions ω1 (0) = 1 and ω2 (0) = 0.
b. What conditions must the components of ω satisfy for this dynamically balanced
system? Discuss the motion.
Figure 11.29: Uniform rigid wheel rotating around the axis ω, in Problem 11.30.
12 Coupled Oscillations
In this chapter, we explore the properties of coupled harmonic oscillators. These systems
can be analyzed by using either the Lagrangian approach of Chapter 8, or alternatively
using Newton’s second law. The simplest form of these systems in mechanics contains two
masses connected by springs to each other. A second simple example of coupled mechanical
oscillators is the double pendulum, which also exhibits a wide range of interesting behaviors.
We will see that these simple oscillating systems can exhibit normal modes of oscillation,
which are patterns of motion in which all parts of the system move sinusoidally with the
same frequency. The frequencies of the normal modes of a system are known as its natural
frequencies of oscillation. We will find that any motion exhibited by the system can be
expressed as a linear combination of these normal modes.
The discussion of the two-mass system will lead us to a more general description of lin-
early coupled harmonic systems, and how their equations of motion can be written in matrix
form. The best way to obtain solutions to the equations of motions for coupled oscillations
is by using standard techniques from Linear Algebra, in order to find the eigenvalues and
eigenvectors of a matrix. The eigenvectors and eigenvalues of the matrix characterizing the
oscillating system are closely related to its normal modes.
This chapter will conclude with a general treatment of coupled oscillations, and a dis-
cussion of normal coordinates.
Figure 12.1: System of two coupled harmonic oscillators consisting of two masses m1 and
m2 connected with three springs with constants k1 , k2 , and k3 .
Let us denote by x1 (t) and x2 (t) the horizontal displacements of the two masses from
their respective equilibrium points. The force on the first mass due to the first spring is
−k1 x1 . The middle spring will be stretched by a distance (x1 − x2 ), and the force on the
first mass due to this middle spring will be −k2 (x1 − x2 ). The total force on the first mass
must then be F1 = −k1 x1 − k2 (x1 − x2 ). Similarly, the force on the second mass due to the
middle spring is −k2 (x2 − x1 ), and the force on the second mass due to the third spring
will be −k3 x2 .
453
454 Coupled Oscillations
Using the notation ẍ for acceleration, the equations of motion from Newton’s second
law F = ma for the two masses are:
)
m1 ẍ1 = −k1 x1 − k2 (x1 − x2 )
(12.1.1)
m2 ẍ2 = −k2 (x2 − x1 ) − k3 x2
In a more general way, we can obtain the same equations by starting with the Lagrangian
formulation of Chapter 8. The potential energies of the two end springs are V1 = k1 x21 /2
and V3 = k3 x22 /2, while the potential energy for the middle spring is V2 = k2 (x1 − x2 )2 /2,
so that the Lagrangian is equal to:
1 1 1 1 1
L = T − VT otal = m1 x˙1 2 + m2 x˙2 2 − k1 x21 − k3 x22 − k2 (x1 − x2 )2 (12.1.2)
2 2 2 2 2
The Euler-Lagrange equations are:
d ∂L ∂L
− =0 → m1 ẍ1 = −k1 x1 − k2 (x1 − x2 ) (12.1.3)
dt ∂ ẋ1 ∂x1
d ∂L ∂L
− =0 → m2 ẍ2 = −k2 (x2 − x1 ) − k3 x2 (12.1.4)
dt ∂ ẋ2 ∂x2
These are of course the same equations as in (12.1.1).
Example 12.1: Numerical solution for the general case of two coupled
oscillating masses
Integrate (12.1.1) for k1 = 4 N/m, k2 = 2 N/m, k3 = 3 N/m, m1 = 1 kg, m2 = 2 kg
and plot the numerical solutions x1 (t) and x2 (t), with the initial conditions x1 (0) = 0,
x2 (0) = 1 m, ẋ1 (0) = 0 and ẋ2 (0) = 0. This situation corresponds to the case where the
first mass m1 is initially at rest at its equilibrium position (x1 (0) = 0 and ẋ1 (0) = 0),
and the second mass is pulled a distance a = 1 meter from its equilibrium and released
from rest (ẋ2 (0) = 0).
Solution:
In this example we use the NDSolve command in Mathematica, and the odeint
library in Python to numerically solve the system of differential equations, and to obtain
the numerical solutions x1 (t) and x2 (t).
The plots of x1 (t) and x2 (t) in Figure 12.2 are obviously complex, and it is not
possible to give a simple physical description of the motion of the two masses. The key
physical component which creates this complex behavior is the middle spring in Figure
12.1, since this is the component that couples the motion of the two masses.
Coupled oscillations of a two-mass, three-spring system 455
Python Code
As usual for solving second-order ODEs with Python, we define a vector X =
[x1,y1,x2,y2] where y1,y2 represent the speeds v1 = dx1 /dt and v2 = dx2 /dt.
We use the command odeint and define a function solvODE whose input are X
and the time array t, and the output is an array soln with columns representing
x1 (t), dx1 /dt, x2 (t), dx2 /dt. The plots of x1 (t) and x2 (t) are shown in Figure 12.2.
import numpy as np
from [Link] import odeint
import [Link] as plt
[Link](1,2,1)
[Link](t, soln[:,0])
[Link]('(a) x1(t)')
[Link](1,2,2)
[Link](t, soln[:,2])
[Link]('(b) x2(t)')
plt.tight_layout()
[Link]()
456 Coupled Oscillations
Mathematica Code
We use NDSolve to solve the system of ODEs from t = 0 to t = 20 s.
The numerical values for the parameters m1 , m2 , k1 , k2 , and k3 are needed in
order to plot the solutions using the Plot and GraphicsGrid commands.
SetOptions[Plot, BaseStyle->{FontSize->14}];
k1 = 4; k2 = 2; k3 = 3; m1 = 1; m2 = 2;
0.5 0.5
5 10 15 20 5 10 15 20
-0.5 -0.5
-1.0
Figure 12.2: Plots of the positions x1 (t), x2 (t) of the two masses for the two-mass three-
spring system, from Example 12.1.
The minus sign in x2 (t) tells us that the two masses will move together with the same
speed, but they will be completely out of phase as shown in Figure 12.3ab. p
The frequency of oscillation for both masses in this situation is ω2 = 3k/m.
This situation is referred to as the antisymmetric oscillation of the system.
(b) In this situation the two masses are pulled the same distance a from their
corresponding equilibrium, and they are released from rest (ẋ1 (0) = 0 and ẋ2 (0) = 0).
The analytical solutions are
p
x1 (t) = x2 (t) = a cos k/m t
This tells us that if the two masses are initially displaced from equilibrium by the same
distance and released from rest, the two masses will move together with the same speed
and in phase, as if the middle spring was not present. This makes physical sense, since
in this situation the middle spring will be unstretched from its natural length, and will
remain unstretched during the motion of the two masses. p
The frequency of oscillation for both masses in this situation is ω1 = k/m, i.e.,
the same frequency as if only one of the two masses were attached to a single spring
with a spring constant k.
This situation is referred to as the symmetric oscillation of the system.
Python Code
(a) We use the command dsolve_system in SymPy to solve analytically the sys-
tem of ODEs with the given initial conditions. The command lambdify converts the
symbolic answer x1 (t) and x2 (t) into NumPy arrays which are plotted in Figures 12.3a
and 12.3b.
(b) We use the same code (not shown here) and change only the initial conditions
x1 (0) = a, x2 (0) = a, ẋ1 (0) = 0 and ẋ2 (0) = 0. The positions x1 (t) and x2 (t) are
plotted in Figures 12.3c and 12.3d.
458 Coupled Oscillations
[Link](x1soln(xvals),label='(a) x1(t)')
[Link](x2soln(xvals),'r--',label='(b) x2(t)')
[Link]('Time t [s]')
[Link]('x1(t), x2(t)')
[Link]()
[Link]()
x2(t) = -a*cos(sqrt(3)*sqrt(k)*t/sqrt(m))
Coupled oscillations of a two-mass, three-spring system 459
Mathematica Code
We use DSolve to solve symbolically the system of differential equations, and
ExpToTrig is used to convert the solutions into trig functions. Note also the use of
the Simplify command.
SetOptions[Plot, BaseStyle->{FontSize->14}];
sol =
numValues = {a → 1, k → 1, m → 1};
nn h√ √ i h √ √ ioo
x1[t] → aCos √3 kt
m
, x2[t] → −aCos 3 kt
√
m
PlotStyle->Dashed];
sol =
numValues = {a → 1, k → 1, m → 1};
nn h√ i h √ ioo
x1[t] → aCos √kt
m
, x2[t] → aCos √kt
m
PlotStyle->Dashed];
0.5 0.5
2 4 6 8 10 2 4 6 8 10
-0.5 -0.5
-1.0 -1.0
(c) x1[t] (d) x2[t]
1.0 1.0
0.5 0.5
2 4 6 8 10 2 4 6 8 10
-0.5 -0.5
-1.0 -1.0
Figure 12.3: (a),(b) Plots of the antisymmetric normal mode of the two-mass three-spring
system, from Example 12.2. The two masses in this case are completely out of phase and
x1 (t) = −x2 (t). (c),(d) Plots of the symmetric normal mode of the system, in which the
two masses are completely in phase and x1 (t) = x2 (t).
Example 12.2 showed that the system of two equal masses p and three identical
p springs
in Figure 12.1 has two natural frequencies given by ω1 = k/m and ω2 = 3k/m. By
properly choosing the initial conditions in the system as in the two examples, we can force
both masses to oscillate with a single frequency, either ω1 or ω2 . In these special situations,
the two natural frequencies are uncoupled from each other, and we say that these are the
normal modes of the oscillating system.
Figure 12.4 shows schematically the p motion of the two masses in either the symmetric
oscillation pattern with
p frequency ω 1 = k/m (left panel), or an antisymmetric oscillation
with frequency ω2 = 3k/m (right panel).
(a) (b)
Example 12.3: Analytical solutions for equal masses and identical springs;
decoupling of the two frequencies
Integrate (12.1.1) for identical springs and identical masses, with the initial condi-
tions x1 (0) = 0, x2 (0) = a, ẋ1 (0) = 0 and ẋ2 (0) = 0.
Solution:
In this case, the second mass in Figure 12.1 is moved from equilibrium by a distance
a and is released from rest. The first mass is initially at rest at its equilibrium position.
The analytical solutions obtained from the CAS are
h p p i
x1 (t) = (a/2) cos k/m t − cos 3k/m t
h p p i
x2 (t) = (a/2) cos k/m t + cos 3k/m t
and these are shown in Figures 12.5 (a) and (b) below. Once more, the functions
x1 (t) and x2 (t) are complicated, and it is difficult to describe how exactly the two
masses are moving. This is because mathematically both x1 (t) and x2 (t) contain the
frequencies ω1 and ω2 .
Figures 12.5 (c) and (d) show plots of the function
p
x1 (t) + x2 (t) = a cos k/m t
p
x1 (t) − x2 (t) = −a cos 3k/m t
By using these linear combinations, it is now possible to decouple the two normal modes,
so that the motions
p shown in Figures
p 12.5 (c) and (d) are simple cosine functions with
frequencies ω1 = k/m and ω2 = 3k/m.
Python Code
We use the command dsolve_system in SymPy to solve analytically the system of
ODEs with the given initial conditions. The command lambdify converts the symbolic
answer x1 (t) and x2 (t) into NumPy arrays which are plotted in four panels.
462 Coupled Oscillations
x1(t) =
a*(cos(sqrt(k)*t/sqrt(m)) - cos(sqrt(3)*sqrt(k)*t/sqrt(m)))/2
x2(t) =
a*(cos(sqrt(k)*t/sqrt(m)) + cos(sqrt(3)*sqrt(k)*t/sqrt(m)))/2
Coupled oscillations of a two-mass, three-spring system 463
Mathematica Code
We use DSolve to solve symbolically the system of differential equations, and
ExpToTrig is used to convert the solutions into trig functions.
sol =
numValues = {a → 1, k → 1, m → 1};
n h√ i h √ √ i h√ i h √ √ io
x1[t] → 12 a Cos √kt
m
− Cos 3 kt
√
m
, x2[t] → 1
2 a Cos √kt + Cos
m
3 kt
√
m
Figure 12.5: Plots of the positions (a) x1 (t), (b) x2 (t), (c) x1 (t) + x2 (t) and (d) x1 (t) − x2 (t)
of the two-mass, three-spring system from Example 12.3.
In Example 12.4 we examine one more interesting behavior of the two-mass, three-
spring system, the case of weakly coupled oscillators. In this example the weak coupling
is established by choosing a middle spring with smaller spring constant than the two end
springs (k1 = k3 = k and k2 << k).
In the next two sections, we develop a more formal mathematical analysis of the normal
modes for the system in Figure 12.1, by using the techniques of Linear Algebra.
Normal mode analysis of the two-mass, three-spring system 465
0.5 0.5
20 40 60 80 20 40 60 80
-0.5 -0.5
-1.0 -1.0
(c) x1[t]+x2[t] (d) x1[t]-x2[t]
1.0 1.0
0.5 0.5
20 40 60 80 20 40 60 80
-0.5 -0.5
-1.0 -1.0
Figure 12.6: Plots of the positions (a) x1 (t) and (b) x2 (t), (c) x1 (t) + x2 (t) and (d) x1 (t) −
x2 (t) of the weakly coupled two-mass, three-spring system, from Example 12.4.
where A1 and A2 are the unknown amplitudes of oscillation for the two masses, and ω is
the unknown frequency of oscillation. Substituting these into the matrix equation (12.2.2):
m 0 −ω 2 A1 eiωt −2k k A1 eiωt
= (12.2.4)
0 m −ω 2 A2 eiωt k −2k A2 eiωt
By canceling the exponential factor eiωt which is common to all terms, and combining the
matrices, we obtain:
−ω 2 m + 2k −k A1 0
= (12.2.5)
−k −ω 2 m + 2k A2 0
This matrix equation represents a system of equations. A theorem from Linear Algebra says
that if the determinant of the matrix is non-zero, then there is a unique solution, which in
this case is the trivial solution A1 = A2 = 0. However, in order for multiple solutions to
exist, the determinant of the matrix must be zero. We are interested in a nontrivial solution
A1 , A2 ̸= 0, so we solve for the values of ω which cause the determinant to be zero.
We set the determinant of the matrix equal to zero:
−ω 2 m + 2k −k
det =0 (12.2.6)
−k −ω 2 m + 2k
ω 2 m − 2k ω 2 m − 2k − k 2 = 0 (12.2.7)
Solving for ω, we obtain four possible solutions, only two of which are positive:
r r
k 3k
ω1 = , ω2 = (12.2.8)
m m
This completes the first part of the analysis, where we determined the two natural frequen-
cies ω1 and ω2 . In the previous section, we found that oscillatory solutions to our system of
equations can contain one or both of these two frequencies.
In order to complete the description of the system, we mustq also find the two unknown
k
amplitudes of oscillation A1 and A2 . If we substitute ω1 = m into the matrix equation
(12.2.6), we obtain:
q 2
k
m − 2k k
m A1 −k k A1
q 2 (12.2.9)
A2 = k −k A2
=0
k k
m m − 2k
Since A1 = A2 and x1 (t) = x2 (t), this type of motion corresponds to both masses moving
in the same direction and in phase at all times, as we saw previously in Figure 12.4a. This
type of motion is known as the first normal mode or the symmetric mode of oscillation,
and the general motion of the system in this mode can be written in terms of trigonometric
functions:
x1 (t) = x2 (t) = D1 cos (ω1 t − ϕ1 ) (12.2.13)
In matrix notation, the first normal mode can be written as:
x1 (t) 1
= D1 cos (ω1 t − ϕ1 ) (12.2.14)
x2 (t) 1
By working
p in a similar fashion for the second natural frequency of the system, we substitute
ω2 = 3k/m into (12.1.1), and obtain A1 = −A2 . Since A1 = −A2 , this type of motion
corresponds to the two masses moving in opposite directions, while the center of mass
remains stationary, as shown in Figure 12.4b. This type of motion is known as the second
normal mode or the antisymmetric mode of oscillation. p
We can then write the second possible solution corresponding to ω2 = 3k/m as:
x1 (t) 1
= D2 cos (ω2 t − ϕ2 ) (12.2.15)
x2 (t) −1
Python Code
We enter the ODEs for the variables x1 (t), x2 (t) to obtain the symbolic equations
eq1 and eq2. The matrix A is formed from the coefficients A1 , A2 of eq1 and eq2, using
the .coeff() method.
468 Coupled Oscillations
The natural frequencies are found using the solve command in SymPy to solve the
characteristic equation det(A)=0.
print('-'*28,'CODE OUTPUT','-'*29,'\n')
Mathematica Code
The code follows the same steps in the analytical solution and in the above Python
code, by evaluating the elements of the matrix
p and solving thepcharacteristic equation
det(A)=0 to obtain the frequencies ω1 = k/m and ω2 = 3k/m. The command
Coefficient is used to find the elements of the matrix.
Print[Solve[Det[A]==0, ω]]
The
nn natural frequencies√are:
√ o n o n √ √ o n √ √ oo
ω → − √m k
, ω → √m k
, ω → − √3mk , ω → 3 k
√
m
Figure 12.1:
m1 ẍ1 = −k1 x1 − k2 (x1 − x2 ) m2 ẍ2 = −k2 (x2 − x1 ) − k3 x2 (12.2.16)
or after dividing the first equation by m1 , and the second equation by m2 :
k1 k2 k2 k3
ẍ1 = − x1 − (x1 − x2 ) ẍ2 = − (x2 − x1 ) − x2 (12.2.17)
m1 m1 m2 m2
By substituting a trial solution of the form x1 (t) = A1 eiωt and x2 (t) = A2 eiωt and canceling
the common factor eiωt , these equations yield:
k1 k2 k2 k3
− A1 ω 2 = − A1 − (A1 − A2 ) − A2 ω 2 = − (A2 − A1 ) − A2 (12.2.18)
m1 m1 m2 m2
These can be written in compact matrix form as:
k1 +k2 −k2
m1 m1 A1 A1
= ω2 (12.2.19)
−k2 k2 +k3
m m
A2 A2
2 2
You will recognize that this equation is an eigenvalue problem in the theory of Linear
Algebra, similar to the eigenvalue problems we encountered for the moment of inertia matrix
in Chapter 11.
For the two-mass system of Figure 12.1, the eigenvalue problem to be solved becomes
clear by writing (12.2.19) in this matrix form:
GA = ω 2 A (12.2.20)
−k2
k1 +k2
m1 m1
A1
A= G=
A2 −k2 k2 +k3
m2 m2
We are looking for the eigenvalues λ = ω 2 of the square matrix G, which will give us the
natural frequencies of oscillation. We are also looking for the corresponding eigenvectors A,
which will give us the normal modes of oscillation corresponding to each natural frequency.
In order for the eigenvalue equation (12.2.20) to have a nontrivial solution (A ̸= 0), we must
have: k1 +k2
−k2
m1 − ω
2
m1
det =0 (12.2.21)
−k2
m2
k2 +k3
m2 − ω 2
which is the characteristic equation of our eigenvalue problem. From this point on, we
proceed by following the same two-step method used in the previous section. First, we must
solve the characteristic equation (12.2.21) in order to find the frequencies ω1 and ω2 . These
frequencies will depend on k1 , k2 , k3 , m1 , and m2 . In the next step, we substitute the
first natural frequency ω1 into (12.2.19), in order to find (A1 , A2 ), the first normal mode.
Finally, we repeat the previous steps using the second natural frequency ω2 , in order to find
(A1 , A2 ) for the second normal mode.
The Mathematica and Python codes in Example 12.6 show how to find the eigenvectors
and eigenvalues for two different cases of the two-mass system in Figure 12.1.
Normal mode analysis of the two-mass, three-spring system 471
print('-'*28,'CODE OUTPUT','-'*29,'\n')
k, m = symbols('k, m')
A = Matrix([[2*k/m,-k/m],[-k/m,2*k/m]])
omega_sq = list([Link]().keys())
eigenvects = list([Link]())
print('-'*28,'CODE OUTPUT','-'*29,'\n')
A = Matrix([[2*k/m1,-k/m1],[-k/m2,2*k/m2]])
omega_sq = list([Link]())
eigenvects = list([Link]())
2 ∗ k/m −k/m
A= ;
−k/m 2 ∗ k/m
2 ∗ k/m1 −k/m1
A= ;
−k/m2 2 ∗ k/m2
np o
rule = m12 − m1m2 + m22 ->z ;
Sqrt[Eigenvalues[A]]/.rule]
q q
k(m1+m2−z) k(m1+m2+z)
The frequencies after the z-substitution are: m1m2 , m1m2
Eigenvectors[A]/.rule//Simplify]
The eigenvectors are: m1−m2+z
m1 , 1 , − −m1+m2+z
m1 ,1
and evaluating the natural frequencies. In Subsection 12.3.1, we will develop the Lagrangian
and the equations of motion. In Subsection 12.3.2, we will find the analytical solution for
the special case of two identical coupled pendula. In Subsection 12.3.3, we will treat the
double pendulum as an eigenvalue problem, and show how to obtain the natural frequencies
and the amplitudes of the normal modes.
1 1 1
T1 = m1 ẋ21 + ẏ12 = m1 L21 cos2 θ1 θ̇12 + L21 sin2 θ1 θ̇12 = m1 L21 θ̇12 (12.3.1)
2 2 2
The location (x2 , y2 ) of m2 is shifted with respect to the first mass by (x1 , y1 ), so that
(x2 , y2 ) = (L1 sin θ1 + L2 sin θ2 , L1 cos θ1 + L2 cos θ2 ). Therefore, the kinetic energy of the
second mass is:
1
T2 = m2 ẋ22 + ẏ22 (12.3.2)
2
1 d 2 d 2
= m2 (L1 sin θ1 + L2 sin θ2 ) + (L1 cos θ1 + L2 cos θ2 ) (12.3.3)
2 dt dt
+x
+y L1
θ1
m1
L2
θ2
m2
Figure 12.7: The double pendulum oscillator is characterized by the two angles (θ1 (t), θ2 (t)).
1 1
(m1 + m2 ) L21 θ̇12 + m2 L1 L2 θ̇1 θ̇2 + m2 L22 θ̇22
T = (12.3.6)
2 2
The total potential energy V is the sum of potential energies for each pendulum:
(m1 + m2 ) −L1 ω 2 + g A1 − m2 L2 ω 2 A2 = 0 (12.3.15)
−m2 L1 ω 2 A1 − m2 L2 ω 2 − g A2 = 0 (12.3.16)
This system of linear equations for A1 and A2 will have a nontrivial solution, only if the
determinant is zero:
(m1 + m2 ) −L1 ω 2 + g −m 2 L2 ω
2
det =0 (12.3.17)
−m2 L1 ω 2 −m2 L2 ω 2 − g
Double pendulum 477
In principle, we can obtain the solution to this characteristic equation; however, the resulting
algebraic expressions are very complicated. So instead of looking at the completely general
solution, let us look at the special case of equal lengths (L1 = L2 = L), and identical masses
(m1 = m2 = m). In this special case, (12.3.17) becomes:
2m −Lω 2 + g −mLω
2
det =0 (12.3.18)
−mLω 2 −m Lω 2 − g
which gives the two possible solutions:
r r
√ g √ g
ω1 = 2+ 2 ω2 = 2− 2 (12.3.19)
L L
As in the case of the two-mass, three-spring oscillators, this completes the first part of the
analysis, where we determined the frequencies ω1 and ω2 of the normal modes. In order
to complete the description of the system, we must also q find the two unknown amplitudes
√
of oscillation A1 and A2 . Substituting the value of ω1 = 2 − 2 g/L into (12.3.15), we
find:
n √ g o √ g
2m −L 2 − 2 + g A1 − mL 2 − 2 A2 = 0 (12.3.20)
L L
Simplifying and canceling the common factors:
√
A1 2− 2 1
= √ = −√ (12.3.21)
A2 2 −1 + 2 2
q √ √
The solution for ω1 = 2 − 2 g/L is then A2 = 2A1 , and we can write the first
possible solution corresponding to the first normal mode:
√ √
θ1 (t) = A1 eiω1 t θ2 (t) = 2θ1 (t) = 2A1 eiω1 t (12.3.22)
√ √
Since A2 = 2A1 and θ2 (t) = 2θ1 (t), this type of motion corresponds to both masses
moving in the same direction and in phase at all times, √ as shown in Figure 12.8a. The
amplitude of the second pendulum must be equal to 2 times larger than the amplitude
of the first pendulum. This is the first normal mode or the symmetric mode of oscillation,
and the general motion of the system in this mode can be written as a linear combination
of trigonometric functions:
√
θ2 (t) = 2θ1 (t) cos (ω1 t − ϕ1 ) (12.3.23)
In matrix notation, the first normal mode can be written as:
θ1 (t) 1
= D1 √ cos (ω1 t − ϕ1 ) (12.3.24)
θ2 (t) 2
q √
By working in a similar manner with the second frequency ω2 = 2+ 2 g/L, we find:
θ1 (t) −1
= D2 √ cos (ω2 t − ϕ1 ) (12.3.25)
θ2 (t) 2
This is the second normal mode or the antisymmetric mode of oscillation, in which both
masses moving in the same direction completely out of phase
√ at all times, as shown in Figure
12.8b. The amplitude of the second pendulum is again 2 times larger than the amplitude
of the first pendulum.
478 Coupled Oscillations
Figure 12.8: Symmetric and antisymmetric normal modes of small angle oscillations for the
double
q pendulum with equal masses and equal lengths. The two natural frequencies are
√ √
ω= 2 ± 2 g/L, and the amplitudes are related by A2 = ± 2A1 .
The above results can be obtained using a CAS, as shown in Example 12.7.
Example 12.7: The natural frequencies and normal modes of the double
pendulum
Find the natural frequencies of the double pendulum with equal masses and equal
lengths.
Solution:
When m1 = m2 = m and L1 = L2 = L, the system of equations (12.3.15) and
(12.3.16) can be written in matrix form as:
−2m Lω 2 − g −mLω 2 A1 0
=
−mLω 2 −m Lω 2 − g A2 0
Once more, we accept only the two positive values of the natural frequency ω. The
solutions are r
√
ω1 = 2 − 2 g/L
and r
√
ω2 = 2+ 2 g/L
Double pendulum 479
Python Code
The code uses the command Matrix is Sympy to define the matrix, and Solve is
used to solve the characteristic equation for the natural frequency ω.
from sympy import Matrix, symbols, solve, det
print('-'*28,'CODE OUTPUT','-'*29,'\n')
A = Matrix([[2*m*(-L*omega**2+g),-m*L*omega**2],\
[-m*L*omega**2,-m*(L*omega**2 - g)]])
omega_vals = solve(det(A),omega)
Mathematica Code
The code uses the commands Det and Solve to find the four roots of the character-
istic equation for the natural frequency ω.
∧ ∧
2 ∗ m ∗ (−L ∗ ω 2 + g) −m ∗ L ∗ ω 2
A= ;
−m ∗ L ∗ ω ∧ 2 −m ∗ (L ∗ ω ∧ 2 − g)
0
Do Print Solve Det[A] == , ω [[i]] ,
0
{i, 1, 4}]
q √
ω→− L − L 2g 2g
q √
ω→ L − L
2g 2g
q √
ω→− L + L 2g 2g
q √
ω → 2g L + L
2g
480 Coupled Oscillations
By substituting θ̈1 from this expression in (12.3.11), we obtain the equation for θ̈2 :
(m1 + m2 ) g m2 g
− A1 ω 2 = − A1 + A2 (12.3.28)
m1 L1 m1 L1
(m1 + m2 ) g g (m1 + m2 )
− A2 ω 2 = − A1 − A2 (12.3.29)
m1 L2 m1 L2
In matrix form:
(m1 +m2 )g
− mm12Lg1 A1 A1
m1 L1
= ω2 (12.3.30)
(m1 +m2 )g
m1 L2 − g(m 1 +m2 )
m1 L2
A2 A2
This is once more the standard form of the eigenvalue problem, and we can proceed by
finding the eigenvalues and eigenvectors of the 2 × 2 matrix on the left-hand side of this
matrix equation. Finding the natural frequencies and the amplitudes of oscillation A1 and
A2 in Python and Mathematica is left as an exercise, see the End-of-Chapter Problems.
generalized quantities were useful in describing the Euler-Lagrange equations of the system
in the compact form:
d ∂L ∂L
− =0 (12.4.1)
dt ∂ q̇j ∂qj
We also considered a system of N particles, denoted by the index α = 1, 2, . . . , N , and
assumed that the Cartesian coordinates rα , describing the location of the particle with
mass, mα , are given in terms of the generalized coordinates by:
rα = rα (q1 , . . . , qn ) , (12.4.2)
We then showed that the kinetic energy which is written in Cartesian coordinates as
1X
T = mα ṙα · ṙα (12.4.3)
2 α
where
X ∂rα ∂rα
ajk = mα · (12.4.5)
α
∂qj ∂qk
and the coefficients ajk = ajk (q1 , . . . , qs ) depend on the coordinates qj .
Next, we assume that the potential energy of the system depends only on the coordinates
qj :
V = V (q1 , . . . , qs ) (12.4.6)
Under the above assumptions, our Lagrangian has the form:
1X
L=T −V = ajk q̇j q̇k − V (q1 , . . . , qs ) (12.4.7)
2
j,k
Let us now assume that the system performs small oscillations around a point of stable
equilibrium qEQ = (q1 , q2 , . . . , qs )EQ . Without loss of generality, we can redefine our co-
ordinates so that this equilibrium point is the origin of our generalized coordinate system,
i.e. ,qEQ = 0. Next, we expand the potential energy around this point:
X
s
∂V 1 X ∂2V
s
V = V (0) + qi + qj qk + ... (12.4.8)
i=1
∂qi 2 ∂qj ∂qk
j,k=1
where all derivatives are evaluated at the equilibrium point located at the origin of our
coordinate system, qEQ = 0. At the equilibrium points we have ∂V /∂qi = 0, and we can
further simplify this expression by setting V (0) = 0 to obtain:
1 X
s
V = Kjk qj qk (12.4.9)
2
j,k=1
We can also Taylor expand the coefficients ajk in (12.4.5) around the equilibrium point,
and keep only the constant term in the expansion, so that the ajk are now constants. By
combining (12.4.4) and (12.4.9), we obtain the following expression for the kinetic energy
T , for the potential energy V and the Lagrangian L:
1 X
s
T = ajk q̇j q̇k ajk = constants (12.4.11)
2
j,k=1
1 X
s
V = Kjk qj qk Kjk = constants (12.4.12)
2
j,k=1
1 X 1 X
s s
L=T −V = ajk q̇j q̇k − Kjk qj qk (12.4.13)
2 2
j,k=1 j,k=1
Example 12.8 shows how to calculate the coefficients ajk and Kjk for the double pen-
dulum system we studied in the previous section.
As we will see next, the matrix M can be thought of as a generalized “mass matrix”
and the matrix K as a generalized “spring constant” matrix K.
∂L ∂V X s
= = Kjk qk (12.4.14)
∂qj ∂qj
k=1
!
d ∂L d ∂T d X
s X
n
= = ajk q̇k = ajk q̈k (12.4.15)
dt ∂ q˙j dt ∂ q˙j dt
k=1 k=1
X
s X
s
ajk q̈k = − Kjk qk (12.4.16)
k=1 k=1
We will have one such equation for each coordinate qj . Finally, we can write the equations
of motion in compact form as a single matrix equation:
a11 a12 ··· a1s q̈1 K11 K12 ··· K1s q1
a21 a22 ··· a2s q̈2 K21 K22 ··· K2s q2
.. .. .. .. .. = − .. .. .. .. ..
. . . . . . . . . .
as1 as2 ··· ass q̈s Ks1 Ks2 ··· Kss qs
(12.4.18)
with the s × 1 column matrix q denoting the generalized coordinates of the system, M rep-
resenting the symmetric s × s generalized “mass matrix”, and K the symmetric generalized
484 Coupled Oscillations
ω 2 MA = KA (12.4.20)
with the s × 1 column matrix A (whose elements are the Aj from the trial solution qj )
denoting the unknown amplitude matrix.
Equation (12.4.20) is the generalized matrix form of the familiar equation mω 2 = k,
which describes the oscillation frequency ω for a mass m attached to a spring with spring
constant k. This equation can be solved in principle by using any of the Linear Algebra
techniques we saw previously in this book.
Example 12.9 shows one method of solving (12.4.20) for the double pendulum.
Example 12.9: Finding the natural frequencies and normal modes of the
double pendulum, again
Solve (12.4.20) for the double pendulum with equal masses and equal lengths, and
find the natural frequencies and the normal modes.
Solution:
In Example 12.9, we calculated the coefficients ajk and Kjk of the matrices M and K
for the double pendulum. Equation (12.4.20) then becomes:
2 (m1 + m2 ) L21 m2 L1 L2 A1 (m1 + m2 ) gL1 0 A1
ω =
m2 L1 L2 m2 L22 A2 0 m2 gL2 A2
By collecting terms, i.e., writing (12.4.20) as ω 2 M − K A = 0, we obtain:
(m1 + m2 ) L21 ω 2 − gL1 m2 L1 L2 ω 2 A1 0
=
m2 L1 L2 ω 2 m2 L22 ω 2 − gL2 A2 0
Simplifying and setting L1 = L2 = L and m1 = m2 = m:
2mL Lω 2 − g mL2 ω 2 A1 0
=
mL2 ω 2 mL Lω 2 − g A2 0
This, of course, is the same equation we obtained and solved in Example 12.7, and
we can reuse the code for Example 12.7 to find ω and A.
In the next subsection, we proceed to show how the above general matrix formalism of
the equations of motion leads to the concept of normal coordinates.
General theory of small oscillations and normal coordinates 485
X
s
q= cj (t)Aj (12.4.23)
j=1
where cj (t) are time-dependent coefficients. Our goal is to show that these coefficients cj (t)
oscillate independently of each other, i.e., that each coefficient corresponds to a different
frequency ωj .
Substituting (12.4.23) into (12.4.17) and using (12.4.22), we obtain:
Since the vectors are linearly independent, the last equation can hold only if the coeffi-
cients of the vector MAj are equal:
X
s
q= bj sin (ωj t − ϕj ) Aj (12.4.29)
j=1
In words, this equation tells that any solution q of the equations of motion can be
written as the linear combination of s independent oscillating terms, each of which has its
own characteristic natural frequency ωj . These oscillating terms are known as the normal
486 Coupled Oscillations
coordinates cj (t) of the system. Hence all motions of a linear coupled oscillator can be
expressed as a linear combination of normal coordinates.
The material in this section is a formal way of demonstrating the result of Example 12.4.
In that example we found that the analytical solution for equalmasses and pequal spring
p
constants, could be written as the sum of two terms, cos k/mt and cos 3k/mt . For
p
example, the
p solution x 1 (t) could be written in the form (12.4.29) by writing ω 1 = k/m
and ω2 = 3k/m as the frequencies, ϕ1 = ϕ2 = π/2 as the phases, and
a/2 0
A1 = A2 = (12.4.30)
0 −a/2
as the amplitudes.
Systems of coupled harmonic oscillators can be analyzed by using either the La-
grangian approach, or alternatively using Newton’s second law. The simplest form of
these systems consists of two masses connected by springs to each other, with the La-
grangian:
1 1 1 1 1
L=T −V = m1 x˙1 2 + m2 x˙2 2 − k1 x21 − k3 x22 − k2 (x1 − x2 )2
2 2 2 2 2
This leads to the system of coupled differential equations:
The second possible p solution for the motion of the two masses corresponds to the
natural frequency ω2 = 3k/m, and in this type of motion the two masses moves in
opposite directions, while the center of mass remains stationary. This type of motion is
known as the second normal mode or the antisymmetric mode of oscillation, and can
be written as:
x1 (t) 1
= D2 cos (ω2 t − ϕ2 )
x2 (t) −1
In general, the motion of the system will be a linearp
combination of the
p two possible
normal modes, corresponding to the frequencies ω1 = k/m and ω2 = 3k/m.
End−of−chapter problems 487
This system can also be reduced into an eigenvalue problem, by substituting a trial
solution of the form x1 (t) = A1 eiωt and x2 (t) = A2 eiωt in the system of coupled
equations.
In a second well-known example of coupled harmonic oscillators, we examined the
double pendulum, which also has two normal modes. q The frequencies of the
q symmetric
√ g √
and antisymmetric modes of oscillation are ω1 = 2 − 2 L and ω2 = 2 + 2 Lg .
In this chapter we also looked at the general mathematical formalism for the normal
modes of coupled oscillators. Here we use generalized coordinates qj (j = 1, 2, . . . , s)
and the corresponding generalized velocities q̇j , where s is the number of degrees of
freedom of the system.
The Lagrangian for small oscillations around an equilibrium position can be reduced
into a quadratic function of the generalized coordinates and generalized velocities of the
system in the form:
1X 1 X
n
L=T −V = ajk q̇j q̇k − Kjk qj qk
2 2
j,k j,k=1
X
n X
n
ajk q̈k = − Kjk qk
k=1 k=1
This system of coupled differential equations can be solved using standard techniques
of Linear Algebra.
Any solution q = qj (j = 1, 2, . . . , s) of these equations of motion can be written
as the linear combination of s independent oscillating terms, each of which has its own
characteristic natural frequency ωj :
X
s
q= bj sin (ωj t − ϕj ) Aj
j=1
These oscillating terms are known as the normal coordinates of the system.
2. Consider the two-mass, three-spring system studied in this chapter, with different
masses m1 , m2 and identical spring constants k1 = k2 = k3 .
488 Coupled Oscillations
5. Consider two equal masses m attached to one wall and to each other with springs
of spring constant k,√ as shown
p in Figure 12.9. Show that the natural frequencies of
5±1
the system are ω = 2 k/m.
Figure 12.9: Two equal masses attached to each other and to a wall by springs, Problem
12.5.
6. Consider the three different situations shown in Figure 12.10, where three identical
masses m are attached to springs with the same spring constant k . Write the equations
of motion for these three cases.
Figure 12.10: Three identical masses connected by identical springs, Problem 12.6.
End−of−chapter problems 489
7. Three equal masses m are connected to each other with identical springs of constant
k, as shown in Figure 12.11. Find and describe the normal modes of oscillation (assume
no friction), by using a CAS.
Figure 12.11: Three identical masses connected by two identical springs, Problem 12.7.
8. Three equal masses m are connected with springs of the same spring constant
k. The masses are connected to each other and to two end walls, as shown in Figure
12.12. Calculate the frequencies of the normal-modes of oscillations of this system and
describe the corresponding motion of the three masses in each normal mode.
Figure 12.12: Three identical masses connected to four identical springs, Problem 12.8.
9. Find the effective spring constants and natural frequencies for each of the oscillat-
ing systems shown in Figure 12.13 below. In Figure 12.13a, two springs with spring
constants k1 and k2 are attached in parallel to a mass m and to one wall. In Figure
12.13b, two springs with spring constants k1 and k2 attached in series to a mass m
and to one wall.
(a) (b)
10. Two identical masses are connected with identical springs with spring constant, k,
and are restricted to move on a circle as shown in Figure 12.14. Find expressions for
the natural frequencies and describe the motion of the system.
490 Coupled Oscillations
11. Repeat Problem 10, with three identical masses connected with identical springs
with spring constant k. The equilibrium position is when the masses are equally
spaced.
12. Four identical masses are connected by four identical springs, and are constrained
to move on a frictionless circle of radius R. The equilibrium position is when the
masses are equally spaced. How many normal modes of small oscillations are there
and what are the frequencies of small oscillations?
13. Three bodies of equal mass m are connected with springs of constant, k, and are
placed in an equilateral shape as shown in Figure 12.15. The masses are constrained to
move on the xy-plane. Construct the Lagrangian of this system and find the natural
frequencies.
14. A simple classical model of the CO2 molecule would be a linear structure of
three masses, with the electrical forces between the ions represented by two identical
springs of equilibrium length L and force constant k. Assume that only motion along
the original equilibrium line is possible, i.e., ignore rotations. Let m be the mass of
each oxygen and M be the mass of the carbon atom located between the oxygen
atoms.
a. How many vibrational degrees of freedom does this system have?
b. Find the normal modes and calculate the natural frequencies.
End−of−chapter problems 491
15. Two equal masses m are suspended from a ceiling by springs with constants k, as
shown in Figure 12.16.
a. Find the equations of motion of the two masses by using a coordinate system
(y1 , y2 ) as measured from the ceiling.
Figure 12.16: Two masses hanging by springs from a vertical support, Problem 12.15.
17. Two unequal masses m and M (with M > m) hang from a support by strings
of equal lengths l, with the respective angles with the vertical θ1 , θ2 . The masses
are coupled by a spring of spring constant K and of unstretched length equal to the
distance L between the support points, as shown in Figure 12.17. Assume that the
distance between the supports L << l. Find the normal mode frequencies for the
small oscillations along the line between the two masses, and describe the motion of
the two masses in each mode. Write down the most general solution.
492 Coupled Oscillations
Figure 12.17: Two unequal mass pendula masses m, M connected by a spring, Problem
12.17.
19. A mass M moves along the x-axis on a frictionless surface, and is attached to a
wall with a spring with spring constant k as shown in Figure 12.19. The mass m is
connected to M by a massless string.
20. A thin uniform bar of mass m and length 3L/2 is suspended by a string of length
L and negligible mass as shown in Figure 12.20. Find the normal frequencies for small
oscillations in the xy-plane.
21. A mass m moves in a gravitational field g pointing in the z-direction, and on the inside
wall of a frictionless axially symmetric vessel given by z = b(x2 + y 2 )/2 , where a is a
constant and z is in the vertical direction, as shown in Figure 12.21. The particle is
moving in a circular orbit at height z = z0 .
a. Obtain the angular frequency of the circular motion in terms of m, z0 , b, and g.
b. Find the total energy and angular momentum in terms of m, z0 , b, and g.
c. The particle is pushed slightly downwards in the horizontal circular orbit. Obtain
the frequency of oscillation about the unperturbed orbit, in the case of small
oscillations around the stable circular motion.
494 Coupled Oscillations
Figure 12.21: An axially symmetric vessel given by z = b(x2 + y 2 )/2, Problem 12.21.
b. Find the frequency of small oscillations around this stable equilibrium point,
when the moment of inertia of the object around the center of mass is ICM .
Assume that the object is only allowed to roll around the pivot contact point.
24. A uniform sphere of radius a rests in equilibrium inside a uniform hemispherical shell
of radius R, as shown in Figure 12.23.
a. Find the relationship between a and R in order to have a stable equilibrium
situation for small oscillations.
b. Find the natural frequency for small oscillations of the system.
Figure 12.23: A uniform sphere resting inside a hemispherical shell, Problem 12.24.
13 Nonlinear Systems
Nonlinear systems are everywhere! In physics, one of the most common examples of a non-
linear system is an oscillator undergoing large amplitude oscillations. However, nonlinear
systems occur in other sciences as well. Examples of nonlinear systems in other fields in-
clude predator-prey models, population dynamics, disease propagation, arms-race models,
economic models, and the list goes on. In fact, nonlinear systems are the norm, and linear
systems are often approximations. While the diversity and difficulty of nonlinear systems
may be concerning, there are some basic methods of analysis which are applicable to most
of the nonlinear systems you would encounter. In this chapter, we will learn some of those
methods. Along the way, we will discover some interesting new behaviors that only nonlin-
ear systems can exhibit, such as bifurcations and chaos. At the end of the chapter, you will
have an opportunity to apply what you have learned, by analyzing systems from a variety
of natural and social sciences.
497
498 Nonlinear Systems
Now, let us change the differential equation to the form: ẍ + x2 = 0. Suppose we find
two solutions to this equation, x1 and x2 . Is it true that c1 x1 (t) + c2 x2 (t) is still a solution?
We insert the superposition into the nonlinear differential equation:
2
ẍ + x2 = (c1 x¨1 + c2 ẍ2 ) + (c1 x1 + c2 x2 )
= c1 x¨1 + x21 + c2 ẍ2 + x22 + 2c1 c2 x1 x2 (13.1.2)
= 2c1 c2 x1 x2
Notice that now, we do not get zero. The result is that unlike linear systems, nonlinear
systems cannot be broken into parts, solved individually, and then have those solutions
combined for a solution to the whole system. Recall the topic of the driven damped harmonic
oscillator. If there are multiple sinusoidal drive terms on the right-hand side of the equation,
we could solve the differential equation for one right-hand term at a time, then add the
individual solutions to get a particular solution. That cannot be done for nonlinear systems.
This makes nonlinear systems more difficult to solve in closed-form. In fact, closed-form
solutions for nonlinear differential equations often cannot be found.
Many systems from the physical, biological, and social sciences are nonlinear, and linear
descriptions of behavior are often approximations. For example, Hooke’s Law, F (x) = −kx,
holds for an oscillator undergoing small amplitude oscillations. Once the amplitude of the
oscillations is large enough, then the restoring force is no longer linear, and nonlinear terms
need to be included in order for the equation of motion to accurately describe the oscillation.
One of the results is that the period of oscillation is no longer independent of the amplitude
of oscillation.
As we will see, nonlinear systems can display a much more diverse set of behaviors than
linear systems. The limited types of behavior and mathematical simplicity makes linear
systems easier to solve, and allows us to predict future states of the system with a high
degree of accuracy. Nonlinear systems, however, are often not exactly solvable and display
complex behaviors such as bifurcations and chaos, which can make long-term predictions of
behavior impossible.
Linear approximations can shed some light on the solution of a nonlinear system. These
linear approximations, often done using Taylor expansion, will allow us to use some of the
tools for linear differential equations in order to provide some understanding of the nonlinear
system.
One of the powerful tools we have for analyzing nonlinear systems is the phase space plot
mentioned in Chapter 6. Phase space plots will provide graphical methods of understanding
the long-term behavior of a nonlinear system. Recall, that for the damped driven harmonic
oscillator, we were mostly interested in the steady-state solution and less interested in the
transient behavior. The same will generally be true for nonlinear systems, and phase space
plots will allow us to identify the nature of the steady-state solution.
Nonlinear systems appear in many fields besides physics. The mathematical techniques
we will learn in this chapter are applicable to systems from a wide range of natural and
social sciences. Some of the most exciting developments in science are the applications of
“traditional physics techniques” to problems in the biological and social sciences.
γ = 0.1 γ=0
1.00
1.0
0.75
0.50
0.5
velocity 0.25
velocity
0.00 0.0
−0.25
−0.5
−0.50
−0.75
−1.0
−1.00
−1.0 −0.5 0.0 0.5 1.0 −1 0 1
position position
Figure 13.1: The phase space plot for (13.2.1) with γ = 0.1 (left) and γ = 0 (right).
ẍ + 2γ ẋ + ω02 x = 0 (13.2.1)
where x is the displacement of the mass m from the spring’s equilibrium, γ is the damping
parameter, and ω02 = k/m depends on the spring constant k.
The phase portrait of (13.2.1) is shown in Figure 13.1 where m = 1, ω0 = 1, and
x(0) = 1, ẋ(0) = 0. For the undamped case, γ = 0 and for the damped case γ = 0.1.
Pretend, for a moment, that we did not know how to solve this problem in closed form,
but instead all we had were the phase space plots that were generated numerically; this is
often true for nonlinear systems. What can we learn from Figure 13.1 about the behavior
of (13.2.1)?
Let us first consider the left graph in Figure 13.1, where γ = 0.1 and, hence, there is
a small amount of damping in the system. To help visualize the behavior of the system,
we will continue to think of (13.2.1) as describing a mass on a spring with damping. The
path in phase space, called the phase space trajectory, or simply trajectory, represents the
solution to (13.2.1).
To understand the behavior of the system, follow the trajectory in phase space! As we
follow the trajectory from its starting point, we see that the position decreases towards zero,
while the velocity becomes more negative. Thinking of a mass on a spring, the trajectory
represents a mass starting at rest at a position of 1.0 m to the right of equilibrium (x = 0),
and when released, it moves to the left towards equilibrium, gaining speed. The mass reaches
equilibrium where it has its maximum (negative) speed, overshoots equilibrium, and begins
to slow down (velocity becomes less negative). The mass continues moving to the left to a
distance of about 0.6 meters left of equilibrium and, at that point, the velocity is zero. The
mass, however, has reached a turning point and moves to the right (positive velocity) gaining
speed as it approaches equilibrium again. The mass reaches its highest speed at equilibrium
and begins to slow down. However, notice that the mass does not return to its initial
position, instead ending up at a distance of about 0.5 m to the right of equilibrium before
turning around. This decaying oscillation continues until the mass is at rest at equilibrium
(trajectory ends at the origin).
We can use Figure 13.1 to answer our question about the steady-state of the system
(the mass is at rest at the equilibrium position), and we could even discuss the transient
behavior, all without having a closed-form solution! The final point, in this case the origin,
500 Nonlinear Systems
is a point where both ẋ = 0 and v̇ = 0. Points in phase space that satisfy the conditions,
ẋ = 0 and v̇ = 0, are called fixed points of the system. Fixed points correspond to equilibrium
points of the system and take on different forms. In the case of γ = 0.1, the fixed point is
called a stable spiral, and it represents a decaying oscillation onto the equilibrium position.
We can get the same qualitative information about the system’s behavior in the case of
γ = 0, which corresponds to the right graph in Figure 13.1. Again, starting with an initial
condition of (x = 1, v = 0), and continuing with the mass-spring analogy, we can follow
the trajectory counterclockwise to see that the mass moves towards equilibrium with an
increasing speed (to the left), overshoots equilibrium, slows down and stops a distance of
1.0 m to the left of equilibrium. At that point, the mass begins moving to the right with
increasing speed until it overshoots equilibrium and returns to its starting position. The
closed curve trajectory represents an oscillation, the system returning to its initial state.
The origin is still an equilibrium position and is still a fixed point, but the mass does not
come to rest there. In this case, the fixed point at the origin is referred to as a center (as
in center of oscillation).
As we can see, it is possible to get a lot of valuable information from phase space plots.
We can ask further questions. For example, do all initial conditions have trajectories that
spiral into the origin when γ = 0.1? The answer, of course, is yes because damping removes
energy from the system and causes it to come to rest at equilibrium. However, we could find
this out by selecting several initial conditions and numerically solving (13.2.1). We would
find that all points have trajectories that spiral into the origin, and therefore the origin is
a global attractor, a fixed point which “attracts” trajectories starting from all points in the
phase space. Likewise, we could repeat the exercise for γ = 0 and find that the resulting
phase space graph consists of nested closed trajectories. In this case, the origin neither
attracts nor repels trajectories and is considered to be neutrally stable. Hence, we could
answer the question about the behavior of the system for any initial condition, even without
solving the system in closed form.
In the above example, we saw two types of fixed points, the stable spiral and a center,
representing a stable and neutral equilibrium, respectively. There are other types of fixed
points which repel trajectories, corresponding to unstable equilibrium, as well as fixed points
that both attract and repel trajectories (also corresponding to unstable equilibrium). In
the next section, we will discuss fixed points more generally. We will look into how to
find them and how to classify the stability of their equilibrium states. The next section is
mathematical in nature and a bit abstract, but we will follow with two examples which will
help demonstrate the key ideas of the section.
where f (x, y) and g(x, y) are functions of the variables x and y. For example, x and y could
represent position and velocity for a physical system, or they could represent the numbers
of rabbits and foxes in a predator-prey model. We can recast (13.2.1) into a form similar to
(13.3.1) by choosing y = v and (13.2.1) becomes,
)
ẋ =y
(13.3.2)
ẏ = − 2γy − x
where f (x, y) = y and g(x, y) = −2γy − x. Equations (13.3.1) are sometimes referred
to as a two-dimensional system of equations because it depends on two variables, x and
y. In addition, (13.3.1) is called the equations of motion for our system. Recall that the
term, equations of motion, for a physical system describes the actual motion of a particle.
However, it is common to refer to (13.3.1) as equations of motion even if we are using them
to describe the populations of animals, or any other type of system that is not necessarily
moving (but is changing). The equations of motion describe the behavior of a given system
regardless of the nature of the system.
While nonlinear systems are diverse and often difficult to analyze, there are some general
strategies on how to approach such systems. For example, a general approach that we like
to recommend to our students is the following:
1. Find the fixed points (equilibrium points) of the system, points (x∗ , y ∗ ) such that
f (x∗ , y ∗ ) = 0 and g (x∗ , y ∗ ) = 0.
In this section, we will focus on the first two steps, and then, in later sections, we will
demonstrate the final two steps by example.
To find the fixed points, (x∗ , y ∗ ) for the system (13.3.1), we simply solve the equations:
)
f (x∗ , y ∗ ) =0
(13.3.3)
g (x∗ , y ∗ ) =0
for (x∗ , y ∗ ). In our damped harmonic oscillator example, there is one fixed point
(x∗ = 0, y ∗ = 0), found by solving f (x∗ , y ∗ ) = y ∗ = 0 and g (x∗ , y ∗ ) = −2γy ∗ − x∗ = 0.
Systems may have multiple fixed points. Solving for fixed points can be done either by hand,
or by using a computer algebra system.
Once we have found the fixed points, we need to find the stability of those fixed points.
In other words, are the equilibrium states stable, unstable, or neutrally stable? To find the
stability, we must know how the system behaves near each equilibrium state, i.e., we need
to find the mathematical form of the equations of motion near the equilibrium point.
502 Nonlinear Systems
u̇ =f (x∗ + u, y ∗ + v) (13.3.4)
∂f ∂f
=f (x∗ , y ∗ ) + u +v +O u2 , v 2 (13.3.5)
∂x (x∗ ,y∗) ∂y (x∗ ,y∗)
∂f ∂f
=u +v (13.3.6)
∂x (x∗ ,y∗) ∂y (x∗ ,y∗)
Notice that some terms appear to be lost from (13.3.5)to (13.3.6). The term f (x∗ , y ∗ ) =
0 by the definition of fixed points, while the term O u2 , v 2 contains second-order and higher
terms. Recall that u and v are small, so u2 and v 2 are very small and negligible for the
dynamics. While there are cases where those nonlinear terms need to be retained, we will
focus this text on systems for which those terms can be neglected. The same procedure can
be repeated for g(x, y):
∂g ∂g
v̇ = u +v (13.3.7)
∂x (x∗ ,y∗) ∂y (x∗ ,y∗)
The equations for u̇ and v̇ tell us how the perturbations from the fixed point (x∗ , y ∗ )
evolve in time. By Taylor expanding (13.3.1) about the fixed point, we obtain a system of
equations that is linear in u and v. The above process is sometimes called the linearization
of the equations of motion. We can solve these linearized equations in closed form and get
an understanding of how the trajectories behave near the fixed point. In other words, we
will be able to find the stability of the equilibrium point. It is helpful to cast the linearized
equations into matrix form:
where we have removed the notation for the evaluation of each partial derivative for sim-
plicity in notation.
Fixed points and phase portraits 503
The 2 × 2 matrix in (13.3.8) is called the Jacobian matrix A and, for simplicity, we can
recast (13.3.8) in the form,
u̇ = Au (13.3.9)
where u = (u, v). Equation (13.3.9) represents a system of first-order differential equations
which can be solved with the solution u = weλt , where w is a constant vector. Inserting
our trial solution into (13.3.9) yields,
λw =Aw (13.3.10)
which is the eigenvector equation for the matrix A. Hence, in our trial solution, u = weλt , λ
is the eigenvalue of A associated with the eigenvector, w. We have previously studied eigen-
values and eigenvectors in Chapters 11 and 12. Here we will study them from a geometric
perspective.
Returning to our analysis, we can rewrite (13.3.10) in the form,
(A − λ1) w = 0 (13.3.11)
where 1 is the 2 × 2 identity matrix (with 1’s on the diagonal and 0’s otherwise) and 0 is
the zero vector. Linear algebra tells us that if the matrix, A − λ1, is invertible, then the
solution to (13.3.11) is w = 0, which is the trivial solution. For a nontrivial solution, we
need the matrix A − λ1 to be singular (i.e., not invertible). Linear algebra also tells us that
a matrix is singular if its determinant is zero. Hence, in order to get a nontrivial solution,
det (A − λ1) = 0 must be true. The condition det (A − λ1) = 0 produces a polynomial in
λ, called the characteristic polynomial, which can be solved to obtain the eigenvalues of A.
Because the matrix A is a 2 × 2 matrix, it will produce two eigenvalues and each eigenvalue
can be plugged into (13.3.11) to get its associated eigenvector. Using the principle of linear
superposition, the solution to (13.3.9) is therefore,
The sign of the eigenvalue λ gives the stability of the fixed point along the direction of
w. Because we are working with problems in two dimensions, (13.3.12) tells us that there
are two directions of stability for the fixed point. One direction is along w1 and the other
is along w2 , these directions are eigenvectors of A. Each direction has its own stability
determined by λ1 and λ2 , respectively. Hence, if λ1 < 0 and λ2 > 0, then a point u starting
near the fixed point will initially move towards the fixed point along the direction of w1
but, as time progresses, it will eventually start to move away from the fixed point along
the direction of w2 . The fixed point in this case represents an unstable equilibrium since
perturbations from the equilibrium (the fixed point) grow exponentially as t → ∞.
In the next two examples, we will demonstrate the procedure of finding and classify-
ing fixed points using the outline developed above. Example 13.1 examines the damped
harmonic motion and demonstrates how to find and classify fixed points analytically.
ẋ =y
ẏ = − 2γy − ω02 x
Find the Jacobian matrix and compute its eigenvalues and its eigenvectors.
Solution:
We have already noted that f = y and g = −2γy − ω02 x and that the fixed point is
located at the origin. We can use (13.3.8) to get the Jacobian,
∂f ∂f
0 1
∂x ∂y
A= =
∂g
∂x
∂g
∂y (0,0) −ω0 −2γ
2
q
γ − γ 2 − ω02 w1 + w2 =0
q
−ω02 w1 + −γ − γ 2 − ω02 w2 =0
resulting in !
p
w1 − ω12 γ + γ 2 − ω02
= 0
w2 1
What does all of this say about the stability of the equilibrium at the origin? We
will return to that later in this section. For now, this example is intended to simply
demonstrate the procedure outlined so far in this section.
Example 13.2 demonstrates how to use Python and Mathematica to find and classify
fixed points. The system in Example 13.2 does not describe a particular physical system.
However, it is a simple system of equations that allows for a direct demonstration of the
procedure and is more easily extended to a discussion of stability than Example 13.1.
ẋ =y(x + 1)
ẏ =x(y + 1)
Using Mathematica and Python, find the fixed points and solve the corresponding
linearized system of equations.
Solution:
The code appears below. We find there are two fixed points, the origin and the point
(−1, −1). After normalizing the eigenvectors, the solution near the origin is
√ √
u 1/√2 −1/√ 2
= c1 t
e + c2 e−t
v 1/ 2 1/ 2
where c1 and c2 are constants that cannot be found without initial conditions for our
linearized system. We will leave it to the reader to normalize the solution near the point
(−1, −1).
Python Code
After defining f and g, we solved for the fixed points. Note that Python put the
origin as the last fixed point. We then used Matrix to create the Jacobian matrix A and
found its eigenvalues and eigenvectors. We used list comprehensions in eigenvects1
and eigenvects2 so that the print command would print the eigenvectors as lists.
506 Nonlinear Systems
print('-'*28,'CODE OUTPUT','-'*29,'\n')
x, y = symbols('x,y')
f = y*(x + 1)
g = x*(y + 1)
A_fps1 = ([Link]([(x,fps1[0]),(y,fps1[1])]))
A_fps2 = ([Link]([(x,fps2[0]),(y,fps2[1])]))
eigenvals1 = list(A_fps1.eigenvals().keys())
eigenvals2 = list(A_fps2.eigenvals().keys())
Mathematica Code
After defining f and g, we solved for the fixed points. Note that Mathematica put
the origin as the last fixed point. We then created the Jacobian matrix A and found its
eigenvalues and eigenvectors using the Eigenvalues and Eigenvectors commands.
f = y ∗ (x + 1);
g = x ∗ (y + 1);
Afps1 = A/.fps[[2]];
Afps2 = A/.fps[[1]];
Now let us examine the solution near the origin from Example 13.2. We see that along
the direction of w1 = (1, 1), there is an exponential growth away from the origin since λ > 0.
However, along the direction of w2 = (−1, 1), there is exponential decay towards the origin,
since λ < 0. This fixed point has two different stabilities which depend on direction. The
unstable direction w1 is tangent to a curve called the unstable manifold of the fixed point.
The stable direction w2 is tangent to a curve called the stable manifold. Each vector,
w1 and w2 , is tangent to its respective manifold at the fixed point. The origin in Example
13.2 is called a saddle point (or simply, saddle) and is ultimately unstable, as we will see
below. To better understand what is going on here, let us examine the phase portrait near
the origin in Example 13.3.
508 Nonlinear Systems
Example 13.3: The phase portrait of the system from Example 13.2
Plot the phase portrait near the origin for the system of equations in Example 13.2.
Solution:
The code below creates the phase portraits shown in Figure 13.2. In each case, the
solid black lines represent the stable and unstable manifold. The arrowheads on the
stream plots show the flow of trajectories near the origin. Trajectories starting near
the stable manifolds approach the origin, but they eventually turn toward the unstable
manifold and move away from the origin.
Python Code
The stable and unstable manifolds are found by integrating the equations near the
origin. The command streamplot is used to show the vector field around the origin.
Trajectories will flow along the arrows created by the stream plot.
import numpy as np
import [Link] as plt
from [Link] import odeint
times = [Link](0,8,100)
def deriv(z,t):
x, y = z
dzdt = [y*(x+1), x*(y+1)]
return dzdt
ic1 = [-0.001,0.0009]
ic2 = [0.001, -0.001]
ic3 = [-0.001, 0.0011]
ic4 = [-0.001, -0.001]
X, Y = [Link]([Link](-0.1,0.1,100), \
[Link](-0.1,0.1,100))
f_vec = Y*(X + 1)
g_vec = X*(Y + 1)
Mathematica Code
We begin by computing trajectories that will be the stable and unstable manifolds.
We create multiple plots using ParametricPlot, one for each manifold. We then plot
the stream plot using StreamPlot where the inputs are f (x, y) and g(x, y). The Show
command displays all of the graphs as one plot.
tmax = 6;
soln1 = NDSolve[{x′ [t] == y[t](x[t] + 1), y ′ [t] == x[t](y[t] + 1), x[0] == −0.001,
soln2 = NDSolve[{x′ [t] == y[t](x[t] + 1), y ′ [t] == x[t](y[t] + 1), x[0] == 0.001,
soln3 = NDSolve[{x′ [t] == y[t](x[t] + 1), y ′ [t] == x[t](y[t] + 1), x[0] == 0.001,
soln4 = NDSolve[{x′ [t] == y[t](x[t] + 1), y ′ [t] == x[t](y[t] + 1), x[0] == −0.001,
stream = StreamPlot[{y(x + 1), x(y + 1)}, {x, −0.1, 0.1}, {y, −0.1, 0.1},
StreamColorFunction->Blue];
As we can see in the above example, the eigenvalues give the stability of the fixed
point. There are three simple types of fixed points associated with real eigenvalues in two-
dimensional systems: stable node, unstable node, and a saddle.
• The stable node has two negative eigenvalues and trajectories that start near the stable
node and approach it exponentially. A stable node corresponds to a stable equilibrium
position. For each stable node there is a region in the phase space called its basin of
attraction. The basin of attraction for a stable node is the set of all initial conditions
whose trajectories approach the stable node as t → ∞.
• The unstable node, sometimes called a repellor, has two positive eigenvalues. It is
called a repellor because trajectories starting near the node move away from the node
at an exponential rate. An unstable node corresponds to an unstable equilibrium.
510 Nonlinear Systems
0.10
0.100
0.075
0.05
0.050
0.025
0.00
y
0.000
y
−0.025
- 0.05
−0.050
−0.075
- 0.10
−0.100
−0.100 −0.075 −0.050 −0.025 0.000 0.025 0.050 0.075 0.100
- 0.10 - 0.05 0.00 0.05 0.10
x
x
(a) (b)
Figure 13.2: Phase portrait for Example 13.3 created by Python (a) and Mathematica (b).
In both graphs, the X-shaped black lines are the stable and unstable manifold. The blue
arrows (in the e-book) show the flow of the trajectories.
• The saddle, explored in Examples 13.2 and 13.3, has one positive and one negative
eigenvalue. It corresponds to an unstable equilibrium. The stable manifolds of the
saddle often serve as borders for the basin of attraction for stable nodes and other
stable structures in the phase space (see below).
In addition to the points listed above, there are three types of fixed points with complex
eigenvalues. Suppose λ = α + iβ, then eλt = eαt (cos(βt) + i sin(βt)). In the case of complex
eigenvalues we see that there is a combination of exponential growth or decay and oscillation,
similar to the damped harmonic oscillator case. The possible fixed points are:
• A stable spiral occurs when Re(λ) < 0, and the trajectory spirals onto the fixed point.
A stable spiral appears in the phase portrait of the underdamped harmonic oscillator
with β < ω0 .
• An unstable spiral occurs when Re(λ) > 0, and the trajectory spirals away from the
fixed point. This would correspond to the damped harmonic oscillator with a negative
damping parameter.
• A center occurs when Re(λ) = 0 and there is neither exponential growth away from the
fixed point, nor is there exponential decay onto the fixed point. The point is neutrally
stable and the trajectories circle the center. This corresponds to the undamped simple
harmonic oscillator.
What happens when there is a zero eigenvalue? One typically uses numerical methods to
analyze the system. Finally, it should be mentioned that there are cases that are called
degenerate, because they have only one eigenvalue and/or one eigenvector. These lead to
other types of fixed points which are beyond the scope of this book. The interested reader
is directed to Strogatz [11] for a thorough and readable review of even more types of fixed
points. Next, we will use our newfound knowledge of fixed points to analyze the simple
plane pendulum.
The equation of motion of the pendulum has been found many times in this book,
where the natural frequency ω02 = g/ℓ. Equation (13.3.13) can be solved in closed form using
elliptical integrals; however, those solutions are not very insightful. Let us instead proceed
with the analysis developed in Section 13.3, by breaking up (13.3.13) into two first-order
equations:
θ̇ =y
(13.3.14)
ẏ = − ω02 sin θ
where the variable y is the angular velocity. Notice that fixed points occur at (θ∗ = 0, y = 0)
and (θ∗ = ±π, y = 0); these make sense physically because they correspond to the very
bottom and top of the pendulum’s path. Based on the way we have defined our coordinate
system, θ = ±π are the same point, the very top of the pendulum’s path. Note that θ = +π
when the pendulum approaches the top moving counterclockwise, and θ = −π when it
approaches the top moving clockwise. The Jacobian of the system is:
0 1
A= (13.3.15)
−ω02 cos θ 0
with eigenvalues λ = ±iω0 . The origin, corresponding to the bottom of the pendulum’s
path, is a center. The center is representing the oscillation of the pendulum about the
stable equilibrium position.
At (±π, 0), the Jacobian (13.3.15) becomes
0 1
(13.3.17)
ω02 0
which has eigenvalues λ = ±ω0 . The fixed point corresponding to the unstable equilibrium
is a saddle. Were you expecting an unstable node? The topmost point cannot be an unstable
mode because an unstable mode repels all trajectories. A saddle, on the other hand, has a
stable direction. We know that the pendulum can approach the top before turning around,
and hence, the topmost point must be a saddle. Now that we know the location and stability
of the fixed points, we are ready to draw the phase portrait.
Figure 13.4 illustrates the phase portrait for the simple pendulum using ω0 = 1. Recall
that the points θ = ±π correspond to the same physical location. Hence, the two saddle
512 Nonlinear Systems
points in the phase portrait are actually the same point. The red line (in the e-book) in Fig-
ure 13.4 is both the stable and unstable manifold of the saddle, which is sometimes referred
to as a homoclinic orbit, a trajectory that connects a saddle point to itself. Physically, the
homoclinic orbit represents the pendulum starting with an angular displacement of θ = π
(vertical position) and an angular velocity of 0, where the pendulum then swings down in
a clockwise direction through the stable equilibrium and returns to the vertical position,
coming to a momentary rest and swinging back in a clockwise direction. The homoclinic
orbit represents the largest possible amplitude of oscillation of the pendulum.
Initial conditions that start inside the homoclinic orbit correspond to oscillatory behav-
ior. Notice that these inside trajectories (black lines) in Figure 13.4 form closed loops, which
we know to mean that the system eventually returns to its initial state after a time τ , the
period of oscillation. Notice how the trajectories begin to take the shape of the homoclinic
orbit as the amplitude of oscillation gets bigger. The graphs of θ(t) for each of the trajecto-
ries inside the homoclinic orbit are shown in Figure 13.5. As the amplitude increases in size,
the period of oscillation increases. Recall that in the simple harmonic oscillator, the period
of oscillation was independent of the amplitude of oscillation. In nonlinear oscillators, there
is typically a relationship between amplitude and period.
Finally, notice that the trajectories outside of the homoclinic orbit in Figure 13.4 do
not form closed loops. Those orbits correspond to the pendulum going over the top of its
motion and continually rotating in one direction, either clockwise (trajectories below the
homoclinic orbit) or counterclockwise (trajectories above the homoclinic orbit). Hence, we
see that the homoclinic orbit separates two distinct behaviors of the pendulum (oscillatory
versus continual rotation in one direction). The homoclinic orbit is sometimes called a
separatrix, because it separates two distinct types of behavior.
1
θ (rad)
0
Out[ ]=
-1
θ(0) = 0.5
-2 θ(0) = 1.5
θ(0) = 2.5
0 2 4 6 8 10 12
t (sec)
Figure 13.5: Graphs of θ (in radians) versus time (seconds) for each of the oscillatory
trajectories shown in Figure 13.4.
0.1
0.0
V(x)
Out[ ]=
-0.1
-0.2
Next, using m = k = ϵ = 1, we will find the fixed points, identify their stability, and
plot the phase portrait. In order to plot the phase portrait, we will need to recast (13.3.19)
into a two-dimensional system, )
ẋ =y
(13.3.20)
ẏ =x − x3
We see from (13.3.20) that fixed points exist at (0, 0), (1, 0), and (−1, 0). The Jacobian
matrix is,
0 1
A= (13.3.21)
1 − 3x2 0
514 Nonlinear Systems
√
which provides eigenvalues of ±1 for (0, 0) and ±i 2 for the points (1, 0) and (−1, 0). Hence,
the origin is a saddle, and the other two points are centers. In Example 13.4, we plot the
phase portrait for the double well.
Python Code
This code follows that of Example 13.3 in structure. Note the variables right_hc
and left_hc are the solutions for the left and right homoclinic orbits, respectively.
import numpy as np
import [Link] as plt
from [Link] import odeint
times = [Link](0,20,200)
def deriv(z,t):
x, y = z
dzdt = [y, x - x**3]
return dzdt
ic1 = [0.001,0.001]
ic2 = [-0.001, -0.001]
X, Y = [Link]([Link](-2,2,100), \
[Link](-2,2,100))
f_vec = Y
g_vec = X - X**3
Mathematica Code
This code is similar to that of Example 13.3. The variables
leftHomoClinicSolution and rightHomoclinicSolution contain the solutions
for the left and right homoclinic orbits, respectively.
sp = StreamPlot[{y, x − x∧ 3}, {x, −2, 2}, {y, −2, 2}, FrameLabel → {x, y},
leftHomoclinicSolution =
NDSolve[{x′ [t] == y[t], y ′ [t] == x[t] − x[t]∧ 3, x[0] == 0.01, y[0] == 0}, {x, y},
{t, 0, 100}];
rightHomoclinicSolution =
NDSolve[{x′ [t] == y[t], y ′ [t] == x[t] − x[t]∧ 3, x[0] == −0.01, y[0] == 0}, {x, y},
{t, 0, 100}];
0
y
-1
-2
-2 -1 0 1 2
x
Figure 13.7: Mathematica-generated phase portrait for the double-well potential from Ex-
ample 13.4.
not be surprising: the damping is causing decaying oscillation onto the equilibria at (±1, 0).
To better see this, we will study the phase portrait in Example 13.5.
Python Code
This code follows that of Example 13.4 in structure. The natures of the manifolds
produced by each solution are described by their variable name.
import numpy as np
import [Link] as plt
from [Link] import odeint
times = [Link](0,80,2000)
def deriv(z,t):
x, y = z
dzdt = [y, x - x**3 - 0.1*y]
return dzdt
[Link](unstable_1[:,0],unstable_1[:,1],'k')
[Link](unstable_2[:,0],unstable_2[:,1],'k')
[Link](stable_1[:,0],stable_1[:,1],'r')
[Link](stable_2[:,0],stable_2[:,1],'r')
[Link]('x')
[Link]('y')
[Link](-2,2)
[Link](-2,2)
[Link]()
518 Nonlinear Systems
Mathematica Code
This code is similar to that of Example 13.4. We identified the stable and unstable
manifolds in the variable names for each plot.
soln1 = NDSolve[{x′ [t]==y[t], y ′ [t]==x[t](1 − x[t]∧ 2) − 0.1 ∗ y[t],
Examining the code in Example 13.5 provides a good opportunity to discuss how to
find stable manifolds. Notice that the stable manifolds, with variable names stable_1 and
stable_2 (in Python), are found by integrating (13.3.23) backwards in time. The stable
manifold is the set of points that moves towards the saddle as t → ∞. The stable manifold
can be difficult to find integrating forward in time. Hence, in order to find the stable
Fixed points and phase portraits 519
2.0
1.5
1.0
0.5
0.0
y
−0.5
−1.0
−1.5
−2.0
−2.0 −1.5 −1.0 −0.5 0.0 0.5 1.0 1.5 2.0
x
Figure 13.8: Python-generated phase portrait for the double-well potential from Example
13.4.
manifold, one chooses an initial condition near the saddle point and integrates the equations
backwards in time. Points on the stable manifold move away from the saddle as t → −∞.
The unstable manifold is the set of points that moves towards the saddle as t → −∞ (or
away as t → ∞), and it is found by solving the equations forward in time, using an initial
condition near the saddle.
If we think of k and ϵ as parameters that can be varied, then we see that the location of
the fixed points in (13.3.26) can change. For example, as k → 0 the fixed points (13.3.26)
collide at the origin. This collision is an example of a bifurcation, and it tells us the condition
for which two stable equilibria can exist in the system. In this case, we use the term stable
equilibrium in the sense of Chapter 5, i.e., as a local minimum in the potential. Furthermore,
the eigenvalues of the Jacobian matrix evaluated at (13.3.26) are,
1 p
λ= −b ± b2 − 8k (13.3.27)
2
√
When 0 < b < 8k, we see that the fixed points located at (13.3.26) are stable spirals.
However, if b → 0, the previously stable fixed points become centers. This is an example of
520 Nonlinear Systems
another type of bifurcation where the fixed point changes stability. There are many types
of bifurcations between fixed points, and a complete overview of them is beyond the scope
of this book. However, the interested reader should consult Refs. [11, 12, 13]. In the next
paragraph, we will briefly mention two important bifurcations.
One of the most common bifurcations is the so-called saddle-node bifurcation. In a
saddle-node bifurcation, a saddle point and a stable node collide and both points disappear
from the phase portrait. Physically speaking, the system goes from having two equilibria,
one stable and one unstable, to having no equilibrium points (sometimes there is another
attracting structure elsewhere in the phase portrait). Another common bifurcation of fixed
points is the so-called transcritical bifurcation. In a transcritical bifurcation, a saddle and a
stable node collide, and pass through each other. However, as the collision occurs, the fixed
points exchange stabilities, so the saddle becomes a stable node and the stable node becomes
a saddle. Physically speaking, the equilibria exchange stabilities, but both equilibrium states
continue to exist after the bifurcation. Of course, for each bifurcation, the equilibrium state
is changing because the fixed point is moving, therefore changing the position and speed of
the equilibrium state.
We might imagine, that if we were designing a system, we would want to know of possible
bifurcations in the system in order to prevent problems such as a desirable stable equilibrium
suddenly becoming unstable. For example, we might want to engineer an airplane wing that
stays relatively flat during flight. All airplane wings move a little during flight. However,
we would want to avoid the flat state from becoming unstable and the system undergoing
galloping, where the amplitude of oscillation of the wing gets large. A bifurcation in which
the galloping state becomes stable would be a dangerous situation, as can be seen in videos
of the famous Tacoma Narrows Bridge collapse.
Next, we are going to study more complicated behaviors unique to nonlinear systems,
namely limit cycles and chaos.
dV 1 d2 V 1 d3 V 1 d4 V
V (x) ≈ V (0) + x+ x2 + x3 + x4 + · · · (13.4.1)
dx x=0
2! dx2 x=0
3! dx3 x=0
4! dx4 x=0
We have already made the argument that dV dx = 0 at the equilibrium, and that argument
continues to hold for the large amplitude case. The derivatives produce a constant value
when evaluated at the origin, so we will rewrite (13.4.1) in the form:
1 2 1 1
V (x) ≈ V (0) + kx + αx3 + δx4 + · · · (13.4.2)
2! 3! 4!
Next, we apply a restriction to the force which is common in physics, even in nonlinear
systems, that V (x) is symmetric about the equilibrium. Hence, the potential energy of the
object at a position x is the same as that at a position −x. In other words, we would not
expect the oscillator to have an energy that is dependent upon which side of equilibrium it
is on. In order to satisfy this restriction, we must require that α = 0. We can then find F
by calculating F = −dV /dx to get the force:
using F (x) = mẍ. We see that the result of examining large amplitude oscillations is that
we must include a cubic nonlinearity in our equation of motion. If we include a damping
term and a drive term, the new net force acting on the system is mẍ = Fnet (x) = −kx −
ϵx3 − β ẋ + f cos(ωt), and our equation of motion becomes:
ẍ + c1 ẋ − c2 x + c3 x3 = d cos(ωt) (13.4.5)
where c1 = β/m, c2 = k/m, c3 = ϵ/m, and d = f /m. Equation (13.4.5) is called the Duffing
equation and is a standard model equation used in nonlinear dynamics to study a wide
range of nonlinear phenomena. With the right choice of parameters, ci and d, the Duffing
equation can be made to display a large variety of nonlinear behaviors. We will use the
Duffing equation to demonstrate limit cycles, period-doubling bifurcations, and chaos.
0.8 1.4
d = 0.68
0.6 1.2
0.4 1.0
0.2 0.8
x'
x
Out[ ]=
0.0 0.6
-0.2 0.4
-0.4 0.2
-0.6 0.0
0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 4500 4520 4540 4560 4580 4600
x t
Figure 13.9: Phase portrait (left) and x(t) (right) of (13.4.5) with ci = 1, for all i, ω = 1,
and d = 0.68.
The graphs of Figure 13.10 shows the phase portrait (left) and solution (right) when d
is increased to 0.69. The limit cycle appears to intersect itself; however, it does not. The
apparent intersection is due to a three-dimensional phase portrait being projected into two
dimensions. Although beyond the scope of this chapter, the Duffing equation is actually a
three-dimensional system due to the explicit dependence of time in this system. The solution
for d = 0.69 is called a period-2 solution because, loosely speaking, the oscillator has to go
through two oscillations before returning to its initial state, once the oscillator has settled
onto the limit cycle behavior.
Figure 13.10: Phase portrait (left) and x(t) (right) of (13.4.5) with ci = 1, for all i, ω = 1,
and d = 0.69.
Figure 13.11 shows the phase portrait (left) and solution (right) when d is increased
to 0.75. There are even more apparent intersections in the phase portrait and the solution
x(t) appears even more complicated. Figure 13.11 illustrated a period-4 solution to (13.4.5).
We are seeing an interesting phenomenon that can occur in nonlinear oscillators called a
period-doubling bifurcation, whereas the parameter d in (13.4.5) varies, the period of the
oscillator (and therefore the limit cycle) doubles. One method of illustrating period-doubling
bifurcations is by using something called a Poincaré section, which we will discuss below.
Limit cycles 523
1.5
0.8
d = 0.75
0.6
1.0
0.4
0.2
x'
x
Out[ ]= 0.0 0.5
-0.2
-0.4
0.0
-0.6
0.0 0.5 1.0 1.5
x 4500 4520 4540 4560 4580 4600
t
Figure 13.11: Phase portrait (left) and x(t) (right) of (13.4.5) with ci = 1, for all i, ω = 1,
and d = 0.75.
The Poincaré section samples the solution once a period and then plots the phase space.
Since the drive frequency is ω = 1, we can sample x(t) and ẋ(t) at times t = 2nπ, where
n is an integer. The code for producing Poincaré sections is shown in Example 13.6 in the
next section.
The Poincaré sections for the solutions in Figures 13.9 through 13.11 are shown in Figure
13.12.
0.75 0.75
d = 0.68 d = 0.69
0.5 0.5
0.25 0.25
x'
x'
0 0
-0.25 -0.25
-0.5 ● -0.5 ●
●
0 0.3 0.6 0.9 1.2 0 0.3 0.6 0.9 1.2
x x
Out[ ]=
0.75
d = 0.75
0.5
0.25
x'
●
0
-0.25 ●
●
-0.5 ●
0 0.3 0.6 0.9 1.2
x
Figure 13.12: The Poincaré sections for the solutions shown in Figures 13.9 through 13.11.
Notice how in Figure 13.12, for d = 0.68, there is only one point. That is because, after
settling onto the limit cycle, the solution repeats its state once every period. We are not
sampling the solution at its maximum, i.e., the x-coordinate of the point in the Poincaré
section does not correspond to the maximum value of the right graph in Figure 13.9. The fact
that the point in the Poincaré section does not match either the maximum or minimum
value of the solution does not matter. What matters is that every t = 2nπ, the system
returns to the same state. However, we see that when d = 0.69, the oscillator appears to
jump between two points in its Poincaré section. It takes 4π = 2 × 2π, or twice the period
to repeat its state. Continuing this reasoning, we see that when d = 0.75, the system is
exhibiting period-4 behavior.
As mentioned previously, Figures 13.9 through 13.12 are demonstrating period-doubling
bifurcations. We see a period-doubling bifurcation in the limit cycle between d = 0.68 and
d = 0.69. We see another period-doubling bifurcation between d = 0.69 and d = 0.75. As we
continue to increase d, we would see several more period-doubling bifurcations, the series
524 Nonlinear Systems
of which is called a period-doubling cascade, which will eventually lead to chaotic behavior
once d = 0.8. However, to illustrate chaos, we will change the parameters used in (13.4.5)
in order to better visualize the attractor corresponding to chaotic behavior.
13.5 CHAOS
In addition to interesting oscillations, nonlinear systems can also display a behavior called
chaos. To explore the phenomenon of chaos, we will use the Duffing equation, but with a
specific set of parameter values:
ẍ + 0.15ẋ − x + x3 = 0.3 cos(t) (13.5.1)
It is worth mentioning that there are many different values of ci and d from (13.4.5) that
will produce chaotic behavior in the Duffing equation, including those used in Section 13.4.2
with d = 0.8. However, we use the parameters as in (13.5.1) because they provide a good
view of the attractor associated with the chaotic dynamics. Example 13.6 will demonstrate
the chaotic solution of (13.5.1) and also show how Figures (13.9)-(13.12) are created. Let us
start by plotting the solution, phase portrait, and Poincaré section of the solution to (13.5.1)
using the initial conditions x(0) = 0 and ẋ(0) = 0. Plot x(t), the phase portrait, and
the Poincaré section after allowing transients to decay.
Solution:
The solution is presented in Figure 13.13, which shows the output of the Python
code. Notice how in Figure 13.13, the phase portrait does not contain a limit cycle, but
some unusual trajectory which seems to oscillate about each of the stable equilibrium
in the double-well potential. Those oscillations are clear in the graph of x(t), where
the solution oscillates about the equilibrium at x = 1, before switching and oscillating
about x = −1. Notice that the duration of time spent near each equilibrium varies and
the switching between one equilibrium to the next seems unpredictable. This is strange
behavior!
Like in Section 13.4.2, we can use a Poincaré section to understand the structure
of the attractor. Notice that the Poincaré section is not a simple collection of points.
In fact, it has its own complex structure. You might wonder if we solved (13.5.1) for
a longer period of time, we would find that any of the points in the Poincaré section
repeat themselves, hence demonstrating a periodicity. The answer is no, there is no
repetition, and therefore the system is not periodic. The Poincaré section is even more
interesting if we zoom into it and look at its structure. Doing so would reveal that the
bands that are visible in the Poincaré section of Figure 13.13 persist when zoomed in at
any scale provided enough points are plotted, which can get computationally expensive.
The presence of structure at arbitrary scale means that the attractor is a fractal!
Python Code
To use odeint, we need to rewrite (13.5.2) as
)
ẋ = v
(13.5.3)
v̇ = −0.15y + x − x3 + 0.3 cos (t)
Chaos 525
We set a transient time of 4800 using the variable start. Notice that start appears
in the plot command as the starting point for the slices used to create each plot (except
for the Poincaré section). The transient time is much shorter than 4800; however, we
choose a large value to make the graphs easier to read.
To create the Poincaré section, we used a slice in the scatter command. The stride
of the slice is tau = 2*[Link], which matches the period of the drive term in (13.5.2).
To properly visualize the Poincaré section, we needed a lot of data. Therefore, we used
the full solution for the Poincaré section.
import numpy as np
import [Link] as plt
from [Link] import odeint
def deriv(z,t):
x, y = z
dzdt = [y, -0.15*y + x - x**3 + 0.3*[Link](t)]
return dzdt
ics = [0,0]
soln = odeint(deriv,ics,times)
tau = int(2*[Link]/dt)
#plot x(t)
ax[0,0].plot(times[start:],soln[start:,0])
ax[0,0].set_xlabel('time')
ax[0,0].set_ylabel('x')
ax[0,0].set_title('x(t)')
plt.tight_layout()
[Link]()
526 Nonlinear Systems
Mathematica Code
We use NDSolve to solve (13.5.2). The plots of x(t) and the phase portrait are
similar to that done earlier in this chapter. To create the Poincaré section, we sampled
the solution at time interval of t = 2π and stored the result as the table psData, which
was then plotted with ListPlot.
BaseStyle->{FontSize->16}, ImageSize->Large];
PlotLabel->“x(t)”];
v(t)
0 0.0
x
−0.5
−1
−1.0
4800 4850 4900 4950 5000 −1 0 1
time x(t)
Poincare Section
1.0
0.5
v
0.0
−0.5
−1 0 1
x
Figure 13.13: Python-generated plots of x(t), the phase portrait, and Poincaré section of
(13.5.2) from Example 13.6.
What have we learned in our study so far from Figure 13.13? We learned that chaotic
systems are not periodic. The trajectory of a chaotic system’s solution in the phase portrait
is attracted to a structure with fractal properties. Furthermore, the behavior of the solution
is not random; the system is obeying the Duffing equation. This is getting strange! But
wait, there is more...
oscillator (SHO) with two initial conditions x(0) = 1.1 and x(0) = 1.0, each with ẋ(0) = 0,
for comparison.
Figure 13.14: Plots comparing similar initial conditions for the simple harmonic oscillator
(SHO) and the Duffing equation. The value of Difference in the title of each plot describes
the difference in the initial positions of the two oscillators. The black solid curve has an
initial position of x(0) = 0 and the red dashed curve (in the e-book) has an initial position
of x(0) = 0 + Difference. In all cases ẋ(0) = 0.
In Figure 13.14, the black line (in the e-book) for the SHO is the solution for x(0) = 1 and
ẋ(0) = 0. For the Duffing equation, the black line is the solution for x(0) = 0 and ẋ(0) = 0.
The red dashed line (in the e-book) for each graph has a zero initial velocity, but an initial
position that is off by the value of “Difference” (the value of which is in each plot’s title) from
the red line’s initial condition (e.g., for the SHO, the red dashed line has an initial position
of x = 1.1). Notice that the SHO behaves exactly as described in the above paragraph. The
two solutions track each other with only a small difference in their amplitudes (as expected
from the initial condition). However, the Duffing equation solutions are very different from
the SHO solutions. Notice that over time, the small difference in the initial conditions is
magnified. Eventually, the two solutions are not similar at all. For example, there are times
where the red solution is near x = 1, but the black solution is near the other equilibrium at
x = −1, and vice versa. We see in Figure 13.14 that the smaller the initial difference, the
longer the solutions are similar, but even extreme initial similarity (the lower right graph in
Figure 13.14) eventually yields a divergence in the solutions. This phenomenon is referred to
as sensitive dependence on initial conditions, and is a critical component of chaotic behavior.
Attractors on which the trajectories exhibit sensitive dependence on initial conditions are
called strange attractors.
Is the sensitive dependence on initial conditions just a fancy way of saying that the
system is random? No, the system is not random. The Duffing equation is an ordinary
differential equation. The solution of the Duffing equation is dictated by its initial conditions,
and therefore is a deterministic system. In other words, future values of x(t) and ẋ(t) depend
on the initial conditions x(0) and ẋ(0). In a random system, past states do not dictate
Chaos 529
future states (otherwise, there would be no lottery!). The fact that the Duffing equation
is deterministic means that the interesting behavior arises due to the nonlinearity of the
system, not due to some random elements.
Other than being a mathematical curiosity, why is sensitive dependence on initial con-
ditions important? As an example, it is helpful to consider the case where chaos was first
presented in its modern form by meteorologist Edward Lorenz (1917-2008), who was creat-
ing weather models.
Lorenz’s weather model demonstrated chaotic behavior. To illustrate sensitive depen-
dence on initial conditions, suppose that the weather perfectly follows Lorenz’s model (in
reality, it does not). Does that mean we can perfectly predict the weather at any point in
the future? No. In order to make predictions, we need to input an initial condition into the
model. The initial condition comes from instruments used to measure various atmospheric
conditions. The instruments have a certain degree of accuracy; they may only measure the
true value of a quantity to, for example, one part in a thousand. The actual degree of
accuracy is irrelevant, the point is that the measured initial conditions will be different
from the true state of the atmosphere. Since, in our example, the weather perfectly obeys
a chaotic model, then the slight difference in measured versus true values will mean that
after a period of time, the model’s predictions will diverge from the actual weather. The
chaotic system is sensitive to initial conditions! The result of a chaotic system’s sensitive
dependence on initial conditions is that there is no accurate long-term prediction possible
for chaotic systems.
where λ is called the maximum Lyapunov exponent. The maximum Lyapunov exponent
measures the rate of exponential divergence between two initially nearby trajectories on
the chaotic attractor. Chaotic systems have λ > 0. The maximum Lyapunov exponent is
typically difficult to calculate for a system; however, there are methods of finding λ from
measured data called time series. A review of such methods can be found in Kantz and
Schreiber [14].
So what have we learned? First, chaotic systems are not random; they are deterministic.
Second, their trajectories live on strange attractors in the phase portrait, and these attrac-
tors have fractal structure. This means that chaotic systems are not periodic; they do not
settle onto fixed points. They are also not quasiperiodic, an oscillator consisting of a sum of
incommensurate frequencies. Third, trajectories on the chaotic attractor exhibit sensitive
dependence on initial conditions. This means that there is no long-term predictability for
a chaotic system. So what is chaos? Chaos has eluded a formal definition since it was first
formally presented by Lorenz in 1963. However, for our purposes, Strogatz’s definition [11],
will suffice:
Chaos is aperiodic long-term behavior in a deterministic system that exhibits
sensitive dependence on initial conditions.
If the authors may be so bold, we suggest that of all the factors, it is the sensitivity to
initial conditions that is truly the hallmark of chaos. That sensitivity is what makes chaotic
systems difficult to predict and very interesting!
530 Nonlinear Systems
In this chapter, we studied systems whose equations of motion have nonlinear terms.
These equations have the form
ẋ =f (x, y)
ẏ =g(x, y)
Although the equations governing nonlinear systems are not usually solvable in
closed form, we can use tools such as phase portraits to understand possible steady
state behaviors of the system as well as identify the stability of equilibria.
The fixed points of the system can be found by solving
f (x∗ , y ∗ ) =0
g(x∗ , y ∗ ) =0
End-of-chapter problems 531
Although we cannot solve the whole system analytically, we can linearize the system
about the fixed points, which results in an easily solvable system of equations:
∂f ∂f
u̇ u
=
∂x ∂y
∂g ∂g
v̇ ∂x ∂y
v
where the eigenvalues of the Jacobian matrix A give us information about the stability
of the equilibrium. The eigenvalues can be found using the characteristic polynomial,
det (A − λ1) = 0
In nonlinear systems, the equilibrium states can change (both location in phase space
and stability).
Finally, we also explored a behavior called chaos, which is unique to nonlinear sys-
tems. A hallmark of chaos is that the solutions of a chaotic system display sensitive
dependence on initial conditions. In other words, two initially similar states will evolve
to very different behaviors, thus inhibiting one’s ability to make long-term predictions
on chaotic systems.
d3 x
+x=0
dt3
Is this equation a linear or a nonlinear differential equation? Justify your answer. Solve
the equation for x(t).
2. Are the following differential equations linear or nonlinear? Justify your answers.
d3 x
a. dt3 + t3 x = 0.
b. ẍ + t3 ẋx = 0
c. ẍ + t2 x = A cos (t)
d. ẋ + x sin t = t3
3. Consider the differential equation
ẍ = t2 x − tx2
Suppose you have found two solutions to this equation, x1 (t) and x2 (t). Is it true that
c1 x1 + c2 x2 is also a solution? Prove your answer.
532 Nonlinear Systems
4. Using a computer, plot the phase portrait for the damped harmonic oscillator with
γ < 0 and ω02 = 1. You may use x(0) = 1 and ẋ(0) = 0. Do you get what you expect?
Why or why not? What does it mean for γ < 0?
5. Using a computer, plot the phase portrait for the damped pendulum, ẍ+ω02 sin x+
γ ẋ = 0 for ω02 = 1 and three values of γ, less than, equal to, and greater than ω02 . For
each case, use x(0) = 1 and ẋ(0) = 0. Discuss your results.
Section 13.3: Fixed Points and Phase Portraits
6. Consider a one-dimensional system, ẋ = f (x). We can assign a potential function to
the system, V (x), such that
dV
f (x) = −
dx
which makes the potential function similar to the potential energy discussed in Chap-
ter 5. In this chapter, we discussed that the condition for fixed points (i.e., equilibrium
points), x∗ , f (x∗ ) = 0. How can we use the potential to find fixed points using V (x)?
In other words, how does one find fixed points using V (x)? How can one use V (x) to
identify the stability of a fixed point?
7. Consider the system ẋ = 1 − x2 . Find the potential corresponding to this system (see
Problem 6). Using the potential, find the fixed points and identify their stability.
8. In this chapter, we discussed how to identify the stability of fixed points for two-
dimensional systems. The logistic equation, ẋ = rx(1 − x/k), is used to model popu-
lation sizes, and is a one-dimensional system. Note that r is a positive constant called
the linear growth rate and k is a positive constant called the carrying capacity. Find
the fixed points for the logistic equation and give them a physical interpretation. Find
the stability of each fixed point by perturbing the fixed point, x = x∗ + u (for u << 1)
and expanding the logistic equation in powers of u. The result will be a differential
equation for u which you can solve.
9. Find the eigenvalues and eigenvectors for the following matrices. Solve this prob-
lem analytically and by using a computer algebra system.
0 1 2 1 1 1
(a) (b) (c)
3 0 7 3 1 1
11. Solve the pendulum equation (13.3.13) numerically with an initial condition of
θ(0) = 2.7, 2.9, and 3.0 (all with θ̇(0) = 0 and ω0 = 1). Keeping in mind Figure 13.5,
why does the solution, θ(t), change as the initial angular displacement approaches the
vertical (x = π)?
End-of-chapter problems 533
12. Strogatz [11] discusses the mathematics of love affairs, an interesting and fun way
to explore two-dimensional linear systems. Let R(t) be Romeo’s love (positive) or
hate (negative) for Juliet at time t, and J(t) be Juliet’s love or hate for Romeo at
time t. The love affair can be modeled using the equations:
Ṙ =aR + bJ
J˙ =cJ + dR
13. In this problem, we will build on Problem 12 with a nonlinear romance! We will
have both Romeo and Juliet be very sensitive to their own emotions:
Ṙ = − 2R − 2J(1 − |J|)
J˙ =J + R(1 − |R|)
The nonlinear term J(1 − |J|) is sometimes called a repair nonlinearity (Sprott [17]),
and the number 1 in the second term on the right-hand side is a measure of when
Juliet’s love becomes counterproductive. Plot the phase portrait for this system and
discuss the nature of the relationship between Romeo and Juliet.
14. Find the Jacobian matrix for (13.3.25) and compute its eigenvalues for each of the
fixed points.
15. The Lotka-Volterra model of competition is a mathematical model for two species
X and Y who compete for the same resources. Let x be the population size of species
X and y be the population size of species Y , then one choice of a Lotka-Volterra
model would be:
ẋ =4x − 3x2 − xy
ẏ =2y − 4y 2 − 3xy
For this model, identify the fixed points and their stability. Can the two species ever
coexist? Note that this kind of equation-based model tends to work well for large
populations. For small populations, agent-based models tend to be more useful. For a
discussion of agent-based versus equation-based modeling, the interested reader should
consult Wilensky and Rand [16].
16. Plot the phase portrait for the Lotka-Volterra competition model in Problem 15.
Discuss the final state of the system for various initial conditions.
534 Nonlinear Systems
17. Lotka-Volterra equations can also be used to describe predator-prey models where
species Y (predator) eats species X (prey). Consider the predator-prey model
ẋ =3x − 7xy
ẏ = − 2y + 5xy
where like the competition model, we will assume x(t) and y(t) measure the number of
each species in the hundreds. Find analytically the fixed points of this predator-prey
model and identify their stability. Comment on the nature of the equilibrium state
corresponding to each fixed point.
18. Using a computer, draw the phase portrait for the predator-prey model in Problem
17.
19. The SIS (susceptible-infected-susceptible) disease transmission model can be used for
diseases that do not remove individuals from the population, either through immunity
or death. SIS models are sometimes appropriate for some bacterial diseases such as
streptococcal pharyngitis (also known as sore throat). Consider two populations of
individuals s(t) and i(t), representing the number of susceptible and infected individ-
uals, respectively. The SIS model is:
ṡ =µn − µs + γi − βsi
i̇ = − µi − γi + βsi
where the coefficients represent rates, and n = s + i is the total population. Com-
ment on the physical meaning of each coefficient: µ,γ, and β. Find the fixed points
for the system and identify their stability. Note that negative values of s and i are
meaningless.
Section 13.4: Limit Cycles
where ω = 1.4. Show that the Duffing equation, (13.8.1), undergoes a series of period-
doubling bifurcations by changing the value of d. Start with d = 0.1 and gradually
increase its value until a period-doubling bifurcation is observed. Use x(0) = 0 and
ẋ(0) = 0 as initial conditions.
21. The logistic map, xn+1 = rxn (1 − xn ), is a discrete form of the logistic equation
(see Problem 8). After choosing an initial value x0 and parameter r, it is easy to
compute successive values. For example, x1 = rx0 (1 − x0 ) and x2 = rx1 (1 − x1 ),
and so on. Using x0 = 0.1, plot xn vs. n for r = 2.9, 3.2, 3.5, and 3.55. Identify the
periodicity of each solution. You can produce a Poincaré section by plotting xn+1 vs.
xn . Finally, try r = 3.91. What kind of behavior is the logistic map exhibiting when
r = 3.91?
End-of-chapter problems 535
22. Weakly driven nonlinear oscillators can be excited to large amplitudes through
a phenomenon called autoresonance. The oscillator is driven by a periodic forcing
term whose amplitude is small, but its frequency changes (typically decreasing) with
time. As the drive frequency decreases through the oscillator’s resonant frequency,
the oscillator becomes phase-locked with the driving force, resulting in the oscillator
maintaining resonance even though the drive frequency is no longer the oscillator’s
natural frequency. Consider the following driven pendulum:
ẍ + ω02 sin(x) = ϵcos ω0 t − 1/2αt2
Notice that the drive frequency (the time derivative of the drive phase) is fd = ω0 −αt,
so that at t = 0, the drive frequency is equal to the natural frequency of the pendulum.
Starting with initial conditions, x(−1000) = 0 and ẋ(−1000) = 0, compute x(t) for
ϵ = 0.0459 and ϵ = 0.0461 for the pendulum with ω0 = 2π, α = 0.001. For which value
of ϵ is the pendulum displaying autoresonance? For more information on autoresonance
and the pendulum, check out Fajans and Friédland [18].
23. Electrical circuits provide excellent examples of nonlinear systems. One of the
most famous circuit-inspired equations is the so-called Van der Pol equation
ẍ − ϵ 1 − x2 ẋ + x = 0
which is a simple harmonic oscillator with a nonlinear damping term. Notice that the
sign of the damping actually changes with the value of x. For example if ϵ > 0, then
the damping is negative for x < 1 and is positive for x > 1. Thus small oscillations
will grow due to negative damping, but once the oscillations are large enough, they
will dampen out as the damping term becomes positive. The Van der Pol oscillator
can also display so-called relaxation oscillations, a common form of oscillations in
nonlinear systems where rapid changes of x are followed by slower variations. To see
relaxation oscillations in action, solve the Van der Pol oscillator for ϵ = 8.0. Plot both
x(t) and the phase portrait. Describe the solution.
24. It can sometimes be convenient to describe limit cycles using polar coordinates. Con-
sider the following system in polar coordinates:
ṙ =r(r − 1)(r − 2)
θ̇ =1
where r and θ are the usual polar coordinates with r ≥ 0. Notice that one can find
values of r that make ṙ = 0, but there are no values of θ or r for which θ̇ = 0. Give
a description of the phase portrait in this case. There are limit cycles in this system.
Where are they and what is their stability? The stability can be found by using the
method outlined in Problem 8 for the ṙ equation.
Section 13.5: Chaos
display chaotic behavior with σ = 10, r = 28, and b = 8/3. Plot the phase portrait
(x, y, z) for the Lorenz equations.
26. The Lorenz equations in Problem 25 are a chaotic system. Show that they demon-
strate sensitive dependence on initial conditions.
27. Chua’s circuit is a electrical circuit with a piecewise linear negative resistance NR .
It is one of the simplest circuits to exhibit a variety of nonlinear behaviors including
a period-doubling route to chaos. The circuit schematic is shown in Figure 13.15. Let
x, y, and z be proportional to the voltages across the capacitors C1 and C2 , and the
current in the inductor L, respectively. The equations governing the circuit can be
obtained from Kirchoff’s rules and simplified to be:
ẋ =α(y − x − g(x))
ẏ =x − y + z
ż = − βy
28. A period-doubling route to chaos can be observed in the equations for Chua’s
circuit (see Problem 27) by using the same parameters as used in Problem 27, but
with β = 50, 35, 33.8, etc. For each value of β, create a graph of x(t) and identify the
periodicity of each solution. For what value of β is there a period-8 solution?
29. As a final problem for this chapter, we will explore the idea of bifurcations of fixed
points. Consider the following predator-prey model:
ẋ =x(1 − x) − xy
ẏ = − ϵy + xy
c. Notice that for a certain value of ϵ, fixed points collide in the phase portrait (i.e.,
two or more fixed points occupy the same location in the phase portrait). Those
collisions are bifurcations of fixed points. For what value of ϵ do the bifurcations
occur?
d. Find the Jacobian of the system and evaluate the Jacobian at each fixed point.
e. Find the stability of each fixed point by finding the eigenvalues of the Jacobian
associated with each fixed point. You may want help from a computer algebra
system for this.
f. Describe how the stability of each fixed point changes with ϵ. Besides collisions
between fixed points, bifurcations can also involve changes in the stability of a
fixed point. Plotting the eigenvalues as a function of ϵ is often a useful trick to
identify whether or not the eigenvalues are positive or negative.
g. Draw phase portraits for the system before and after the bifurcation(s) by choos-
ing a value of ϵ less than and greater than the bifurcation conditions you found
in parts c and e. Notice that the phase portraits are different.
h. Provide a qualitative description of what happens to the system as ϵ increases.
What does ϵ represent in our system? Does the increasing the value of ϵ have the
effect on the phase portrait that you expected? Why or why not?
A Introduction to Python
A.1 DATA TYPES AND VARIABLES IN PYTHON
The main numeric types in Python are integers, floating point numbers and complex num-
bers. A floating point number (or float) is a real number written in decimal form. Python
stores floats and integers internally in different ways.
In Example A.1 we assign a value to a variable using the assignment operator =, for
example a = 0.0003 assigns the value of 0.0003 to the variable a. We can also define
variables by using scientific notation
√ to represent floats, for example b = 1.64e-4. Python
uses the letter j to represent −1, and the built-in function complex(a,b) creates the
complex number a+b*j. We can use the built-in function type() to identify the type of a
Python object, and the built-in function print(a) is used to print the value of a variable.
Similar to several other computer languages, the line e = ′ time′ defines a string variable e.
Example A.1 shows how the function type(a) can be used to find out what class of
object the variable a belongs to. In most codes of this book you will see the line of code
print('-'*28,'CODE OUTPUT','-'*29), which is used to separate the Python code from
the output generated by the code.
Python Code
#define variables
a, b, c, d = 0.00007, 1.64e-4, 10, complex(3,4)
e = 'time'
print('-'*28,'CODE OUTPUT','-'*29)
539
540 Appendix A: Introduction to Python
Multiple variable assignments can be compressed to one line. For example, the code
a,b,c = 1, 2, 3 is a compressed version of the three individual lines of code a = 1, b =
2, and c = 3.
The common arithmetic operators in Python are: addition +, subtraction −, multipli-
cation ∗, division / and exponentiation ∗∗. In addition, the % operator is used to find the
remainder (or modulo), and the // is used for integer division.
In Python we can use f-strings to format the printing of variables. Within the f-string,
any variable can be enclosed inside curly brackets, for example print(f′ {a}′ ) will print the
numerical value of the variable a, and print(f′ {a**2}′ ) prints the numerical value of a2 .
By using the f-string formats print(f′ {a:.3}′ ), print(f′ {a:.2e}′ ), print(f′ {a:.2f}′ )
and print(f′ {a:g}′ ), we print the variable a using two decimals, using scientific notation,
and as a float in generic notation, respectively.
In Example A.2 we use f-strings to format the printing of variables.
Example A.2: Assign Python variables a, b to the numbers 5.0/3 and 1.645.
(a) Use f-strings to print the variable a using scientific notation with two significant
figures.
(b) Print the variable a2 without any formatting and by using generic notation.
(c) Print the variable b using two decimal points in the output of the code.
(d) What does round(a,2) and round(b,1) produce in the code?
Python Code
print('-'*28,'CODE OUTPUT','-'*29,'\n')
A variable name cannot begin with a number, and there are reserved words in Python
which should not be used as variables. Table A.1 shows a partial list of reserved words.
Table A.1
Partial list of reserved words in Python.
A.2.1 LISTS
We create a Python list using square brackets, with items separated by com-
mas. Lists can contain data of any type and even other lists. For example,
a=[2.0,[3,0],5j,[1,1,2],′ s′ ,1] defines a list containing floats, integers, complex num-
bers, other lists, and strings.
We can access the elements of a list by their index, and it is important to remember that
lists are indexed starting at 0, not at 1. For example print(a[0]) prints the first element
in the list a, and print(a[2]) prints the third element. We can also use negative indices
to access elements starting from the end of the list, so that print(a[-1] prints the last
element in the list, print(a[-2]) prints the second to last element, etc.
Since lists are mutable, they can be altered, so we can redefine any of the elements in
the list, for example a[-1] = -2 sets the last element of the list to -2. We can use multiple
indices to access several entries in a list of lists, for example print(a[1][0]) will print the
first element in the element a[1]. In the above list a, the element print(a[1][0]) is 0.
542 Appendix A: Introduction to Python
We can define sub-lists called slices, by using the syntax a[start:end:step]. For ex-
ample, the slice a[Link] starts at index 2 and increases by a step of 2 taking every second
element in the list, but does not include the ending value 5 of the index. We can omit one
of the indices or the step parameter in a slice, for example a[:5] creates a list of the first
five elements of a, and a[2:] creates a list of all the elements of a after and including a[2].
Likewise, a[::2] creates a list which contains every other element in a.
Lists can be concatenated using the addition operator +, for example, a[1]+a[3] creates
a new list with the elements from both a[1], a[3].
Example A.3 presents how to use these general properties of lists and how to access and
modify parts of a list.
Python Code
(a) The first and last elements in this list are added by a[0]+a[-1].
(b)-(c) a[2]=-2 sets the third element in the list equal to -2. Similarly, a[3][2] obtains
the third part of the fourth element of the list.
(d)-(e) The line a[2:len(a):2] creates a new list which starts from the third element
a[2] in the list, up to the length of the list which is specified by len(a).
(f)-(g) The code a[1]+a[3] produces a new list by concatenating the list [1, 1, 2] to the
end of the list [3, 0]. Finally, a[1]*3 produces a new list by repeating the elements of
the list a[1] three times.
Sequences in python 543
print('-'*28,'CODE OUTPUT','-'*29,'\n')
print('list a=',a)
a[2] = -2
print('\na[2] = -2 modifies list a into \na =',a,'\n')
Example A.4:
(a) What does the line print(range(1,7,2)) produce in the output of the Python
code?
(b) Change the object range(1,7,2) into a list, by using the Python function list().
(c) Find the maximum element, the sum of the elements and the length of the object
range(1,7,2).
(d) What will be the result of the code [u**3 for u in [1,2,3]]?
(e) What will be the result of the code [x%3 for x in range(0,12)]?
Sequences in python 545
Python Code
print('-'*28,'CODE OUTPUT','-'*29,'\n')
a = range(1,7,2)
print('Define the range sequence a = ',a,'\n')
# print(a) does not print the elements of the range() object
# Use list(a) to convert the range into a list, then print elements
print('list(a) gives: ',list(a),'\n')
string and list types in Python. Lists are mutable but strings are not, i.e., we can modify
the value of an element in a list, but not for a string. However, parts of a string can be
extracted using slices, for example ′ hi′ [1] will extract the second letter in the string ′ hi′ .
In the second iteration of the loop, the variable t has the value of 1 and the process is
repeated. Afterwards, the loop has two more iterations, t = 2 and t = 3. The integer 3 is
the last element of range(4) and, therefore the loop stops after that iteration.
Example A.5:
Create a function f(vo,a,t) which evaluates the position y of a particle starting at the
origin, moving with initial speed v0 , under a constant acceleration a, and at time t:
1
y = v0 t + a t 2 (A.3.2)
2
Use a for loop so that the function f is called repeatedly to evaluate the position of the
particle at times t = 0, 1, 2, and 3 seconds.
Python Code
As outlined above, we construct the for loop using range(4). The function f is called
repeatedly inside the loop, to evaluate the position variable ypos. The value of f is
added (appended) to the list ypos by using the [Link](f(1,2,t)) command.
print('-'*28,'CODE OUTPUT','-'*29,'\n')
In some cases, the functions we need in our code are simple and they depend only on one
variable, so that we can use a simple function structure called a lambda function. Example
A.6 defines a lambda named function f, which evaluates the position ypos of the particle
based on (A.3.1).
Example A.6:
Repeat the previous example by using a lambda function.
Python Code
Note that when using this simpler type of function, the variables v0 and a are treated
as global variables with fixed values v0 = 1 and a =2.
548 Appendix A: Introduction to Python
print('-'*28,'CODE OUTPUT','-'*29,'\n')
In many occasions we need to execute parts of the code only if certain conditions are
true. In Python such conditional statements are implemented using the if, elif and else
keywords, as in Example A.7. The conditional statement also uses indentation, just like the
functions and for loops.
Example A.7
Repeat the previous example; however, this time use an if statement inside the for
loop, so that the code stores only values of the position which are smaller than 7.
Python Code
In this example the ypos variable is evaluated and stored only if the conditional state-
ment f(t)<7 is true, otherwise, the code line [Link](f(t)) is ignored.
print('-'*28,'CODE OUTPUT','-'*29,'\n')
Example A.8:
Write a Python code to demonstrate the four methods described above for importing
the numpy package, and then evaluate the cosine function cos(0.5) in each method.
Python Code
The comments in this code explain the differences between the four methods of loading
and using the package.
550 Appendix A: Introduction to Python
print('-'*28,'CODE OUTPUT','-'*29,'\n')
from numpy import cos # method 3: import only function cos() from numpy
print('Importing just the NumPy function, result is: ', cos(0.5))
Libraries are sometimes organized into multiple modules. For example, the mod-
ule name A.B indicates a module B contained within a library named A. For ex-
ample, [Link]() refers to the function normal() contained within the
module random of the library numpy. The general format for this type of function is
[Link]().
Table A.2
NumPy functions for creating arrays and matrices.
Function Description
[Link](a) Creates N-dimensional NumPy array from sequence a.
[Link](start, stop, step) Creates an evenly spaced 1D array from start to stop,
excluding the stop value.
[Link](start, stop, N) Creates a 1D array with length equal to N,
including the start and stop value.
[Link](shape) Creates array of given shape and type, filled with zeros.
[Link](shape) Creates an array of given shape and type, filled with ones.
[Link](shape) Creates an array of given shape and type,
filled with random float numbers from 0 to 1.
[Link](array, newshape) Changes the dimensions of a 1D array.
Example A.9 applies some of these array functions to create various types of arrays. In
the first two lines of code, notice that when we print a NumPy array it looks a lot like a
Python list, except the elements are separated by spaces, while in a list the elements are
separated by commas.
The function [Link](start,stop,step) is very similar to the list function
range(start,stop,step) that we saw before when discussing lists. In Example A.9, the
code line [Link](0,3.5,.5) creates a 1D NumPy array with values from 0 to 3.5 in
steps of .5, excluding the end value of 3.5.
The function [Link](start,stop,N) is slightly different, since we specify the
number of points N between the start and end values, instead of the step in the array. In
the same example, [Link](0,8,6) creates an array with exactly six elements between
0 and 8, including the end value 8.
Similarly [Link](5) creates a 1D NumPy array of zeros of length 5. Similarly,
[Link](2,1) creates a 2D NumPy array of zeros with 2 rows and 1 column. The code
line [Link]([1,2]) will generate a matrix with one row and two columns, with
random values between 0 and 1.
Example A.9 demonstrates various types of arrays, and how to use the [Link](),
[Link](), [Link]() and [Link]() functions.
Example A.9
Write a simple code to show how to create arrays using the [Link](),
[Link](), [Link]() and [Link]() functions.
552 Appendix A: Introduction to Python
Python Code
The comments in the code explain the various commands.
import numpy as np
print('-'*28,'CODE OUTPUT','-'*29,'\n')
print('printing the list [1,2,3]: ',[1,2,3])
print('printing the array [Link]([1,2,3]): ',[Link]([1,2,3]),'\n')
define in this book will always be called using the function name first, followed in parenthesis
by all of the arguments of the function.
Methods are somewhat similar to functions, but they are called using the dot notation,
such as [Link]. Loosely speaking, methods are always attached to a specific object, while
functions are isolated. Another example of a function versus a method is the implementation
of the dot and cross products of two vectors A and B in SymPy and NumPy. In SymPy
the dot product is implemented as a method [Link](B), while in NumPy the dot product
is represented as a function dot(A,B). We will later see several more different types of
functions and methods within the NumPy, SymPy and SciPy packages used in this book.
Table A.3
Useful commands (methods) for extracting the properties or attributes of an array.
Command Description
[Link] Prints the data type for NumPy array A.
[Link] Prints the number of dimensions for NumPy array A.
[Link] Prints the size (total number of elements) for NumPy array A.
[Link] Finds the number of rows and columns for NumPy array A.
Example A.10 shows how we can use some of these functions with arrays. All entries in
a NumPy array are of the same data type. We will mostly work with numeric arrays which
contain integers, floats, complex numbers or Booleans. We will also mostly be working with
the default integer type numpy.int64 and the default float type numpy.float64. We can access
the datatype of a NumPy array A by its [Link] attribute. We create a 2D NumPy array
from a list of lists of integers using the lines of code A = [Link]([[1,2,3],[4,5,6]])
and [Link] prints out dtype(′ int32′ ) i.e, the data is of integer type and is represented
in the computer’s memory by 32-bits. Similarly, [Link] tells us that A has two dimensions,
with the first dimension corresponding to the vertical direction counting the rows, and the
second dimension corresponds to the horizontal direction counting the columns. Finally, we
can find out the total elements in array A with [Link].
In the next section we see how to carry out arithmetic operations with various types of
arrays.
Table A.4
Partial list of useful array functions in Python.
Array functions in NumPy
[Link] [Link] [Link] [Link]
[Link] [Link] [Link] [Link]
Mathematical functions in NumPy
[Link] [Link] [Link]
[Link] [Link] [Link]
[Link] np.log10 [Link]
Mathematical constants in NumPy
[Link] np.e
Example A.10:
Define two NumPy arrays, a and b from the lists [1, 2, 3] and [4, 5, 6], respectively.
In addition, define a 3 × 3 matrix M of your choosing as a NumPy array.
Write a simple code to demonstrate the following:
1. The use of the functions mean(a), argmax(a) , std(a) for the NumPy array a.
2. The result of a + b and a * b.
3. Broadcasting, using 1 + a**2.
4. The use of the functions [Link](M,axis=0) , [Link](M,axis=1) .
The NumPy library 555
Python Code
import numpy as np
print('-'*28,'CODE OUTPUT','-'*29,'\n')
a = [Link]([1,2,3])
b = [Link]([4,5,6])
M = [Link]([[2,4,2],[2,1,1],[3,2,0]])
#Part 1
print('mean of elements in array a = ',[Link](a))
print('std dev of elements in array a = ',[Link](a))
print('max of elements in array a = ',[Link](a))
print('sum of elements in array a = ',[Link](a),'\n')
#Part 2
print('a + b = ' , a+b)
print('a * b = ', a*b, '\n')
#Part 3
print('1 + a**2 = ', 1 + a**2,'\n')
#Part 4
print('matrix M =',M,'\n')
print('sum of elements of M along axis=0 (rows) = ',[Link](M,axis=0))
print('sum of elements of M along axis=1 (columns) = ',[Link](M,axis=1))
Example A.11:
(a) Define a 3 × 3 matrix v of your choosing and demonstrate the use of indexing with
v[3], v[1,2] and v[-1,-1].
(b) What elements of the matrix correspond to v[2,:] and v[:,3] ?
Python Code
import numpy as np
print('-'*28,'CODE OUTPUT','-'*29,'\n')
properties of the plot. To improve the appearance of the plot, we use pyplot() functions
to add a figure title, legend, grid lines, etc. Finally, the line [Link]() displays the figure.
Let’s begin with a basic example, of solving a simple physics problem in which we throw
a ball straight up with an initial speed v0 = 5 m/s. We want to plot the position y(t) as a
function of time, and also find numerically the maximum height reached by the ball. The
kinematic equations for this problem are:
1
y = v0 t − g t2 (A.6.1)
2
v(t) = v0 − g t (A.6.2)
2
where g = 9.8 m/s is the acceleration of gravity. Example A.12 shows how we would solve
this problem using the numerical capabilities of Python.
Example A.12
Write a code to evaluate and plot the kinematic equation (A.6.1), from t = 0 to t =1 s
with vo = 5 m/s.
Python Code
The first line in the code import numpy as np causes Python to import the NumPy
library, with the alias np. We import the Python library Matplotlib and its submodule
pyplot, in order to plot the position y(t). The code imports the [Link]
submodule using the short-hand alias plt. After the libraries are imported, we define
the initial condition variable vo and the acceleration of gravity g, in a single line vo, g
= 5, 9.8.
We need to tell Python for which values of time t we will be computing the position
y(t). In this case, we use t=[Link](0,1,100) to define the array with the values
of times t, which will be used to compute y(t). We next use a list comprehension in the
form y=[vo*u-g*u**2/2 for u in t] to obtain the array y containing the values of
y(t).
The pyplot commands plot, title, ylabel, xlabel are used to improve the appear-
ance of the plot in Figure A.1, and finally [Link]() prints the plot. The last four
lines in the code show how to evaluate numerically the maximum height ymax and the
corresponding time tmax, by applying the functions max() and argmax(), respectively.
558 Appendix A: Introduction to Python
print('-'*28,'CODE OUTPUT','-'*29,'\n')
import numpy as np
import [Link] as plt
vo, g = 5, 9.8 # define values of vo, g
[Link](t,y)
[Link]()
Figure A.1: Plot of the kinematic equation (A.6.1), from t = 0 to t =1 s with vo = 5 m/s.
The matplotlib module 559
We can improve further the plots by specifying various options inside the [Link]()
function. For example, we specify the color , e.g., by name as in color=′ red′ , or by a RGB tu-
ple such as (1,0,1). We can also specify the type of line to be used with linestyle=′ dashed′ ,
the type of marker for data points with marker=′ o′ , the linewidth with linewidth=2, etc.
It is very convenient to use combined format strings as in the command
[Link](x,y,′ rd--′ ) where the string ′ rd--′ ) signifies a red line ( ’r’), a diamond
marker (’d’) and a dashed line (--).
Examples of colors are: b blue, g green, r red, c cyan, m magenta, y yellow, k black, w
white. Examples of character Markers are: . point, o circle, v triangle down, ^ triangle up,
s square, p pentagon, * star, + plus, x x, D diamond. Finally, examples of linestyles are: -
solid line style, -- dashed line, -. dash-dot line, : dotted line.
The graphical commands in this example are an example of procedural programming.
Next, we will use the Matplotlib module to produce 3D plots using object oriented pro-
gramming.
Example A.13
Write a Python code to plot the surface function z = f (x, y) = x + y + 3 in 3D, when
−3 ≤ x ≤ 3 and -3 ≤ y ≤ 3.
Python Code
The 3D plot in the example is created using the plot_surface() func-
tion within the matplotlib library. The lines fig = [Link]() and and
fig.add_subplot(projection =′ 3d′ ) create the 3D plot, and the wireframe style is
used for the plot.
The NumPy command meshgrid(x, x) creates double arrays X,Y from the single
NumPy arrays x,y,z. It is necessary to created double arrays which are required as
inputs for the function plot_surface(X,Y,Z).
The plotting function plot_wireframe(X,Y,Z) plots the 3D surface of the plane z =
f (x, y) = 3 + x + y with the result shown in Figure A.2.
560 Appendix A: Introduction to Python
import numpy as np
import [Link] as plt
[Link]()
Figure A.2: Plot of a 3D surface z = f (x, y) from Example A.13 using MatPlotLib.
Symbolic computation with SymPy 561
Example A.14:
Use SymPy to solve again the problem of throwing a ball straight up with an initial
speed v0 = 5 m/s. Evaluate symbolically the maximum height ymax reached by the ball
(neglecting air resistance), and how long it takes to reach this maximum height.
Python Code
The following Python code evaluates the time tmax and the maximum height ymax ,
starting from (A.7.1) and (A.7.2). In this example, the SymPy library includes the
function solve and the method .subs which can help us solve algebraic equations.
Notice that we tell Python that the variables vo, t, g need to be defined, using the
symbols command, and that we also include the option real=True to signify that they
are to be treated as real variables.
The code line solve(vo-g*t,t) solves symbolically the equation v0 − g t = 0 for the
variable t, while the line [Link](t,tmax) substitutes symbolically the value of t with
tmax.
562 Appendix A: Introduction to Python
y = vo*t-g*t**2/2
# substitute tmax in y(t) to find ymax, using method .subs
print('Max height reached = ',[Link](t,tmax))
In the next section we provide an example which shows how to use the lambdify and
diff functions in Python.
Example A.15:
Use SymPy to evaluate the symbolic derivative of the function f = a sin(bt) with respect
to time t, and evaluate this derivative in the interval t = 0 to t = 6. Use the numerical
values a = 1 and b = 2.
Python Code
The Python code imports the lambdify function with the code line from
[Link] import lambdify. Notice that we tell Python that the
variables a, b, t need to be defined using the symbols command, and that we also
include the option real=True to signify that they are to be treated as real variables.
The diff(f,t) command is used to evaluate the symbolic derivative of the function
f = a sin(b t) and the result is stored in the variable deriv.
Next, [Link](a:1,b:2) substitutes the numerical values a = 1 and b = 2 into the sym-
bolic derivative, and code line y = lambdify(t,[Link](a:1,b:2)) creates a function
y = f (t).
Overview of integration methods in python 563
import numpy as np
from sympy import symbols, sin, diff
from [Link] import lambdify
print('-'*28,'CODE OUTPUT','-'*29,'\n')
f = a*sin(b*t)
deriv = diff( f,t) # evaluate symbolic derivarive of f
print('Symbolic Derivative v=dy/dt: ',deriv)
# print y(t)
print('Derivative values = \n',y(tims))
• Method #2: Using the [Link] library, we can carry out numeric integration
of functions from other libraries, or functions defined by the user (see Table A.5), or
samples of a function which are often stored as NumPy arrays (see Table A.6).
564 Appendix A: Introduction to Python
Table A.5
Integration functions available in the [Link] library for given functions.
Python function Description
quad General purpose integration.
dblquad General purpose double integration.
tplquad General purpose triple integration.
fixed_quad Integrate func(x) using Gaussian quadrature of order n.
quadrature Integrate with given tolerance using Gaussian quadrature.
romberg Integrate func using Romberg integration.
Of the methods in Table A.5, we will use the quad command in this book to evaluate 1D
integrals, while the functions dblquad and tplquad will be used to evaluate two-dimensional
and three-dimensional integrals.
Table A.6
Integration functions available in the [Link] library for sampled functions.
Python function Description
trapezoid Use the trapezoidal rule to compute an integral
cumulative_trapezoid Use the trapezoidal rule to cumulatively compute an integral
simpson Use Simpson’s rule to compute an integral
from samples of the function
romb Use Romberg Integration to compute integral
from (2k + 1) evenly-spaced samples
For a more complete listing of integration routines in SciPy, and details on how each
algorithm works, see the online manual and tutorial for [Link].
Example A.16 evaluates an indefinite integral which appears often in physics, using the
[Link] command.
Example A.16:
Calculate these integrals using SymPy.
Z Z
(a) x cos(n x) dx (b) x sin(n x) dx
Dsolve() command in SymPy 565
Python Code
Using integration by parts, we obtain:
Z
x sin(n x) cos(n x)
x cos(n x) dx = + +C
n n2
and Z
x cos(n x) sin(n x)
x sin(n x) dx = − + +C (A.9.1)
n n2
where C is an arbitrary constant of integration. The following Python code to evaluate
the definite integral gives the same result. Notice that we tell Python the variable the
variable x needs to be defined using the symbols command, and that the variable n
is not zero, by including the option positive=True. We also use the symbolic form of
cos() for the cosine function, instead of the numerical form of [Link]().
print('-'*28,'CODE OUTPUT','-'*29,'\n')
print("The indefinite cosine integral = ",integrate(x*cos(n*x),x))
print("The indefinite sine integral = ",integrate(x*sin(n*x),x))
Example A.17:
Consider a particle that is moving along a line with an acceleration proportional
to time a t, where a is a constant. If at time t = 0 the particle’s velocity is v0 , find
the formula for the particle’s velocity as a function of time, by solving the differential
equation dv/dt = a t.
Python Code
The first line tells Python to import several commands from the Symbolic Python
(SymPy) library. Libraries are written by experienced programmers, and they include
functions which can be used by any code that imports the library. In this case, the
SymPy library includes functions like dsolve which solve differential equations in closed
form.
566 Appendix A: Introduction to Python
print('-'*28,'CODE OUTPUT','-'*29,'\n')
Example A.18
Using an initial velocity of v(0) = v0 =1 m/s, find and graph the numerical solution
to the differential equation:
dv
= at (A.11.1)
dt
where the constant a = 2 m/s2 .
Numerical integration: the odeint() command in SciPy 567
Python Code
We import three libraries, NumPy, SciPy, and the graphics library Matplotlib. From
the SciPy library we import only the function odeint which is used to numerically solve
the differential equation (A.11.1). After the libraries are imported, we assign the values
of the initial condition variable v0 and the acceleration a.
To solve the differential equation numerically, we create a new function in Python
that we called velderiv(v,t), which contains the differential equation we are solving.
In Python, function definition is done using the command def. The arguments of the
function are v and t, and they are included in parentheses following the function name.
The next few lines contain the actual calculation of the function. Notice we included
a local variable dvdt, which stays within the function and is equal to the first derivative
of v. The last line of the function is return dvdt, which returns the value of the variable
dvdt.
We also need to tell Python for which values of t we will be computing v(t). In
this case, times is an array which contains the list [t0 , t1 , . . . , t30 ] = [0, 0.1, . . . , 3.0],
and hence we will be solving for v(0), v(0.1), . . . , v(3.0). Next, we solve the differential
equation using the command odeint, which is imported from the [Link]
library. The odeint command in this example is:
velocity = odeint(velderiv,v0,times).
This command has three arguments: the differential equation (as the user-defined func-
tion velderiv), the initial value (v0), and the list of times times. The result is an
array which we called velocity, and contains values [v0 , v1 , . . .], where vi = v(ti ). The
last group of lines in the program set up the graph of v versus t.
import numpy as np
from [Link] import odeint
import [Link] as plt
Figure A.3: Plot of the numerical solution of the differential equation A.11.1 from Example
A.18.
Table A.7
Partial list of vector functions and methods in the package [Link].
Function/Method Description
R = CoordSys3D('R') Define Cartesian coordinate system named R.
R.base_vectors() The unit base vectors of the coordinate system R.
[Link] components of vector v.
[Link]() magnitude of vector v.
[Link]() the normalized version of vector v.
[Link](u) The vector projection of vector von vector u,
[Link](u, scalar=True) The scalar magnitude of the projection of vector von vector u.
[Link](u) cross product of vectors v, u.
[Link](u) dot product of vectors v, u.
v.to_matrix(C) Modify vector v into a matrix form C.
For several more examples of Python codes covering many of the topics in this book,
the readers are referred to our recently published book Mathematical Methods using Python
(Pagonis and Kulp, [3]).
B Introduction to Mathematica
B.1 VARIABLES IN MATHEMATICA
Although Mathematica is best known for its symbolic capabilities, it is a programming lan-
guage in and of itself. Therefore, it can store floats, integers, complex numbers, and strings
as variables. In general, variable names in Mathematica should be lowercase (functions be-
gin with uppercase letters); however, there is nothing preventing you from using upper case
letters in Mathematica. The Print command can be used to display a variable’s contents.
Note that Mathematica can also print contents without using the Print command. By
default, Mathematica displays the output when commands are executed, or variables are
assigned. Lines ending with a semicolon (;) suppress the output.
569
570 Appendix B: Introduction to Mathematica
Mathematica Code
a = 0.0004;
b = 3 ∗ 10∧ 4;
c = 1 − 2I;
s = “Hello World!”
Hello World!
Print[“a = ”, a]
a = 0.0004
Print[“b = ”, b]
b = 30000
Print[“c = ”, c]
c = 1 − 2i
Print[“s = ”, s]
s = Hello World!
We stored nothing in x. x = x
Variable names in Mathematica cannot start with a number. It is often good to use
variable names that are clear. However, Mathematica does not allow spaces or underscores
in variable names. Words can be separated in a variable’s name using capitalization. For
example, suppose we wish to calculate a projectile’s time of flight. We can store that time
in a variable named timeOfFlight where we capitalized the O and the F to separate words.
Variable names can not be the same as function names. For example, you cannot use
Sin as a variable name since that is Mathematica’s reserved command for the trig function.
However, sin can be used as a variable name. The Mathematica naming convention (of
using capitalization for functions and not variables) can help prevent you from trying to
assign variables to protected names.
The Mathematica notebook will also give color clues as to variables which have already
been defined. For example, if you were to type the letter a later in the code used in Example
B.1, then it would appear black because Mathematica knows the value of a. Likewise,
if you type the name of a command such as Sin, it would also appear black, because
Mathematica knows that function. However, if you were to type sin in the code, it would
appear blue. The variable sin is not defined and Mathematica colors variables and terms
blue when it doesn’t understand them. Coloration can be a useful way of debugging code
in Mathematica. Finally, some characters may appear in the color teal. These are variables
which Mathematica intends to use in a function. For example in the command Solve[x^2
== 1,x], we are asking Mathematica to solve the equation x2 = 1 for x. The variable x is
not previously defined, but Mathematica is using it in the Solve command.
Lists in Mathematica 571
Mathematica code
Notice that a[[2;;4]] creates a list that starts with the second element of a, and
ends with the fourth element of a. The ranges are inclusive and the resulting list has
three elements.
In part (b), note that a[[-1]] indicates the last element of the array a.
When computing a[[4]] + a[[5]], we find that we get a new list where the string
“world” is added to each element of a[[4]]. Note that Mathematica is okay with
combining variable types in this way. Finally 3*a[[2]] produces a list where each
element of a[[2]] is multiplied by the first element of a (the number 3). Further,
notice that we did not use the Print command and let Mathematica output the result
of each calculation immediately below each line that doesn’t end with a semicolon.
572 Appendix B: Introduction to Mathematica
(*Part (a)*)
a[[2;;4]]
(*Part (b)*)
a[[−1]] = “world”;
(*Part (c)*)
a[[5]] + a[[4]]
{1 + world, 4 + world}
(*Part (d)*)
3 ∗ a[[2]]
{3, 6, 9}
Mathematica Code
Following Mathematica’s naming convention, we began with defining the function
X using a capital letter. In the square brackets, we included each argument for X, in
this case the initial velocity v0, acceleration a, and time t. To define the function, we
use SetDelayed (:=) which assigns the right-hand side to the function X, but does not
evaluate the definition until it is called in the code. In the second line of the code, we
show how to evaluate the function. Finally, we create a list of positions using the Table
command. Table creates a list where the first argument is the object being computed
(in this case, the function X with specified v0 and a). The second argument of Table is a
list that contains the variable being iterated, the starting value for the iteration, and the
final value (both values are inclusive). A step size can be included as a fourth value in
the list. For example, the command Table[X[3, 2, t], {t, 0, 3,2}] would create
a list starting at t = 0 and ending at t = 3, but calculate only every other element. The
result would be {0,10}.
X[v0_, a_, t_]:=v0 ∗ t + 1/2 ∗ a ∗ t∧ 2;
X[3, 2, 1]
The Table command is one method of performing a loop in Mathematica that is par-
ticularly useful if you have a simple calculation, or if you want the output of the loop to be
a list. More complicated loops can be done in Mathematica using the command Do. In the
next example, we will repeat Example B.3 using a Do-loop.
Mathematica Code
We defined the function X as in Example B.3. We then created an empty list Xlist
which will store the position of the particle as a function of time. Notice that the Do
loop has several lines. Before the comma in Do are the lines that are iterated during
the loop. In this case, we evaluate the function X[3,2,t] and store the result in the
variable xpos. The AppendTo command appends the value of xpos to the end of the
list. Finally, we display the value of the variable Xlist.
574 Appendix B: Introduction to Mathematica
xlist = {};
AppendTo[xlist, xpos],
{t, 0, 3}];
xlist
Conditional statements are used when we need to execute parts of the code, but only if
certain conditions are true. In Mathematica, we use the If command as demonstrated in
Example B.5.
Mathematica Code
This time we included an If command in the Do loop. We used white space to
separate the if-statement for clarity. The first argument of If is xpos < 10 and it states
the condition that must be true in order for the second argument AppendTo[xlist,
xpos] to be executed. In this case if the particle’s position is less than 10 meters, then
the position’s value is appended to xlist. A third argument can be included in If,
which would be the calculation executed if the condition were false.
Vectors and matrices in Mathematica 575
xlist = {};
AppendTo[xlist, xpos]]
, {t, 0, 3}];
xlist
{0, 4}
Mathematica Code
Notice that in Mathematica, vectors are stored as lists. The first element is the
x−component, the second is the y−component and so on. In general, an n-dimensional
vector is stored as a list of length n. The command . or Dot[r1,r2] is used for the dot
product.
Matrices are stored as a two-dimensional array in Mathematica. Notice that the
elements of the array are row vectors. Matrix multiplication is done using . just like the
dot product. Furthermore, we demonstrate the MatrixForm command which produces
easier to read output for matrices. The double slashes tells Mathematica to perform the
MatrixForm command on the output.
576 Appendix B: Introduction to Mathematica
r2 = {−1, 1, 4};
r1 + r2
{2, −1, 5}
r1.r2
−1
A+B
A.B//MatrixForm
a + 2c b + 2d
3a + 4c 3b + 4d
• Plot3D is used to plot functions of two independent variables. The result is the surface
of a function in 3D.
Each type of plot is demonstrated in Example B.7.
Creating plots in Mathematica 577
x(t) = 1 + 2t (B.5.1)
y(t) = 2 + 3t − 4.5t2
(B.5.2)
2
x + y2
f (x, y) = 3 exp − (B.5.3)
3
Mathematica Code
(a) We begin with the SetOptions command which forces certain options on the
commands that appear in its first argument. In this case, we are forcing the options Axes
-> False which removes the axes from the plot, Frame -> True which encloses the plot
in a frame, and BaseStyle -> {FontSize -> 16}, which forces the font size to be 16
for the commands Plot, ListPlot, and ParametricPlot. The command Plot3D does
not have a Frame option, hence the additional line of code.
For the Plot command, the first argument is the function to be plotted, and the
second argument is the range of independent coordinate values. The range is inputted
as a list. The first argument of the list is the independent variable, the second argument
is the starting value, and the third argument is the final value. The FrameLabel option
is used to label the plot’s axes. The output of ListPlot is shown in Figure B.1(a).
(b) Before we could use ListPlot, we needed to define a list of ordered pairs. That
is done using the Table command. In this case, the first argument is the ordered pair.
The second argument contains the options. The output of ListPlot is shown in Figure
B.1(b).
(c) ParametricPlot is used in the same way as Plot; however, an ordered pair
is plotted instead. The option AspectRatio -> Full is used to prevent Mathematica
from using the same scale to display the vertical and horizontal axes. The reader is
encouraged to download the code from this chapter and change the AspectRatio to see
how the plot is changed. The output of ListPlot is shown in Figure B.1(c).
(d) Finally Plot3D is used like Plot, except ranges for both independent variables
must be given. The output is a wireframe surface. If you are using the Mathematica
notebook, you can mouse over the plot and click and drag to change its orientation.
The output of ListPlot is shown in Figure B.1(d).
578 Appendix B: Introduction to Mathematica
Frame->True, BaseStyle->{FontSize->16}];
SetOptions[Plot3D, BaseStyle->{FontSize->16}];
x[t_]:=1 + 2 ∗ t;
y[t_]:=2 + 3 ∗ t − 4.5 ∗ t∧ 2;
Plot3D[f [x, y], {x, −2, 2}, {y, −2, 2}, AxesLabel->{x, y, f}]
Basic symbolic calculations in Mathematica 579
2.5 0
- 10
2.0
- 20
y(t)
1.5
y
- 30
- 40
1.0
- 50
0.5 - 60
0.0 0.2 0.4 0.6 0.8 1.0 0 2 4 6 8
time x
(a) (b)
-5
- 10
y(t)
- 15
- 20
- 25
- 30
1 2 3 4 5 6 7
x(t)
(c) (d)
Figure B.1: Output of Plot (a), ListPlot (b), ParametricPlot (c), and Plot3D (d) from
Example B.7.
Mathematica Code
This problem involves finding the maximum of the function y(t), which is done by
finding dy/dt = 0, solving for t, and inserting that value of t into y(t).
We begin by defining (B.6.1) as a variable (not a function) y. The command D[y,
t] computes dy/dt (the result is displayed below the command). We then use the Solve
command to find the value of t when dy/dt = 0. In the Solve command, note the use
of ==, which is used as equivalence. A single equal sign is used for variable assignment.
If one needs to test equality or set two sides of an equation equal, one must use ==.
Finally, we use the replacement command /. to substitute the value of tmax into y.
y = y0 + v0 ∗ t − 1/2 ∗ g ∗ t∧ 2;
D[y, t]
−gt + v0
y/.tmax[[1]]
v02
2g + y0
Mathematica Code
We know that this problem involves integrating the force. After defining the variable,
force, we use the command Integrate to perform the integration. The first argument
of Integrate is the function being integrated. The second argument can be one of two
Numerical solutions to integrals and differential equations in Mathematica 581
things. Had we simply put x as the second argument, Mathematica would have given
an indefinite integral (without the constant of integration). However, we included a list
of the variable of integration, its lower limit, and its upper limit. The result is a definite
integral.
force = −k ∗ x;
d2 x
= −kx (B.6.2)
dt2
with the initial conditions x(0) = x0 and ẋ(0) = 0.
Mathematica code
The DSolve command is used to solve (B.6.2). The first element is a list which
includes the ODE and the initial conditions. Note the use of apostrophes to denote
differentiation, and square brackets to denote that x is a function of time t. The
second argument of DSolve is the function being solved for, and the third element
is the independent variable. If we wanted a general solution, we could have omitted
the initial conditions from the first argument of DSolve and Mathematica would have
given a solution with arbitrary constants. Finally, we display the solution using x[t]/.
soln[[1]], which tells Mathematica to display the function x[t] stored in the variable
soln.
soln = DSolve[{x”[t]== − k ∗ x[t], x[0]==x0, x′ [0]==0}, x, t];
x[t]/.soln[[1]]
h√ i
x0 Cos kt
ing functions as numerical solutions, so the solutions can be evaluated just like any other
function.
Numerical integration is done using the command NIntegrate which is used exactly
like Integrate except that the limits of integration need numerical values. Furthermore,
all parameters in the function (such as k in Example B.10) must be given numerical values.
We demonstrate numerical integration of ODEs in the next example.
d2 x
= −kx (B.7.1)
dt2
where k = 2 N/m and the initial conditions x(0) = x0 = 1 and ẋ(0) = 0. Plot the result
for t = 0 . . . 10.
Mathematica Code
The NDSolve command is used to solve (B.7.1). Like DSolve, the first element is
a list which includes the ODE and the initial conditions. The second argument of
NDSolve is the function being solved for, and the third element is the numerical range
of independent variable. The result of NDSolve is an interpolating function. We plot
the resulting function using the Plot command. Note again the use of x[t] /. soln
to specify the function x[t], which is stored in the variable soln.
BaseStyle->{FontSize->16}];
{t, 0, 10}];
1.0
0.5
x(t) 0.0
- 0.5
- 1.0
0 2 4 6 8 10
time
Figure B.2: A graph of the solution to (B.7.1) from Example B.11.
Bibliography
1. J. Taylor, Classical Mechanics, University Science Books, Sausalito, CA, 2005.
2. A. Hadhazy, Fact or fiction: The days (and nights) are getting longer, Scientific American (6
2001).
4. W. Hamilton, On a general method in dynamics; by which the study of the motions of all free
systems of attracting or repelling points is reduced to the search and differentiation of one
central relation, or characteristic function, Philosophical Transactions of the Royal Society,
Part 2 (1834) 247–308.
6. S. Thornton, J. Marion, Classical Dynamics of Particles and Systems, 5th Edition, Thomson
- Brooks/Cole, Belmont, CA, 2004.
8. H. Goldstein, C. Poole, J. Safko, Classical Mechanics, 3rd Edition, Pearson, London, 2001.
9. V. Arnold, Mathematical Methods of Classical Mechanics, 2nd Edition, Springer, New York,
1997.
10. J. Worthington, A study of the planar circular restricted three body problem and the vanishing
twist, Ph.D. thesis, University of Sydney (10 2012).
11. S. Strogatz, Nonlinear Dynamics and Chaos: With Applications to Physics, Biology, Chem-
istry, and Engineering, Chapman and Hall/CRC, Cambridge, UK, 2024.
12. R. Hilborn, Chaos and Nonlinear Dynamics: An Introduction for Scientists and Engineers,
2nd Edition, Oxford University Press, New York, 2001.
14. H. Kantz, T. Schreiber, Nonlinear Time Series Analysis, 2nd Edition, Cambridge University
Press, Cambridge, UK, 2004.
15. H. Abarbanel, Analysis of Observed Chaotic Data, Springer, New York, 1996.
17. J. Sprott, Dynamical models of love, Nonlinear Dynamics, Psychology, and Life Sciences 8 (8)
(2004) 303 – 313.
585
Index
*, 549 brachistochrone, 259
6-12 potential, 324 burn rate, 135
587
588 Index