Dynamics of flexible multibody systems : a formulation with applications