How do the energy and generalized momenta change under the following coordinate
transformation $$q= f(Q,t).$$
The new momenta: $$P = \partial L / \partial \dot Q = \partial L / \partial \dot q\times \partial \dot q / \partial \dot Q = p \partial \dot q / \partial \dot Q = p \partial q / \partial Q. $$
The new velocity:
$$\dot Q = \partial Q / \partial q \times \dot q + \partial Q / \partial t.$$
The new energy:
$$E' = P\dot Q - L = p \partial q / \partial Q (\partial Q / \partial q \times \dot q + \partial Q / \partial t) - L = p\dot q + p \partial q / \partial t - L = E + p \partial q / \partial t.$$
But the answer is $$E' = E - p \partial q / \partial t.$$
What did i got wrong?