Suppose I have a robot arm configuration space (c-space) $Q$ and with Lagrangian $L = T - V$ on $TQ$, and I set up the equation of motion
$$\frac{\partial}{\partial t}\left\{\frac{\partial L}{\partial \dot{q}_i}\right\} - \frac{\partial L}{\partial q_i} = 0$$
in a coordinate patch on $Q$. Then the Riemannian metric $g$ on $Q$ is given by reading off the coefficients of $\ddot{q}_i$ from that equation of motion in that coordinate patch; see, for instance, https://youtu.be/BjD-pL819LA?t=189
My question is, if I instead set up the Hamiltonian $H = T + V$ on $T^*Q$, is there a similar "automatic" way to read off the Riemannian metric from $H$ or the equation of motion? Something that could be done in MATLAB, for instance, is the idea.
I wouldn’t phrase it as “the Riemannian metric is given by reading off the coefficients of $\ddot{q}_i$” because that makes it seem like the Riemannian metric is some secondary piece of information, when in fact it is starting from the Riemannian metric that you are able to define the kinetic term $T$ (and hence from that you get the Lagrangian/Hamiltonian). So at the very least, you should say that the Riemannian metric (components) are given by reading off the coefficients of the quadratic velocity terms, $\dot{q}^i\dot{q}^j$ in the Lagrangian $L$, or in other words, $g_{ij}=\frac{\partial ^2L}{\partial\dot{q}^i\partial \dot{q}^j}$.
Anyway, if you’re given a Hamiltonian $H$ on $T^*Q$, and told that it arises from a kinetic plus potential term (which by definition means the kinetic term comes from a Riemannian metric), then $H=\frac{1}{2}g^{ab}p_ap_b+V(q)$, so Hamilton’s equations are \begin{align} \begin{cases} \dot{q}^i=\frac{\partial H}{\partial p_i}&=g^{ib}p_b\\ \dot{p}_i=-\frac{\partial H}{\partial q^i}&=-\frac{1}{2}\frac{\partial g^{ab}}{\partial q^i}p_ap_b-\frac{\partial V}{\partial q^i}. \end{cases} \end{align} So I guess you could say that the (inverse) metric components are given by reading off the coefficients of $p_b$ in the first set of Hamilton’s equations. But like I said, this is logically backwards; you first start with a Riemannian metric and then write down the Hamiltonian, and then you get Hamilton’s equations. Or at the very least, you can say that the (inverse) metric (components) are given by reading off the coefficients of the quadratic momenta terms $p_ap_b$ in the Hamiltonian $H$, or in other words, $g^{ab}=\frac{\partial^2H}{\partial p_a\partial p_b}$.