Action variables in canonical transformations Let's suppose we have a Hamiltonian $H(p_k, q_k)$ and we want to transform it via a canonical transformation to one Hamiltonian which doesn't depend on the new coordinates $w_k$, but only in the momenta, $\bar{H}(J_k)$
Such coordinates are called action-angle variables. One (or the only one?) way to find the new coordinates is define $J_l$ as:
$$J_l = \int^{T_l}_0 p_l dq_l$$
Why are this $J_l$ the momenta that make the Hamiltonian doesn't depend on $\bar{q}_k$?
I think it has something to do with the type 1 generating function (in one dimension, $S(q, \bar{q})$), since:
$$dS = \frac{\partial S}{\partial q}dq + \frac{\partial S}{\partial q}dq = 
pdq - Jdw$$
And then integrating in a period of motion:
$$\oint dS = \oint pdq - J\oint dw$$
$\oint dw$ is defined to be 1, and S is basically the action and thus should be 0 in one period, so that we could deduce the $J$ equation from here. Am I right?
 A: I think your derivation is correct.
An alternative approach. Suppose that (in any phase space) we have a tube of phase trajectories. Let $\gamma_1$ and $\gamma_2$ be two curves that encircle the tube. Given any 1-form $\omega^1$, Stokes' lemma is (see page 236 and surrounding of Arnold's Mathematical Methods of Classical Mechanics)
$\oint_{\gamma_1} \omega^1 = \oint_{\gamma_2} \omega^1$.
Now the so-called integral invariant of Poincare-Cartan (couldn't figure out how to do acute accents here) $\mathbf{p}d\mathbf{q} - H dt$ is a 1-form so
$\oint_{\gamma_1} \mathbf{p}d\mathbf{q} - Hdt = \oint_{\gamma_2} \mathbf{p}d\mathbf{q} - Hdt$.
Or, if the phase-space is time-independent (or if we consider trajectories on a single time slice)
$\oint_{\gamma_1} \mathbf{p}d\mathbf{q} = \oint_{\gamma_2} \mathbf{p}d\mathbf{q}$.
If the system has an action-angle representation, all trajectories are confined to some topological torus in phase space. Thus the tori constitute a tube of phase trajectories.
The specific tori are labelled by the action variables $J_i$. But from the above we see that integrating over any loop encircling a given torus must always give the same result, while integrating over a different torus will give a different result. Therefore, the integral $\oint_{\gamma} \mathbf{p}d\mathbf{q}$ must yield the action variables. Integrating over the relevant coordinate period closes the loop in the appropriate way.
A: I've come up with another answer.
The type II generating function $S^\prime(q, J)$ can be obtained from its differential as:
$\int dS^\prime = \int p dq +  \int w dJ$
But since $J$ is constant, the second term vanishes. 
We also have
$w = \frac{\partial S^\prime}{\partial J} = \frac{\partial}{\partial J} \int p dq$
If we take the integration limits over a period of motion and we set $\oint dw = 1$, for example, we get the definition of J
$J = \oint p dq$
