Computationally efficient expressions of dynamic equations for flexible mechanisms