I was struggling with this exercise about Hamilton-Jacobi equation. I have to solve by means 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 equations of motion 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's equation 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 proceed 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 identical to the ones obtained by solving directly the Hamilton equations.
EXTERNAL EDIT: The reference most probably used is Revista Mexicana de Física 60, 75-79 (2014), where the problem is solved as an example explicitly.