Variational integrators and the Newmark algorithm for conservative and dissipative mechanical systems | Synapse