STEM 隨筆︰古典力學︰運動學【四‧B】

回顧『虛功原理』︰

Equations of motion from D’Alembert’s principle

If there are constraints on particle k, then since the coordinates of the position rk = (xk, yk, zk) are linked together by a constraint equation, so are those of the virtual displacements δrk = (δxk, δyk,δzk). Since the generalized coordinates are independent, we can avoid the complications with the δrk by converting to virtual displacements in the generalized coordinates. These are related in the same form as a total differential,[23]

\displaystyle \delta \mathbf {r} _{k}=\sum _{j=1}^{n}{\frac {\partial \mathbf {r} _{k}}{\partial q_{j}}}\delta q_{j}\,.

There is no partial time derivative with respect to time multiplied by a time increment, since this is a virtual displacement, one along the constraints in an instant of time.

The first term in D’Alembert’s principle above is the virtual work done by the non-constraint forces Nk along the virtual displacements δrk, and can without loss of generality be converted into the generalized analogues by the definition of generalized forces

\displaystyle Q_{j}=\sum _{k=1}^{N}\mathbf {N} _{k}\cdot {\frac {\partial \mathbf {r} _{k}}{\partial q_{j}}}\,

so that
\displaystyle \sum _{k=1}^{N}\mathbf {N} _{k}\cdot \delta \mathbf {r} _{k}=\sum _{k=1}^{N}\mathbf {N} _{k}\cdot \sum _{j=1}^{n}{\frac {\partial \mathbf {r} _{k}}{\partial q_{j}}}\delta q_{j}=\sum _{j=1}^{n}Q_{j}\delta q_{j}\,.
This is half of the conversion to generalized coordinates. It remains to convert the acceleration term into generalized coordinates, which is not immediately obvious. Recalling the Lagrange form of Newton’s second law, the partial derivatives of the kinetic energy with respect to the generalized coordinates and velocities can be found to give the desired result;[24]
\displaystyle \sum _{k=1}^{N}m_{k}\mathbf {a} _{k}\cdot {\frac {\partial \mathbf {r} _{k}}{\partial q_{j}}}={\frac {\mathrm {d} }{\mathrm {d} t}}{\frac {\partial T}{\partial {\dot {q}}_{j}}}-{\frac {\partial T}{\partial q_{j}}}\,.
Now D’Alembert’s principle is in the generalized coordinates as required,
\displaystyle \sum _{j=1}^{n}\left[Q_{j}-\left({\frac {\mathrm {d} }{\mathrm {d} t}}{\frac {\partial T}{\partial {\dot {q}}_{j}}}-{\frac {\partial T}{\partial q_{j}}}\right)\right]\delta q_{j}=0\,,
and since these virtual displacements δqj are independent and nonzero, the coefficients can be equated to zero, resulting in Lagrange’s equations[25][26] or the generalized equations of motion,[27]
\displaystyle Q_{j}={\frac {\mathrm {d} }{\mathrm {d} t}}{\frac {\partial T}{\partial {\dot {q}}_{j}}}-{\frac {\partial T}{\partial q_{j}}}
These equations are equivalent to Newton’s laws for the non-constraint forces. The generalized forces in this equation are derived from the non-constraint forces only – the constraint forces have been excluded from D’Alembert’s principle and do not need to be found. The generalized forces may be non-conservative, provided they satisfy D’Alembert’s principle.[28]

Euler–Lagrange equations and Hamilton’s principle

As the system evolves, q traces a path through configuration space (only some are shown). The path taken by the system (red) has a stationary action (δS = 0) under small changes in the configuration of the system (δq).[29]

For a non-conservative force which depends on velocity, it may be possible to find a potential energy function V that depends on positions and velocities. If the generalized forces Qi can be derived from a potential V such that[30][31]

\displaystyle Q_{j}={\frac {\mathrm {d} }{\mathrm {d} t}}{\frac {\partial V}{\partial {\dot {q}}_{j}}}-{\frac {\partial V}{\partial q_{j}}}\,,

equating to Lagrange’s equations and defining the Lagrangian as L = TV obtains Lagrange’s equations of the second kind or the Euler–Lagrange equations of motion
\displaystyle {\frac {\partial L}{\partial q_{j}}}-{\frac {\mathrm {d} }{\mathrm {d} t}}{\frac {\partial L}{\partial {\dot {q}}_{j}}}=0\,.
However, the Euler–Lagrange equations can only account for non-conservative forces if a potential can be found as shown. This may not always be possible for non-conservative forces, and Lagrange’s equations do not involve any potential, only generalized forces; therefore they are more general than the Euler–Lagrange equations.

