Let us take, for example, a generator function of type 2 (please see goldstein), i.e , F2(q,P,t) function of the old coordinates (q) and the new momenta (P), and consider the following non-relativistic transformation:
x=x'+Vt , x'- new (spacial) coordinate
t=t' , (time remains the same)
as you can see, you will also have to know how the momenta transforms (in order to determine F2)
px=mV+px' , px' new momentum (px'=P, if you prefer)
px is your old momentum, therefore F2 = (mV+px')x + A
now lets determine A,
"A" is not a constant because if you take dF2/dP it won't equal the new momenta. There's still a " - Vtpx' "
lacking in the equation (with the minus sign included).
Well if that quatity is missing , all we have to do is add it to the equation (A=-Vtpx').
So here it is, the F2(q,P,t) generator function for this non-relativistic transformation is:
F2 = (mV+px')x - Vtpx'
I down know if there is another (better) way to do it, but I hope it helps.
Related Threads for: Calculating generator function in canonical transformation