Solution (source code)

= Solution

For a canonical coordinate and momentum, the <Poisson bracket> is
$$
\{f,g\}=f_qg_p-f_pg_q.
$$
The chain rule and <Hamilton equations> $\dot q=H_p$, $\dot p=-H_q$ give
$$
\boxed{\frac{df}{dt}=\{f,H\}+f_t.}
$$
For the stated complex variables, direct differentiation gives
$$
\{a,a\}=0,\qquad
\boxed{\{a,a^*\}=-i.}
$$
Since $H=\omega aa^*$, the product rule for the <Poisson bracket> yields
$$
\{a,H\}=-i\omega a,\qquad \{a^*,H\}=i\omega a^*.
$$
The linear change of variables is invertible, so treating $a,a^*$ as independent coordinates when differentiating gives
$$
\boxed{\frac{df}{dt}
=i\omega\left(a^*\frac{\partial f}{\partial a^*}
-a\frac{\partial f}{\partial a}\right)+\frac{\partial f}{\partial t}.}
$$
In particular $a(t)=a(0)e^{-i\omega t}$ and $a^*(t)=a^*(0)e^{i\omega t}$. On a continuously chosen branch along a nonzero trajectory,
$$
\boxed{\log a^*-i\omega t,\qquad \log a+i\omega t}
$$
are constant. The logarithm is undefined at the zero-energy equilibrium, and a fixed principal branch need not be continuous across its cut; the branch qualification is necessary.