Hamiltonian formalism for nonlinear waves | Synapse