When does the total time derivative of the Hamiltonian equal its partial time derivative? When does the total time derivative of the Hamiltonian equal the partial time derivative of the Hamiltonian?  In symbols, when does $\frac{dH}{dt} = \frac{\partial H}{\partial t}$ hold?
In Thornton & Marion, there is an identity in one of the problems, for any function $g$ of the generalized momentum and generalized coordinates, the following is true:
$$ \frac{dg}{dt} = [g,H] + \frac{\partial g}{\partial t},$$
where H is the Hamiltonian.
It seems to me that if we let $g = H$, then, since the Hamiltonian clearly commutes with itself, then $\frac{dH}{dt} = \frac{\partial H}{\partial t}$ is always true.  Is this the correct way to look at it?
 A: I claim that

The partial and total time derivatives of the hamiltonian are equal whenever the hamiltonian is evaluated on a solution to Hamilton's equations of motion.

For conceptual simplicity, let's restrict the discussion to systems with a two-dimensional phase space $\mathcal P$ with generalized coordinates $(q,p)$.
It's important to note what the total time derivative and partial time derivative mean in this context.  In particular, recall that the Hamiltonian is a function that maps a pair consisting of a point $(q,p)$ in phase space and a point $t$ in time, to a real number $H(q,p,t)$.  When we say that we are taking the partial time derivative of $H$, we mean that we are taking a derivative with respect to its last argument (in my notation).  When we say that we are taking a total time derivative, we have in mind evaluating the phase space arguments of the Hamiltonian on a parameterized path $(q(t), p(t))$ in phase space, then then taking the derivative with respect to $t$ of the resulting expression, like this;
\begin{align}
  \frac{d}{dt}\Big(H(q(t), p(t), t)\Big)
\end{align}
If we use the chain rule, we find that this total time derivative can be related to the partial time derivative of $H$ as follows:
\begin{align}
  \frac{d}{dt}\Big(H(q(t), p(t), t)\Big) = \frac{\partial H}{\partial q}(q(t), p(t), t) \dot q(t) + \frac{\partial H}{\partial p}(q(t), p(t), t) \dot p(t) + \frac{\partial H}{\partial t}(q(t), p(t), t) 
\end{align}
I have deliberately not abbreviated notation here to make explicit what exactly is going on so that there is no confusion.  For example, the expression
\begin{align}
  \frac{\partial H}{\partial q}(q(t), p(t), t)
\end{align}
means that we take the partial derivative of $H$ with respect to its first argument (which I labeled $q$), then then I evaluate the resulting function on $(q(t), p(t), t)$. 
Now the question is, when are the total and partial time derivatives the same?  Well, the relationship between them that we derived above shows that this happens if and only if the other stuff in the equation vanishes;
\begin{align}
  \frac{\partial H}{\partial q}(q(t), p(t), t) \dot q(t) + \frac{\partial H}{\partial p}(q(t), p(t), t) \dot p(t)=0
\end{align}
Notice, now, that this equation definitely does not hold for a general path $(q(t), p(t))$ in phase space.  I'll leave it to you to find a simple counterexample.  So, for what paths does this relationship hold?  Well, notice that this relationship is satisfied provided the path satisfies Hamilton's equations;
\begin{align}
  \dot q(t) &= \frac{\partial H}{\partial p}(q(t), p(t), t) \\
  \dot p(t) &= -\frac{\partial H}{\partial q}(q(t), p(t), t)
\end{align}
In other words, we have demonstrated the claim I started with.
A: Can you share the specifics of the resource that contains the equation you mentioned for the function g? Moreover, assuming that the total time derivative of the Hamiltonian equals its partial time derivative, the hamiltonian then will be indistinguishable from the Lagrangian, which raises another question: when will the Hamiltonian be equal to the Lagrangian of a system, if it can? Those are just my initial thoughts; I'll get back to you if I build up on my thoughts.
