12.3.21 problem 22

Internal problem ID [1598]
Book : Elementary differential equations with boundary value problems. William F. Trench. Brooks/Cole 2001
Section : Chapter 2, First order equations. separable equations. Section 2.2 Page 52
Problem number : 22
Date solved : Tuesday, March 04, 2025 at 12:53:39 PM
CAS classification : [_separable]

\begin{align*} y^{\prime }+x^{2} \left (y+1\right ) \left (y-2\right )^{2}&=0 \end{align*}

Maple. Time used: 0.038 (sec). Leaf size: 35
ode:=diff(y(x),x)+x^2*(y(x)+1)*(y(x)-2)^2 = 0; 
dsolve(ode,y(x), singsol=all);
 
\[ y = {\mathrm e}^{\operatorname {RootOf}\left (3 x^{3} {\mathrm e}^{\textit {\_Z}}+\ln \left ({\mathrm e}^{\textit {\_Z}}+3\right ) {\mathrm e}^{\textit {\_Z}}+9 c_1 \,{\mathrm e}^{\textit {\_Z}}-\textit {\_Z} \,{\mathrm e}^{\textit {\_Z}}-3\right )}+2 \]
Mathematica. Time used: 0.482 (sec). Leaf size: 52
ode=D[y[x],x]+x^2*(y[x]+1)*(y[x]-2)^2==0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to \text {InverseFunction}\left [\frac {1}{9} \left (-\frac {3}{\text {$\#$1}-2}-\log (\text {$\#$1}-2)+\log (\text {$\#$1}+1)\right )\&\right ]\left [-\frac {x^3}{3}+c_1\right ] \\ y(x)\to -1 \\ y(x)\to 2 \\ \end{align*}
Sympy. Time used: 0.497 (sec). Leaf size: 31
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x**2*(y(x) - 2)**2*(y(x) + 1) + Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ \frac {x^{3}}{3} - \frac {\log {\left (y{\left (x \right )} - 2 \right )}}{9} + \frac {\log {\left (y{\left (x \right )} + 1 \right )}}{9} - \frac {1}{3 \left (y{\left (x \right )} - 2\right )} = C_{1} \]