Return to computing page for the first course APMA0330
Return to computing page for the second course APMA0340
Return to Mathematica tutorial for the first course APMA0330
Return to Mathematica tutorial for the second course APMA0340
Return to the main page for the first course APMA0330
Return to the main page for the second course APMA0340
Introduction to Linear Algebra with Mathematica
A set of generalized coordinates q_{1}, q_{2}, …, q_{n} completely describes the positions of all particles in a mechanical system. In a system with d degrees of freedom and k constraints, n = d − k independent generalized coordinates are needed to completely specify all the positions.
The generalized coordinates may have units of length, or angle, or perhaps something totally
different. In the theory of small oscillations, the normal coordinates are conventionally
chosen to have units of (mass) ½ ×(length). However, once a choice of generalized coordinate
is made, with a concomitant set of units, the units of the conjugate momentum and force
are determined.
Lagrangian mechanics is a reformulation of classical mechanics that expresses the equations of motion in terms of a scalar quantity, called the Lagrangian (that has units of energy). In Lagrangian mechanics, the evolution of a physical system is described by the solutions to the Euler--Lagrange equations for the action of the system. The Lagrangian formulation, in contrast to Newtonian one, is independent of the coordinates in use. The Euler--Lagrange equation was first discovered in the middle of 1750s by Leonhard Euler (1707--1783) from Berlin (Prussia) and the young Italian mathematician from Turin Giuseppe Lodovico Lagrangia (1736--1813) while they worked together on the tautochrone problem.
We consider a system of n particles that is described by at most 3n coordinates \( \left\{ x_1 , x_2 , \ldots , x_{3n} \right\} . \) Not all of these coordinates are independent---there may exist some constraints. These constraints are easiest to handle when they are in the form \( f(x_1 , x_2 , \ldots , x_{3n} , t ) =0, \) in which case they are called holonomic. If there are k holonomic constraints, then k of the 3n coordinates can be eliminated, leaving 3n-k independent variables \( \left\{ q_1 , q_2 , \ldots , q_{3n-k} \right\} , \) known as the generalized coordinates of the motion. Then the original coordinates will be functions \( x_i = x_i \left( q_1 , q_2 , \ldots , q_{3n-k} , t \right) , \quad i = 1, 2, \ldots , 3n , \) of the generalized coordinates. The generalized coordinates could be distances, angles, or other quantities relating to the description of the motion. The number of generalized coordinates is the number of independent degrees of freedom.
We derive the Euler–Lagrange equations from d’Alembert’s Principle. Suppose that the system is described by generalized coordinates q. The virtual displacement of the i-th particle δr_{i} is consistent with the constraints acting on the system. To first order in δ's, we have
which is d’Alembert’s Principle, is valid for the virtual displacement δr_{i}.
Note that d’Alembert’s Principle is expressed as a scalar equation involving
what is termed virtual work F_{i} \cdot \deltar_{i}, which is the work that would be done on the
mass m_{i} in the virtual displacement δr_{i}. This virtual work is equal to a corresponding
virtual change in the kinetic energy of the mass m_{i}, which is
\( m_i \ddot{\bf r}_i \cdot \delta{\bf r}_i . \) This
formulation includes, in principle, work by dissipative forces as well. Work and
energy then replace forces in a formulation of mechanics based on d’Alembert’s
Principle.
The above equations in Cartesian coordinates can be written as
Since the generalized coordinates q_{k} are independent of one another, the δq_{k} are arbitrary. Therefore, the above equation can only be valid if each α_{k} is independently zero. That is
This equation is often called cancellation of the dots because it appears as
though we have simply canceled the dots (time derivatives) in \( \partial \dot{x}_i /\partial \dot{q}_k \) to obtain \( \partial x_i/\partial q_k . \) This means mathematically that the Cartesian coordinate x_{i} depends only on q and the time t and is independent of the velocities \( \dot{q}_k \)
We now recall that the forces remaining are those arising from external fields. In modern notation these forces are equal to the negative gradient of a scalar potential Π, which is a function only of spatial coordinates. That is
These are the Euler–Lagrange equations. The combination K − Π is
called the Lagrangian, which is a scalar function of the generalized coordinates q, the time derivatives of the generalized coordinates \( \dot{\bf q} , \) and possibly the time t.
---------------------------
✶
■
In terms of generalized coordinates q_{i}, the equations of motion follow from 3n-k equations
where K is the kinetic energy and Q_{i} are the generalized forces. If F_{i} is the i-th component of the force, then the generalized force Q_{i} is defined by
If some of the forces are conservative, then they can be expressed in term of the potential Π, where \( F = - \nabla \, \Pi . \) There are many sources of potential energy, of which we idicate the following:
Gravitational Energy. This is simply m g h, where m is the mass, h is the height, and g is gravity.
Spring energy. This is the energy held by compressing/elongating a spring or extending it.The simplest (Hooke's law) spring has an energy, E_{H} = ½K(ℓ - ℓ_{0})², where K is a constant and ℓ_{0} is the rest length of the spring.
Inverse distance energy. Many phenomena have energy that depends of the inverse of the distance, E_{i} = K/r, where K is a constant and r is a distance.
Chemical and electrical energy are other types that can be important in applications, but almost all of the systems we study here rely on the above three examples. Note that in all physical systems, there is friction.
Expressing the conservative forces by a potential Π and nonconservative forces by the generalized forces Q_{i}, the equation of motion follow from Euler--Lagrange's equations
The Lagrangian \( {\cal L} = \mbox{K} - \Pi \) describes the conservative forces. The force field F(x) is said to be conservative if
\[
{\bf F} ({\bf x}) = - \nabla \Pi ({\bf x})
\]
for a smooth potential function \( \Pi\,:\,\mathbb{R}^n \to \mathbb{R} , \) where ∇ denotes the gradient with respect to x. Equivalently, the force field is conservative if the work done by F on the particle as it moves from point A to point B,
which is a real-valued function, defined on a space of trajectories \( \left\{ {\bf x}: [a,b] \to \mathbb{R}^n \right\} . \) A scalar-valued function of functions, such as the action, is often called a functional.
The principle of stationary action (also called Hamilton’s principle) states that, for fixed initial and final
positions x(a) and x(b), the trajectory of the particle x(t) is a stationary point of the action.
Then for fixed initial and final positions, the path of least action (stationary action) will be the path along which Newton's laws are obeyed. So for Newtonian mechanics, the Lagrangian is chosen to be \( {\cal L} = \mbox{K} - \Pi . \) To explain what this means in more detail, suppose that \( \left\{ {\bf h}: [a,b] \to \mathbb{R}^n \right\} \) is a trajectory with h(a) = h(b) = 0. The directional (or Gâteaux)
derivative of S at x(t) in the direction h(t) is
Friction is not conservative, and so it doesn't fit neatly into the scheme we've outlined so far. In this case, one needs to take into account the non-conservative generalized forces.
Example: Consider an elastic spring attached to mass m; its Lagrangian is
where k is a spring constant, because its kinetic energy is \( \mbox{K} = \frac{m}{2} \, \dot{x}^2 \) and the potential energy is \( \Pi = \frac{k}{2}\, x^2 . \)
The position x(t) of a one-dimensional oscillator moving in a potential \( \Pi \,:\, \mathbb{R} \to \mathbb{R} \) satisfies the ordinary differential equation
\[
m\,\ddot{x} + \Pi' (x) =0 ,
\]
where prime denotes the derivative with respect to x. The solutions lie on the curves in the \( ( x, \dot{x}) \) phase plane given by
\[
\frac{m}{2}\, \dot{x} + \Pi (x) = E \qquad \mbox{the total energy is a constant}.
\]
The equilibrium solutions are the critical points of the potential Π. Local minima of Π correspond to stable equilibria, while other critical points correspond to unstable equilibria. For example, the quadratic potential
\( \Pi = \frac{k}{2}\, x^2 \) gives the linear simple
harmonic oscillator, \( \ddot{x} + \omega^2 x =0 , \) with frequency \( \omega = \sqrt{k/m} . \) Its solution curves in the phase plane are ellipses, and the origin is a stable equilibrium.
Example: The simplest version of
the Atwood machine consists of two masses, m_{1} and m_{2}, suspended on either side of a
massless, frictionless pulley of radius R by a massless rope of length \( \ell . \) Picking an origin in space at the center of the pulley, we can characterize the configuration
of the system by, say, the vertical position of m_{1}, which we specify via the vertical
distance s from the origin. So we choose s as the generalized coordinate for our system---Atwood's machine. The location of the other mass is now determined; its vertical
distance from the origin is \( \ell -\pi R -s . \) Evidently, if the velocity of m_{1} is \( \dot{s} = {\text d}s/{\text d}t , \) then the velocity
of m_{2} is \( -\dot{s} . \) The kinetic energy of the system (the two masses) is then
The Atwood machine (or Atwood's machine) was invented in 1784 by the English mathematician George Atwood.
Example: Consider a particle of constant mass m moving in n-dimensional
space in a spatially-dependent conservative force field \( {\bf F} ({\bf x}) = - \nabla \Pi ({\bf x}) . \) Then according to Newton's second law, a trajectory satisfies the equation
\[
m\,\ddot{\bf x} = - \nabla \Pi ({\bf x}) ,
\]
where a dot denotes the derivative with respect to time t. Taking the scalar product with respect to velocity \( \dot{\bf x} , \) we get
Example: The trajectory \( {\bf x}\,:\,|a,b| \to \mathbb{R}^3 \) of a particle of mass m moving in gravitational 3-dimensional field satisfies the vector differential equation (Newton’s universal law of gravitation)
where ϕ is the gravitational potential field and ρ is the mass density. This allows one to derive the corresponding Euler-Lagrange equation, which is actually the Poisson's equation for gravity:
\[
\nabla^2 \phi = 4\pi G \rho .
\]
Example: We use notation of r and θ for polar coordinates on the plane. The velocity has two component: in the radial direction it is dr/dt and in the tangential direction it is r(dθ/dt). Since the gravitational potential is \( -m\,k/{\bf r} , \) with k = GM, the kinetic and potential energy in polar coordinates become
We see from the latter that we can have a circular orbit if the "centrifugal force" (\( r\dot{\theta}^2 \) ) balances the gravitational attraction (k/r^{2}); in that case there won't be any radial acceleration and, upon substitution v = r(dθ/dt), the equation of circular motion becomes
The right hand side of the latter equation, \( - \frac{2}{r}\,\dot{r} \left( \dot{\theta} + \omega_0 \right) , \) is the tangential Coriolis force; it depends on the radial velocity, and the sum of the angular velocity of the particle in the frame and rotation rate of the frame. The first term on the right of the former equation is the centrifugal force due to the particle's own motion and the rotation of the frame. The second term is the radial Coriolis force; it's proportional to ω_{0}, so for a non-rotating frame, it vanishes.
Return to Mathematica page
Return to the main page (APMA0340)
Return to the Part 1 Matrix Algebra
Return to the Part 2 Linear Systems of Ordinary Differential Equations
Return to the Part 3 Non-linear Systems of Ordinary Differential Equations
Return to the Part 4 Numerical Methods
Return to the Part 5 Fourier Series
Return to the Part 6 Partial Differential Equations
Return to the Part 7 Special Functions