# Hamilton-Jacobi method with time dependent Hamiltonian

I have the following phase space $$M = \{ (p, q) \in \mathbb{R}^2 \mid q \geq 0 \}$$ and the Hamiltonian $$H = q^2p^2t$$. How does one solve for $$q(t)$$, with $$q(0) = q_0 > 0, p(0) = p_0$$ using the HJ equation?

I tried writing the generating function $$S = S(q, t) = a(t)b(q)$$, as I don't think additive separation of variables works in this case. The problem here is that plugging this guess into HJ, I get two differential equations (one for $$a$$ and one for $$b$$) and hence two arbitrary integration constants. But I only need one as the system is one-dimensional. I feel like I'm going nowhere with this. Any suggestions? Am I on the right track?

EDIT: here is my attempt. The HJ equation reads $$\partial_tS + H(q, \partial_qS, t) = 0$$. With $$S(q, t) = a(t)b(q)$$, we have $$\dot{a}b + q^2a^2b'^2t = 0 \implies -\frac{\dot{a}}{a^2t} = \frac{q^2b'^2}{b}$$ Introducing the sepration constant $$k$$, we have $$\begin{cases} -\frac{\dot{a}}{a^2t} = k \\ \frac{q^2b'^2}{b} = k \end{cases}$$ Here is where I'm stuck, because I get two integration constants, say $$\alpha_1, \alpha_2$$. Then, there are two more constants of motion, namely $$\beta_i = \partial_{\alpha_i}S, i =1, 2$$. Do I need them to determine $$k$$ maybe? I think there are two many constants for me to relate them to the initial conditions $$(q_0, p_0)$$.

EDIT 2: following Qmechanic's hint, I set $$-\frac{\partial_tS}{t} = \alpha^2 = (q \partial_qS)^2$$ From the first equality, I get $$S = -\frac{\alpha^2t^2}{2} + f(q)$$. Substituing into the second one, I get $$f(q) = \alpha \log(q)$$. From here, the solution is straightforward.

Hint: Use the separation of variable trick on the HJ equation: $$-\frac{\partial_t S}{t} ~=~\alpha^2~=~ (q\partial_qS)^2.$$