The Euler–Lagrange equations also follow from the calculus of variations. The variation of the Lagrangian is

\displaystyle \delta L=\sum _{j=1}^{n}\left({\frac {\partial L}{\partial q_{j}}}\delta q_{j}+{\frac {\partial L}{\partial {\dot {q}}_{j}}}\delta {\dot {q}}_{j}\right)\,,\quad \delta {\dot {q}}_{j}\equiv \delta {\frac {\mathrm {d} q_{j}}{\mathrm {d} t}}\equiv {\frac {\mathrm {d} (\delta q_{j})}{\mathrm {d} t}}\,,

which has a similar form to the total differential of L, but the virtual displacements and their time derivatives replace differentials, and there is no time increment in accordance with the definition of the virtual displacements. An integration by parts with respect to time can transfer the time derivative of δqj to the ∂L/∂(dqj/dt), in the process exchanging d(δqj)/dt for δqj, allowing the independent virtual displacements to be factorized from the derivatives of the Lagrangian,
\displaystyle \int _{t_{1}}^{t_{2}}\delta L\,\mathrm {d} t=\sum _{j=1}^{n}\left[{\frac {\partial L}{\partial {\dot {q}}_{j}}}\delta q_{j}\right]_{t_{1}}^{t_{2}}+\int _{t_{1}}^{t_{2}}\sum _{j=1}^{n}\left({\frac {\partial L}{\partial q_{j}}}-{\frac {\mathrm {d} }{\mathrm {d} t}}{\frac {\partial L}{\partial {\dot {q}}_{j}}}\right)\delta q_{j}\,\mathrm {d} t\,.
Now, if the condition δqj(t1) = δqj(t2) = 0 holds for all j, the terms not integrated are zero. If in addition the entire time integral of δL is zero, then because the δqj are independent, and the only way for a definite integral to be zero is if the integrand equals zero, each of the coefficients of δqj must also be zero. Then we obtain the equations of motion. This can be summarized by Hamilton’s principle;
\displaystyle \int _{t_{1}}^{t_{2}}\delta L\,\mathrm {d} t=0\,.
The time integral of the Lagrangian is another quantity called the action, defined as[32]
\displaystyle S=\int _{t_{1}}^{t_{2}}L\,\mathrm {d} t\,,
which is a functional; it takes in the Lagrangian function for all times between t1 and t2 and returns a scalar value. Its dimensions are the same as [ angular momentum ], [energy]·[time], or [length]·[momentum]. With this definition Hamilton’s principle is
\displaystyle \delta S=0\,.
Thus, instead of thinking about particles accelerating in response to applied forces, one might think of them picking out the path with a stationary action, with the end points of the path in configuration space held fixed at the initial and final times. Hamilton’s principle is sometimes referred to as the principle of least action, however the action functional need only be stationary, not necessarily a maximum or a minimum value. Any variation of the functional gives an increase in the functional integral of the action.

Historically, the idea of finding the shortest path a particle can follow subject to a force motivated the first applications of the calculus of variations to mechanical problems, such as the Brachistochrone problem solved by Jean Bernoulli in 1696, as well as Leibniz, Daniel Bernoulli, L’Hôpital around the same time, and Newton the following year.[33] Newton himself was thinking along the lines of the variational calculus, but did not publish.[33] These ideas in turn lead to the variational principles of mechanics, of Fermat, Maupertuis, Euler,Hamilton, and others.

Hamilton’s principle can be applied to nonholonomic constraints if the constraint equations can be put into a certain form, a linear combination of first order differentials in the coordinates. The resulting constraint equation can be rearranged into first order differential equation.[34] This will not be given here.

Lagrange multipliers and constraints

The Lagrangian L can be varied in the Cartesian rk coordinates, for N particles,

\displaystyle \int _{t_{1}}^{t_{2}}\sum _{k=1}^{N}\left({\frac {\partial L}{\partial \mathbf {r} _{k}}}-{\frac {\mathrm {d} }{\mathrm {d} t}}{\frac {\partial L}{\partial {\dot {\mathbf {r} }}_{k}}}\right)\cdot \delta \mathbf {r} _{k}\,\mathrm {d} t=0\,.

