Finding the first integral of $\ddot{p}-\dot{p}/p+A/p-p^3=0$? I am reading a paper (https://arxiv.org/abs/math/9907210), and the author first gives the following differential equation:
$$\ddot{p}-\frac{\dot{p}^2}{p}+\frac{A}{p}-p^3=0$$
Later, they state that the first integral is given by
$$\dot{p}^2=p^4+Kp^2+A$$
where $K$ is a real constant. I can't get this; here is my attempt.
Multiply by $\dot{p}$ and integrate with respect to $s$, 
$$\int \dot{p}\ddot{p} ds=\int (\frac{\dot{p}^2}{p}-\frac{A}{p}+p^3)\dot{p}ds$$
Left hand side is good, $\frac{1}{2}\dot{p}^2$, but the right hand side is not:
$$\int (\frac{\dot{p}^2}{p}-\frac{A}{p}+p^3)\dot{p}ds=\int\frac{\dot{p}^3}{p}ds-A\ln(p)+\frac{1}{4}p^4.$$
Maybe my naive understanding of "first integral" is incorrect. Can anyone spot my error?
 A: I don't know if this is classified as an error.  But the integral $\int\frac{\dot{p}^3}{p}ds$ depends on the path, not just the initial and the final states.  To have an integral of motion, you should end up with an expression involving $p$ and $\dot{p}$ only, which is independent of the path you take.  I am presenting a derivation of the integral of motion in the cited paper.
Multiply both sides of the DE by $\frac{2\dot{p}}{p^2}$, we get
$$\frac{2\dot{p}\ddot{p}}{p^2}-\frac{2\dot{p}^3}{p^3}+\frac{2A\dot{p}}{p^3}-2p\dot{p}=0.$$
This is equivalent to
$$\frac{d}{ds}\left(\frac{\dot{p}^2}{p^2}-\frac{A}{p^2}-p^2\right)=0.$$
Thus, there exists a constant $K$ such that
$$\frac{\dot{p}^2}{p^2}-\frac{A}{p^2}-p^2=K.$$
That is, $$\dot{p}^2=p^4+Kp^2+A.$$
A: The other method for autonomous second order ODE is to assume that for some specific solution one can find a relation $\dot p=v(p)$. Then the second order equation for $p$ transforms into a first order equation for $v$,
$$
vv'-\frac{v^2}p+\frac Ap-p^3=0.
$$
As is visible, this is linear in $u(p)=v(p)^2$, $$u'-\frac{2u}{p}+\frac{2A}{p}-2p^3.$$ The integrating factor is $\frac1{p^2}$, so that
$$
\frac{d}{dp}\frac{u}{p^2}=\frac{pu'-2u}{p^3}=2p-\frac{2A}{p^3}
\implies \frac{u}{p^2}=p^2+\frac{A}{p^2}+K
$$
Substituting backwards gives the expression for $K=\frac{\dot p^2}{p^2}-\frac{A}{p^2}-p^2$ as first integral.
A: Since the authors of the paper have worked out the first integral, it may be easier to read "backward" to see how it could be obtained. 
By definition, the "first integral" of the DE is a function. It was given in a confusing way in the paper: 
$$
\dot p^2-p^4-Kp^2-A=0\tag{1}
$$
However, a hint from the paper to understand this is that $K$ is an "arbitrary real constant" and by definition, one should have
$$
\frac{d}{ds}\Phi(s,p)=0,
$$
where $\Phi$ denotes the first integral. Assuming $p^2>0$ and rewriting (1), one has
$$
\frac{\dot p^2}{p^2}-p^2-\frac{A}{p^2}=K.
$$
Now if one denotes 
$$
\Phi(s,p)=\frac{\dot p^2}{p^2}-p^2-\frac{A}{p^2},
$$
then one can check that indeed
$$
\frac{d}{ds}\Phi(s,p)
=\frac{2\dot p \ddot p-4p^3\dot p}{p^2}
+(\dot p^2-p^4-A)\frac{-2 p\dot p}{p^4}
=\frac{2\ddot p}{p^2}\left(
\ddot p -\frac{\dot p^2}{p}
+\frac{A}{p}
-p^3
\right)=0
$$
