29.6.16 problem 162

Internal problem ID [4762]
Book : Ordinary differential equations and their solutions. By George Moseley Murphy. 1960
Section : Various 6
Problem number : 162
Date solved : Sunday, March 30, 2025 at 03:53:13 AM
CAS classification : [_linear]

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

Maple. Time used: 0.002 (sec). Leaf size: 45
ode:=x*diff(y(x),x)+x+(-a*x^2+2)*y(x) = 0; 
dsolve(ode,y(x), singsol=all);
 
\[ y = \frac {\frac {x}{a}+{\mathrm e}^{\frac {a \,x^{2}}{2}} \left (-\frac {\sqrt {\pi }\, \sqrt {2}\, \operatorname {erf}\left (\frac {\sqrt {2}\, \sqrt {a}\, x}{2}\right )}{2 a^{{3}/{2}}}+c_1 \right )}{x^{2}} \]
Mathematica. Time used: 0.102 (sec). Leaf size: 70
ode=x D[y[x],x]+x+(2-a x^2)y[x]==0; 
ic={}; 
DSolve[{ode,ic},y[x],x,IncludeSingularSolutions->True]
 
\[ y(x)\to \frac {-\frac {\sqrt {2 \pi } e^{\frac {a x^2}{2}} \text {erf}\left (\frac {\sqrt {a} x}{\sqrt {2}}\right )}{a^{3/2}}+2 c_1 e^{\frac {a x^2}{2}}+\frac {2 x}{a}}{2 x^2} \]
Sympy. Time used: 1.075 (sec). Leaf size: 78
from sympy import * 
x = symbols("x") 
a = symbols("a") 
y = Function("y") 
ode = Eq(x*Derivative(y(x), x) + x + (-a*x**2 + 2)*y(x),0) 
ics = {} 
dsolve(ode,func=y(x),ics=ics)
 
\[ \left [ y{\left (x \right )} = \begin {cases} \frac {C_{1}}{x^{2}} - \frac {x}{3} & \text {for}\: a = 0 \\\text {NaN} & \text {otherwise} \end {cases}, \ y{\left (x \right )} = \begin {cases} \frac {C_{1} e^{\frac {a x^{2}}{2}}}{x^{2}} + \frac {1}{a x} - \frac {\sqrt {2} \sqrt {\pi } e^{\frac {a x^{2}}{2}} \operatorname {erf}{\left (\frac {\sqrt {2} \sqrt {a} x}{2} \right )}}{2 a^{\frac {3}{2}} x^{2}} & \text {for}\: a \neq 0 \\\text {NaN} & \text {otherwise} \end {cases}\right ] \]