I am trying to understand Example 5.12 of the book Geometry, Topology and Physics by Nakahara. In particular, consider the two-form $\omega=dp_{\mu} \wedge dq^{\mu}$ (1) and the Hamiltonian vector field $X_f=\frac{\partial f}{\partial p_{\mu}}\frac{\partial }{\partial q^{\mu}}-\frac{\partial f}{\partial q^{\mu}}\frac{\partial }{\partial p_{\mu}}$ (2)
In the book it says that "it is easy to verify" that:
$i_{X_f} \omega = -\frac{\partial f}{\partial p_{\mu}}dp^{\mu}-\frac{\partial f}{\partial q^{\mu}} dq^{\mu}=-df$ (3).
But I am a bit confused about how to explicitly verify (3), and I think part of my confusion is that I am not sure what the components of $X_f$ are. For example, in the case $X=y\frac{\partial}{\partial x}-x\frac{\partial}{\partial y}$, I know that $X^{\mu=1}=y$ and $X^{\mu=2}=-x$. However, in the case at hand it seems that one component is $\frac{\partial f}{\partial p_{\mu}}$ and $-\frac{\partial f}{\partial q^{\mu}}$ seems to be the other component. Is that right? If so, then the index $\mu$ in $X_{f}$ does not seem to be indicating the components of the field. (As a side-note question: why $dp$ has $\mu$ as a lower index and $dq$ has it as an upper index? In all the other examples in that chapter, we always had two-forms written as $dx^{\mu_1} \wedge dx^{\mu_2}$ with both indices up.)
Now, as it is explained in the book (Eq. 5.79), in general, for an r-form $\omega$,
$i_{X}\omega=1/r! \sum_{s=1}^r X^{\mu_s}\omega_{\mu_1...\mu_{s}...\mu_r}(-1)^{s-1}dx^{\mu_1}\wedge...\wedge \hat{dx^{\mu_s}}\wedge...\wedge dx^{\mu_r} $ (4),
where the hat over $dx^{\mu_s}$ indicates that this element is omitted. In the case at hand, $r=2$, and so we only have two terms for the sum in (4). But I cannot use this formula precisely because I am confused about the meaning of $X^{\mu_s}$ for the vector field in question. So, in summary: can someone please show me as explicit as possible how to verify (3) by using the general formula (4) in the case of the vector field (2)? (I already read this question Expression for Hamiltonian vector field! but it did not help me much because at the moment of computing the inner product they were not as explicit as I needed to understand). Thanks a lot!
In classical mechanics, the first and simplest context in which the Hamilton equations appear is on the cotangent manifold $T^*Q$ of the configuration space $Q$ of a system. In this context, coordinates $(q^1, \dots, q^n)$ on (an open set $U$ of) $Q$ induce special coordinates on (the corresponding open set $T^*U$ of) $T^*Q$, for instance $(x^1, \dots, x^{2n}) = (q^1, \dots, q^n, p_1, \dots, p_n)$, or alternatively $(y^1, \dots, y^{2n}) = (q^1, p_1, \dots, q^n, p_n)$, or many other alternatives. Some choice of convention is at play here. (I postponed the explanation of the strange index position on the $p$'s to the end of this answer.)
If we were to choose the first convention, we then have $x^{\nu} = q^{\mu}$ if $\nu = \mu \le n$ and $x^{\nu} = p_{\mu}$ if $\nu = \mu + n > n$. We write $X_f = (X_f)^{\nu} \frac{\partial}{\partial x^{\nu}}$ and we aim to show that $(X_f)^{\nu} = \partial f/\partial p_{\mu}$ when $\nu \le n$ and $(X_f)^{\nu} = - \partial f/\partial q^{\mu}$ when $\nu > n$. The symplectic 2-form is $\omega = \sum_{\mu=1}^n dp_{\mu} \wedge dq^{\mu}$ (the overall sign is a convention which I were able to deduce from what you wrote in your question; see what follows), and we compute
$$ \begin{align} \sum_{\mu=1}^n \left[ - \frac{\partial f}{\partial q^{\mu}} dq^{\mu} - \frac{\partial f}{\partial p^{\mu}} dp_{\mu} \right] &= - df \\ &= i_{X_f} \omega = \sum_{\mu=1}^n [(i_{X_f} dp_{\mu}) \wedge dq^{\mu} - dp_{\mu} \wedge (i_{X_f}dq^{\mu}) ] \\ &= \sum_{\mu=1}^n [ (i_{X_f} dx^{\mu+n}) \wedge dq^{\mu} - dp_{\mu} \wedge (i_{X_f} dx^{\mu})] \\ &= \sum_{\mu=1}^n [(X_f)^{\mu+n} dq^{\mu} - dp_{\mu} (X_f)^{\mu}] \end{align}$$
so that $(X_f)^{\mu+n} = - \partial f/\partial q^{\mu}$ and $(X_f)^{\mu} = \partial f/\partial p_{\mu}$, as claimed. The notation used in this calculation is closer to what is common to differential geometers; physicists are more used to the abstract index notation, where $\omega = \frac{1}{2} \sum_{\nu, \lambda=1}^{2n} \omega_{\nu \lambda} dx^{\nu} \wedge dx^{\lambda}$ with $\omega_{\nu \lambda} = \delta_{n, \nu - \lambda} - \delta_{n, \lambda - \nu}$ and one would use the formula you wrote to compute the contraction $i_{X_f}\omega$. It is however exactly the same calculation as above.
Regarding the reason why the coordinate index is lowered on the $p$'s, one could (and perhaps, pedantically, should) write coordinates on $T^*Q$ with upper indices, as we did for the $x$'s or the $y$'s above. But the fact is that a point $P \in T^*Q$ is given by the data of a configuration $q \in Q$ and of a covector $p \in T^*_q Q$. One can write the covector $p$ in the coordinates $q^{\mu}$ as $p = p_{\mu}dq^{\mu}$, which is compatible with the abstract index notation applied on $Q$. The scalars $p_{\mu}$'s serve themselves as coordinates on $T^*_q Q$. So if we want our notation for the induced coordinates on $T^*Q$ to be explicit about the origin of these induced coordinates, we have to stick with the $p_{\mu}$'s with their lower index, against what would prescribe the usual index notation for coordinates on a manifold.
On general symplectic manifolds, because of the existence of Darboux coordinates (also called 'canonical coordinates') which allow to locally think of the symplectic manifold as part of a cotangent bundle, we push this abuse of notation somewhat further by writing Darboux coordinates in the form $(q^{\mu}, p_{\mu})$. (This abuse of notation implicitly conveys the idea of the local equivalence of all symplectic manifolds of the same dimension.)