(Note for nitpickers: This may seem a bit surprising, since we generated this form of the action using the equations along the actual dynamical path, how can we vary it and still use them? \delta S=\i...(Note for nitpickers: This may seem a bit surprising, since we generated this form of the action using the equations along the actual dynamical path, how can we vary it and still use them? \delta S=\int[\delta p d q+p d(\delta q)-(\partial H / \partial q) \delta q d t-(\partial H / \partial p) \delta p d t]=0 \delta S=\int \delta p\{d q-(\partial H / \partial p) d t\}+[p \delta q]-\int \delta q\{d p+(\partial H / \partial q) d t\}=0