29.6.12 problem 158

Internal problem ID [4758]
Book : Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
Section : Various 6
Problem number : 158
Date solved : Sunday, March 30, 2025 at 03:53:04 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.076 (sec). Leaf size: 37
ode=x D[y[x],x]+x+(2+a x)y[x]==0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {-\frac {a^2 x^2-2 a x+2}{a^3}+c_1 e^{-a x}}{x^2} \]
Sympy. Time used: 0.428 (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 ] \]