12.1.4 problem 2(d)

Internal problem ID [1522]
Book : Elementary differential equations with boundary value problems. William F. Trench. Brooks/Cole 2001
Section : Chapter 1, Introduction. Section 1.2 Page 14
Problem number : 2(d)
Date solved : Saturday, March 29, 2025 at 10:57:31 PM
CAS classification : [_separable]

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

Maple. Time used: 0.004 (sec). Leaf size: 14
ode:=2*diff(y(x),x)+x*(-1+y(x)^2) = 0; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \tanh \left (\frac {x^{2}}{4}+\frac {c_1}{2}\right ) \]
Mathematica. Time used: 0.234 (sec). Leaf size: 52
ode=2*D[y[x],x] +x*(y[x]^2-1)== 0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to \frac {e^{\frac {x^2}{2}}-e^{2 c_1}}{e^{\frac {x^2}{2}}+e^{2 c_1}} \\ y(x)\to -1 \\ y(x)\to 1 \\ \end{align*}
Sympy. Time used: 1.892 (sec). Leaf size: 63
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq(x*(y(x)**2 - 1) + 2*Derivative(y(x), x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ \left [ y{\left (x \right )} = \frac {- e^{C_{1}} - e^{x^{2}} - 2 \sqrt {e^{C_{1} + x^{2}}}}{e^{C_{1}} - e^{x^{2}}}, \ y{\left (x \right )} = \frac {- e^{C_{1}} - e^{x^{2}} + 2 \sqrt {e^{C_{1} + x^{2}}}}{e^{C_{1}} - e^{x^{2}}}\right ] \]