Solution (source code)

= Solution

A one-dimensional <canonical transformation> is a locally invertible change of phase-space variables preserving the symplectic two-form: $dQ\wedge dP=dq\wedge dp$. Equivalently it preserves <Hamilton equations> for the transformed <Hamiltonian>. Expanding the two-form yields
$$
dQ\wedge dP=(Q_qP_p-Q_pP_q)\,dq\wedge dp,
$$
so
$$
\boxed{\{Q,P\}=Q_qP_p-Q_pP_q=1}.
$$
Conversely this Jacobian condition makes the transformation locally invertible and symplectic in two dimensions.