In general, the mass matrix M depends on the state q, and therefore varies with time.
Lagrangian mechanics yields an ordinary differential equation (actually, a system of coupled differential equations) that describes the evolution of a system in terms of an arbitrary vector of generalized coordinates that completely defines the position of every particle in the system.
For example, consider a system consisting of two point-like masses confined to a straight track.
The state of that systems can be described by a vector q of two generalized coordinates, namely the positions of the two particles along the track.
The mass matrix M is the diagonal block matrix where in each block the diagonal elements are the mass of the corresponding particle:[2] where Ini is the ni × ni identity matrix, or more fully: For a less trivial example, consider two point-like objects with masses m1, m2, attached to the ends of a rigid massless bar with length 2R, the assembly being free to rotate and slide over a fixed plane.
The state of the system can be described by the generalized coordinate vector where x, y are the Cartesian coordinates of the bar's midpoint and α is the angle of the bar from some arbitrary reference direction.
The positions and velocities of the two particles are and their total kinetic energy is where
For discrete approximations of continuum mechanics as in the finite element method, there may be more than one way to construct the mass matrix, depending on desired computational accuracy and performance.