Is it true that:
$$\frac{1}{2}\frac{d\mu}{dq}\cdot\frac{p^2}{\mu^2}=\frac{1}{2}\frac{d\mu}{dq}\cdot\frac{\partial}{\partial \mu}\left(\frac{-p^2}{2\mu}\right)=-\frac{\partial}{\partial q}\left(\frac{p^2}{2\mu}\right),\;\;\; \mu=\mu(q)$$
And if not why? I've seen the first equation being equal to the last part, but the middle step is my interpretation of how they are equal. My reasoning is that $\dfrac{d\mu}{dq}=\dfrac{\partial \mu}{\partial q}$ as $\mu$ is just a function of $q$. And so I can use chain rule for partials. Is this correct? (By the way it's for Hamiltonian equations).