Canonical transformations and conservation of energy I have an important doubt about the nature of canonical transformations in hamiltonian mechanics.
Suppose I have a one-degree-of-freedom lagrangian system, whose hamiltonian depends explicitly on time:
$$\frac{\partial{\mathcal{H}(p, q, t)}}{\partial{t}} \neq 0$$
so in principle energy is not a conserved quantity. Then I find a canonical transformation, $Q(q, t), P(p, t)$ such that the new hamiltonian, $\mathcal{H}'$ has no explicit time dependency:
$$\mathcal{H}' = \mathcal{H}'(Q, P)$$
Can I say then that indeed energy is a conserved quantity?
If the answer is yes, then it's a bit counter-intuitive for me, specially if it is more or less easy to find such transformations. And if the answer is no, then that makes me think that canonical transformations don't conserve the nature of the system.
 A: The error in OP's reasoning(v1) can be traced back to the fact that the Hamiltonian $H(q,p.t)$ of a system is not always the total energy $E$ of the system, cf. this question. In particular, this happens sometimes for systems with explicit time dependence.
By the way, it should be mentioned that the extreme situation, where the new Hamiltonian $H^{\prime}\equiv 0$ vanishes identically, is the starting point for Hamilton-Jacobi theory.
A: You can make a time-dependent transformation of coordinates, and maybe some authors would even call this a "canonical transformation", but it isn't truly.  If you're familiar with the math of cotangent bundles, you'll recognize that an explicitly time-dependent transformation isn't a symplectomorphism in the sense a rotation strictly among the coordinates of the phase space that preserves the canonical structure.  Time isn't a phase space coordinate.
For example, an underdamped harmonic oscillator will both decay exponentially in amplitude and oscillate around the center.  You can cook up a new $P$ and $Q$ that sort of shrink along with its amplitude and thus, in terms of these coordinates, your system seems like an undamped harmonic oscillator.  You can write a Hamiltonian $H^\prime(Q,P)$ and see its time independent.  But when you go to unwind this change of coordinates back to your original $p$ and $q$ in which the system is damped, you're not making a proper canonical transformation.
