I have a Lagrangian $L$, a momentum $p$ and a Hamiltonian $H$:
$$L=\frac m 2(\dot z + A\omega\cos\omega t)^2 - \frac k 2 z^2$$
$$p=m\dot z + mA\omega\cos\omega t$$
$$H=p\dot z - L=\frac m 2 \dot z^2 - \frac m 2 (A\omega\cos\omega t)^2 - \frac k 2z^2$$
And I want to calculate $\frac {\partial H} {\partial z}$ and $\frac {\partial H} {\partial p}$. I understand from this question that I need to algebraically manipulate $H$ to express it in terms of $p$ and $z$. The answers there suggested trying to express $\dot z$ in terms of $z$ and $p$, and presumably I need to express $t$ in terms of $z$ and $p$ as well. But that seems like its going to lead into very nasty territory... first of all, I've got quadratics, so that's not an invertible function. Second of all, for $t$, if I have to use inverse trigonometric functions, then it'll only be valid over a particular range of the variable.
Could I get some pointers on how to tackle this calculation? Is inverting the various relations really the way to go?