29.11.13 problem 304

Internal problem ID [4904]
Book : Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
Section : Various 11
Problem number : 304
Date solved : Sunday, March 30, 2025 at 04:10:10 AM
CAS classification : [_rational, _Bernoulli]

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

Maple. Time used: 0.003 (sec). Leaf size: 21
ode:=(-x^2+4)*diff(y(x),x)+4*y(x) = (x+2)*y(x)^2; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {x -2}{\left (\ln \left (2+x \right )+c_1 \right ) \left (2+x \right )} \]
Mathematica. Time used: 0.242 (sec). Leaf size: 32
ode=(4-x^2)D[y[x],x]+4 y[x]==(2+x)y[x]^2; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)\to \frac {2-x}{(x+2) (-\log (x+2)+c_1)} \\ y(x)\to 0 \\ \end{align*}
Sympy. Time used: 0.323 (sec). Leaf size: 26
from sympy import * 
x = symbols("x") 
y = Function("y") 
ode = Eq((4 - x**2)*Derivative(y(x), x) - (x + 2)*y(x)**2 + 4*y(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ y{\left (x \right )} = \frac {x - 2}{C_{1} x + 2 C_{1} + x \log {\left (x + 2 \right )} + 2 \log {\left (x + 2 \right )}} \]