Dynamics modeling of Lagrangian mechanisms from inertial matrix elements