In the book Analytical Mechanics by Louis N.Hand, chapter 6, Question 1, It is asked to use the generating function $$F = q + Q\tag{1}$$ to any Hamiltonian (I have used Harmonic oscillator). By doing so we get a new Hamiltonian with a dependency of q.
Now my question is Why does this happens? And what's wrong with our generating function?
The quote from the book is:
Follow the recipe for a canonical transformation outlined in the previous section for $F = q + Q$ (use it on your favourite Hamiltonian). You will find you do not obtain Hamilton's equations in terms of the new variables. Why does this happen? What is wrong with our generating function?
The example I used is:
So $$p = \frac{\partial F}{\partial q} = 1\tag{2}$$ and $$P = - \frac{\partial F}{\partial Q}= -1.\tag{3}$$
Also $$H = \frac{p^2}{2} + \frac{w^2 q^2}{2}.\tag{4}$$ Then $$ H' = H + \frac{\partial F}{\partial t} = \frac{1}{2} + \frac{w^2q^2}{2} + \dot{q}+\dot{Q}$$
To satisfy the Hamilton's equation, the final change is done, $$ H' = \frac{1}{2} + \frac{w^2q^2}{2} + \dot{q}+\dot{Q}P$$