Solution (source code)

= Solution

A <Poisson structure> is a real bilinear operation on <smooth functions> on $M$,
$$
\{\cdot,\cdot\}:C^\infty(M)\times C^\infty(M)\longrightarrow C^\infty(M),
$$
which is antisymmetric, obeys the <Jacobi identity>, and is a <derivation> in each argument. Explicitly,
$$
\{f,g\}=-\{g,f\},\qquad
\{f,\{g,h\}\}+\{g,\{h,f\}\}+\{h,\{f,g\}\}=0,\qquad
\{f,gh\}=\{f,g\}h+g\{f,h\}.
$$
Antisymmetry supplies the corresponding <Leibniz rule> in the first argument. Equivalently it is a smooth <Poisson bivector> $\Pi$ with $\{f,g\}=\Pi(df,dg)$ and $[\Pi,\Pi]=0$ for the <Schouten-Nijenhuis bracket>. In local coordinates,
$$
\{f,g\}=\sum_{i,j}\Pi^{ij}(x)\partial_i f\partial_j g,\qquad
\Pi^{ij}=-\Pi^{ji},\qquad
\sum_l\left(\Pi^{il}\partial_l\Pi^{jk}+\Pi^{jl}\partial_l\Pi^{ki}+\Pi^{kl}\partial_l\Pi^{ij}\right)=0.
$$
The last equation is the coordinate <Jacobi identity>. Nondegeneracy is not part of the definition: a <Poisson structure> may have <Casimir functions> and <symplectic leaves> of different dimensions.

A <Hamiltonian system> consists of such a <Poisson manifold>, a <Hamiltonian> $H\in C^\infty(M)$, and the flow of its <Hamiltonian vector field>. Choose the convention
$$
\boxed{X_H(f)=\{f,H\},\qquad \dot x^i=\sum_j\Pi^{ij}\partial_jH.}
$$
For an observable with no explicit time dependence, $df/dt=\{f,H\}$. In particular $H$ is conserved because $\{H,H\}=0$. For the canonical <Poisson bracket>, this convention gives $\dot q_i=\partial H/\partial p_i$ and $\dot p_i=-\partial H/\partial q_i$.