If I have: $$H(q,p,t)=\dot{q}_ip_i-L(q,\dot{q},t)$$
How can I obtain the following relations:
$$\mathrm{d}H=\dot{q}_i\mathrm{d}p_i-\dot{p}_i\mathrm{d}q_i-\frac{\partial L}{\partial t}\mathrm{d}t$$
$$\mathrm{d}H=\frac{\partial H}{\partial p_i}\mathrm{d}p_i+\frac{\partial H}{\partial q_i}\mathrm{d}q_i+\frac{\partial H}{\partial t}\mathrm{d}t$$
What I asked is how can I obtain the last two relations from the first one. Thanks!
In both cases, the total differential is an application of the chain rule for conservative dynamical systems. To implement the change of Lagrangian basis $(q,\dot q,t)$ to the Hamiltonian basis $(q,p,t)$ one defines what is called the "canonical momentum": $p_i(t)=\frac{\partial L}{\partial \dot q_i}$. One usually inverts these relations to find $\dot q_i$ as a function of $(q,p,t)$ and subsequently defines the Hamiltonian as $$H(q_i,p_i,t) = \sum_i p_i\dot q_i - L$$ The substitution is made in the definition of $H$: $\dot q_i =\dot q_i(p,q,t)$.