# Hamilton-Jacobi equation with time dependent Hamiltonian

I was struggling with this exercise about Hamilton-Jacobi equation. I have to solve by menas of Hamilton's principal function the system with Hamiltonian: $$\tag{1} H=\frac{p^2}{2m}-mAtx$$ with $A$ constant and initial conditions $t=0$, $x=0$, $p=mv_0$. Before attacking the Hamilton-Jacobi (HJ) equation, I've observed that the equation of motions are easily integrable and I get $x(t)=\frac{1}{6}At^3+v_0t$ and $p(t)=\frac{1}{2}mAt^2+mv_0$. Following the HJ's approach and named the Hamilton's principal function as $S=S(x,\alpha,t)$ I set $p=\frac{\partial S}{\partial x}$ in the Hamiltonian, and the HJ'sequation reads: $$\tag{2} \frac{1}{2m}\left(\frac{\partial S}{\partial x}\right)^2-mAtx+\frac{\partial S}{\partial t}=0$$ From here on I'm not sure how to proceed. The separation of variables is not feasible. I've observed that a function of the type $$\tag{3} S=\frac{1}{2}mAxt^2-\frac{1}{40}mA^2t^5$$ satisfies the HJ's equation, but how can I set the constant of integration $\alpha$ to procced and solve the equation?

**[EDIT]**After some research I've found the right way of solving equation (2) and indeed my previous equation (3) is incomplete. I add here the right solution for $S$ from (2) and a short derivaton of the solution for $x$ and $p$: $$\tag{4} S(x,\alpha,t)=\left(\frac{1}{2}mAt^2+\alpha\right)x-\left(\frac{1}{40}mA^2t^5+\frac{1}{6}A\alpha t^3+\frac{\alpha^2}{2m}\right)$$

With (4) the equation for the transformed canonical coordinate $X$ can be found as: $$\tag{5} X=\frac{\partial S}{\partial\alpha}=x-\frac{1}{6}At^3-\frac{\alpha}{m}t$$ while the expression for the momentum $p$ is

$$\tag{6} p=\frac{\partial S}{\partial x}=\frac{1}{2}mAt^2+\alpha$$ By imposing the initial conditions the solutions for $x$ from (5) and for $p$ from (6) are identincal to the ones obtained by solving directly the Hamilton equations.

-

It will not be simpler to assume that $x(t=0)=0$, so let us consider general initial conditions

$$\tag{1} x(t=0)=x_0\quad\text{together with}\quad\dot{x}(t=0)=v_0.$$

Now the constant $A$ has dimension of jerk and the constant $m$ has dimension of mass. We can effectively put the constants $A=1=m$ to unity by scaling the variables appropriately

$$x ~\longrightarrow~Ax, \qquad x_0 ~\longrightarrow~Ax_0, \qquad v_0 ~\longrightarrow~Av_0, \qquad t ~\longrightarrow~t,$$

$$\tag{2}p ~\longrightarrow~mAp, \qquad H~\longrightarrow~mA^2 H, \qquad S~\longrightarrow~mA^2 S. \qquad$$

[In other words, if we treat time $t$ as dimensionless, then we are effectively going to dimensionless variables. We can always in the end of the calculation restore the $A$- and the $m$-dependence by performing the opposite scaling of eq. (2).]

Now recall that the Hamilton's principal function $S(x,P,t)$ is a type 2 generating function for a canonical transformation $(x,p) \to (X,P)$, so that

$$\tag{3} p~=~\frac{\partial S}{\partial x} ,\qquad X~=~\frac{\partial S}{\partial P},\qquad K-H~=~\frac{\partial S}{\partial t}.$$

Next recall that the Kamiltonian $K\equiv 0$ vanishes identically, which implies that the new canonical variables $(X,P)$ are constants of motion (COM). Now where are we going to find two COM? Well, the two initial conditions (1) are two COM. Here it helps that OP has already found the full explicit solution by another method

$$\tag{4} x~=~x_0 +v_0 t +\frac{t^3}{6}\quad\text{and}\quad p~=~v_0 +\frac{t^2}{2}.$$

Let us therefore identify the new canonical variables with the initial conditions

$$\tag{5} X~\equiv~x_0 \quad\text{and}\quad P~\equiv~v_0 .$$

Hence we get

$$\tag{6} \frac{\partial S}{\partial x}~\stackrel{(3)}{=}~p ~\stackrel{(4)}{=}~v_0 +\frac{t^2}{2} \quad\text{and}\quad \frac{\partial S}{\partial v_0}~\stackrel{(3)+(5)}{=}~x_0 ~\stackrel{(4)}{=}~x - v_0 t -\frac{t^3}{6}.$$

Eq. (6) has the full solution

$$\tag{7} S(x,v_0,t)~=~(v_0 +\frac{t^2}{2})x- \frac{v_0^2 t}{2} -\frac{v_0t^3}{6} +S_0(t)$$

for some function $S_0(t)$, which can only depend on the time variable $t$. Inserting eq. (7) into the Hamilton-Jacobi equation yields

$$\frac{v_0^2 }{2}+\frac{v_0t^2}{2} -tx -\frac{\partial S_0}{\partial t} ~\stackrel{(7)}{=}~-\frac{\partial S}{\partial t}$$ $$\tag{8} ~\stackrel{\text{HJ eq.}}{=}~H~=~\frac{p^2}{2} -tx~\stackrel{(4)}{=}~\frac{1}{2}\left(v_0 +\frac{t^2}{2}\right)^2-tx,$$

$$\tag{9} S_0(t) = -\frac{t^5}{40}$$