Nonconservative Lagrangian and Hamiltonian mechanics | Synapse