Hamilton’s principle is still valid even if the coordinates L is expressed in are not independent, here rk, but the constraints are still assumed to be holonomic.[35] As always the end points are fixed δrk(t1) = δrk(t2) = 0 for all k. What cannot be done is to simply equate the coefficients of δrk to zero because the δrk are not independent. Instead, the method of Lagrange multipliers can be used to include the constraints. Multiplying each constraint equation fi(rk, t) = 0 by a Lagrange multiplier λi for i = 1, 2, …, C, and adding the results to the original Lagrangian, gives the new Lagrangian
\displaystyle L'=L(\mathbf {r} _{1},\mathbf {r} _{2},\ldots ,{\dot {\mathbf {r} }}_{1},{\dot {\mathbf {r} }}_{2},\ldots ,t)+\sum _{i=1}^{C}\lambda _{i}(t)f_{i}(\mathbf {r} _{k},t)\,.
The Lagrange multipliers are arbitrary functions of time t, but not functions of the coordinates rk, so the multipliers are on equal footing with the position coordinates. Varying this new Lagrangian and integrating with respect to time gives
\displaystyle \int _{t_{1}}^{t_{2}}\delta L'\mathrm {d} t=\int _{t_{1}}^{t_{2}}\sum _{k=1}^{N}\left({\frac {\partial L}{\partial \mathbf {r} _{k}}}-{\frac {\mathrm {d} }{\mathrm {d} t}}{\frac {\partial L}{\partial {\dot {\mathbf {r} }}_{k}}}+\sum _{i=1}^{C}\lambda _{i}{\frac {\partial f_{i}}{\partial \mathbf {r} _{k}}}\right)\cdot \delta \mathbf {r} _{k}\,\mathrm {d} t=0\,.
The introduced multipliers can be found so that the coefficients of δrk are zero, even though the rk are not independent. The equations of motion follow. From the preceding analysis, obtaining the solution to this integral is equivalent to the statement
\displaystyle {\frac {\partial L'}{\partial \mathbf {r} _{k}}}-{\frac {\mathrm {d} }{\mathrm {d} t}}{\frac {\partial L'}{\partial {\dot {\mathbf {r} }}_{k}}}=0\quad \Rightarrow \quad {\frac {\partial L}{\partial \mathbf {r} _{k}}}-{\frac {\mathrm {d} }{\mathrm {d} t}}{\frac {\partial L}{\partial {\dot {\mathbf {r} }}_{k}}}+\sum _{i=1}^{C}\lambda _{i}{\frac {\partial f_{i}}{\partial \mathbf {r} _{k}}}=0\,,
which are Lagrange’s equations of the first kind. Also, the λi Euler-Lagrange equations for the new Lagrangian return the constraint equations
\displaystyle {\frac {\partial L'}{\partial \lambda _{i}}}-{\frac {\mathrm {d} }{\mathrm {d} t}}{\frac {\partial L'}{\partial {\dot {\lambda }}_{i}}}=0\quad \Rightarrow \quad f_{i}(\mathbf {r} _{k},t)=0\,.
For the case of a conservative force given by the gradient of some potential energy V, a function of the rk coordinates only, substituting the Lagrangian L = TV gives
\displaystyle \underbrace {{\frac {\partial T}{\partial \mathbf {r} _{k}}}-{\frac {\mathrm {d} }{\mathrm {d} t}}{\frac {\partial T}{\partial {\dot {\mathbf {r} }}_{k}}}} _{-\mathbf {F} _{k}}+\underbrace {-{\frac {\partial V}{\partial \mathbf {r} _{k}}}} _{\mathbf {N} _{k}}+\sum _{i=1}^{C}\lambda _{i}{\frac {\partial f_{i}}{\partial \mathbf {r} _{k}}}=0\,,
and identifying the derivatives of kinetic energy as the (negative of the) resultant force, and the derivatives of the potential equaling the non-constraint force, it follows the constraint forces are
\displaystyle \mathbf {C} _{k}=\sum _{i=1}^{C}\lambda _{i}{\frac {\partial f_{i}}{\partial \mathbf {r} _{k}}}\,,}
thus giving the constraint forces explicitly in terms of the constraint equations and the Lagrange multipliers.

 

可知

\displaystyle \underbrace {{\frac {\partial T}{\partial \mathbf {r} _{k}}}-{\frac {\mathrm {d} }{\mathrm {d} t}}{\frac {\partial T}{\partial {\dot {\mathbf {r} }}_{k}}}} _{-\mathbf {F} _{k}}+\underbrace {-{\frac {\partial V}{\partial \mathbf {r} _{k}}}} _{\mathbf {N} _{k}}+\underbrace {\sum _{i=1}^{C}\lambda _{i}{\frac {\partial f_{i}}{\partial \mathbf {r} _{k}}}}_{\mathbf {C_k }} + Q_k =0\,,

 

