Hamiltonian is expressed as $H(q,p,t)$, that is, it is a function of the $n$ generalzed coordinates and their conjugate momenta, which are taken to be independent, plus the independent variable, time.
勒让德变换可以写成以下形式:从$F(\boldsymbol u,\boldsymbol w)$变换到$F^*(\boldsymbol v,\boldsymbol w)$,其中$\boldsymbol u,\boldsymbol v$是变换对,$\boldsymbol \omega$是不参与变换的变量。勒让德变换满足下式:
$$ F^*(\boldsymbol v,\boldsymbol w)+F(\boldsymbol u,\boldsymbol w)=\boldsymbol u\cdot \boldsymbol v,\text{where}\ \boldsymbol v=\nabla_{\boldsymbol u}F(\boldsymbol u,\boldsymbol w) $$
And the inverse formula, but the symmetric relation.
$$ F^(\boldsymbol v,\boldsymbol w)+F(\boldsymbol u,\boldsymbol w)=\boldsymbol u\cdot \boldsymbol v,\text{where}\ \boldsymbol u=\nabla_{\boldsymbol v}F^(\boldsymbol v,\boldsymbol w) $$
Futher more, the varible $\boldsymbol \omega$ don’t join the transformation.
$$ \nabla_{\boldsymbol w}F^*(\boldsymbol v,\boldsymbol w)+\nabla_{\boldsymbol w}F(\boldsymbol u,\boldsymbol w)=0 $$
$L(\dot q, q,t)\to H(p,q,t)$, we get:
$$ p_j=\frac{\partial L(\dot q,q,t) }{\partial \dot q_j}\\ \dot q=\frac{\partial H}{\partial p} $$
Futher:
$$ \frac{\partial H}{\partial t}=-\frac{\partial L}{\partial t}\\\frac{\partial H}{\partial q}=-\frac{\partial L}{\partial q} $$
the E-L equation gives that:
$$ \frac d{dt}\frac{\partial L}{\partial\dot{q}j}=\dot{p}j=\frac{\partial L}{\partial q_j}+\sum{k=1}^m\lambda_k\frac{\partial g_k}{\partial q_j}+Q_j^{EXC}\\\to \dot p_j=-\frac{\partial H}{\partial q_j}+\sum{k=1}^m\lambda_k\frac{\partial g_k}{\partial q_j}+Q_j^{EXC} $$
the total differential of the Hamiltonian can be written as below. One can aslso expolre futher this by taking the time differential of Jacobi’s generalized energy.
$$ \frac{dH(\mathbf{q},\mathbf{p},t)}{dt}=\sum_j\left(\frac{\partial H}{\partial p_j}\dot{p}_j+\frac{\partial H}{\partial q_j}\dot{q}_j\right)+\frac{\partial H}{\partial t}\\=\sum_j\left(\dot q_j\dot{p}j-\frac{\partial L}{\partial q_j}\dot{q}j\right)-\frac{\partial L}{\partial t}\\=\sum_j\left(\frac{\partial L}{\partial q_j}+\sum{k=1}^m\lambda_k\frac{\partial g_k}{\partial q_j}+Q_j^{EXC}-\frac{\partial L}{\partial q_j}\right)\dot q_j-\frac{\partial L}{\partial t}\\ \to \frac{dH(\mathbf{q},\mathbf{p},t)}{dt}=\sum_j\left(\sum{k=1}^m\lambda_k\frac{\partial g_k}{\partial q_j}+Q_j^{EXC}\right)\dot q_j-\frac{\partial L}{\partial t} $$
In summary, Hamilton’s equations of motion[canonical equation of motion] are given by
$$ \begin{align}\.{q}{j}& =\frac{\partial H(\mathbf{q},\mathbf{p},t)}{\partial p_j} \\ \.{p}{j}& =-\frac{\partial H(\mathbf{q},\mathbf{p},t)}{\partial q_j}+\left[\sum_{k=1}^m\lambda_k\frac{\partial g_k}{\partial q_j}+Q_j^{EXC}\right] \\ \frac{dH(\mathbf{q},\mathbf{p},t)}{dt}& =\sum_j\left(\left[\sum_{k=1}^m\lambda_k\frac{\partial g_k}{\partial q_j}+Q_j^{EXC}\right]\dot{q}_j\right)+\frac{\partial H(\mathbf{q},\.{\mathbf{q}},t)}{\partial t} \end{align} $$
$(1)$ is the total differential of generalized coordinates, $(2)$ is the total differential of generalized momentum, $(3)$ is the generalized energy theorem in Hamiltonian Mechanics.