Solving a nonlinear autonomous system using polar coordinates

I have the nonlinear system:

\begin{equation} \begin{array} fx'=-y-x\sqrt{x^2+y^2}\\ y'=x-y\sqrt{x^2+y^2} \end{array} \end{equation}

which I solve by polar coordinates transformation. $x=r\cos\phi \ y=r\sin\phi$ and $x'=dr\cos\phi-r\sin\phi$ and $y'=dr\sin\phi+r\cos\phi$.

\begin{equation} \begin{array} fdr\cos\phi-r\sin\phi=-r\sin\phi-r\cos\phi\sqrt{r^2\cos^2\phi+r^2\sin^2\phi}\\ dr\sin\phi+r\cos\phi=r\cos\phi-r\sin\phi\sqrt{r^2\cos^2\phi+r^2\sin^2\phi}\ \end{array} \end{equation}

Clearly, many terms cancel out and we obtain:

\begin{equation} \begin{array} fdr=-r^2\\ dr=-r^2\ \end{array} \end{equation}

Then, integrating both sides with respect to $r$ we obtain:

\begin{equation} \begin{array} fr=-\frac{1}{3}r^3+c\\ r=-\frac{1}{3}r^3+c \end{array} \end{equation}

Since $r=\frac{x}{\cos\phi} and r=\frac{y}{\sin\phi}$ we get

\begin{equation} \begin{array} fx=-\frac{x^3}{\cos^2\phi}+c\cos\phi\\ y=-\frac{y^3}{\sin^3\phi}+c\sin\phi \end{array} \end{equation}

The summing up the two equations, and isolating for y, I get a very scary result:

y≈0.26457 sin^4(ϕ) cos(ϕ) (sqrt((27 c csc^9(ϕ) sec^2(ϕ) + 27 c csc^8(ϕ) sec^3(ϕ) - 27 x^3 csc^9(ϕ) sec^5(ϕ) - 27 x csc^9(ϕ) sec^3(ϕ))^2 + 108 csc^15(ϕ) sec^6(ϕ)) + 27 c csc^9(ϕ) sec^2(ϕ) + 27 c csc^8(ϕ) sec^3(ϕ) - 27 x^3 csc^9(ϕ) sec^5(ϕ) - 27 x csc^9(ϕ) sec^3(ϕ))^(1/3) - (1.2599 csc(ϕ) sec(ϕ))/(sqrt((27 c csc^9(ϕ) sec^2(ϕ) + 27 c csc^8(ϕ) sec^3(ϕ) - 27 x^3 csc^9(ϕ) sec^5(ϕ) - 27 x csc^9(ϕ) sec^3(ϕ))^2 + 108 csc^15(ϕ) sec^6(ϕ)) + 27 c csc^9(ϕ) sec^2(ϕ) + 27 c csc^8(ϕ) sec^3(ϕ) - 27 x^3 csc^9(ϕ) sec^5(ϕ) - 27 x csc^9(ϕ) sec^3(ϕ))^(1/3) and csc(ϕ) sec(ϕ)!=0

What went wrong here?

Thanks

UPDATE, with Jean Maries correction we get:

\begin{equation} \begin{array} fx=\frac{\cos\phi}{\phi+c}\\ y=\frac{\sin\phi}{\phi+c} \end{array} \end{equation}

Summing up and solving for y:

\begin{equation} y=\frac{\cos\phi}{\phi+c}+\frac{\sin\phi}{\phi+c}-x \end{equation}

which plotted , with an arbitrary value of $c$ is:

Plot


Solution 1:

$dr=-r^2$ cannot be integrated as you do. You need to write it under the form

$$- \dfrac{dr}{r^2}=1$$

giving :

$$\dfrac{1}{r}=\varphi+c$$

($c$ arbitrary constant), otherwise said:

$$r=\frac{1}{\varphi+c}$$