64.5.34 problem 37 (b)

Internal problem ID [13268]
Book : Differential Equations by Shepley L. Ross. Third edition. John Willey. New Delhi. 2004.
Section : Chapter 2, section 2.3 (Linear equations). Exercises page 56
Problem number : 37 (b)
Date solved : Wednesday, March 05, 2025 at 09:32:34 PM
CAS classification : [_separable]

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

Maple. Time used: 0.011 (sec). Leaf size: 37
ode:=(1+y(x))*diff(y(x),x)+x*(2*y(x)+y(x)^2) = x; 
dsolve(ode,y(x), singsol=all);
 
\begin{align*} y &= -1-\sqrt {2+{\mathrm e}^{-x^{2}} c_{1}} \\ y &= -1+\sqrt {2+{\mathrm e}^{-x^{2}} c_{1}} \\ \end{align*}
Mathematica. Time used: 23.612 (sec). Leaf size: 163
ode=(y[x]+1)*D[y[x],x]+x*(y[x]^2+2*y[x])==x; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to -1-e^{-x^2} \sqrt {e^{x^2} \left (2 e^{x^2}+e^{2 c_1}\right )} \\ y(x)\to -1+e^{-x^2} \sqrt {e^{x^2} \left (2 e^{x^2}+e^{2 c_1}\right )} \\ y(x)\to -1-\sqrt {2} \\ y(x)\to \sqrt {2}-1 \\ y(x)\to \sqrt {2} e^{-x^2} \sqrt {e^{2 x^2}}-1 \\ y(x)\to -\sqrt {2} e^{-x^2} \sqrt {e^{2 x^2}}-1 \\ \end{align*}
Sympy. Time used: 0.752 (sec). Leaf size: 32
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x*(y(x)**2 + 2*y(x)) - x + (y(x) + 1)*Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ \left [ y{\left (x \right )} = - \sqrt {C_{1} e^{- x^{2}} + 2} - 1, \ y{\left (x \right )} = \sqrt {C_{1} e^{- x^{2}} + 2} - 1\right ] \]