23.1.161 problem 161

Internal problem ID [4768]
Book : Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
Section : Part II. Chapter 1. THE DIFFERENTIAL EQUATION IS OF FIRST ORDER AND OF FIRST DEGREE, page 223
Problem number : 161
Date solved : Tuesday, September 30, 2025 at 08:30:57 AM
CAS classification : [_linear]

\begin{align*} x y^{\prime }+x +\left (a x +2\right ) y&=0 \end{align*}
Maple. Time used: 0.001 (sec). Leaf size: 36
ode:=x*diff(y(x),x)+x+(a*x+2)*y(x) = 0; 
dsolve(ode,y(x), singsol=all);
 
\[ y = -\frac {1}{a}+\frac {2}{a^{2} x}-\frac {2}{a^{3} x^{2}}+\frac {{\mathrm e}^{-a x} c_1}{x^{2}} \]
Mathematica. Time used: 0.07 (sec). Leaf size: 41
ode=x*D[y[x],x]+x+(2+a*x)*y[x]==0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\begin{align*} y(x)&\to \frac {e^{-a x-2} \left (\int _1^x-e^{a K[1]+2} K[1]^2dK[1]+c_1\right )}{x^2} \end{align*}
Sympy. Time used: 0.253 (sec). Leaf size: 65
from sympy import * 
x = symbols("x") 
a = symbols("a") 
y = Function("y") 
ode = Eq(x*Derivative(y(x), x) + x + (a*x + 2)*y(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ \left [ y{\left (x \right )} = \begin {cases} \frac {C_{1}}{a x^{3} + 3 x^{2}} - \frac {x^{3}}{a x^{3} + 3 x^{2}} & \text {for}\: a^{3} = 0 \\\text {NaN} & \text {otherwise} \end {cases}, \ y{\left (x \right )} = \begin {cases} \frac {C_{1} e^{- a x}}{x^{2}} - \frac {1}{a} + \frac {2}{a^{2} x} - \frac {2}{a^{3} x^{2}} & \text {for}\: a^{3} \neq 0 \\\text {NaN} & \text {otherwise} \end {cases}\right ] \]