是拉格朗日力學廣義運動方程式也。

考察 SymPy mechanics 之

Lagrange’s Method in Physics/Mechanics

mechanics provides functionality for deriving equations of motion using Lagrange’s method. This document will describe Lagrange’s method as used in this module, but not how the equations are actually derived.

Structure of Equations

In mechanics we are assuming there are 3 basic sets of equations needed to describe a system; the constraint equations, the time differentiated constraint equations and the dynamic equations.

\mathbf{m_{c}}(q, t) \dot{q} + \mathbf{f_{c}}(q, t) = 0

\mathbf{m_{dc}}(\dot{q}, q, t) \ddot{q} + \mathbf{f_{dc}}(\dot{q}, q, t) &= 0

\mathbf{m_d}(\dot{q}, q, t) \ddot{q} + \mathbf{\Lambda_c}(q, t)\lambda + \mathbf{f_d}(\dot{q}, q, t) = 0

In this module, the expressions formed by using Lagrange’s equations of the second kind are rearranged into the following form:

\mathbf{M}(q, t) x = \mathbf{f}(q, \dot{q}, t)

where in the case of a system without constraints:

x = \ddot{q}

For a constrained system with n generalized speeds and mm constraints, we will get n – m equations. The mass-matrix/forcing equations are then augmented in the following fashion:

x = \begin{bmatrix} \ddot{q} \\ \lambda \end{bmatrix}

\mathbf{M}(q, t) = \begin{bmatrix} \mathbf{m_d}(q, t)  & \mathbf{\Lambda_c}(q, t) \end{bmatrix}

\mathbf{F}(\dot{q}, q, t) = \begin{bmatrix} \mathbf{f_d}(q, \dot{q}, t) \end{bmatrix}

 

及其相關文件

LagrangesMethod

class sympy.physics.mechanics.lagrange.LagrangesMethod(Lagrangian, qs, forcelist=None, bodies=None, frame=None, hol_coneqs=None, nonhol_coneqs=None)

Lagrange’s method object.

This object generates the equations of motion in a two step procedure. The first step involves the initialization of LagrangesMethod by supplying the Lagrangian and the generalized coordinates, at the bare minimum. If there are any constraint equations, they can be supplied as keyword arguments. The Lagrange multipliers are automatically generated and are equal in number to the constraint equations. Similarly any non-conservative forces can be supplied in an iterable (as described below and also shown in the example) along with a ReferenceFrame. This is also discussed further in the __init__ method.

Attributes

q, u (Matrix) Matrices of the generalized coordinates and speeds
forcelist (iterable) Iterable of (Point, vector) or (ReferenceFrame, vector) tuples describing the forces on the system.
bodies (iterable) Iterable containing the rigid bodies and particles of the system.
mass_matrix (Matrix) The system’s mass matrix
forcing (Matrix) The system’s forcing vector
mass_matrix_full (Matrix) The “mass matrix” for the qdot’s, qdoubledot’s, and the lagrange multipliers (lam)
forcing_full (Matrix) The forcing vector for the qdot’s, qdoubledot’s and lagrange multipliers (lam)

……

Kinetic Energy

The kinetic energy of a particle P is defined as

T_P = \frac{1}{2} m \mathbf{v^2}

where mm is the mass of the particle P and vv is the velocity of the particle in the inertial frame.

Similarly the kinetic energy of a rigid body B is defined as

T_B = T_t + T_r

where the translational kinetic energy is given by:

T_t = \frac{1}{2} m \mathbf{v^*} \cdot \mathbf{v^*}

and the rotational kinetic energy is given by:

T_r = \frac{1}{2} \omega \cdot \mathbf{I^*} \cdot \omega

where m is the mass of the rigid body, \mathbf{v^*} is the velocity of the mass center in the inertial frame, \omega is the inertial angular velocity of the body and \mathbf{I^*} is the central inertia dyadic.

Potential Energy

Potential energy is defined as the energy possessed by a body or system by virtue of its position or arrangement.

Since there are a variety of definitions for potential energy, this is not discussed further here. One can learn more about this in any elementary text book on dynamics.

Lagrangian

The Lagrangian of a body or a system of bodies is defined as:

\mathcal{L} = T - V

where T and V are the kinetic and potential energies respectively.

Using energy functions in Mechanics

The following example shows how to use the energy functions in mechanics.

As was discussed above in the momenta functions, one first creates the system by going through an identical procedure.

………

 

大體完備矣。

讀者自可閱讀辨識的呦☆