12.3.17 problem 18

Internal problem ID [1594]
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 : 18
Date solved : Tuesday, March 04, 2025 at 12:53:21 PM
CAS classification : [_separable]

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

With initial conditions

\begin{align*} y \left (0\right )&=3 \end{align*}

Maple. Time used: 0.325 (sec). Leaf size: 70
ode:=diff(y(x),x) = -2*x*(y(x)^3-3*y(x)+2); 
ic:=y(0) = 3; 
dsolve([ode,ic],y(x), singsol=all);
 
\[ y = {\mathrm e}^{\operatorname {RootOf}\left (18 x^{2} {\mathrm e}^{\textit {\_Z}}+2 \,{\mathrm e}^{\textit {\_Z}} \ln \left (2\right )-2 \ln \left ({\mathrm e}^{\textit {\_Z}}-3\right ) {\mathrm e}^{\textit {\_Z}}-2 \,{\mathrm e}^{\textit {\_Z}} \ln \left (5\right )+2 \textit {\_Z} \,{\mathrm e}^{\textit {\_Z}}-54 x^{2}+3 \,{\mathrm e}^{\textit {\_Z}}-6 \ln \left (2\right )+6 \ln \left ({\mathrm e}^{\textit {\_Z}}-3\right )+6 \ln \left (5\right )-6 \textit {\_Z} -15\right )}-2 \]
Mathematica. Time used: 1.07 (sec). Leaf size: 49
ode=D[y[x],x]==-2*x*(y[x]^3-3*y[x]+2); 
ic=y[0]==3; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \text {InverseFunction}\left [\frac {1}{9} \left (-\frac {3}{\text {$\#$1}-1}-\log (\text {$\#$1}-1)+\log (\text {$\#$1}+2)\right )\&\right ]\left [-x^2-\frac {1}{6}+\frac {1}{9} \log \left (\frac {5}{2}\right )\right ] \]
Sympy. Time used: 0.487 (sec). Leaf size: 41
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(2*x*(y(x)**3 - 3*y(x) + 2) + Derivative(y(x), x),0) 
ics = {y(0): 3} 
dsolve(ode,func=y(x),ics=ics)
 
\[ x^{2} - \frac {\log {\left (y{\left (x \right )} - 1 \right )}}{9} + \frac {\log {\left (y{\left (x \right )} + 2 \right )}}{9} - \frac {1}{3 \left (y{\left (x \right )} - 1\right )} = - \frac {1}{6} - \frac {\log {\left (2 \right )}}{9} + \frac {\log {\left (5 \right )}}{9} \]